Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventSourceREST.h
Go to the documentation of this file.
1 //
2 // Author: Richard Jones June 29, 2012
3 //
4 // DEventSourceREST
5 //
6 /// Implements JEventSource for REST files
7 
8 #ifndef _JEVENT_SOURCEREST_H_
9 #define _JEVENT_SOURCEREST_H_
10 
11 #include <vector>
12 #include <string>
13 
14 #include <pthread.h>
15 
16 #include <JANA/JEventSource.h>
17 #include <JANA/jerror.h>
18 #include <JANA/JCalibration.h>
19 
20 #include "hddm_r.hpp"
21 
22 #include <PID/DMCReaction.h>
23 #include <PID/DBeamPhoton.h>
24 #include <PID/DDetectorMatches.h>
25 #include "TRACKING/DMCThrown.h"
27 #include <FCAL/DFCALShower.h>
29 #include <BCAL/DBCALShower.h>
31 #include <START_COUNTER/DSCHit.h>
32 #include <TOF/DTOFPoint.h>
33 #include <TRIGGER/DTrigger.h>
34 #include <DANA/DApplication.h>
35 #include <RF/DRFTime.h>
36 #include <DIRC/DDIRCPmtHit.h>
37 #include <DIRC/DDIRCTruthBarHit.h>
38 #include <PID/DParticleID.h>
39 #include <TAGGER/DTAGMGeometry.h>
40 #include <TAGGER/DTAGHGeometry.h>
41 #include "DResourcePool.h"
42 
43 #include <TMatrixF.h>
44 #include <DMatrix.h>
45 #include <TMath.h>
46 
47 class DEventSourceREST:public JEventSource
48 {
49  public:
50  DEventSourceREST(const char* source_name);
51  virtual ~DEventSourceREST();
52  virtual const char* className(void) {
54  }
55  static const char* static_className(void) {
56  return "DEventSourceREST";
57  }
58 
59  jerror_t GetEvent(JEvent &event);
60  void FreeEvent(JEvent &event);
61  jerror_t GetObjects(JEvent &event, JFactory_base *factory);
62 
63  jerror_t Extract_DMCReaction(hddm_r::HDDM *record,
64  JFactory<DMCReaction> *factory, JEventLoop* locEventLoop);
65  jerror_t Extract_DRFTime(hddm_r::HDDM *record,
66  JFactory<DRFTime> *factory, JEventLoop* locEventLoop);
67  jerror_t Extract_DBeamPhoton(hddm_r::HDDM *record,
68  JFactory<DBeamPhoton> *factory,
69  JEventLoop *eventLoop);
70  jerror_t Extract_DMCThrown(hddm_r::HDDM *record,
71  JFactory<DMCThrown> *factory);
72  jerror_t Extract_DSCHit(hddm_r::HDDM *record,
73  JFactory<DSCHit>* factory);
74  jerror_t Extract_DTOFPoint(hddm_r::HDDM *record,
75  JFactory<DTOFPoint>* factory);
76  jerror_t Extract_DFCALShower(hddm_r::HDDM *record,
77  JFactory<DFCALShower>* factory);
78  jerror_t Extract_DBCALShower(hddm_r::HDDM *record,
79  JFactory<DBCALShower>* factory);
80  jerror_t Extract_DTrackTimeBased(hddm_r::HDDM *record,
81  JFactory<DTrackTimeBased>* factory, JEventLoop* locEventLoop);
82  jerror_t Extract_DTrigger(hddm_r::HDDM *record,
83  JFactory<DTrigger>* factory);
84  jerror_t Extract_DDetectorMatches(JEventLoop* locEventLoop, hddm_r::HDDM *record,
85  JFactory<DDetectorMatches>* factory);
86 #if 0
87  jerror_t Extract_DRFTime(hddm_r::HDDM *record,
88  JFactory<DRFTime>* factory);
89 #endif
90  jerror_t Extract_DDIRCPmtHit(hddm_r::HDDM *record,
91  JFactory<DDIRCPmtHit>* factory, JEventLoop* locEventLoop);
92 
93  void Get7x7ErrorMatrix(double mass, const double vec[5], const TMatrixFSym* C5x5, TMatrixFSym* loc7x7ErrorMatrix);
94  private:
95  // Warning: Class JEventSource methods must be re-entrant, so do not
96  // store any data here that might change from event to event.
97 
98  uint32_t Convert_SignedIntToUnsigned(int32_t locSignedInt) const;
99 
102 
107  map<unsigned int, vector<vector<int>>> dDIRCChannelStatusMap; //unsigned int is run number
108 
111 
112  map<unsigned int, double> dTargetCenterZMap; //unsigned int is run number
113  map<unsigned int, double> dBeamBunchPeriodMap; //unsigned int is run number
114  static thread_local shared_ptr<DResourcePool<TMatrixFSym>> dResourcePool_TMatrixFSym;
115 
116  std::ifstream *ifs; // input hddm file ifstream
117  hddm_r::istream *fin; // provides hddm layer on top of ifstream
118 };
119 
120 #endif //_JEVENT_SOURCEREST_H_
jerror_t Extract_DTOFPoint(hddm_r::HDDM *record, JFactory< DTOFPoint > *factory)
virtual ~DEventSourceREST()
void FreeEvent(JEvent &event)
DEventSourceREST(const char *source_name)
static const char * static_className(void)
void Get7x7ErrorMatrix(double mass, const double vec[5], const TMatrixFSym *C5x5, TMatrixFSym *loc7x7ErrorMatrix)
uint32_t Convert_SignedIntToUnsigned(int32_t locSignedInt) const
jerror_t Extract_DBeamPhoton(hddm_r::HDDM *record, JFactory< DBeamPhoton > *factory, JEventLoop *eventLoop)
jerror_t GetObjects(JEvent &event, JFactory_base *factory)
virtual const char * className(void)
jerror_t Extract_DRFTime(hddm_r::HDDM *record, JFactory< DRFTime > *factory, JEventLoop *locEventLoop)
jerror_t Extract_DFCALShower(hddm_r::HDDM *record, JFactory< DFCALShower > *factory)
jerror_t Extract_DMCThrown(hddm_r::HDDM *record, JFactory< DMCThrown > *factory)
jerror_t Extract_DSCHit(hddm_r::HDDM *record, JFactory< DSCHit > *factory)
jerror_t Extract_DTrackTimeBased(hddm_r::HDDM *record, JFactory< DTrackTimeBased > *factory, JEventLoop *locEventLoop)
map< unsigned int, vector< vector< int > > > dDIRCChannelStatusMap
jerror_t Extract_DTrigger(hddm_r::HDDM *record, JFactory< DTrigger > *factory)
jerror_t Extract_DDIRCPmtHit(hddm_r::HDDM *record, JFactory< DDIRCPmtHit > *factory, JEventLoop *locEventLoop)
static thread_local shared_ptr< DResourcePool< TMatrixFSym > > dResourcePool_TMatrixFSym
jerror_t Extract_DMCReaction(hddm_r::HDDM *record, JFactory< DMCReaction > *factory, JEventLoop *locEventLoop)
jerror_t Extract_DBCALShower(hddm_r::HDDM *record, JFactory< DBCALShower > *factory)
map< unsigned int, double > dBeamBunchPeriodMap
jerror_t Extract_DDetectorMatches(JEventLoop *locEventLoop, hddm_r::HDDM *record, JFactory< DDetectorMatches > *factory)
hddm_r::istream * fin
jerror_t GetEvent(JEvent &event)
DBCALShower_factory_IU * dBCALShowerFactory
std::ifstream * ifs
map< unsigned int, double > dTargetCenterZMap
DFCALShower_factory * dFCALShowerFactory
Implements JEventSource for REST files.