// $Id$ // // File: DReaction_factory_k02pilambda.cc // Created: Mon Jul 18 19:42:31 EDT 2016 // Creator: pmatt (on Linux pmattdesktop.jlab.org 2.6.32-642.el6.x86_64 x86_64) // #include "DReaction_factory_k02pilambda.h" #include "DCustomAction_dEdxCut.h" //------------------ // brun //------------------ jerror_t DReaction_factory_k02pilambda::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_k02pilambda::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 /************************************************** k02pilambda Reaction Definition *************************************************/ locReaction = new DReaction("k02pilambda"); //g, p -> K0, pi+, pi0, Lambda locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(KShort); locReactionStep->Add_FinalParticleID(PiPlus); locReactionStep->Add_FinalParticleID(Pi0); locReactionStep->Add_FinalParticleID(Lambda); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //K0 -> pi+, pi- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(KShort); locReactionStep->Add_FinalParticleID(PiPlus); locReactionStep->Add_FinalParticleID(PiMinus); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //pi0 -> g, g locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Pi0); locReactionStep->Add_FinalParticleID(Gamma); locReactionStep->Add_FinalParticleID(Gamma); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //Lambda -> p, pi- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Lambda); locReactionStep->Add_FinalParticleID(Proton); locReactionStep->Add_FinalParticleID(PiMinus); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak /**************************************************** k02pilambda 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 // 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("3q+,ks_2piq,pi0,lambda"); //boolean-AND of skims // Highly Recommended: When generating particle combinations, reject all beam photons that match to a different RF bunch locReaction->Set_MaxPhotonRFDeltaT(1.5*dBeamBunchPeriod); // 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); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_k02pilambda.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change /************************************************** k02pilambda Pre-Combo Custom Cuts *************************************************/ // Highly Recommended: Very loose invariant mass cuts, applied during DParticleComboBlueprint construction locReaction->Set_InvariantMassCut(Pi0, 0.05, 0.22); locReaction->Set_InvariantMassCut(KShort, 0.3, 0.7); locReaction->Set_InvariantMassCut(Lambda, 1.0, 1.2); // Highly Recommended: Very loose DAnalysisAction cuts, applied just after creating the combination (before saving it) // Example: Missing mass squared of proton locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.1, 0.1)); /**************************************************** k02pilambda 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 // PID & Kinematics locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); 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)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiPlus, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiPlus, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.0, PiMinus, SYS_TOF)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiMinus, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, PiMinus, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Proton, SYS_TOF)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Proton, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Proton, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCustomAction_dEdxCut(locReaction, false)); //false: focus on keeping signal locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction, "PostPIDCuts")); // Masses, PreKinFit locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false, 850, 0.05, 0.22, "Pi0")); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, KShort, false, 800, 0.3, 0.7, "KShort")); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Lambda, false, 1000, 1.0, 1.2, "Lambda")); locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 1000, -0.1, 0.1)); //Resonances deque locKStar0PIDs; locKStar0PIDs.push_back(KShort); locKStar0PIDs.push_back(Pi0); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locKStar0PIDs, false, 600, 0.6, 1.2, "KStar0")); deque locKStarPlusPIDs; locKStarPlusPIDs.push_back(KShort); locKStarPlusPIDs.push_back(PiPlus); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locKStarPlusPIDs, false, 600, 0.6, 1.2, "KStarPlus")); deque locSigmaStar0PIDs; locSigmaStar0PIDs.push_back(Lambda); locSigmaStar0PIDs.push_back(Pi0); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locSigmaStar0PIDs, false, 1200, 1.2, 2.4, "SigmaStar0")); deque locSigmaStarPlusPIDs; locSigmaStarPlusPIDs.push_back(Lambda); locSigmaStarPlusPIDs.push_back(PiPlus); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locSigmaStarPlusPIDs, false, 1200, 1.2, 2.4, "SigmaStarPlus")); deque locLambda2PiPIDs; locLambda2PiPIDs.push_back(Lambda); locLambda2PiPIDs.push_back(PiPlus); locLambda2PiPIDs.push_back(Pi0); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locLambda2PiPIDs, false, 1000, 1.2, 2.2, "Lambda2Pi")); locReaction->Add_AnalysisAction(new DHistogramAction_Dalitz(locReaction, 0, locKStar0PIDs, locKStarPlusPIDs, false, 250, 0.4, 1.4, 250, 0.4, 1.4, "Dalitz_KStars")); locReaction->Add_AnalysisAction(new DHistogramAction_Dalitz(locReaction, 0, locSigmaStar0PIDs, locSigmaStarPlusPIDs, false, 440, 1.4, 5.8, 440, 1.4, 5.8, "Dalitz_SigmaStars")); // Kinematic Fit Results 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 //-1: require kinematic fit converges // Masses, PostKinFit locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false, 850, 0.05, 0.22, "Pi0_PostKinFit")); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, KShort, false, 800, 0.3, 0.7, "KShort_PostKinFit")); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Lambda, false, 1000, 1.0, 1.2, "Lambda_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 1000, -0.1, 0.1, "PostKinFit")); //Resonances, PostKinFit locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locKStar0PIDs, false, 600, 0.6, 1.2, "KStar0_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locKStar0PIDs, true, 600, 0.6, 1.2, "KStar0_KinFitPostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locKStarPlusPIDs, false, 600, 0.6, 1.2, "KStarPlus_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locKStarPlusPIDs, true, 600, 0.6, 1.2, "KStarPlus_KinFitPostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locSigmaStar0PIDs, false, 1200, 1.2, 2.4, "SigmaStar0_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locSigmaStar0PIDs, true, 1200, 1.2, 2.4, "SigmaStar0_KinFitPostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locSigmaStarPlusPIDs, false, 1200, 1.2, 2.4, "SigmaStarPlus_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locSigmaStarPlusPIDs, true, 1200, 1.2, 2.4, "SigmaStarPlus_KinFitPostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locLambda2PiPIDs, false, 1000, 1.2, 2.2, "Lambda2Pi_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, 0, locLambda2PiPIDs, true, 1000, 1.2, 2.2, "Lambda2Pi_KinFitPostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_Dalitz(locReaction, 0, locKStar0PIDs, locKStarPlusPIDs, false, 250, 0.4, 1.4, 250, 0.4, 1.4, "Dalitz_KStars_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_Dalitz(locReaction, 0, locKStar0PIDs, locKStarPlusPIDs, true, 250, 0.4, 1.4, 250, 0.4, 1.4, "Dalitz_KStars_KinFitPostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_Dalitz(locReaction, 0, locSigmaStar0PIDs, locSigmaStarPlusPIDs, false, 440, 1.4, 5.8, 440, 1.4, 5.8, "Dalitz_SigmaStars_PostKinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_Dalitz(locReaction, 0, locSigmaStar0PIDs, locSigmaStarPlusPIDs, true, 440, 1.4, 5.8, 440, 1.4, 5.8, "Dalitz_SigmaStars_KinFitPostKinFit")); // Kinematics 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 locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction)); _data.push_back(locReaction); //Register the DReaction with the factory return NOERROR; } //------------------ // fini //------------------ jerror_t DReaction_factory_k02pilambda::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }