Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventWriterEVIO.h
Go to the documentation of this file.
1 
2 #ifndef _DEventWriterEVIO_
3 #define _DEventWriterEVIO_
4 
5 #include <map>
6 #include <vector>
7 #include <string>
8 
9 #include <JANA/JObject.h>
10 #include <JANA/JEventLoop.h>
11 #include <JANA/JApplication.h>
12 
13 #include <DAQ/JEventSource_EVIO.h>
15 
16 #include <pthread.h>
17 #include <stdint.h>
18 #include <fstream>
19 
20 #include <JANA/JEventLoop.h>
21 
22 #include <DAQ/Df250PulseIntegral.h>
23 #include <DAQ/Df250TriggerTime.h>
24 #include <DAQ/Df250WindowRawData.h>
25 #include <DAQ/Df125PulseIntegral.h>
26 #include <DAQ/Df125TriggerTime.h>
27 #include <DAQ/Df125WindowRawData.h>
28 #include <DAQ/Df125CDCPulse.h>
29 #include <DAQ/Df125FDCPulse.h>
30 #include <DAQ/Df125Config.h>
31 #include <DAQ/DF1TDCTriggerTime.h>
32 #include <DAQ/DF1TDCHit.h>
33 #include <DAQ/DF1TDCConfig.h>
34 #include <DAQ/DCAEN1290TDCConfig.h>
35 #include <DAQ/DCAEN1290TDCHit.h>
36 #include <DAQ/DEPICSvalue.h>
37 #include <DAQ/DEventTag.h>
38 
39 #include <DANA/DStatusBits.h>
40 #include <TTAB/DTranslationTable.h>
41 
42 #include "HDEVIOWriter.h"
43 #include "DEVIOBufferWriter.h"
44 
45 using namespace std;
46 using namespace jana;
47 
48 class DEventWriterEVIO : public JObject
49 {
50  public:
51  JOBJECT_PUBLIC(DEventWriterEVIO);
52 
53  DEventWriterEVIO(JEventLoop* locEventLoop);
54  ~DEventWriterEVIO(void);
55 
56  bool Write_EVIOEvent(JEventLoop* locEventLoop, string locOutputFileNameSubString) const;
57  bool Write_EVIOEvent(JEventLoop* locEventLoop, string locOutputFileNameSubString,
58  vector<const JObject *> &locObjectsToSave) const;
59  bool Write_EVIOBuffer(JEventLoop* locEventLoop, vector<uint32_t> *locOutputBuffer, string locOutputFileNameSubString) const;
60  bool Write_EVIOBuffer(JEventLoop* locEventLoop, uint32_t *locOutputBuffer, uint32_t locOutputBufferSize, string locOutputFileNameSubString) const;
61 
62  string Get_OutputFileName(JEventLoop* locEventLoop, string locOutputFileNameSubString) const;
63  void SetDetectorsToWriteOut(string detector_list, string locOutputFileNameSubString) const;
64 
65  bool Is_MergingFiles() const { return dMergeFiles; }
66  void Set_MergeFiles(bool in_flag) { dMergeFiles = in_flag; }
67  string Get_MergedFilename() const { return dMergedFilename; }
68  void Set_MergedFilename(string in_filename) { dMergedFilename = in_filename; }
69 
70  bool COMPACT;
73 
74  protected:
75  bool Open_OutputFile(JEventLoop* locEventLoop, string locOutputFileName) const;
76 
77  std::ofstream *ofs_debug_input;
78  std::ofstream *ofs_debug_output;
79 
80  // the Translation Table is needed to get the mapping of detector type to ROC number
82 
85 
86  private:
87 
88  //contain static variables shared amongst threads: acquire "EVIOWriter" write lock before calling
89  size_t& Get_NumEVIOOutputThreads(void) const;
90  map<string, HDEVIOWriter*>& Get_EVIOOutputters(void) const;
91  map<string, pthread_t>& Get_EVIOOutputThreads(void) const;
92  map<string, DEVIOBufferWriter*>& Get_EVIOBufferWriters(void) const;
93 };
94 
95 #endif //_DEventWriterEVIO_
96 
std::ofstream * ofs_debug_input
bool Is_MergingFiles() const
void Set_MergedFilename(string in_filename)
void Set_MergeFiles(bool in_flag)
std::ofstream * ofs_debug_output
const DTranslationTable * ttab
string Get_MergedFilename() const