CMS 3D CMS Logo

LmfSource.h
Go to the documentation of this file.
1 #ifndef SourceModule_H
2 #define SourceModule_H
3 
4 #include <vector>
5 #include <string>
6 #include <cinttypes>
7 #include <fstream>
8 
13 
15 private:
16  struct IndexRecord {
17  uint32_t orbit;
18  uint32_t filePos;
19  // bool operator<(const IndexRecord& i) const { return orbit < i.orbit; }
20  };
21 
22 public:
24  ~LmfSource() override {}
25 
26 private:
29  void produce(edm::Event& e) override;
30 
37  edm::EventAuxiliary::ExperimentType& eType) override;
38 
39  bool openFile(int iFile);
40 
41  bool readFileHeader();
42 
49  bool readEventWithinFile(bool doSkip);
50 
56 
57 private:
60  std::vector<std::string> fileNames_;
61 
64  int iFile_;
65 
69 
73 
77  int fedId_;
78 
81  std::vector<uint32_t> header_;
82 
83  static const unsigned fileHeaderSize;
84 
87  std::vector<uint32_t> fileHeader_;
88 
91  static const unsigned char minDataFormatVersion_;
92 
95  static const unsigned char maxDataFormatVersion_;
96 
100  bool filter() const;
101 
106  bool readEvent(bool doSkip = false);
107 
112  bool nextEventWithinFile();
113 
118  void checkFileNames();
119 
123  void readIndexTable();
124 
126  uint32_t lumiBlock_;
127  uint32_t runNum_;
128  uint32_t bx_;
129  uint32_t eventNum_;
130  uint32_t orbitNum_;
131 
132  unsigned char dataFormatVers_;
133 
134  std::ifstream in_;
135 
138  bool rcRead_;
139 
140  unsigned preScale_;
141 
144  uint32_t iEvent_;
145 
148  uint32_t iEventInFile_;
149 
150  uint32_t indexTablePos_;
151 
153 
154  int nFeds_;
155 
159  std::vector<IndexRecord> indexTable_;
160 
164  static const unsigned maxEvents_ = 1 << 20;
165 
169  static const unsigned maxEventSize_ = 1 << 20; //1MB. (full DCC event is 49kB)
170 
175 
180 
184 
188 
192 
193  std::ifstream fileList_;
194 
198 
202 };
203 #endif //SourceModule_H not defined
int iFile_
Definition: LmfSource.h:64
int nSecondsToSleep_
Definition: LmfSource.h:197
uint32_t orbitNum_
Definition: LmfSource.h:130
bool openFile(int iFile)
Definition: LmfSource.cc:129
std::ifstream in_
Definition: LmfSource.h:134
static const unsigned fileHeaderSize
Definition: LmfSource.h:83
uint32_t runNum_
Definition: LmfSource.h:127
bool filter() const
Definition: LmfSource.cc:428
bool readEventWithinFile(bool doSkip)
Definition: LmfSource.cc:258
uint32_t indexTablePos_
Definition: LmfSource.h:150
bool rcRead_
Definition: LmfSource.h:138
std::vector< uint32_t > header_
Definition: LmfSource.h:81
std::string fileListName_
Definition: LmfSource.h:183
void checkFileNames()
Definition: LmfSource.cc:442
uint32_t iEventInFile_
Definition: LmfSource.h:148
uint32_t iEvent_
Definition: LmfSource.h:144
~LmfSource() override
Definition: LmfSource.h:24
LmfSource(const edm::ParameterSet &pset, const edm::InputSourceDescription &isd)
Definition: LmfSource.cc:23
unsigned preScale_
Definition: LmfSource.h:140
int nFeds_
Definition: LmfSource.h:154
static const unsigned char minDataFormatVersion_
Definition: LmfSource.h:91
static const unsigned maxEvents_
Definition: LmfSource.h:164
uint32_t bx_
Definition: LmfSource.h:128
FEDRawDataCollection fedColl_
Definition: LmfSource.h:68
std::string inputDir_
Definition: LmfSource.h:187
int verbosity_
Definition: LmfSource.h:201
static const unsigned maxEventSize_
Definition: LmfSource.h:169
int calibTrig_
Definition: LmfSource.h:152
unsigned long long TimeValue_t
Definition: Timestamp.h:21
uint32_t lumiBlock_
Definition: LmfSource.h:126
bool setRunAndEventInfo(edm::EventID &id, edm::TimeValue_t &time, edm::EventAuxiliary::ExperimentType &eType) override
Definition: LmfSource.cc:222
void produce(edm::Event &e) override
Definition: LmfSource.cc:113
unsigned long long uint64_t
Definition: Time.h:13
unsigned char dataFormatVers_
Definition: LmfSource.h:132
int fedId_
Definition: LmfSource.h:77
bool watchFileList_
Definition: LmfSource.h:179
std::vector< IndexRecord > indexTable_
Definition: LmfSource.h:159
bool orderedRead_
Definition: LmfSource.h:174
void readIndexTable()
Definition: LmfSource.cc:462
std::ifstream fileList_
Definition: LmfSource.h:193
bool nextEventWithinFile()
Definition: LmfSource.cc:176
std::string currentFileName_
Definition: LmfSource.h:191
uint64_t timeStamp_
Definition: LmfSource.h:125
uint32_t eventNum_
Definition: LmfSource.h:129
bool readFileHeader()
Definition: LmfSource.cc:56
bool readEvent(bool doSkip=false)
Definition: LmfSource.cc:200
std::vector< uint32_t > fileHeader_
Definition: LmfSource.h:87
std::string toString(edm::TimeValue_t &t) const
Definition: LmfSource.cc:430
FEDRawData emptyFedBlock_
Definition: LmfSource.h:72
std::vector< std::string > fileNames_
Definition: LmfSource.h:60
static const unsigned char maxDataFormatVersion_
Definition: LmfSource.h:95