CMS 3D CMS Logo

DCCDataParser.h
Go to the documentation of this file.
1 /*----------------------------------------------------------*/
2 /* DCC DATA PARSER */
3 /* */
4 /* Author : N.Almeida (LIP) Date : 30/05/2004 */
5 /*----------------------------------------------------------*/
6 
7 #ifndef DCCTBDATAPARSER_HH
8 #define DCCTBDATAPARSER_HH
9 
10 #include <fstream> //STL
11 #include <iostream>
12 #include <string>
13 #include <vector>
14 #include <map>
15 
16 #include <cstdio> //C
17 
18 #include "ECALParserException.h" //DATA DECODER
19 #include "DCCEventBlock.h"
20 #include "DCCDataMapper.h"
21 
22 class DCCTBDataMapper;
23 class DCCTBEventBlock;
24 
26 public:
38  DCCTBDataParser(const std::vector<uint32_t> &parserParameters, bool parseInternalData = true, bool debug = true);
39 
43  void parseFile(std::string fileName, bool singleEvent = false);
44 
48  void parseBuffer(const uint32_t *buffer, uint32_t bufferSize, bool singleEvent = false);
49 
54 
59  std::pair<uint32_t, uint32_t> checkEventLength(const uint32_t *pointerToEvent,
60  uint32_t bytesToEnd,
61  bool singleEvent = false);
62 
66  std::vector<uint32_t> parserParameters();
67  uint32_t numbXtalSamples();
68  uint32_t numbTriggerSamples();
69  uint32_t numbTTs();
70  uint32_t numbSRF();
71  uint32_t dccId();
72  uint32_t srpId();
73  uint32_t tcc1Id();
74  uint32_t tcc2Id();
75  uint32_t tcc3Id();
76  uint32_t tcc4Id();
77 
81  void setParameters(const std::vector<uint32_t> &newParameters);
82 
86  uint32_t srpBlockSize();
87  uint32_t tccBlockSize();
88 
92  bool debug();
93 
97  std::vector<DCCTBEventBlock *> &dccEvents();
98 
102  std::map<std::string, uint32_t> &errorCounters();
103 
107  std::vector<std::pair<uint32_t, std::pair<const uint32_t *, uint32_t> > > events();
108 
112  void resetErrorCounters();
113 
117  std::string getDecString(uint32_t data);
118  std::string getHexString(uint32_t data);
119  std::string index(uint32_t position);
120  std::string getIndexedData(uint32_t indexed, uint32_t *pointer);
121 
125  const uint32_t *getBuffer() { return buffer_; }
126 
131 
133  EMPTYEVENTSIZE = 32 //bytes
134  };
135 
136 protected:
137  void computeBlockSizes();
138 
139  const uint32_t *buffer_; //data buffer
140  uint32_t bufferSize_; //buffer size
141 
142  uint32_t srpBlockSize_; //SR block size
143  uint32_t tccBlockSize_; //TCC block size
144 
145  uint32_t processedEvent_;
148 
149  std::vector<DCCTBEventBlock *> dccEvents_;
150 
151  // std::pair< errorMask, std::pair< pointer to event, event size (number of DW)> >
152  std::vector<std::pair<uint32_t, std::pair<const uint32_t *, uint32_t> > > events_;
153 
154  bool parseInternalData_; //parse internal data flag
155  bool debug_; //debug flag
156  std::map<std::string, uint32_t> errors_; //errors map
157  std::vector<uint32_t> parameters; //parameters vector
158 
160  EVENTLENGTHMASK = 0xFFFFFF,
161 
162  BOEBEGIN = 28, //begin of event (on 32 bit string starts at bit 28)
163  BOEMASK = 0xF, //mask is 4 bits (F)
164  BOE = 0x5, //B'0101'
165 
166  EOEBEGIN = 28, //end of event
167  EOEMASK = 0xF, //4 bits
168  EOE = 0xA //B'1010'
169  };
170 };
171 
173 
174 inline std::vector<uint32_t> DCCTBDataParser::parserParameters() { return parameters; }
175 inline uint32_t DCCTBDataParser::numbXtalSamples() { return parameters[0]; }
176 inline uint32_t DCCTBDataParser::numbTriggerSamples() { return parameters[1]; }
177 inline uint32_t DCCTBDataParser::numbTTs() { return parameters[2]; }
178 inline uint32_t DCCTBDataParser::numbSRF() { return parameters[3]; }
179 inline uint32_t DCCTBDataParser::dccId() { return parameters[4]; }
180 inline uint32_t DCCTBDataParser::srpId() { return parameters[5]; }
181 inline uint32_t DCCTBDataParser::tcc1Id() { return parameters[6]; }
182 inline uint32_t DCCTBDataParser::tcc2Id() { return parameters[7]; }
183 inline uint32_t DCCTBDataParser::tcc3Id() { return parameters[8]; }
184 inline uint32_t DCCTBDataParser::tcc4Id() { return parameters[9]; }
185 
186 inline void DCCTBDataParser::setParameters(const std::vector<uint32_t> &newParameters) {
187  parameters = newParameters;
189 }
190 
191 inline uint32_t DCCTBDataParser::srpBlockSize() { return srpBlockSize_; }
192 inline uint32_t DCCTBDataParser::tccBlockSize() { return tccBlockSize_; }
193 
194 inline bool DCCTBDataParser::debug() { return debug_; }
195 inline std::vector<DCCTBEventBlock *> &DCCTBDataParser::dccEvents() { return dccEvents_; }
196 inline std::map<std::string, uint32_t> &DCCTBDataParser::errorCounters() { return errors_; }
197 inline std::vector<std::pair<uint32_t, std::pair<const uint32_t *, uint32_t> > > DCCTBDataParser::events() {
198  return events_;
199 }
200 
201 #endif
DCCTBDataParser::parserParameters
std::vector< uint32_t > parserParameters()
Definition: DCCDataParser.h:174
DCCTBDataParser::tccBlockSize_
uint32_t tccBlockSize_
Definition: DCCDataParser.h:143
DCCTBDataParser::srpBlockSize
uint32_t srpBlockSize()
Definition: DCCDataParser.h:191
DCCTBDataParser::events
std::vector< std::pair< uint32_t, std::pair< const uint32_t *, uint32_t > > > events()
Definition: DCCDataParser.h:197
DCCTBDataParser::numbSRF
uint32_t numbSRF()
Definition: DCCDataParser.h:178
DCCTBDataParser::dccId
uint32_t dccId()
Definition: DCCDataParser.h:179
DCCTBEventBlock
Definition: DCCEventBlock.h:16
DCCTBDataParser::EVENTLENGTHMASK
Definition: DCCDataParser.h:160
DCCTBDataParser::parseInternalData_
bool parseInternalData_
Definition: DCCDataParser.h:154
DCCTBDataParser::processedEvent_
uint32_t processedEvent_
Definition: DCCDataParser.h:145
DCCTBDataParser::parseFile
void parseFile(std::string fileName, bool singleEvent=false)
Definition: DCCDataParser.cc:57
DCCTBDataParser::EMPTYEVENTSIZE
Definition: DCCDataParser.h:133
DCCTBDataParser::EOEMASK
Definition: DCCDataParser.h:167
DCCTBDataParser::buffer_
const uint32_t * buffer_
Definition: DCCDataParser.h:139
DCCTBDataParser::tcc4Id
uint32_t tcc4Id()
Definition: DCCDataParser.h:184
DCCTBDataParser::DCCDataParserGlobalFields
DCCDataParserGlobalFields
Definition: DCCDataParser.h:132
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
DCCTBDataParser::debug_
bool debug_
Definition: DCCDataParser.h:155
DCCTBDataParser::debug
bool debug()
Definition: DCCDataParser.h:194
DCCTBDataParser::errors_
std::map< std::string, uint32_t > errors_
Definition: DCCDataParser.h:156
DCCTBDataParser::getDecString
std::string getDecString(uint32_t data)
Definition: DCCDataParser.cc:290
DCCTBDataParser::events_
std::vector< std::pair< uint32_t, std::pair< const uint32_t *, uint32_t > > > events_
Definition: DCCDataParser.h:152
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
ECALParserException.h
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
DCCTBDataParser::tcc1Id
uint32_t tcc1Id()
Definition: DCCDataParser.h:181
DCCTBDataParser::getIndexedData
std::string getIndexedData(uint32_t indexed, uint32_t *pointer)
Definition: DCCDataParser.cc:313
DCCTBDataParser::EOE
Definition: DCCDataParser.h:168
DCCTBDataParser::bufferSize_
uint32_t bufferSize_
Definition: DCCDataParser.h:140
DCCTBDataParser::eventErrors_
std::string eventErrors_
Definition: DCCDataParser.h:146
DCCTBDataParser::dccEvents
std::vector< DCCTBEventBlock * > & dccEvents()
Definition: DCCDataParser.h:195
DCCTBDataParser::srpId
uint32_t srpId()
Definition: DCCDataParser.h:180
DCCDataMapper.h
DCCTBDataParser::srpBlockSize_
uint32_t srpBlockSize_
Definition: DCCDataParser.h:142
DCCTBDataParser::BOEBEGIN
Definition: DCCDataParser.h:162
DCCTBDataMapper
Definition: DCCDataMapper.h:86
DCCTBDataParser::dccEvents_
std::vector< DCCTBEventBlock * > dccEvents_
Definition: DCCDataParser.h:149
DCCTBDataParser::numbXtalSamples
uint32_t numbXtalSamples()
Definition: DCCDataParser.h:175
DCCTBDataParser::tcc2Id
uint32_t tcc2Id()
Definition: DCCDataParser.h:182
DCCTBDataParser::index
std::string index(uint32_t position)
Definition: DCCDataParser.cc:277
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DCCTBDataParser::errorCounters
std::map< std::string, uint32_t > & errorCounters()
Definition: DCCDataParser.h:196
DCCTBDataParser::mapper_
DCCTBDataMapper * mapper_
Definition: DCCDataParser.h:147
DCCTBDataParser::DCCTBDataParser
DCCTBDataParser(const std::vector< uint32_t > &parserParameters, bool parseInternalData=true, bool debug=true)
Definition: DCCDataParser.cc:7
DCCTBDataParser::resetErrorCounters
void resetErrorCounters()
Definition: DCCDataParser.cc:18
DCCTBDataParser::checkEventLength
std::pair< uint32_t, uint32_t > checkEventLength(const uint32_t *pointerToEvent, uint32_t bytesToEnd, bool singleEvent=false)
Definition: DCCDataParser.cc:206
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
DCCTBDataParser::BOE
Definition: DCCDataParser.h:164
DCCTBDataParser::EOEBEGIN
Definition: DCCDataParser.h:166
DCCTBDataParser::numbTTs
uint32_t numbTTs()
Definition: DCCDataParser.h:177
DCCTBDataParser::~DCCTBDataParser
~DCCTBDataParser()
Definition: DCCDataParser.cc:331
DCCTBDataParser::tcc3Id
uint32_t tcc3Id()
Definition: DCCDataParser.h:183
DCCTBDataParser::DCCTBDataParserFields
DCCTBDataParserFields
Definition: DCCDataParser.h:159
DCCTBDataParser::parameters
std::vector< uint32_t > parameters
Definition: DCCDataParser.h:157
DCCTBDataParser::computeBlockSizes
void computeBlockSizes()
Definition: DCCDataParser.cc:29
DCCTBDataParser::tccBlockSize
uint32_t tccBlockSize()
Definition: DCCDataParser.h:192
DCCTBDataParser::getBuffer
const uint32_t * getBuffer()
Definition: DCCDataParser.h:125
DCCTBDataParser::parseBuffer
void parseBuffer(const uint32_t *buffer, uint32_t bufferSize, bool singleEvent=false)
Definition: DCCDataParser.cc:104
DCCTBDataParser::numbTriggerSamples
uint32_t numbTriggerSamples()
Definition: DCCDataParser.h:176
DCCTBDataParser::setParameters
void setParameters(const std::vector< uint32_t > &newParameters)
Definition: DCCDataParser.h:186
DCCTBDataParser::mapper
DCCTBDataMapper * mapper()
Definition: DCCDataParser.h:172
DCCTBDataParser
Definition: DCCDataParser.h:25
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DCCEventBlock.h
DCCTBDataParser::BOEMASK
Definition: DCCDataParser.h:163
DCCTBDataParser::getHexString
std::string getHexString(uint32_t data)
Definition: DCCDataParser.cc:302