// $Id$ // // File: DReaction_factory_Bee.cc // Created: Thu Nov 10 13:25:05 EST 2016 // Creator: cfanelli (on Linux ifarm1101 2.6.32-431.el6.x86_64 x86_64) // #include "DReaction_factory_Bee.h" //#include "DCustomAction_Bee_hists.h" //------------------ // brun //------------------ jerror_t DReaction_factory_Bee::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_Bee::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 /************************************************** Bee Reaction Definition *************************************************/ locReaction = new DReaction("Bee_preco"); //Example: g, p -> p + B locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(omega); //omega/phi mix. -> B 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 //B->e+e- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(omega); locReactionStep->Add_FinalParticleID(Electron); locReactionStep->Add_FinalParticleID(Positron); locReactionStep->Set_KinFitConstrainInitMassFlag(false); //Does not constrain B mass. locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //------ Control Settings ------ locReaction->Set_EventStoreSkims("2q+,q-"); locReaction->Set_KinFitType(d_P4AndVertexFit); locReaction->Set_MaxPhotonRFDeltaT(0.5*dBeamBunchPeriod); locReaction->Set_MaxExtraGoodTracks(3); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_Bee_preco.root"); //------ locReaction->Set_InvariantMassCut(omega,0.00,0.500); locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.1, 0.1)); // 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_Bee_hists(locReaction, false, "Bee_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, -1.)); //Requires KF to converge //locReaction->Add_AnalysisAction(new DCustomAction_Bee_hists(locReaction, true, "Bee_KinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 250, 0.0, 0.5,"Bee_prekin")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, true, 250, 0.0, 0.5,"Bee_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 //======================================================================================= //---------------- // Missing Proton //---------------- locReaction = new DReaction("Bee_pmiss"); //Example: g, p -> (p) + B locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(omega); //omega/phi mix. -> B locReactionStep->Add_FinalParticleID(Proton,true); //missing proton locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //B->e+e- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(omega); locReactionStep->Add_FinalParticleID(Electron); locReactionStep->Add_FinalParticleID(Positron); locReactionStep->Set_KinFitConstrainInitMassFlag(false); //Does not constrain B mass. locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak //------ Control Settings ------ locReaction->Set_EventStoreSkims("q+,q-"); locReaction->Set_KinFitType(d_P4AndVertexFit); locReaction->Set_MaxPhotonRFDeltaT(0.5*dBeamBunchPeriod); locReaction->Set_MaxExtraGoodTracks(3); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_Bee_pmiss.root"); //------ locReaction->Set_InvariantMassCut(omega,0.00,0.500); //locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMassSquared(locReaction, false, -0.1, 0.1)); locReaction->Add_ComboPreSelectionAction(new DCutAction_MissingMass(locReaction, false, 0.7, 1.5)); // 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, 3.0, 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_Bee_hists(locReaction, false, "Bee_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, -1.)); //Requires KF to converge //locReaction->Add_AnalysisAction(new DCustomAction_Bee_hists(locReaction, true, "Bee_KinFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 250, 0.0, 0.5,"Bee_prekin")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, true, 250, 0.0, 0.5,"Bee_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_Bee::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }