// $Id$ // // File: DReaction_factory_jpsi_robison.cc // Created: Thu Jul 14 17:03:48 EDT 2016 // Creator: robison (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64) // #include "DReaction_factory_jpsi_robison.h" #include "DCustomAction_jpsi_hists.h" //------------------ // brun //------------------ jerror_t DReaction_factory_jpsi_robison::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_jpsi_robison::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 /************************************************** jpsi_robison Reaction Definition *************************************************/ locReaction = new DReaction("jpsi_robison"); //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 //Example: g, p -> p + J/psi locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(Jpsi); locReactionStep->Add_FinalParticleID(Proton); //proton reconstructed //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 //Jpsi->e+e- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Jpsi); locReactionStep->Add_FinalParticleID(Electron); locReactionStep->Add_FinalParticleID(Positron); locReactionStep->Set_KinFitConstrainInitMassFlag(false); //Does not constrain Jpsi mass. locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak /**************************************************** jpsi_robison Control Settings ****************************************************/ //Options: d_NoFit (default), d_P4Fit, d_VertexFit, d_P4AndVertexFit locReaction->Set_KinFitType(d_P4AndVertexFit); //locReaction->Set_EventStoreSkims("jpsi_ee"); //boolean-AND of skims //This skim finds >=2+ tracks, >=1- track, and uses jpsi skim cuts: //Jpsi skim: invariant mass cut from 1.5 to 4 //Jpsi skim: measured E/p cut from 0.65 to 1.4 in both e- and e+ candidate. // 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(3); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_jpsi_robison.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change /************************************************** jpsi_robison Pre-Combo Custom Cuts *************************************************/ locReaction->Set_InvariantMassCut(Jpsi,1.5,4.0); locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.25, 0.25)); /**************************************************** jpsi_robison Analysis Actions ****************************************************/ // HISTOGRAM PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); // CUT PID // SYS_TOF, SYS_BCAL, SYS_FCAL, ...: DetectorSystem_t: Defined in libraries/include/GlueX.h // locReaction->Add_AnalysisAction(new DCutAction_EachPIDFOM(locReaction, 5.73303E-7)); // locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 1.0, Proton, SYS_TOF)); //cut at delta-t +/- 1.0 //false: measured data // locReaction->Add_AnalysisAction(new DCutAction_PIDTimingBeta(locReaction, 0.0, 0.9, Neutron, SYS_BCAL)); //min/max beta cut for neutrons // locReaction->Add_AnalysisAction(new DCutAction_NoPIDHit(locReaction, KPlus)); //for K+ candidates, cut tracks with no PID hit 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)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Proton, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 1.0, Electron, SYS_TOF)); //false: measured data, locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Electron, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Electron, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 1.0, Positron, SYS_TOF)); //false: measured data, locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Positron, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Positron, SYS_FCAL)); locReaction->Add_AnalysisAction(new DHistogramAction_MissingTransverseMomentum(locReaction, false, 1000, 0.0, 1.0)); //false: fill histograms with measured particle data locReaction->Add_AnalysisAction(new DCutAction_TransverseMomentum(locReaction, 0.4)); //Max Missing Pt of 0.4 GeV locReaction->Add_AnalysisAction(new DCustomAction_jpsi_hists(locReaction, false, "jpsi_PreKin")); //Custom histograms /********************************************** KINEMATIC FIT IS PERFORMED HERE *********************************************************/ locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction,0.05)); //See what results look like pre-KF //locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, 0)); //Requires KF to converge locReaction->Add_AnalysisAction(new DCustomAction_jpsi_hists(locReaction, true, "jpsi_KinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Jpsi, false, 250, 1.5, 4,"Jpsi_IM_prekin")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Jpsi, true, 250, 1.5, 4,"Jpsi_IM_kinfit")); // HISTOGRAM MASSES //false/true: measured/kinfit data // 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, 0.0)); //0% confidence level cut //require kinematic fit converges // HISTOGRAM MASSES //false/true: measured/kinfit data //locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false, 600, 0.0, 0.3, "Pi0_PostKinFit")); //locReaction->Add_AnalysisAction(new DHistogramAction_MissingMass(locReaction, false, 1000, 0.7, 1.2, "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 // -------------------- LOW MASS e- e+ REACTION -------------------------------------------------------------- locReaction = new DReaction("lowmass_electrons_robison"); //Example: g, p -> p + J/psi locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(Jpsi); locReactionStep->Add_FinalParticleID(Proton); //proton reconstructed //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 //Jpsi->e+e- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Jpsi); locReactionStep->Add_FinalParticleID(Electron); locReactionStep->Add_FinalParticleID(Positron); locReactionStep->Set_KinFitConstrainInitMassFlag(false); //Does not constrain Jpsi mass. locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak locReaction->Set_KinFitType(d_P4AndVertexFit); locReaction->Set_MaxPhotonRFDeltaT(1.5*dBeamBunchPeriod); locReaction->Set_MaxExtraGoodTracks(3); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_lowmass_jpsi.root"); locReaction->Set_InvariantMassCut(Jpsi,0.5,4); locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.25, 0.25)); // HISTOGRAM PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); 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)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Proton, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 1.0, Electron, SYS_TOF)); //false: measured data, locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Electron, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Electron, SYS_FCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 1.0, Positron, SYS_TOF)); //false: measured data, locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Positron, SYS_BCAL)); locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction,false, 2.5, Positron, SYS_FCAL)); locReaction->Add_AnalysisAction(new DHistogramAction_MissingTransverseMomentum(locReaction, false, 1000, 0.0, 1.0)); //false: fill histograms with measured particle data locReaction->Add_AnalysisAction(new DCutAction_TransverseMomentum(locReaction, 0.4)); //Max Missing Pt of 0.4 GeV locReaction->Add_AnalysisAction(new DCustomAction_jpsi_hists(locReaction, false, "jpsi_PreKin")); //Custom histograms // ----------------------- KIN FIT PERFORMED HERE --------------------------- locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction,0.05)); //See what results look like pre-KF locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, 0)); //Requires KF to converge locReaction->Add_AnalysisAction(new DCustomAction_jpsi_hists(locReaction, true, "jpsi_KinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Jpsi, false, 250, 1.5, 4,"Jpsi_IM_prekin")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Jpsi, true, 250, 1.5, 4,"Jpsi_IM_kinfit")); // 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_jpsi_robison::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }