Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DNeutralParticleHypothesis_factory.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DNeutralParticleHypothesis_factory.h
4 // Created: Tue Aug 9 14:29:24 EST 2011
5 // Creator: pmatt (on Linux ifarml6 2.6.18-128.el5 x86_64)
6 //
7 
8 #ifndef _DNeutralParticleHypothesis_factory_
9 #define _DNeutralParticleHypothesis_factory_
10 
11 #include <limits>
12 
13 #include <TMath.h>
14 #include <TMatrixFSym.h>
15 
16 #include <JANA/JFactory.h>
17 #include <DANA/DApplication.h>
18 #include <HDGEOMETRY/DGeometry.h>
20 #include <PID/DNeutralShower.h>
21 #include <PID/DEventRFBunch.h>
22 #include <PID/DParticleID.h>
23 #include "PID/DVertex.h"
24 #include "DResourcePool.h"
25 #include <DVector3.h>
26 #include <DMatrix.h>
27 
28 class DNeutralParticleHypothesis_factory : public jana::JFactory<DNeutralParticleHypothesis>
29 {
30  public:
31  DNeutralParticleHypothesis* Create_DNeutralParticleHypothesis(const DNeutralShower* locNeutralShower, Particle_t locPID, const DEventRFBunch* locEventRFBunch, const DLorentzVector& dSpacetimeVertex, const TMatrixFSym* locVertexCovMatrix);
32 
33  void Calc_ParticleCovariance_Photon(const DNeutralShower* locNeutralShower, const TMatrixFSym* locVertexCovMatrix, const DVector3& locMomentum, const DVector3& locPathVector, TMatrixFSym* locParticleCovariance) const;
34  void Calc_ParticleCovariance_Massive(const DNeutralShower* locNeutralShower, const TMatrixFSym* locVertexCovMatrix, double locMass, double locDeltaT, const DVector3& locMomentum, const DVector3& locPathVector, TMatrixFSym* locParticleCovariance) const;
35 
36  void Recycle_Hypotheses(vector<DNeutralParticleHypothesis*>& locHypos){dResourcePool_NeutralParticleHypothesis->Recycle(locHypos);}
37  void Recycle_Hypotheses(vector<const DNeutralParticleHypothesis*>& locHypos){dResourcePool_NeutralParticleHypothesis->Recycle(locHypos);}
39 
42  {
44  return locHypo;
45  }
46 
47  private:
49  double dMaxMassiveNeutralBeta = 0.99999;
50  const DParticleID* dParticleID = nullptr;
51 
52  //RESOURCE POOL
53  vector<DNeutralParticleHypothesis*> dCreated;
55  shared_ptr<DResourcePool<TMatrixFSym>> dResourcePool_TMatrixFSym;
56 
57  jerror_t init(void); ///< Called once at program start.
58  jerror_t brun(jana::JEventLoop *locEventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
59  jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber); ///< Called every event.
60  jerror_t fini(void)
61  {
62  for(auto locHypo : _data)
63  Recycle_Hypothesis(locHypo);
64  _data.clear();
66  return NOERROR;
67  }
68 };
69 
70 #endif // _DNeutralParticleHypothesis_factory_
71 
jerror_t brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
Called everytime a new run number is detected.
DNeutralParticleHypothesis * Create_DNeutralParticleHypothesis(const DNeutralShower *locNeutralShower, Particle_t locPID, const DEventRFBunch *locEventRFBunch, const DLorentzVector &dSpacetimeVertex, const TMatrixFSym *locVertexCovMatrix)
void Calc_ParticleCovariance_Photon(const DNeutralShower *locNeutralShower, const TMatrixFSym *locVertexCovMatrix, const DVector3 &locMomentum, const DVector3 &locPathVector, TMatrixFSym *locParticleCovariance) const
void Recycle_Hypotheses(vector< const DNeutralParticleHypothesis * > &locHypos)
TVector3 DVector3
Definition: DVector3.h:14
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
Called every event.
DResourcePool< DNeutralParticleHypothesis > * dResourcePool_NeutralParticleHypothesis
TLorentzVector DLorentzVector
jerror_t init(void)
Called once at program start.
DType * Get_Resource(void)
shared_ptr< DResourcePool< TMatrixFSym > > dResourcePool_TMatrixFSym
void Calc_ParticleCovariance_Massive(const DNeutralShower *locNeutralShower, const TMatrixFSym *locVertexCovMatrix, double locMass, double locDeltaT, const DVector3 &locMomentum, const DVector3 &locPathVector, TMatrixFSym *locParticleCovariance) const
DNeutralParticleHypothesis * Get_Resource(void)
size_t Get_NumObjectsAllThreads(void) const
void Recycle_Hypothesis(const DNeutralParticleHypothesis *locHypo)
vector< DNeutralParticleHypothesis * > dCreated
void Recycle_Hypotheses(vector< DNeutralParticleHypothesis * > &locHypos)
Particle_t
Definition: particleType.h:12
void Recycle(const DType *locResource)