File: | plugins/Analysis/p2k_hists/DReaction_factory_p2k_hists.cc |
Location: | line 28, column 31 |
Description: | Potential leak of memory pointed to by 'locReaction' |
1 | // $Id$ | |||
2 | // | |||
3 | // File: DReaction_factory_p2k_hists.cc | |||
4 | // Created: Wed Mar 11 20:34:14 EDT 2015 | |||
5 | // Creator: jrsteven (on Linux halldw1.jlab.org 2.6.32-504.8.1.el6.x86_64 x86_64) | |||
6 | // | |||
7 | ||||
8 | #include "DReaction_factory_p2k_hists.h" | |||
9 | ||||
10 | //------------------ | |||
11 | // init | |||
12 | //------------------ | |||
13 | jerror_t DReaction_factory_p2k_hists::init(void) | |||
14 | { | |||
15 | // Make as many DReaction objects as desired | |||
16 | DReactionStep* locReactionStep = NULL__null; | |||
17 | DReaction* locReaction = new DReaction("p2k_pmiss"); //needs to be a unique name for each DReaction object, CANNOT (!) be "Thrown" | |||
| ||||
18 | ||||
19 | // DOCUMENTATION: | |||
20 | // ANALYSIS library: https://halldweb1.jlab.org/wiki/index.php/GlueX_Analysis_Software | |||
21 | // DReaction factory: https://halldweb1.jlab.org/wiki/index.php/Analysis_DReaction | |||
22 | ||||
23 | /**************************************************** p2k_preco Reaction Steps ****************************************************/ | |||
24 | ||||
25 | locReaction = new DReaction("p2k_preco"); //needs to be a unique name for each DReaction object, CANNOT (!) be "Thrown" | |||
26 | ||||
27 | // g, p -> k+, k- ,p | |||
28 | locReactionStep = new DReactionStep(); | |||
| ||||
29 | locReactionStep->Set_InitialParticleID(Gamma); | |||
30 | locReactionStep->Set_TargetParticleID(Proton); | |||
31 | locReactionStep->Add_FinalParticleID(KPlus); | |||
32 | locReactionStep->Add_FinalParticleID(KMinus); | |||
33 | locReactionStep->Add_FinalParticleID(Proton); | |||
34 | locReaction->Add_ReactionStep(locReactionStep); | |||
35 | dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak | |||
36 | ||||
37 | /**************************************************** p2k_preco Control Settings ****************************************************/ | |||
38 | ||||
39 | locReaction->Set_KinFitType(d_P4AndVertexFit); //simultaneously constrain apply four-momentum conservation, invariant masses, and common-vertex constraints | |||
40 | locReaction->Set_MaxPhotonRFDeltaT(0.5*4.008); //beam bunches are every 4.008 ns, (2.004 should be minimum cut value) | |||
41 | ||||
42 | /**************************************************** p2k_preco Analysis Actions ****************************************************/ | |||
43 | ||||
44 | // Recommended: Analysis actions automatically performed by the DAnalysisResults factories to histogram useful quantities. | |||
45 | //These actions are executed sequentially, and are executed on each surviving (non-cut) particle combination | |||
46 | //Pre-defined actions can be found in ANALYSIS/DHistogramActions.h and ANALYSIS/DCutActions.h | |||
47 | ||||
48 | // PID | |||
49 | locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); | |||
50 | locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 1.0, Unknown, SYS_TOF)); //false: measured data //Unknown: All PIDs | |||
51 | locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 10.0, Unknown, SYS_BCAL)); //false: measured data //Unknown: All PIDs | |||
52 | locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 10.0, Unknown, SYS_FCAL)); //false: measured data //Unknown: All PIDs | |||
53 | ||||
54 | // Custom histograms for p2k (no KinFit cut) | |||
55 | locReaction->Add_AnalysisAction(new DCustomAction_p2k_hists(locReaction, false, "NoKinFit_Measured")); | |||
56 | ||||
57 | // Kinematics of final selection | |||
58 | locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false)); //false: fill histograms with measured particle data | |||
59 | ||||
60 | _data.push_back(locReaction); //Register the DReaction with the factory | |||
61 | ||||
62 | return NOERROR; | |||
63 | } | |||
64 | ||||
65 | //------------------ | |||
66 | // fini | |||
67 | //------------------ | |||
68 | jerror_t DReaction_factory_p2k_hists::fini(void) | |||
69 | { | |||
70 | for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) | |||
71 | delete dReactionStepPool[loc_i]; //cleanup memory | |||
72 | return NOERROR; | |||
73 | } | |||
74 |