// $Id$ // // File: DReaction_factory_B3pi.cc // Created: Fri Jul 22 15:09:52 EDT 2016 // Creator: cfanelli (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64) // #include "DReaction_factory_B3pi.h" #include "DCustomAction_HistOmegaVsMissProton.h" #include "DCustomAction_dEdxCut.h" #include "DCustomAction_CutExtraPi0.h" #include "DCustomAction_CutExtraTrackPID.h" //------------------ // brun //------------------ jerror_t DReaction_factory_B3pi::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_B3pi::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 /************************************************** B3pi Reaction Definition *************************************************/ locReaction = new DReaction("B3pi_preco_any"); // g, p -> omega, p locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(omega); locReactionStep->Add_FinalParticleID(Proton); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak // omega -> pi+, pi-, pi0 locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(omega); locReactionStep->Set_KinFitConstrainInitMassFlag(false); locReactionStep->Add_FinalParticleID(PiPlus); locReactionStep->Add_FinalParticleID(PiMinus); locReactionStep->Add_FinalParticleID(Pi0); 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); //locReactionStep->Set_KinFitConstrainInitMassFlag(false); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); /**************************************************** B3pi 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("myskim1,myskim2,myskim3"); //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); locReaction->Set_EventStoreSkims("q+,q-"); // Highly Recommended: When generating particle combinations, reject all beam photons that match to a different RF bunch locReaction->Set_MaxPhotonRFDeltaT(0.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); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_B3pi_preco_any.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change /************************************************** B3pi 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.05, 0.22); // 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.7, 1.2)); locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.06, 0.06)); /**************************************************** B3pi Analysis Actions ****************************************************/ // HISTOGRAM PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); locReaction->Add_AnalysisAction(new DCutAction_BeamEnergy(locReaction,false,3.0,12.0)); // PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); //locReaction->Add_AnalysisAction(new DCustomAction_dEdxCut(locReaction, false)); //false: focus on keeping signal locReaction->Add_AnalysisAction(new DCustomAction_dEdxCut(locReaction, true)); 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 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, 3.0, Gamma, SYS_BCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Gamma, SYS_FCAL)); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction, "PostPIDCuts")); //KINEMATIC FIT locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, -1.0)); //require kinematic fit to converge locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction)); // Pi0 locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false, 600, 0.0, 0.3, "Pi0")); //false: measured data // Missing Mass Squared (Hist and Cut) locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 600, -0.06, 0.06)); // Omega Mass (Hist and Cut) locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 1000, 0., 2.0, "Omega")); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, true, 1000, 0., 2.0, "Omega_Kinfit")); //true: kinfit //locReaction->Add_AnalysisAction(new DCutAction_InvariantMass(locReaction, omega, true, 0.69, 0.88)); //~ +/- 3sigma-ish //true: kinfit // Kinematics of final selection locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false, "Final")); //false: fill histograms with measured particle data _data.push_back(locReaction); //Register the DReaction with the factory //NEW REACTION /**************************************************** pmiss_any Reaction Steps ****************************************************/ locReaction = new DReaction("B3pi_pmiss_any"); //needs to be a unique name for each DReaction object, CANNOT (!) be "Thrown" // g, p -> omega, (p) locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(omega); locReactionStep->Add_FinalParticleID(Proton, true); //true: missing locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak locReaction->Add_ReactionStep(dReactionStepPool[1]); locReaction->Add_ReactionStep(dReactionStepPool[2]); /**************************************************** B3pi_pmiss_any Control Settings ****************************************************/ locReaction->Set_KinFitType(d_P4Fit); //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("q+,q-"); //("2q+,lambda") boolean-AND of skims // Highly Recommended: When generating particle combinations, reject all beam photons that match to a different RF bunch (delta_t > 1.002 ns) locReaction->Set_MaxPhotonRFDeltaT(0.5*dBeamBunchPeriod); //should be minimum cut value locReaction->Set_MaxExtraGoodTracks(3); //not ideal //locReaction->Set_MaxNumBeamPhotonsInBunch(1); //not ideal: throws away a lot of signal // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_B3pi_pmiss_any.root"); /*********************************************** B3pi_pmiss_any Pre-Combo Custom Cuts ***********************************************/ // Loose Pi0 Cut, Applied during Blueprint Construction locReaction->Set_InvariantMassCut(Pi0, 0.05, 0.22); // Loose omega Cut, Applied during Blueprint Construction //locReaction->Set_InvariantMassCut(omega, 0.5, 1.1); // Loose missing mass squared cut, applied just after creating the combination (before saving it) //locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.1, 2.56)); // Example: Missing mass of proton locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMass(locReaction, false, 0.6, 1.3)); /**************************************************** B3pi_pmiss_any Analysis Actions ****************************************************/ locReaction->Add_AnalysisAction(new DCutAction_BeamEnergy(locReaction,false,3.0,12.0)); // PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); locReaction->Add_AnalysisAction(new DCustomAction_dEdxCut(locReaction, true)); //true: focus on rejecting background 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, 3.0, Gamma, SYS_BCAL)); //false: measured data locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 2.5, Gamma, SYS_FCAL)); //false: measured data locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction, "PostPIDCuts")); //KINEMATIC FIT locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, -1.0)); //require kinematic fit to converge locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction)); // Pi0 locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false, 600, 0.0, 0.3, "Pi0")); locReaction->Add_AnalysisAction(new DCutAction_InvariantMass(locReaction, Pi0, false, 0.0775209, 0.188047)); //+/- 3sigma // Extra pi0 locReaction->Add_AnalysisAction(new DCustomAction_CutExtraPi0(locReaction, 0.1, 0.16)); // Extra-track PID (if any) locReaction->Add_AnalysisAction(new DCustomAction_CutExtraTrackPID(locReaction, Proton)); // Omega vs missing proton locReaction->Add_AnalysisAction(new DCustomAction_HistOmegaVsMissProton(locReaction)); // Missing Mass Squared (Hist) locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 1064, -0.1, 2.56)); // Omega Mass (Hist) locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 1000, 0., 2.0, "Omega")); //false: measured data // Omega Mass (Hist) locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, true, 1000, 0., 2.0, "Omega_Kinfit")); _data.push_back(locReaction); //Register the DReaction with the factory return NOERROR; } //------------------ // fini //------------------ jerror_t DReaction_factory_B3pi::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }