// $Id$ // // File: DReaction_factory_p2pi.cc // Created: Wed Jan 21 16:28:09 EST 2015 // Creator: jrsteven (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64) // #include "DReaction_factory_p2pi.h" //------------------ // init //------------------ jerror_t DReaction_factory_p2pi::init(void) { // Make as many DReaction objects as desired DReactionStep* locReactionStep = NULL; DReaction* locReaction = new DReaction("p2pi"); //needs to be a unique name for each DReaction object, CANNOT (!) be "Thrown" /**************************************************** p2pi Reaction Steps ****************************************************/ //Required: DReactionSteps to specify the channel and decay chain you want to study //Particles are of type Particle_t, an enum defined in sim-recon/src/libraries/include/particleType.h // g, p -> pi+, pi- (p) locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(PiPlus); locReactionStep->Add_FinalParticleID(PiMinus); locReactionStep->Add_FinalParticleID(Proton, true); //true: proton missing locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak /**************************************************** p2pi Control Settings ****************************************************/ // Recommended: Type of kinematic fit to perform (default is d_NoFit) //fit types are of type DKinFitType, an enum defined in sim-recon/src/libraries/ANALYSIS/DKinFitResults.h locReaction->Set_KinFitType(d_P4AndVertexFit); //simultaneously constrain apply four-momentum conservation, invariant masses, and common-vertex constraints // Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_p2pi.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change /**************************************************** p2pi Analysis Actions ****************************************************/ // Match reco to truth particles (only for MC!) //locReaction->Add_AnalysisAction(new DCutAction_TrueCombo(locReaction, 0.0, true)); // Mock up of FCAL trigger //locReaction->Add_AnalysisAction(new DCustomAction_fcalTrigger(locReaction, false)); // POCA cut on all tracks locReaction->Add_AnalysisAction(new DCutAction_AllVertexZ(locReaction, 50., 80.)); // PID (not very useful currently) locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); // Custom cut on tagger/SC timing coincidence (2 ns gate currently) locReaction->Add_AnalysisAction(new DCustomAction_taggerCoincidence(locReaction, false, 2.)); // Kinematic Fit Results locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); // Custom histograms for p2pi (no KinFit cut) locReaction->Add_AnalysisAction(new DCustomAction_p2pi_hists(locReaction, false, "Measured")); locReaction->Add_AnalysisAction(new DCustomAction_p2pi_hists(locReaction, true, "KinFit")); // Require KinFit converges locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, 0.0)); // Custom histograms for p2pi (after KinFit convergence) locReaction->Add_AnalysisAction(new DCustomAction_p2pi_hists(locReaction, false, "Converge_Measured")); locReaction->Add_AnalysisAction(new DCustomAction_p2pi_hists(locReaction, true, "Converge_KinFit")); // Require KinFit FOM > 0.1 locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, 0.1)); // Custom histograms for p2pi (after KinFit FOM > 10%) locReaction->Add_AnalysisAction(new DCustomAction_p2pi_hists(locReaction, false, "Cut10_Measured")); locReaction->Add_AnalysisAction(new DCustomAction_p2pi_hists(locReaction, true, "Cut10_KinFit")); // Kinematics of final selection locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false)); locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, true, "KinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction)); _data.push_back(locReaction); //Register the DReaction with the factory return NOERROR; } //------------------ // fini //------------------ jerror_t DReaction_factory_p2pi::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }