// $Id$ // // File: DReaction_factory_Bpi0g.cc // Created: Fri Jul 22 17:28:00 EDT 2016 // Creator: cfanelli (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64) // #include "DReaction_factory_Bpi0g.h" //------------------ // brun //------------------ jerror_t DReaction_factory_Bpi0g::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_Bpi0g::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 /************************************************** Bpi0g Reaction Definition *************************************************/ locReaction = new DReaction("Bpi0g"); double minPi0val = 0.11; double maxPi0val = 0.16; // 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 -> pi0, g locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(omega); locReactionStep->Set_KinFitConstrainInitMassFlag(false); locReactionStep->Add_FinalParticleID(Pi0); locReactionStep->Add_FinalParticleID(Gamma); 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); //register so will be deleted later: prevent memory leak /**************************************************** Bpi0g 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("2q0"); //at least two showers pi0, gamma // 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(3); // Highly Recommended: Enable ROOT TTree output for this DReaction locReaction->Enable_TTreeOutput("tree_Bpi0g.root"); //string is file name (must end in ".root"!!): doen't need to be unique, feel free to change /************************************************** Bpi0g 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); // Loose omega Cut, Applied during Blueprint Construction locReaction->Set_InvariantMassCut(omega, 0.2, 1.2); // 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)); /**************************************************** Bpi0g Analysis Actions ****************************************************/ //locReaction->Add_AnalysisAction(new DCutAction_BeamEnergy(locReaction,false,8.4,9.0)); locReaction->Add_AnalysisAction(new DCutAction_BeamEnergy(locReaction,false,3.0,12.0)); // PID locReaction->Add_AnalysisAction(new DHistogramAction_PID(locReaction)); /* locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 1.0, Unknown, SYS_TOF)); //false: measured data //Unknown: All PIDs locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 10.0, Unknown, SYS_BCAL)); //false: measured data //Unknown: All PIDs locReaction->Add_AnalysisAction(new DCutAction_PIDDeltaT(locReaction, false, 10.0, Unknown, SYS_FCAL)); //false: measured data //Unknown: All PIDs */ 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 //Require proton 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_ProtonPiPlusdEdx(locReaction, 2.2, false)); //select p/pi+ above/below 2.2, //true/false: cut all/no proton candidates above p = 1 GeV/c locReaction->Add_AnalysisAction(new DHistogramAction_MissingMassSquared(locReaction, false, 600, -0.06, 0.06)); //locReaction->Add_AnalysisAction(new DCutAction_MissingMassSquared(locReaction, false, -0.01, 0.005)); // Custom histograms for ppi0gamma_Bboson (no KinFit cut) locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false,500,0.,1., "Pi0_NoKinFit_Measured")); //locReaction->Add_AnalysisAction(new DCustomAction_ppi0gamma_Bboson_hists(locReaction, false, "NoKinFit_Measured")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 1000, 0.2, 1.2, "omega_NoKinFit_Measured")); // Kinematics Pre-Pi0Cut locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false, "Pre-Pi0Cut")); //false: fill histograms with measured particle data locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction, "Pre-Pi0Cut")); // Pi0 mass cut locReaction->Add_AnalysisAction(new DCutAction_InvariantMass(locReaction, Pi0, false, minPi0val, maxPi0val)); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, Pi0, false,500,0.,1., "Pi0_NoKinFit_Measured_afterPi0Cut")); //Kinematics Post-Pi0Cut locReaction->Add_AnalysisAction(new DHistogramAction_ParticleComboKinematics(locReaction, false, "Post-Pi0Cut")); locReaction->Add_AnalysisAction(new DHistogramAction_TrackVertexComparison(locReaction, "Post-Pi0Cut")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 1000, 0.2, 1.2, "omega_NoKinFit_Measured_afterPi0Cut")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, true, 1000, 0.2, 1.2, "omega_KinFit_afterPi0Cut")); //======= //Fit Cut //======= //locReaction->Add_AnalysisAction(new DCutAction_OneVertexKinFit(locReaction, 5.73303E-7, 44.0, 85.0));//Fit Vertex locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, -1.0)); //======= //after fit locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, true, 1000, 0.2, 1.2, "omega_KinFit_afterPi0Cut_afterVtxFit")); locReaction->Add_AnalysisAction(new DHistogramAction_InvariantMass(locReaction, omega, false, 1000, 0.2, 1.2, "omega_Measured_afterPi0Cut_afterVtxFit")); // Omega M vs Omega P //locReaction->Add_AnalysisAction(new DCustomAction_HistOmegaMVsOmegaP(locReaction)); _data.push_back(locReaction); //Register the DReaction with the factory return NOERROR; } //------------------ // fini //------------------ jerror_t DReaction_factory_Bpi0g::fini(void) { for(size_t loc_i = 0; loc_i < dReactionStepPool.size(); ++loc_i) delete dReactionStepPool[loc_i]; //cleanup memory return NOERROR; }