Difference between revisions of "Analysis Examples"

From GlueXWiki
Jump to: navigation, search
(Getting the Thrown Track Topology)
(Blanked the page)
 
Line 1: Line 1:
== Histogramming b<sub>1</sub>(1235)<sup>+</sup> Invariant Mass in b1pi ==
 
* Assumes the DReaction has been setup as shown in: [[Analysis_DReaction | DReaction]]
 
  
=== Minimal/Simplest ===
 
* Minimal: No check against double-counting, using kinematic fit data only.
 
** Not best practice: intended only as a simple illustration.
 
* In your DEventProcessor class definition (header):
 
<syntaxhighlight>
 
TH1D* dHist_omegaMass;
 
</syntaxhighlight>
 
 
* In your DEventProcessor init() method:
 
<syntaxhighlight>
 
dHist_omegaMass = new TH1D("B1InvariantMass", ";#pi^{+}#omega Invariant Mass (GeV/c^{2})", 600, 0.6, 1.8);
 
</syntaxhighlight>
 
 
* In your DEventProcessor evnt() method:
 
<syntaxhighlight>
 
vector<const DParticleCombo*> locParticleCombos;
 
locEventLoop->Get(locParticleCombos);
 
 
for(size_t loc_i = 0; loc_i < locParticleCombos.size(); ++loc_i)
 
{
 
  if(locParticleCombos[loc_i]->Get_Reaction()->Get_ReactionName() != "b1pi")
 
    continue; //wrong DReaction
 
 
  // get omega combo step //0 is photoproduction, 1 is omega decay, 2 is pi0 decay
 
  const DParticleComboStep* locParticleComboStep0 = locParticleCombo->Get_ParticleComboStep(0);
 
  const DParticleComboStep* locParticleComboStep1 = locParticleCombo->Get_ParticleComboStep(1);
 
 
  // calculate b1+ p4 with kinematic fit data
 
  TLorentzVector locP4;
 
  locP4 += locParticleComboStep0->Get_FinalParticle(2)->lorentzMomentum(); //pi+
 
  locP4 += locParticleComboStep1->Get_FinalParticle(0)->lorentzMomentum(); //pi+
 
  locP4 += locParticleComboStep1->Get_FinalParticle(1)->lorentzMomentum(); //pi-
 
  locP4 += locParticleComboStep1->Get_FinalParticle(2)->lorentzMomentum(); //pi0
 
 
  Get_Application()->RootWriteLock(); //ACQUIRE ROOT LOCK!!
 
  {
 
    dHist_omegaMass->Fill(locP4.M());
 
  }
 
  Get_Application()->RootUnLock(); //RELEASE ROOT LOCK!!
 
  break;
 
}
 
</syntaxhighlight>
 
 
=== Thorough: Using an Analysis Action ===
 
* Checks against double-counting, shows/allows histogramming measured or kinfit data.
 
* See DCustomAction_HistMass_b1_1235 in the [https://halldsvn.jlab.org/repos/trunk/sim-recon/src/programs/Analysis/plugins/b1pi_hists/ b1pi Plugin]
 
 
* Add to your DReaction anywhere in the analysis chain:
 
<syntaxhighlight>
 
locReaction->Add_AnalysisAction(new DCustomAction_HistMass_b1_1235(locReaction, false)); //false: measured data
 
locReaction->Add_AnalysisAction(new DCustomAction_HistMass_b1_1235(locReaction, true, "KinFit")); //true: kinfit data //"KinFit:" a unique, distinguishing string (could have been anything)
 
</syntaxhighlight>
 
 
== Kinematic Fit Confidence Level ==
 
* In your DEventProcessor evnt() method:
 
 
<syntaxhighlight>
 
vector<const DParticleCombo*> locParticleCombos;
 
locEventLoop->Get(locParticleCombos);
 
 
for(size_t loc_i = 0; loc_i < locParticleCombos.size(); ++loc_i)
 
{
 
  if(locParticleCombos[loc_i]->Get_Reaction()->Get_ReactionName() != "b1pi")
 
    continue; //wrong DReaction
 
  const DKinFitResults* locKinFitResults = locParticleCombos[loc_i]->Get_KinFitResults();
 
  double locConfidenceLevel = locKinFitResults->Get_ConfidenceLevel();
 
}
 
</syntaxhighlight>
 
 
== Getting the Thrown Track Topology ==
 
 
* There are several ways of getting the thrown track information.  The most direct way of getting it is to ask JANA for the <span style="color:#0000FF">DMCThrown</span> particles (see below).  The <span style="color:#0000FF">DMCThrown</span>::<span style="color:#008000">parentid</span> member variable matches the <span style="color:#0000FF">DMCThrown</span>::<span style="color:#008000">myid</span> member variable that the particle decayed from.  If it did not decay from any particle (e.g. was directly photoproduced by the generator) then the <span style="color:#0000FF">DMCThrown</span>::<span style="color:#008000">parentid</span> member will equal 0.
 
 
<syntaxhighlight>
 
vector<const DMCThrown*> locMCThrowns;
 
locEventLoop->Get(locMCThrowns);
 
</syntaxhighlight>
 
 
* Note that you can use the <span style="color:Red">"Primary,"</span> <span style="color:Red">"Decaying,"</span> and <span style="color:Red">"FinalState"</span> tags for the <span style="color:#0000FF">DMCThrown</span> factory to get specific types of thrown particles.
 
 
* An easier way of getting the information is by asking JANA for the thrown <span style="color:#0000FF">DReaction</span> and <span style="color:#0000FF">DParticleCombo</span> objects.  These are accessible by requesting these objects with the "Thrown" tag (see below).  These contain the PIDs (<span style="color:#0000FF">DReaction</span>) and track kinematics (<span style="color:#0000FF">DParticleCombo</span>) of the thrown particles, organized by the event's decay chain. 
 
**'''NOTE''': when producing these, any decays of kaons, pions, muons, and neutrons are ignored. 
 
**'''NOTE''': if a particle type is not defined in sim-recon/src/libraries/include/particleType.h, then it is ignored when generating these objects. 
 
 
<syntaxhighlight>
 
vector<const DReaction*> locThrownReactions;
 
locEventLoop->Get(locThrownReactions, "Thrown");
 
const DReaction* locThrownReaction = locThrownReactions[0];
 
deque<Particle_t> locThrownPIDs;
 
locThrownReaction->Get_DetectedFinalPIDs(locThrownPIDs, true); //true tells it to include duplicates (so if two pi-'s, list it twice). 
 
 
vector<const DParticleCombo*> locThrownParticleCombos;
 
locEventLoop->Get(locThrownParticleCombos, "Thrown");
 
const DParticleCombo* locThrownParticleCombo = locThrownParticleCombos[0];
 
</syntaxhighlight>
 

Latest revision as of 08:06, 3 November 2017