Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Calibration/HLDetectorTiming/DReaction_factory_p2pi.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DReaction_factory_p2pi.cc
4 // Created: Thu May 7 16:22:04 EDT 2015
5 // Creator: mstaib (on Linux gluon109.jlab.org 2.6.32-358.23.2.el6.x86_64 x86_64)
6 //
7 
8 
10 
11 //------------------
12 // init
13 //------------------
15 {
16  // Make as many DReaction objects as desired
17  DReactionStep* locReactionStep = NULL;
18  DReaction* locReaction = new DReaction("p2pi"); //needs to be a unique name for each DReaction object, CANNOT (!) be "Thrown"
19 
20  // DOCUMENTATION:
21  // ANALYSIS library: https://halldweb1.jlab.org/wiki/index.php/GlueX_Analysis_Software
22  // DReaction factory: https://halldweb1.jlab.org/wiki/index.php/Analysis_DReaction
23 
24  /**************************************************** p2pi Reaction Steps ****************************************************/
25 
26  //Required: DReactionSteps to specify the channel and decay chain you want to study
27  //Particles are of type Particle_t, an enum defined in sim-recon/src/libraries/include/particleType.h
28 
29  //Example: g, p -> pi+, pi-, pi0, (p)
30  locReactionStep = new DReactionStep();
31  locReactionStep->Set_InitialParticleID(Gamma);
32  locReactionStep->Set_TargetParticleID(Proton);
33  locReactionStep->Add_FinalParticleID(PiPlus);
34  locReactionStep->Add_FinalParticleID(PiMinus);
35  locReactionStep->Add_FinalParticleID(Proton, false); //true: proton missing
36  locReaction->Add_ReactionStep(locReactionStep);
37  dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak
38 
39  //optional: in a p4 kinematic fit, this will disable the constraint on the mass of the pi0
40  //default is enabled, but you don't need to worry about setting false for the beam particle step
41  //note that the omega and phi will always be false, regardless of what you set below
42  //locReactionStep->Set_ApplyKinFitMassConstraintOnInitialParticleFlag(false);
43 
44  /**************************************************** p2pi Control Settings ****************************************************/
45 
46  // Recommended: Type of kinematic fit to perform (default is d_NoFit)
47  //fit types are of type DKinFitType, an enum defined in sim-recon/src/libraries/ANALYSIS/DKinFitResults.h
48  locReaction->Set_KinFitType(d_P4AndVertexFit); //simultaneously constrain apply four-momentum conservation, invariant masses, and common-vertex constraints
49 
50  // Highly Recommended: When generating particle combinations, reject all photon candidates with a PID confidence level < 5.73303E-7 (+/- 5-sigma)
51  //locReaction->Set_MinPhotonPIDFOM(5.73303E-7);
52 
53  // Highly Recommended: When generating particle combinations, reject all charged track candidates with a PID confidence level < 5.73303E-7 (+/- 5-sigma)
54  //locReaction->Set_MinChargedPIDFOM(5.73303E-7);
55 
56  // Highly Recommended: When recording thrown/reconstructed matches in ROOT TTree, only register matches with match FOM > 5.73303E-7 (+/- 5-sigma)
57  //locReaction->Set_MinThrownMatchFOMForROOT(5.73303E-7);
58 
59  // Highly Recommended: When generating particle combinations, reject all beam photons that match to a different RF bunch (delta_t > 1.002 ns)
60  //locReaction->Set_MaxPhotonRFDeltaT(0.5*2.004); //beam bunches are every 2.004 ns, (1.002 should be minimum cut value)
61 
62  // Highly Recommended: Cut on number of extra "good" tracks. "Good" tracks are ones that survive the "PreSelect" (or user custom) factory.
63  // Current (09/26/2014): "Good" tracks have a detector-hit match, and tracking FOM > 0.0027 (+/- 3 sigma).
64  // Important: Keep cut large: Can have many ghost and accidental tracks that look "good"
65  locReaction->Set_MaxExtraGoodTracks(0);
66 
67  // Recommended: Enable ROOT TTree output for this DReaction
68  // locReaction->Enable_TTreeOutput("tree_p2pi.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change
69 
70  /************************************************** p2pi Pre-Combo Custom Cuts *************************************************/
71 
72  // Highly Recommended: Very loose invariant mass cuts, applied during DParticleComboBlueprint construction
73  // Example: pi0 -> g, g cut
74  // locReaction->Set_InvariantMassCut(Pi0, 0.08, 0.19);
75 
76  // Highly Recommended: Very loose DAnalysisAction cuts, applied just after creating the combination (before saving it)
77  // Example: Missing mass squared of proton
78  // locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.1, 2.56));
79 
80  /**************************************************** p2pi Analysis Actions ****************************************************/
81 
82 
83  // Recommended: Analysis actions automatically performed by the DAnalysisResults factories to histogram useful quantities.
84  //These actions are executed sequentially, and are executed on each surviving (non-cut) particle combination
85  //Pre-defined actions can be found in ANALYSIS/DHistogramActions.h and ANALYSIS/DCutActions.h
86 
87  // PID & Kinematics
88  locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction, false));
89  //locReaction->Add_AnalysisAction(new DHistogramAction_TruePID(locReaction)); //momentum distributions of tracks with true/false PID (if thrown data available)
90 
91  // Transverse Momentum //Recommended for no-missing-particle reactions only!
92  locReaction->Add_AnalysisAction(new DHistogramAction_MissingTransverseMomentum(locReaction, false, 1000, 0.0, 1.0)); //false: fill histograms with measured particle data
93  locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 1000, -0.1, 0.1));
94  locReaction->Add_AnalysisAction(new DCutAction_MissingMassSquared(locReaction, false, -0.03, 0.03));
95  locReaction->Add_AnalysisAction(new DCutAction_TransverseMomentum(locReaction, 0.4)); //Max Missing Pt of 0.4 GeV
96 
97  // Kinematic Fit Results
98  locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); //5% confidence level cut on pull histograms only
99  // locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, 0.0)); //0% confidence level cut //require kinematic fit converges
100 
101  // Kinematics
102  locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false)); //false: fill histograms with measured particle data
103  // locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, true, "KinFit")); //true: fill histograms with kinematic-fit particle data //"KinFit": unique name since action type is repeated
104  locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction));
105 
106 
107  _data.push_back(locReaction); //Register the DReaction with the factory
108 
109  return NOERROR;
110 }
111 
112 //------------------
113 // fini
114 //------------------
116 {
117  for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i)
118  delete dReactionStepPool[loc_i]; //cleanup memory
119  return NOERROR;
120 }
121 
void Add_ReactionStep(const DReactionStep *locReactionStep)
Definition: DReaction.h:48
void Set_MaxExtraGoodTracks(size_t locMaxExtraGoodTracks)
Definition: DReaction.h:59
void Set_KinFitType(DKinFitType locKinFitType)
Definition: DReaction.h:53
void Add_FinalParticleID(Particle_t locPID, bool locIsMissingFlag=false)
void Set_InitialParticleID(Particle_t locPID, bool locIsMissingFlag=false)
jerror_t fini(void)
Called after last event of last event source has been processed.
void Add_AnalysisAction(DAnalysisAction *locAnalysisAction)
Definition: DReaction.h:50
void Set_TargetParticleID(Particle_t locPID)
Definition: DReactionStep.h:76
jerror_t init(void)
Called once at program start.