Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventWriterHDDM.h
Go to the documentation of this file.
1 #ifndef _DEventWriterHDDM_
2 #define _DEventWriterHDDM_
3 
4 #include <fstream>
5 #include <iostream>
6 #include <iomanip>
7 #include <vector>
8 //#include <JANA/JEventProcessor.h>
9 #include <HDDM/hddm_s.hpp>
10 
11 #include <CDC/DCDCHit.h>
12 #include <TOF/DTOFHit.h>
13 #include <FCAL/DFCALHit.h>
14 #include <BCAL/DBCALDigiHit.h>
15 #include <BCAL/DBCALTDCDigiHit.h>
16 #include <START_COUNTER/DSCHit.h>
17 #include <FDC/DFDCHit.h>
20 #include <TAGGER/DTAGHHit.h>
21 #include <TAGGER/DTAGMHit.h>
22 #include <TPOL/DTPOLHit.h>
23 #include <RF/DRFTime.h>
24 #include <DIRC/DDIRCPmtHit.h>
25 using namespace std;
26 using namespace jana;
27 
28 class DEventWriterHDDM : public JObject
29 {
30  public:
31  JOBJECT_PUBLIC(DEventWriterHDDM);
32 
33  DEventWriterHDDM(JEventLoop* locEventLoop, string locOutputFileBaseName);
34  ~DEventWriterHDDM(void);
35 
36  bool Write_HDDMEvent(JEventLoop* locEventLoop, string locOutputFileNameSubString) const;
37  string Get_OutputFileName(string locOutputFileNameSubString) const;
38 
39  private:
40  bool Write_HDDMEvent(string locOutputFileName, hddm_s::HDDM& locRecord) const;
41 
42  //contains static variables shared amongst threads
43  int& Get_NumEventWriterThreads(void) const; //acquire HDDMWriter lock before modifying
44  map<string, pair<ofstream*, hddm_s::ostream*> >& Get_HDDMOutputFilePointers(void) const;
45 
46  int32_t Convert_UnsignedIntToSigned(uint32_t locUnsignedInt) const;
47 
51 
52  // metadata to save in the HDDM file
53  // these should be consistent during program execution
56 
57  // Information for optional tags
58  string CDC_TAG;
59  string FDC_TAG;
60  string TAGM_TAG;
61  string TAGH_TAG;
62 };
63 
64 #endif //_DEventWriterHDDM_
string HDDM_DATA_VERSION_STRING