#ifndef _DKinFitResults_factory_ #define _DKinFitResults_factory_ #include #include #include #include "JANA/JFactory.h" #include "JANA/JEventLoop.h" #include "HDGEOMETRY/DMagneticFieldMap.h" #include "PID/DChargedTrackHypothesis.h" #include "PID/DChargedTrack.h" #include "PID/DNeutralShower.h" #include "PID/DKinematicData.h" #include "PID/DBeamPhoton.h" #include "ANALYSIS/DParticleCombo.h" #include "ANALYSIS/DKinFitResults.h" #include "ANALYSIS/DAnalysisUtilities.h" #include "ANALYSIS/DKinFitter_GlueX.h" #include "ANALYSIS/DAnalysisResults.h" using namespace std; using namespace jana; class DKinFitResults_factory : public jana::JFactory { public: DKinFitResults_factory(){}; ~DKinFitResults_factory(){}; void Reset_NewEvent(void); private: jerror_t init(void); ///< Called once at program start. jerror_t brun(jana::JEventLoop* locEventLoop, int runnumber); ///< Called everytime a new run number is detected. jerror_t evnt(jana::JEventLoop* locEventLoop, int eventnumber); ///< Called every event. jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called. jerror_t fini(void); ///< Called after last event of last event source has been processed. bool Setup_KinFit(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo, map > >& locDecayingKinFitParticles); void Setup_P4Constraint(const DParticleCombo* locParticleCombo, size_t locStepIndex, const deque >& locInitialKinFitParticles, const deque >& locFinalKinFitParticles, deque& locInitialKinFitParticles_P4, deque& locFinalKinFitParticles_P4, deque& locIncludedStepIndices); void Setup_VertexConstraint(const DParticleCombo* locParticleCombo, size_t locStepIndex, const deque >& locInitialKinFitParticles, const deque >& locFinalKinFitParticles, deque& locInitialKinFitParticles_Vertex, deque& locFinalKinFitParticles_Vertex, deque& locIncludedStepIndices); bool Find_ConstrainableParticles(deque >& locConstrainableParticles, const deque& locConstrainedParticles, const deque >& locInitialKinFitParticles_P4s, const deque >& locFinalKinFitParticles_P4s, const deque& locConstraintsSetIndices); void Calc_P4Guess(pair& locConstrainableParticle, const deque >& locInitialKinFitParticles_P4s, const deque >& locFinalKinFitParticles_P4s, TVector3& locMomentum); bool Calc_VertexGuess(JEventLoop* locEventLoop, const deque& locInitialKinFitParticles, const deque& locFinalKinFitParticles, TVector3& locVertexGuess, deque& locFinalKinFitParticles_Vertex_Updated, int locVertexFindFlag, const map& locP4GuessMap, map& locDecayingParticleTrackPointGuesses); double Calc_TimeGuess(const deque& locFinalKinFitParticles, DVector3 locVertexGuess, bool locUseRFTimeFlag, double locRFTime); void Remove_BadVertexConstraints(deque >& locInitialKinFitParticles_Vertices, deque >& locFinalKinFitParticles_Vertices) const; void Build_KinFitResults(const DParticleCombo* locParticleCombo, const map > >& locInitDecayingKinFitParticles); const DAnalysisUtilities* dAnalysisUtilities; DKinFitter_GlueX dKinFitter; unsigned int dDebugLevel; unsigned int dKinFitDebugLevel; bool dLinkVerticesFlag; }; #endif // _DKinFitResults_factory_