Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventRFBunch_factory.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DEventRFBunch_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 _DEventRFBunch_factory_
9 #define _DEventRFBunch_factory_
10 
11 #include <iostream>
12 #include <iomanip>
13 #include <map>
14 #include <utility>
15 #include <deque>
16 #include <vector>
17 
18 #include <TMath.h>
19 
20 #include <JANA/JFactory.h>
21 
22 #include <DVector3.h>
23 #include <DMatrix.h>
24 
25 #include <PID/DDetectorMatches.h>
26 #include <PID/DParticleID.h>
27 #include <PID/DEventRFBunch.h>
28 #include <RF/DRFTime.h>
30 #include <START_COUNTER/DSCHit.h>
31 #include <BCAL/DBCALShower.h>
32 #include <TOF/DTOFPoint.h>
33 #include <PID/DBeamPhoton.h>
34 
35 #include <HDGEOMETRY/DGeometry.h>
36 #include <DANA/DApplication.h>
37 
38 using namespace std;
39 using namespace jana;
40 
41 class DEventRFBunch_factory : public jana::JFactory<DEventRFBunch>
42 {
43  public:
46 
47  bool Get_RFTimeGuess(JEventLoop* locEventLoop, double& locRFTimeGuess, double& locRFVariance, DetectorSystem_t& locTimeSource) const;
48 
49  private:
50 
51  void Select_GoodTracks(JEventLoop* locEventLoop, vector<const DTrackTimeBased*>& locSelectedTimeBasedTracks) const;
52  jerror_t Select_RFBunch(JEventLoop* locEventLoop, vector<const DTrackTimeBased*>& locTrackTimeBasedVector, const DRFTime* locRFTime);
53  int Conduct_Vote(JEventLoop* locEventLoop, double locRFTime, vector<pair<double, const JObject*> >& locTimes, bool locUsedTracksFlag, int& locHighestNumVotes);
54 
55  bool Find_TrackTimes_SCTOF(const DDetectorMatches* locDetectorMatches, const vector<const DTrackTimeBased*>& locTrackTimeBasedVector, vector<pair<double, const JObject*> >& locTimes) const;
56  bool Find_TrackTimes_All(const DDetectorMatches* locDetectorMatches, const vector<const DTrackTimeBased*>& locTrackTimeBasedVector, vector<pair<double, const JObject*> >& locTimes);
57  bool Find_NeutralTimes(JEventLoop* locEventLoop, vector<pair<double, const JObject*> >& locTimes);
58 
59  int Find_BestRFBunchShifts(double locRFHitTime, const vector<pair<double, const JObject*> >& locTimes, map<int, vector<const JObject*> >& locNumBeamBucketsShiftedMap, set<int>& locBestRFBunchShifts);
60 
61  bool Break_TieVote_BeamPhotons(vector<const DBeamPhoton*>& locBeamPhotons, double locRFTime, map<int, vector<const JObject*> >& locNumBeamBucketsShiftedMap, set<int>& locBestRFBunchShifts, int locHighestNumVotes);
62  int Break_TieVote_Tracks(map<int, vector<const JObject*> >& locNumBeamBucketsShiftedMap, set<int>& locBestRFBunchShifts);
63  int Break_TieVote_Neutrals(map<int, vector<const JObject*> >& locNumBeamBucketsShiftedMap, set<int>& locBestRFBunchShifts);
64 
65  jerror_t Select_RFBunch_NoRFTime(JEventLoop* locEventLoop, vector<const DTrackTimeBased*>& locTrackTimeBasedVector);
66 
67  void Get_RFTimeGuess(vector<pair<double, const JObject*> >& locTimes, double& locRFTimeGuess, double& locRFVariance) const;
68 
69  jerror_t Create_NaNRFBunch(void);
70 
72 
75 
77 
78  string OVERRIDE_TAG;
79 
80  jerror_t init(void); ///< Called once at program start.
81  jerror_t brun(jana::JEventLoop *locEventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
82  jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber); ///< Called every event.
83  jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called.
84  jerror_t fini(void); ///< Called after last event of last event source has been processed.
85 };
86 
87 #endif // _DEventRFBunch_factory_
88 
const DParticleID * dParticleID
TVector3 DVector3
Definition: DVector3.h:14
DetectorSystem_t
Definition: GlueX.h:15