// $Id$ // // File: DReaction_factory_p2pi2pi0_hists.cc // Created: Wed Jul 20 16:45:58 EDT 2016 // Creator: aaustreg (on Linux ifarm1102 2.6.32-431.el6.x86_64 x86_64) // #include "DReaction_factory_p2pi2pi0_hists.h" #include "DCustomAction_dEdxCut.h" #include "DCustomAction_CALCut.h" //------------------ // brun //------------------ jerror_t DReaction_factory_p2pi2pi0_hists::brun(JEventLoop* locEventLoop, int32_t locRunNumber) { vector locBeamPeriodVector; locEventLoop->GetCalib("PHOTON_BEAM/RF/beam_period", locBeamPeriodVector); dBeamBunchPeriod = locBeamPeriodVector[0]; return NOERROR; } //------------------ // evnt //------------------ jerror_t DReaction_factory_p2pi2pi0_hists::evnt(JEventLoop* locEventLoop, uint64_t locEventNumber) { // Make as many DReaction objects as desired DReactionStep* locReactionStep = NULL; DReaction* locReaction = NULL; //create with a unique name for each DReaction object. CANNOT (!) be "Thrown" // DOCUMENTATION: // ANALYSIS library: https://halldweb1.jlab.org/wiki/index.php/GlueX_Analysis_Software // DReaction factory: https://halldweb1.jlab.org/wiki/index.php/Analysis_DReaction /************************************************** p2pi2pi0_hists Reaction Definition *************************************************/ locReaction = new DReaction("p2pi2pi0_hists"); //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-, pi0, pi0, p locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(PiPlus); locReactionStep->Add_FinalParticleID(PiMinus); locReactionStep->Add_FinalParticleID(Pi0); locReactionStep->Add_FinalParticleID(Pi0); locReactionStep->Add_FinalParticleID(Proton); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //Example: pi0 -> g, g locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Pi0); locReactionStep->Add_FinalParticleID(Gamma); locReactionStep->Add_FinalParticleID(Gamma); locReactionStep->Set_KinFitConstrainInitMassFlag(true); //default: true //ignored if p4 not fit or is beam //phi, omega not constrained regardless locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //Example: pi0 -> g, g locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Pi0); locReactionStep->Add_FinalParticleID(Gamma); locReactionStep->Add_FinalParticleID(Gamma); locReactionStep->Set_KinFitConstrainInitMassFlag(true); //default: true //ignored if p4 not fit or is beam //phi, omega not constrained regardless locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak /**************************************************** p2pi2pi0_hists Control Settings ****************************************************/ // Highly Recommended: Set EventStore skim query (use with "eventstore" source) // This will skip creating particle combos for events that aren't in the skims you list // Query should be comma-separated list of skims to boolean-AND together locReaction->Set_EventStoreSkims("2pi0,2q+,q-"); //boolean-AND of skims // 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/DReaction.h //Options: d_NoFit (default), d_P4Fit, d_VertexFit, d_P4AndVertexFit //P4 fits automatically constrain decaying particle masses, unless they are manually disabled locReaction->Set_KinFitType(d_P4AndVertexFit); // Highly Recommended: When generating particle combinations, reject all beam photons that match to a different RF bunch locReaction->Set_MaxPhotonRFDeltaT(1.5*dBeamBunchPeriod); //should be minimum cut value // Optional: When generating particle combinations, reject all photon candidates with a PID confidence level < 5.73303E-7 (+/- 5-sigma) // Make sure PID errors are calculated correctly before using. //locReaction->Set_MinPhotonPIDFOM(5.73303E-7); // Optional: When generating particle combinations, reject all charged track candidates with a PID confidence level < 5.73303E-7 (+/- 5-sigma) // Make sure PID errors are calculated correctly before using. //locReaction->Set_MinChargedPIDFOM(5.73303E-7); // Highly Recommended: Cut on number of extra "good" tracks. "Good" tracks are ones that survive the "PreSelect" (or user custom) factory. // Important: Keep cut large: Can have many ghost and accidental tracks that look "good" locReaction->Set_MaxExtraGoodTracks(4); // Nathans cut on the Minimal Photon Energy (200MeV instead of 100MeV) locReaction->Add_ComboPreSelectionAction(new DCustomAction_CALCut(locReaction, 0.2)); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_p2pi2pi0_hists.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change /************************************************** p2pi2pi0_hists Pre-Combo Custom Cuts *************************************************/ // Highly Recommended: Very loose invariant mass cuts, applied during DParticleComboBlueprint construction // Example: pi0 -> g, g cut locReaction->Set_InvariantMassCut(Pi0, 0.085, 0.185); // Highly Recommended: Very loose DAnalysisAction cuts, applied just after creating the combination (before saving it) // Example: Missing mass of proton locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMass(locReaction, false, -0.2, 0.2)); /**************************************************** p2pi2pi0_hists Analysis Actions ****************************************************/ // Recommended: Analysis actions automatically performed by the DAnalysisResults factories to histogram useful quantities. //These actions are executed sequentially, and are executed on each surviving (non-cut) particle combination //Pre-defined actions can be found in ANALYSIS/DHistogramActions_*.h and ANALYSIS/DCutActions.h //If a histogram action is repeated, it should be created with a unique name (string) to distinguish them // HISTOGRAM PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); // CUT PID from Paul // SYS_TOF, SYS_BCAL, SYS_FCAL, ...: DetectorSystem_t: Defined in libraries/include/GlueX.h locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 3.0, Gamma, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Gamma, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.0, PiPlus, SYS_TOF)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiPlus, SYS_BCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiPlus, SYS_FCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.0, PiMinus, SYS_TOF)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiMinus, SYS_BCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiMinus, SYS_FCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Proton, SYS_TOF)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Proton, SYS_BCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Proton, SYS_FCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCustomAction_dEdxCut(locReaction, false)); //false: focus on keeping signal locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction, "PostPIDCuts")); // HISTOGRAM MASSES //false/true: measured/kinfit data std::deque Four, ThreeP, ThreeM, Three0, TwoP, TwoM, TwoC, Two0, ZP, ZM, Z0; Four.push_back(PiPlus); Four.push_back(PiMinus); Four.push_back(Pi0); Four.push_back(Pi0); ThreeP.push_back(PiPlus); ThreeP.push_back(Pi0); ThreeP.push_back(Pi0); ThreeM.push_back(PiMinus); ThreeM.push_back(Pi0); ThreeM.push_back(Pi0); Three0.push_back(PiPlus); Three0.push_back(PiMinus); Three0.push_back(Pi0); TwoP.push_back(PiPlus); TwoP.push_back(Pi0); TwoM.push_back(PiMinus); TwoM.push_back(Pi0); TwoC.push_back(PiPlus); TwoC.push_back(PiMinus); Two0.push_back(Pi0); Two0.push_back(Pi0); ZP.push_back(PiPlus); ZP.push_back(Proton); ZM.push_back(PiMinus); ZM.push_back(Proton); Z0.push_back(Pi0); Z0.push_back(Proton); // locReaction->Add_AnalysisAction(new DHistogramAction_MissingMass(locReaction, 0, Proton, false, 100, 0, 5, "pre")); //false: measured data // locReaction->Add_AnalysisAction(new DCutAction_MissingMass(locReaction, 0, Proton, false, 1, 1.4, "test")); //false: measured data // locReaction->Add_AnalysisAction(new DHistogramAction_MissingMass(locReaction, 0, Proton, false, 100, 0, 5, "post")); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Four, false, 500, 0.5, 2.5, "Four_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ThreeP, false, 500, 0.3, 2.3, "ThreeP_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ThreeM, false, 500, 0.3, 2.3, "ThreeM_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Three0, false, 500, 0.3, 2.3, "Three0_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoP, false, 500, 0.0, 2.0, "TwoP_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoM, false, 500, 0.0, 2.0, "TwoM_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoC, false, 500, 0.0, 2.0, "TwoC_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Two0, false, 500, 0.0, 2.0, "Two0_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_2DInvariantMass(locReaction, 0, TwoP, TwoM, false, 200, 0.2, 2.2, 200, 0.2, 2.2, "TwoPTwoM_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_2DInvariantMass(locReaction, 0, TwoC, Two0, false, 200, 0.2, 2.2, 200, 0.2, 2.2, "TwoPTwoM_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ZP, false, 500, 1.0, 3.0, "ZP_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ZM, false, 500, 1.0, 3.0, "ZM_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Z0, false, 500, 1.0, 3.0, "Z0_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false,500, 0.085,0.185, "Pi0_PreKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 1000, -0.04, 0.04, "PreKinFit")); // KINEMATIC FIT locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); //5% confidence level cut on pull histograms only locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, -1)); //0% confidence level cut //require kinematic fit converges // HISTOGRAM MASSES //false/true: measured/kinfit data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Four, false, 500, 0.5, 2.5, "Four_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ThreeP, false, 500, 0.3, 2.3, "ThreeP_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ThreeM, false, 500, 0.3, 2.3, "ThreeM_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Three0, false, 500, 0.3, 2.3, "Three0_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoP, false, 500, 0.0, 2.0, "TwoP_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoM, false, 500, 0.0, 2.0, "TwoM_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoC, false, 500, 0.0, 2.0, "TwoC_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Two0, false, 500, 0.0, 2.0, "Two0_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_2DInvariantMass(locReaction, 0, TwoP, TwoM, false, 200, 0.2, 2.2, 200, 0.2, 2.2, "TwoPTwoM_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_2DInvariantMass(locReaction, 0, TwoC, Two0, false, 200, 0.2, 2.2, 200, 0.2, 2.2, "TwoPTwoM_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ZP, false, 500, 1.0, 3.0, "ZP_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ZM, false, 500, 1.0, 3.0, "ZM_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Z0, false, 500, 1.0, 3.0, "Z0_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false,500, 0.085,0.185, "Pi0_ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 1000, -0.04, 0.04, "ConKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Four, true, 500, 0.5, 2.5, "Four_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ThreeP, true, 500, 0.3, 2.3, "ThreeP_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ThreeM, true, 500, 0.3, 2.3, "ThreeM_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Three0, true, 500, 0.3, 2.3, "Three0_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoP, true, 500, 0.0, 2.0, "TwoP_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoM, true, 500, 0.0, 2.0, "TwoM_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, TwoC, true, 500, 0.0, 2.0, "TwoC_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Two0, true, 500, 0.0, 2.0, "Two0_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_2DInvariantMass(locReaction, 0, TwoP, TwoM, true, 200, 0.2, 2.2, 200, 0.2, 2.2, "TwoPTwoM_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_2DInvariantMass(locReaction, 0, TwoC, Two0, true, 200, 0.2, 2.2, 200, 0.2, 2.2, "TwoPTwoM_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ZP, true, 500, 1.0, 3.0, "ZP_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, ZM, true, 500, 1.0, 3.0, "ZM_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, Z0, true, 500, 1.0, 3.0, "Z0_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, true,500, 0.085,0.185, "Pi0_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, true, 1000, -0.04, 0.04, "PostKinFit")); // Kinematics locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false)); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, true, "KinFit")); //true: kinematic-fit data locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction)); _data.push_back(locReaction); //Register the DReaction with the factory return NOERROR; } //------------------ // fini //------------------ jerror_t DReaction_factory_p2pi2pi0_hists::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }