#ifndef _DHistogramActions_Reaction_ #define _DHistogramActions_Reaction_ #include #include #include #include #include #include #include #include "TROOT.h" #include "TDirectoryFile.h" #include "TH1I.h" #include "TH2I.h" #include "TH1D.h" #include "TH2D.h" #include "TTree.h" #include "JANA/JEventLoop.h" #include "particleType.h" #include "PID/DRFTime.h" #include "PID/DChargedTrack.h" #include "PID/DChargedTrackHypothesis.h" #include "PID/DNeutralParticle.h" #include "PID/DNeutralShower.h" #include "PID/DVertex.h" #include "PID/DDetectorMatches.h" #include "PID/DNeutralParticleHypothesis.h" #include "PID/DEventRFBunch.h" #include "TRACKING/DMCThrown.h" #include "ANALYSIS/DReaction.h" #include "ANALYSIS/DKinFitParticle.h" #include "ANALYSIS/DMCThrownMatching.h" #include "ANALYSIS/DMCThrownMatching_factory.h" #include "ANALYSIS/DParticleCombo.h" #include "ANALYSIS/DAnalysisUtilities.h" #include "ANALYSIS/DAnalysisAction.h" #include "ANALYSIS/DCutActions.h" #include "START_COUNTER/DSCHit.h" #include "TAGGER/DTAGHHit.h" #include "TAGGER/DTAGMHit.h" #include "CDC/DCDCHit.h" #include "FDC/DFDCHit.h" #include "TOF/DTOFPoint.h" #include "TOF/DTOFHit.h" #include "BCAL/DBCALShower.h" #include "BCAL/DBCALHit.h" #include "FCAL/DFCALShower.h" #include "FCAL/DFCALHit.h" #include "TRACKING/DTrackTimeBased.h" #include "TRACKING/DTrackWireBased.h" #include "TRACKING/DTrackCandidate.h" using namespace std; using namespace jana; /* REACTION-BASED ACTIONS: DHistogramAction_ParticleComboKinematics DHistogramAction_PID DHistogramAction_TrackVertexComparison DHistogramAction_KinFitResults DHistogramAction_InvariantMass DHistogramAction_MissingMass DHistogramAction_MissingMassSquared DHistogramAction_MissingTransverseMomentum */ class DHistogramAction_PID : public DAnalysisAction { public: DHistogramAction_PID(const DReaction* locReaction, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_PID", false, locActionUniqueString), dNumFOMBins(200), dNumBetaBins(400), dNumDeltaBetaBins(400), dNum2DPBins(300), dNum2DThetaBins(140), dNumPullBins(500), dNum2DPullBins(250), dMinBeta(-0.2), dMaxBeta(1.2), dMinDeltaBeta(-1.0), dMaxDeltaBeta(1.0), dMinP(0.0), dMaxP(12.0), dMinTheta(0.0), dMaxTheta(150.0) { dThrownPIDs.clear(); dThrownPIDs.push_back(Gamma); dThrownPIDs.push_back(Neutron); dThrownPIDs.push_back(PiPlus); dThrownPIDs.push_back(KPlus); dThrownPIDs.push_back(Proton); dThrownPIDs.push_back(PiMinus); dThrownPIDs.push_back(KMinus); dParticleID = NULL; dAnalysisUtilities = NULL; } void Initialize(JEventLoop* locEventLoop); unsigned int dNumFOMBins, dNumBetaBins, dNumDeltaBetaBins, dNum2DPBins, dNum2DThetaBins, dNumPullBins, dNum2DPullBins; double dMinBeta, dMaxBeta, dMinDeltaBeta, dMaxDeltaBeta, dMinP, dMaxP, dMinTheta, dMaxTheta; deque dThrownPIDs; private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); void Fill_ChargedHists(const DChargedTrackHypothesis* locChargedTrackHypothesis, const DMCThrownMatching* locMCThrownMatching, const DEventRFBunch* locEventRFBunch); void Fill_NeutralHists(const DNeutralParticleHypothesis* locNeutralParticleHypothesis, const DMCThrownMatching* locMCThrownMatching, const DEventRFBunch* locEventRFBunch); const DParticleID* dParticleID; const DAnalysisUtilities* dAnalysisUtilities; map dHistMap_PIDFOM; map dHistMap_TOFFOM_BCAL; map dHistMap_TOFFOM_FCAL; map dHistMap_TOFFOM_TOF; map dHistMap_TOFFOM_CDC; map dHistMap_DCdEdxFOM; map dHistMap_BetaVsP; map dHistMap_DeltaBetaVsP; map dHistMap_TOFFOMVsDeltaBeta; map dHistMap_TimePull_CDC; map dHistMap_TimePull_BCAL; map dHistMap_TimePull_TOF; map dHistMap_TimePull_FCAL; map dHistMap_TimePullVsTheta_CDC; map dHistMap_TimePullVsP_CDC; map dHistMap_TimePullVsTheta_BCAL; map dHistMap_TimePullVsP_BCAL; map dHistMap_TimePullVsP_TOF; map dHistMap_TimePullVsP_FCAL; map dHistMap_PVsTheta_LowPIDFOM; map dHistMap_PVsTheta_NaNPIDFOM; map dHistMap_PVsTheta_LowTOFFOM; map dHistMap_PVsTheta_NaNTOFFOM; map dHistMap_PVsTheta_NegativeBeta; map dHistMap_PVsTheta_LowDCdEdxFOM; map dHistMap_PVsTheta_NaNDCdEdxFOM; map, TH1I*> dHistMap_PIDFOMForTruePID; set > > dPreviouslyHistogrammedParticles; //to prevent double-counting (JObject is source object) }; class DHistogramAction_TrackVertexComparison : public DAnalysisAction { public: DHistogramAction_TrackVertexComparison(const DReaction* locReaction, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_TrackVertexComparison", false, locActionUniqueString), dNumDeltaVertexZBins(200), dNumDeltaVertexTBins(100), dNumDOCABins(100), dNum2DPBins(300), dNumThetaBins(300), dMinDeltaVertexZ(-10.0), dMaxDeltaVertexZ(10.0), dMinDeltaVertexT(-5.0), dMaxDeltaVertexT(5.0), dMinDOCA(0.0), dMaxDOCA(10.0), dMinP(0.0), dMaxP(12.0), dMinTheta(0.0), dMaxTheta(150.0) { dAnalysisUtilities = NULL; } unsigned int dNumDeltaVertexZBins, dNumDeltaVertexTBins, dNumDOCABins, dNum2DPBins, dNumThetaBins; double dMinDeltaVertexZ, dMaxDeltaVertexZ, dMinDeltaVertexT, dMaxDeltaVertexT, dMinDOCA, dMaxDOCA, dMinP, dMaxP, dMinTheta, dMaxTheta; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); const DAnalysisUtilities* dAnalysisUtilities; //should be improved...: the particles at a given vertex may span several steps deque > dHistDeque_TrackZToCommon; //dim is step deque > dHistDeque_TrackTToCommon; //dim is step deque > dHistDeque_TrackDOCAToCommon; //dim is step deque dHistDeque_MaxTrackDeltaZ; deque dHistDeque_MaxTrackDeltaT; deque dHistDeque_MaxTrackDOCA; deque, TH2I*> > dHistDeque_TrackDeltaTVsP; //one hist per track pair, more massive particle is listed first, p is that of the more massive particle (generally slower: worse projected resolution) map dHistMap_BeamTrackDeltaTVsP; }; class DHistogramAction_ParticleComboKinematics : public DAnalysisAction { public: DHistogramAction_ParticleComboKinematics(const DReaction* locReaction, bool locUseKinFitResultsFlag, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_ParticleComboKinematics", locUseKinFitResultsFlag, locActionUniqueString), dNumPBins(600), dNumThetaBins(560), dNumPhiBins(360), dNumVertexZBins(600), dNumTBins(200), dNumVertexXYBins(200), dNumBetaBins(400), dNumDeltaBetaBins(400), dNum2DPBins(300), dNum2DThetaBins(140), dNum2DPhiBins(180), dNumDeltaTRFBins(500), dMinT(-5.0), dMaxT(5.0), dMinP(0.0), dMaxP(12.0), dMinTheta(0.0), dMaxTheta(140.0), dMinPhi(-180.0), dMaxPhi(180.0), dMinVertexZ(0.0), dMaxVertexZ(200.0), dMinVertexXY(-5.0), dMaxVertexXY(5.0), dMinBeta(-0.2), dMaxBeta(1.2), dMinDeltaBeta(-1.0), dMaxDeltaBeta(1.0), dMinDeltaTRF(-10.0), dMaxDeltaTRF(10.0) { dParticleID = NULL; dAnalysisUtilities = NULL; } unsigned int dNumPBins, dNumThetaBins, dNumPhiBins, dNumVertexZBins, dNumTBins, dNumVertexXYBins, dNumBetaBins, dNumDeltaBetaBins; unsigned int dNum2DPBins, dNum2DThetaBins, dNum2DPhiBins, dNumDeltaTRFBins; double dMinT, dMaxT, dMinP, dMaxP, dMinTheta, dMaxTheta, dMinPhi, dMaxPhi, dMinVertexZ, dMaxVertexZ, dMinVertexXY, dMaxVertexXY; double dMinBeta, dMaxBeta, dMinDeltaBeta, dMaxDeltaBeta, dMinDeltaTRF, dMaxDeltaTRF; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); void Fill_Hists(JEventLoop* locEventLoop, const DKinematicData* locKinematicData, const DEventRFBunch* locEventRFBunch, size_t locStepIndex); void Fill_BeamHists(const DKinematicData* locKinematicData, const DEventRFBunch* locEventRFBunch); const DParticleID* dParticleID; double dTargetZCenter; const DAnalysisUtilities* dAnalysisUtilities; TH2I* dBeamParticleHist_PVsTheta; TH2I* dBeamParticleHist_PhiVsTheta; TH1I* dBeamParticleHist_P; TH1I* dBeamParticleHist_Theta; TH1I* dBeamParticleHist_Phi; TH1I* dBeamParticleHist_VertexZ; TH1I* dBeamParticleHist_VertexT; TH2I* dBeamParticleHist_VertexYVsX; TH1I* dBeamParticleHist_DeltaTRF; TH2I* dBeamParticleHist_DeltaTRFVsBeamE; deque > dHistDeque_PVsTheta; deque > dHistDeque_BetaVsP; deque > dHistDeque_DeltaBetaVsP; deque > dHistDeque_PhiVsTheta; deque > dHistDeque_P; deque > dHistDeque_Theta; deque > dHistDeque_Phi; deque > dHistDeque_VertexZ; deque > dHistDeque_VertexT; deque > dHistDeque_VertexYVsX; deque dHistDeque_MaxTrackDeltaZ; deque dHistDeque_MaxTrackDeltaT; deque dHistDeque_MaxTrackDOCA; set dPreviouslyHistogrammedBeamParticles; set > > dPreviouslyHistogrammedParticles; }; class DHistogramAction_InvariantMass : public DAnalysisAction { public: DHistogramAction_InvariantMass(const DReaction* locReaction, Particle_t locInitialPID, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMass, double locMaxMass, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_InvariantMass", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dInitialPID(locInitialPID), dNumMassBins(locNumMassBins), dMinMass(locMinMass), dMaxMass(locMaxMass) { dAnalysisUtilities = NULL; } bool dEnableDoubleCounting; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); Particle_t dInitialPID; unsigned int dNumMassBins; double dMinMass, dMaxMass; const DAnalysisUtilities* dAnalysisUtilities; TH1I* dHist_InvaraintMass; set > > dPreviousSourceObjects; }; class DHistogramAction_MissingMass : public DAnalysisAction { public: DHistogramAction_MissingMass(const DReaction* locReaction, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMass, double locMaxMass, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingMass", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumMassBins(locNumMassBins), dMinMass(locMinMass), dMaxMass(locMaxMass), dMissingMassOffOfStepIndex(-1) { dAnalysisUtilities = NULL; } //E.g. If: //g, p -> K+, K+, Xi- // Xi- -> pi-, Lambda // Lambda -> (p), pi- //And: //locMissingMassOffOfStepIndex = 0, locMissingMassOffOfPIDs = K+, K+ //Then: Will histogram missing-mass: g, p -> K+, K+, (X) //Also: //locMissingMassOffOfStepIndex = 1, locMissingMassOffOfPID = pi- //Then: Will histogram missing-mass: g, p -> K+, K+, pi- //But: //locMissingMassOffOfStepIndex = 0, locMissingMassOffOfPIDs = K+ //Then: Will histogram only missing-mass: g, p -> K+_1, (X) and NOT K+_2!!! DHistogramAction_MissingMass(const DReaction* locReaction, int locMissingMassOffOfStepIndex, deque locMissingMassOffOfPIDs, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMass, double locMaxMass, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingMass", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumMassBins(locNumMassBins), dMinMass(locMinMass), dMaxMass(locMaxMass), dMissingMassOffOfStepIndex(locMissingMassOffOfStepIndex), dMissingMassOffOfPIDs(locMissingMassOffOfPIDs) { dAnalysisUtilities = NULL; } DHistogramAction_MissingMass(const DReaction* locReaction, int locMissingMassOffOfStepIndex, Particle_t locMissingMassOffOfPID, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMass, double locMaxMass, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingMass", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumMassBins(locNumMassBins), dMinMass(locMinMass), dMaxMass(locMaxMass), dMissingMassOffOfStepIndex(locMissingMassOffOfStepIndex), dMissingMassOffOfPIDs(deque(1, locMissingMassOffOfPID)) { dAnalysisUtilities = NULL; } bool dEnableDoubleCounting; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); unsigned int dNumMassBins; double dMinMass, dMaxMass; int dMissingMassOffOfStepIndex; deque dMissingMassOffOfPIDs; TH1I* dHist_MissingMass; const DAnalysisUtilities* dAnalysisUtilities; set > > dPreviousSourceObjects; }; class DHistogramAction_MissingMassSquared : public DAnalysisAction { public: DHistogramAction_MissingMassSquared(const DReaction* locReaction, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMassSq, double locMaxMassSq, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingMassSquared", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumMassBins(locNumMassBins), dMinMassSq(locMinMassSq), dMaxMassSq(locMaxMassSq), dMissingMassOffOfStepIndex(-1) { dAnalysisUtilities = NULL; } //E.g. If: //g, p -> K+, K+, Xi- // Xi- -> pi-, Lambda // Lambda -> (p), pi- //And: //locMissingMassOffOfStepIndex = 0, locMissingMassOffOfPIDs = K+, K+ //Then: Will histogram missing-mass: g, p -> K+, K+, (X) //Also: //locMissingMassOffOfStepIndex = 1, locMissingMassOffOfPID = pi- //Then: Will histogram missing-mass: g, p -> K+, K+, pi- //But: //locMissingMassOffOfStepIndex = 0, locMissingMassOffOfPIDs = K+ //Then: Will histogram only missing-mass: g, p -> K+_1, (X) and NOT K+_2!!! DHistogramAction_MissingMassSquared(const DReaction* locReaction, int locMissingMassOffOfStepIndex, deque locMissingMassOffOfPIDs, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMassSq, double locMaxMassSq, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingMass", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumMassBins(locNumMassBins), dMinMassSq(locMinMassSq), dMaxMassSq(locMaxMassSq), dMissingMassOffOfStepIndex(locMissingMassOffOfStepIndex), dMissingMassOffOfPIDs(locMissingMassOffOfPIDs) { dAnalysisUtilities = NULL; } DHistogramAction_MissingMassSquared(const DReaction* locReaction, int locMissingMassOffOfStepIndex, Particle_t locMissingMassOffOfPID, bool locUseKinFitResultsFlag, unsigned int locNumMassBins, double locMinMassSq, double locMaxMassSq, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingMass", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumMassBins(locNumMassBins), dMinMassSq(locMinMassSq), dMaxMassSq(locMaxMassSq), dMissingMassOffOfStepIndex(locMissingMassOffOfStepIndex), dMissingMassOffOfPIDs(deque(1, locMissingMassOffOfPID)) { dAnalysisUtilities = NULL; } bool dEnableDoubleCounting; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); unsigned int dNumMassBins; double dMinMassSq, dMaxMassSq; int dMissingMassOffOfStepIndex; deque dMissingMassOffOfPIDs; TH1I* dHist_MissingMassSquared; const DAnalysisUtilities* dAnalysisUtilities; set > > dPreviousSourceObjects; }; class DHistogramAction_KinFitResults : public DAnalysisAction { public: DHistogramAction_KinFitResults(const DReaction* locReaction, double locPullHistConfidenceLevelCut, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_KinFitResults", true, locActionUniqueString), dNumConfidenceLevelBins(400), dNumPullBins(200), dMinPull(-4.0), dMaxPull(4.0), dPullHistConfidenceLevelCut(locPullHistConfidenceLevelCut) { dAnalysisUtilities = NULL; } unsigned int dNumConfidenceLevelBins, dNumPullBins; double dMinPull, dMaxPull; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); void Create_ParticlePulls(bool locIsBeamFlag, string locStepROOTName, Particle_t locPID, map& locParticlePulls, const string& locKinFitTypeString); double dPullHistConfidenceLevelCut; const DAnalysisUtilities* dAnalysisUtilities; TH1I* dHist_ConfidenceLevel; map, map > dHistMap_Pulls; //size_t is step index, 2nd is particle TH1I* dHist_RFTimePull; map dHistMap_BeamPulls; }; class DHistogramAction_MissingTransverseMomentum : public DAnalysisAction { public: DHistogramAction_MissingTransverseMomentum(const DReaction* locReaction, bool locUseKinFitResultsFlag, unsigned int locNumPtBins = 0, double locMinPt = 0, double locMaxPt = 1.0, string locActionUniqueString = "") : DAnalysisAction(locReaction, "Hist_MissingTransverseMomentum", locUseKinFitResultsFlag, locActionUniqueString), dEnableDoubleCounting(false), dNumPtBins(locNumPtBins), dMinPt(locMinPt), dMaxPt(locMaxPt) { dAnalysisUtilities = NULL; } bool dEnableDoubleCounting; void Initialize(JEventLoop* locEventLoop); private: bool Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo); unsigned int dNumPtBins; double dMinPt, dMaxPt; const DAnalysisUtilities* dAnalysisUtilities; TH1I* dHist_MissingTransverseMomentum; set > > dPreviousSourceObjects; }; #endif // _DHistogramActions_Reaction_