CMS 3D CMS Logo

PackerHelp.h
Go to the documentation of this file.
1 #ifndef EventFilter_HcalRawToDigi_PackerHelp_h
2 #define EventFilter_HcalRawToDigi_PackerHelp_h
3 
11 
12 #include <iostream>
13 #include <cstdio>
14 #include <vector>
15 #include <map>
16 #include <cmath>
17 
18 namespace CDFHeaderSpec{
19  static const int OFFSET_H = 0;
20  static const int MASK_H = 0x8;
21  static const int OFFSET_FOV = 4;
22  static const int MASK_FOV = 0xF;
23  static const int OFFSET_SOURCE_ID = 8;
24  static const int MASK_SOURCE_ID = 0xFFF;
25  static const int OFFSET_BX_ID = 20;
26  static const int MASK_BX_ID = 0xFFF;
27  static const uint64_t OFFSET_LV1_ID = 32;
28  static const int MASK_LV1_ID = 0xFFFFFF;
29  static const int OFFSET_EVT_TY = 56;
30  static const int MASK_EVT_TY = 0xF;
31  static const int OFFSET_FIXED_MSB = 60;
32  static const int MASK_FIXED_MSB = 0xF;
33  static const uint64_t FIXED_MSB = 0x5;
34 }
35 
36 namespace AMC13HeaderSpec{
37  static const int OFFSET_FIXED_LSB = 0;
38  static const int MASK_FIXED_LSB = 0xF;
39  static const int FIXED_LSB = 0x0;
40  static const int OFFSET_ORN = 4;
41  static const int MASK_ORN = 0xFFFFFFFF;
42  static const int OFFSET_RESERVED = 36;
43  static const int MASK_RESERVED = 0xFFFF;
44  static const int OFFSET_NAMC = 52;
45  static const int MASK_NAMC = 0xF;
46  static const int OFFSET_RES = 56;
47  static const int MASK_RES = 0xF;
48  static const int OFFSET_UFOV = 60;
49  static const int MASK_UFOV = 0xF;
50 }
51 
52 namespace AMCHeaderSpec{
53  static const int OFFSET_CRATE_ID = 0;
54  static const int MASK_CRATE_ID = 0xFF;
55  static const int OFFSET_SLOT_ID = 8;
56  static const int MASK_SLOT_ID = 0xF;
57  static const int OFFSET_PRESAMPLES = 12;
58  static const int MASK_PRESAMPLES = 0xF;
59  static const int OFFSET_AMC_NO = 16;
60  static const int MASK_AMC_NO = 0xF;
61  static const int OFFSET_BLK_NO = 20;
62  static const int MASK_BLK_NO = 0xFF;
63  static const int OFFSET_FIXED = 28;
64  static const int MASK_FIXED = 0xF;
65  static const int OFFSET_AMCN_SIZE = 32;
66  static const int MASK_AMCN_SIZE = 0xFFFFFF;
67  static const int OFFSET_C = 56;
68  static const int MASK_C = 0x1;
69  static const int OFFSET_V = 57;
70  static const int MASK_V = 0x1;
71  static const int OFFSET_P = 58;
72  static const int MASK_P = 0x1;
73  static const int OFFSET_E = 59;
74  static const int MASK_E = 0x1;
75  static const int OFFSET_S = 60;
76  static const int MASK_S = 0x1;
77  static const int OFFSET_M = 61;
78  static const int MASK_M = 0x1;
79  static const int OFFSET_L = 62;
80  static const int MASK_L = 0x1;
81 }
82 
83 namespace QIE8HeaderSpec{
84  static const int OFFSET_FIBERCHAN = 0;
85  static const int MASK_FIBERCHAN = 0x3;
86  static const int OFFSET_FIBER = 2;
87  static const int MASK_FIBER = 0x1F;
88  static const int OFFSET_CAPID = 8;
89  static const int MASK_CAPID = 0x3;
90  static const int OFFSET_FIBERERR = 10;
91  static const int MASK_FIBERERR = 0x3;
92  static const int OFFSET_FLAVOR = 12;
93  static const int MASK_FLAVOR = 0x7;
94  static const int OFFSET_HEADER_BIT = 15;
95  static const int MASK_HEADER_BIT = 0x1;
96 }
97 
98 namespace QIE10HeaderSpec{
99  static const int OFFSET_FIBERCHAN = 0;
100  static const int MASK_FIBERCHAN = 0x7;
101  static const int OFFSET_FIBER = 3;
102  static const int MASK_FIBER = 0x1F;
103  static const int OFFSET_MP = 8; // mark-and-pass
104  static const int MASK_MP = 0x1;
105  static const int OFFSET_RESERV = 9; // reserved
106  static const int MASK_RESERV = 0x3;
107  static const int OFFSET_LE = 11; // link error
108  static const int MASK_LE = 0x1;
109  static const int OFFSET_FLAVOR = 12;
110  static const int MASK_FLAVOR = 0x7;
111  static const int OFFSET_HEADER_BIT = 15;
112  static const int MASK_HEADER_BIT = 0x1;
113 }
114 
115 namespace QIE11HeaderSpec{
116  static const int OFFSET_FIBERCHAN = 0;
117  static const int MASK_FIBERCHAN = 0x7;
118  static const int OFFSET_FIBER = 3;
119  static const int MASK_FIBER = 0x1F;
120  static const int OFFSET_CAPID = 8;
121  static const int MASK_CAPID = 0x3;
122  static const int OFFSET_FIBERERR = 10;
123  static const int MASK_FIBERERR = 0x3;
124  static const int OFFSET_FLAVOR = 12;
125  static const int MASK_FLAVOR = 0x7;
126  static const int OFFSET_HEADER_BIT = 15;
127  static const int MASK_HEADER_BIT = 0x1;
128 }
129 
130 namespace TPHeaderSpec{
131  static const int OFFSET_TOWER = 0;
132  static const int MASK_TOWER = 0xF;
133  static const int OFFSET_LINK = 4;
134  static const int MASK_LINK = 0xF;
135  static const int OFFSET_CHANID = 0;
136  static const int MASK_CHANID = 0xFF;
137  static const int OFFSET_RESV = 8;
138  static const int MASK_RESV = 0x3;
139  static const int OFFSET_TPERR = 10;
140  static const int MASK_TPERR = 0x3;
141  static const int OFFSET_FLAVOR = 12;
142  static const int MASK_FLAVOR = 0x7;
143  static const int OFFSET_HEADER_BIT = 15;
144  static const int MASK_HEADER_BIT = 0x1;
145 }
146 
147 class HCalFED{
148 
149 public:
150 
151  typedef std::vector<uint16_t> uhtrData;
152 
153  std::vector<unsigned char> fedData;
154  std::vector<uint64_t> AMCHeaders;
155  std::vector<uhtrData> uhtrs;
156  int fedId;
157  uint64_t AMC13Header,cdfHeader;
162 
163  unsigned char cdfh[8];
165 
166  HCalFED(int fedId_ , uint64_t EventNum_ = 9999 , uint64_t OrbitNum_=999 , uint64_t BxNum_ = 99 ){
167  fedId = fedId_;
168  OrbitNum = OrbitNum_;
169  EventNum = EventNum_;
170  BxNum = BxNum_;
171  Crate = fedId - FEDNumbering::MINHCALuTCAFEDID;
172 
173  setCDFHeader();
174  setAMC13Header();
175 
176  };
177 
178  inline void split64bitTo8bit(std::vector<unsigned char> &outVec, const uint64_t &var64bit){
179  for(int is=0; is<8; is++){ // 64/8 = 8
180  outVec.push_back( (var64bit>> (is*8) ) & 0xFF);
181  }
182  }
183 
184  void setCDFHeader(){
185 
186  cdfHeader = 0 ;
189  cdfHeader |= ((fedId)&CDFHeaderSpec::MASK_SOURCE_ID)<<CDFHeaderSpec::OFFSET_SOURCE_ID; // needs to be configurable
190  cdfHeader |= (BxNum&CDFHeaderSpec::MASK_BX_ID)<<CDFHeaderSpec::OFFSET_BX_ID; // needs to be configurable
194 
195  }
196 
198 
199  AMC13Header = 0;
201  AMC13Header |= ((OrbitNum+1)&AMC13HeaderSpec::MASK_ORN)<<AMC13HeaderSpec::OFFSET_ORN;
206 
207  }
208 
209  void setNAMC(uint64_t NAMC){
211  }
212 
213  void addAMCHeader( uint64_t crate , uint64_t slot , uint64_t AMCsize , uint64_t presamples = 10 , uint64_t blockNum = 0 ){
214 
215  uint64_t header = 0 ;
219  header |= (slot&AMCHeaderSpec::MASK_AMC_NO)<<AMCHeaderSpec::OFFSET_AMC_NO ; // AMC no.
220  header |= (blockNum&AMCHeaderSpec::MASK_BLK_NO)<<AMCHeaderSpec::OFFSET_BLK_NO ; // Block No.
221  header |= (AMCsize&AMCHeaderSpec::MASK_AMCN_SIZE)<<AMCHeaderSpec::OFFSET_AMCN_SIZE ; // size
222  header |= uint64_t(0x1)<<AMCHeaderSpec::OFFSET_C ; // CRC is valid
223  header |= uint64_t(0x1)<<AMCHeaderSpec::OFFSET_V ; // EvN, BcN match
224  header |= uint64_t(0x1)<<AMCHeaderSpec::OFFSET_P ; // Present, header is only made if data is present
225  header |= uint64_t(0x1)<<AMCHeaderSpec::OFFSET_E ; // Enabled, header is only made if AMC is enabled
226  header |= uint64_t(0x0)<<AMCHeaderSpec::OFFSET_S ; // Segmented, always zero for unsegmented data
227  header |= uint64_t(0x0)<<AMCHeaderSpec::OFFSET_M ; // More data
228  header |= uint64_t(0x0)<<AMCHeaderSpec::OFFSET_L ; // Indicates length error
229 
230  AMCHeaders.push_back( header );
231 
232  }
233 
234  void addUHTR( uhtrData uhtr , uint64_t crate , uint64_t slot ){
235  // push uhtr data into FED container
236  uhtrs.push_back(uhtr);
237  // create the corresponding AMC header
238  addAMCHeader( crate , slot , uhtr.size()/4 );
239  };
240 
241  // does not include HEADER and TRAILER
242  void formatFEDdata(FEDRawData& rawData){
243 
244  //std::vector<unsigned char> output;
245  if( uhtrs.size() != AMCHeaders.size() ){
246  return;
247  }
248 
249  // put common data format header in fed container
250  split64bitTo8bit(fedData, cdfHeader);
251 
252  // set the number of AMCs in the AMC13 header
253  setNAMC(uhtrs.size());
254  // put the AMC13 header into the fed container
255  split64bitTo8bit(fedData, AMC13Header);
256 
257  // fill fedData with AMC headers
258  for( unsigned int iAMC = 0 ; iAMC < AMCHeaders.size() ; ++iAMC ){
259  // adjust the AMCsize bits to match uhtr header
260  //AMCHeaders[iAMC] |= uint64_t(uhtrs[iAMC][1]&0xF)<<51 ;
261  //AMCHeaders[iAMC] |= uint64_t(uhtrs[iAMC][0]&0xFFFF)<<47 ;
262  split64bitTo8bit(fedData, AMCHeaders[iAMC]);
263  }
264 
265  // fill fedData with AMC data
266  for( unsigned int iAMC = 0 ; iAMC<uhtrs.size() ; ++iAMC ){
267 
268  unsigned int nWords16 = uhtrs[iAMC].size();
269  for( unsigned int amcWord = 0 ; amcWord<nWords16 ; ++amcWord ){
270  fedData.push_back((uhtrs[iAMC][amcWord]>>0 )&0xFF); // split 16-bit words into 8-bit
271  fedData.push_back((uhtrs[iAMC][amcWord]>>8 )&0xFF);
272  }// end loop over uhtr words
273  }// end loop over uhtrs
274 
275  // fedData should be a integer number of 64 bit words
276  while( fedData.size()%8 != 0 )
277  fedData.push_back(0);
278 
279  // convert to the correct format
280  rawData.resize(fedData.size());
281  unsigned char* words = reinterpret_cast<unsigned char*>(rawData.data());
282 
283  for( unsigned int i = 0 ; i < fedData.size() ; ++i ){
284  *words = fedData[i];
285  words++;
286  }
287 
288  };
289 
290 };
291 
293 
294 public:
295 
296  typedef std::vector<uint16_t> uhtrData;
297  typedef std::map<int,uhtrData> UHTRMap; // the int here is intended to be the raw electronics ID
298 
299  UHTRMap uhtrs;
300 
301  // FIRST WORD
302  static const int OFFSET_DATA_LENGTH = 0;
303  static const int MASK_DATA_LENGTH = 0xFFFFF;
304  static const int OFFSET_BCN = 20;
305  static const int MASK_BCN = 0xFFF;
306  static const int OFFSET_EVN = 32;
307  static const int MASK_EVN = 0xFFFFFF;
308  static const int OFFSET_FILED_BY_AMC13 = 56;
309  static const int MASK_FILED_BY_AMC13 = 0xFF;
310  // SECOND WORD
311  static const int OFFSET_CRATE_ID = 0;
312  static const int MASK_CRATE_ID = 0xFFFFFF;
313  static const int OFFSET_SLOT_ID = 8;
314  static const int MASK_SLOT_ID = 0xF;
315  static const int OFFSET_PRESAMPLES = 12;
316  static const int MASK_PRESAMPLES = 0xF;
317  static const int OFFSET_ORN = 16;
318  static const int MASK_ORN = 0xFFFF;
319  static const int OFFSET_FW_FLAVOR = 32;
320  static const int MASK_FW_FLAVOR = 0xFF;
321  static const int OFFSET_EVENT_TYPE = 40;
322  static const int MASK_EVENT_TYPE = 0xF;
323  static const int OFFSET_PAYLOAD_FORMAT = 44;
324  static const int MASK_PAYLOAD_FORMAT = 0xF;
325  static const int OFFSET_FW_VERSION = 48;
326  static const int MASK_FW_VERSION = 0xFFFF;
327 
329 
330  bool exist( int uhtrIndex ){
331  return uhtrs.count(uhtrIndex) != 0 ;
332  };
333 
334  uint16_t packQIE8header(const HcalQIESample &qieSample, const HcalElectronicsId &eid){
335  uint16_t header =0;
336 
337  int fiber = eid.fiberIndex()+1;
338  int fiberchan = eid.fiberChanId();
339  int fiberErr = qieSample.er();
340  int capid0 = qieSample.capid();
341 
348 
349  return header;
350  }
351 
352  uint16_t packTPheader(const HcalTriggerPrimitiveSample &tpSample, int channelid){
353  uint16_t header =0;
354 
358  header |= (0x4 & TPHeaderSpec::MASK_FLAVOR)<<TPHeaderSpec::OFFSET_FLAVOR; //flavor
360 
361  return header;
362  }
363 
365  uint16_t header =0;
366 
367  int fiber = eid.fiberIndex();
368  int fiberchan = eid.fiberChanId();
369 
377 
378  return header;
379  }
380 
381  uint16_t packQIE11header(const QIE11DataFrame &qiedf, const HcalElectronicsId &eid){
382  uint16_t header =0;
383 
384  int fiber = eid.fiberIndex();
385  int fiberchan = eid.fiberChanId();
386  int capid0 = qiedf.samples() == 0? 0 : qiedf[0].capid(); // capacitor id for the first sample
387 
394 
395  return header;
396  }
397 
398  uhtrData* newUHTR( int uhtrIndex , int ps = 0, int orn = 0 , int bcn = 0 , uint64_t evt = 0 ){
399 
400  // initialize vector of 16-bit words
401  uhtrs[uhtrIndex] = uhtrData(8);
402  // build header -- some information will be updated at the end
403 
404  uint64_t presamples = std::max(ps,0);
405  uint64_t uhtrCrate = uhtrIndex&0xFF;
406  uint64_t uhtrSlot = (uhtrIndex&0xF00)>>8;
407 // From Jeremy:
408 // Set the firmware to zero, the firmware flavor to 0, the payload format to 1, and the event type to 1.
409  uint64_t fwFlavor = 0;
410  uint64_t eventType = 1;
411  uint64_t payloadFormat = 1;
412  uint64_t fwVersion = 0;
413 
414  uint64_t uhtrHeader1 = 0;
415  uhtrHeader1 |= (uint64_t(0x0)&MASK_DATA_LENGTH)<<OFFSET_DATA_LENGTH;
416  uhtrHeader1 |= (bcn&MASK_BCN)<<OFFSET_BCN;
417  uhtrHeader1 |= (evt&MASK_EVN)<<OFFSET_EVN;
418  uhtrHeader1 |= (uint64_t(0x0)&MASK_FILED_BY_AMC13)<<OFFSET_FILED_BY_AMC13;
419 
420  uint64_t uhtrHeader2 = 0;
421  uhtrHeader2 |= (uhtrCrate&MASK_CRATE_ID)<<OFFSET_CRATE_ID;
422  uhtrHeader2 |= (uhtrSlot&MASK_SLOT_ID)<<OFFSET_SLOT_ID;
423  uhtrHeader2 |= (presamples&MASK_PRESAMPLES)<<OFFSET_PRESAMPLES;
424  uhtrHeader2 |= (orn&MASK_ORN)<<OFFSET_ORN;
425  uhtrHeader2 |= (fwFlavor&MASK_FW_FLAVOR)<<OFFSET_FW_FLAVOR;
426  uhtrHeader2 |= (eventType&MASK_EVENT_TYPE)<<OFFSET_EVENT_TYPE;
427  uhtrHeader2 |= (payloadFormat&MASK_PAYLOAD_FORMAT)<<OFFSET_PAYLOAD_FORMAT;
428  uhtrHeader2 |= (fwVersion&MASK_FW_VERSION)<<OFFSET_FW_VERSION;
429 
430  // push header into vector of 16-bit words
431  for (unsigned int i = 0; i< 4; ++i){
432  uhtrs[uhtrIndex][i] = ( uhtrHeader1>>(i*16) )&0xFFFF ;
433  uhtrs[uhtrIndex][i+4] = ( uhtrHeader2>>(i*16) )&0xFFFF ;
434  }
435 
436  return &(uhtrs[uhtrIndex]);
437  };
438 
439  void finalizeHeadTail(uhtrData* uhtr , bool verbosity){
440 
441  uint64_t uhtr_size = uhtr->size()-8;
442 
443  // adjust the size bits
444  uhtr->at(0) = uhtr_size&0xFFFF ;
445  uhtr->at(1) |= (uhtr_size>>16)&0xF ;
446 
447  unsigned int toAdd = 4-uhtr->size()%4;
448  for(unsigned int ia=0; ia<toAdd; ia++){
449  uhtr->push_back(0xD07F);
450  }
451 
452  // add trailer
453  uhtr->push_back( uhtr_size&0xFFFF );
454  uhtr->push_back( (uhtr_size>>16)&0xF );
455  // this is ignoring the event number... I am not sure what this should be
456 
457  // adding some blank stuff for the CRC bits
458  uhtr->push_back( 0 );
459  uhtr->push_back( 0 );
460  };
461 
462  void addChannel( int uhtrIndex , edm::SortedCollection<HFDataFrame>::const_iterator& qiedf , const HcalElectronicsMap* readoutMap, int verbosity = 0 ){
463  if( qiedf->size() == 0 ) return;
464  DetId detid = qiedf->id();
465  HcalElectronicsId eid(readoutMap->lookup(detid));
466  uint16_t header = packQIE8header(qiedf->sample(0), eid);
467  uhtrs[uhtrIndex].push_back(header);
468  // loop over words in dataframe
469  for(int iTS = 0; iTS < qiedf->size(); iTS +=2 ){
470  uint16_t cont =0;
471  int adc0 = qiedf->sample(iTS).adc();
472  int adc1 = qiedf->sample(iTS+1).adc();
473  cont |= adc0&0xFF;
474  cont |= (adc1&0xFF)<<8;
475  uhtrs[uhtrIndex].push_back(cont);
476  }// end loop over dataframe words
477  };
478 
479  void addChannel( int uhtrIndex , edm::SortedCollection<HBHEDataFrame>::const_iterator qiedf , const HcalElectronicsMap* readoutMap, int verbosity = 0 ){
480  if( qiedf->size() == 0 ) return;
481  DetId detid = qiedf->id();
482  HcalElectronicsId eid(readoutMap->lookup(detid));
483  uint16_t header = packQIE8header(qiedf->sample(0), eid);
484  uhtrs[uhtrIndex].push_back(header);
485  // loop over words in dataframe
486  for(int iTS = 0; iTS < qiedf->size(); iTS +=2 ){
487  uint16_t cont =0;
488  int adc0 = qiedf->sample(iTS).adc();
489  int adc1 = qiedf->sample(iTS+1).adc();
490  cont |= adc0&0xFF;
491  cont |= (adc1&0xFF)<<8;
492  uhtrs[uhtrIndex].push_back(cont);
493  }// end loop over dataframe words
494  };
495 
496  void addChannel( int uhtrIndex , edm::SortedCollection<HcalTriggerPrimitiveDigi>::const_iterator qiedf, int channelid, int verbosity = 0 ){
497  if( qiedf->size() ==0 ) return;
498  uint16_t header = packTPheader(qiedf->sample(0), channelid);
499  uhtrs[uhtrIndex].push_back(header);
500  // loop over words in dataframe
501  for( int iTS = 0 ; iTS < qiedf->size() ; iTS++ ){
502  // push data into uhtr data container
503  uhtrs[uhtrIndex].push_back(qiedf->sample(iTS).raw());
504  }// end loop over dataframe words
505  };
506 
507  void addChannel( int uhtrIndex , QIE11DataFrame qiedf , const HcalElectronicsMap* readoutMap, int verbosity = 0 ){
508  DetId detid = qiedf.detid();
509  HcalElectronicsId eid(readoutMap->lookup(detid));
510  // loop over words in dataframe
511  for(edm::DataFrame::iterator dfi=qiedf.begin() ; dfi!=qiedf.end(); ++dfi){
512  if( dfi >= qiedf.end()-QIE11DataFrame::FLAG_WORDS ){
513  continue;
514  }
515  if( dfi == qiedf.begin() && QIE11DataFrame::HEADER_WORDS == 1 ){
516  uint16_t header = packQIE11header(qiedf, eid);
517  uhtrs[uhtrIndex].push_back(header);
518  continue;
519  }
520  // push data into uhtr data container
521  uhtrs[uhtrIndex].push_back(dfi[0]);
522  }// end loop over dataframe words
523  };
524 
525  void addChannel( int uhtrIndex , QIE10DataFrame qiedf , const HcalElectronicsMap* readoutMap, int verbosity = 0 ){
526  DetId detid = qiedf.detid();
527  HcalElectronicsId eid(readoutMap->lookup(detid));
528  // loop over words in dataframe
529  for(edm::DataFrame::iterator dfi=qiedf.begin() ; dfi!=qiedf.end(); ++dfi){
530  if( dfi >= qiedf.end()-QIE10DataFrame::FLAG_WORDS ){
531  continue;
532  }
533  if( dfi == qiedf.begin() && QIE10DataFrame::HEADER_WORDS == 1 ){
534  uint16_t header = packQIE10header(eid);
535  uhtrs[uhtrIndex].push_back(header);
536  continue;
537  }
538  // push data into uhtr data container
539  uhtrs[uhtrIndex].push_back(dfi[0]);
540  }// end loop over dataframe words
541  };
542 
543 };
544 
545 #endif
DetId detid() const
Get the detector id.
std::vector< uhtrData > uhtrs
Definition: PackerHelp.h:155
static const int OFFSET_TPERR
Definition: PackerHelp.h:139
static const int MASK_L
Definition: PackerHelp.h:80
void setCDFHeader()
Definition: PackerHelp.h:184
static const int MASK_CAPID
Definition: PackerHelp.h:121
static const int FLAG_WORDS
static const int MASK_FIBERERR
Definition: PackerHelp.h:123
static const int MASK_H
Definition: PackerHelp.h:20
static const int OFFSET_FLAVOR
Definition: PackerHelp.h:109
static const int MASK_BLK_NO
Definition: PackerHelp.h:62
edm::DataFrame::iterator begin()
iterators
int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
void addChannel(int uhtrIndex, QIE11DataFrame qiedf, const HcalElectronicsMap *readoutMap, int verbosity=0)
Definition: PackerHelp.h:507
static const int MASK_FIBER
Definition: PackerHelp.h:119
static const uint64_t OFFSET_LV1_ID
Definition: PackerHelp.h:27
static const int OFFSET_CRATE_ID
Definition: PackerHelp.h:53
static const int MASK_RESERVED
Definition: PackerHelp.h:43
static const int MASK_FOV
Definition: PackerHelp.h:22
std::vector< unsigned char > fedData
Definition: PackerHelp.h:153
void addUHTR(uhtrData uhtr, uint64_t crate, uint64_t slot)
Definition: PackerHelp.h:234
void finalizeHeadTail(uhtrData *uhtr, bool verbosity)
Definition: PackerHelp.h:439
static const int MASK_FIXED_MSB
Definition: PackerHelp.h:32
static const int MASK_SOURCE_ID
Definition: PackerHelp.h:24
uint64_t cdfHeader
Definition: PackerHelp.h:157
static const int MASK_HEADER_BIT
Definition: PackerHelp.h:95
static const int MASK_RESERV
Definition: PackerHelp.h:106
static const int MASK_FLAVOR
Definition: PackerHelp.h:125
void setNAMC(uint64_t NAMC)
Definition: PackerHelp.h:209
static const int OFFSET_BLK_NO
Definition: PackerHelp.h:61
std::map< int, uhtrData > UHTRMap
Definition: PackerHelp.h:297
static const int OFFSET_FIXED
Definition: PackerHelp.h:63
static const int HEADER_WORDS
static const int MASK_HEADER_BIT
Definition: PackerHelp.h:127
static const int FIXED_LSB
Definition: PackerHelp.h:39
static const int MASK_FIBER
Definition: PackerHelp.h:87
static const int OFFSET_SOURCE_ID
Definition: PackerHelp.h:23
static const int OFFSET_FLAVOR
Definition: PackerHelp.h:141
static const int MASK_TPERR
Definition: PackerHelp.h:140
uhtrData * newUHTR(int uhtrIndex, int ps=0, int orn=0, int bcn=0, uint64_t evt=0)
Definition: PackerHelp.h:398
static const int OFFSET_PRESAMPLES
Definition: PackerHelp.h:57
static const int OFFSET_CHANID
Definition: PackerHelp.h:135
std::vector< T >::const_iterator const_iterator
static const int OFFSET_FIBER
Definition: PackerHelp.h:118
static const int OFFSET_HEADER_BIT
Definition: PackerHelp.h:111
void push_back(T const &t)
static const int OFFSET_RESERVED
Definition: PackerHelp.h:42
static const int OFFSET_FOV
Definition: PackerHelp.h:21
uint64_t OrbitNum
Definition: PackerHelp.h:158
uint16_t packQIE8header(const HcalQIESample &qieSample, const HcalElectronicsId &eid)
Definition: PackerHelp.h:334
void addChannel(int uhtrIndex, edm::SortedCollection< HBHEDataFrame >::const_iterator qiedf, const HcalElectronicsMap *readoutMap, int verbosity=0)
Definition: PackerHelp.h:479
static const int MASK_MP
Definition: PackerHelp.h:104
static const int MASK_ORN
Definition: PackerHelp.h:41
static const int MASK_FIBER
Definition: PackerHelp.h:102
static const int MASK_FIBERCHAN
Definition: PackerHelp.h:100
void addAMCHeader(uint64_t crate, uint64_t slot, uint64_t AMCsize, uint64_t presamples=10, uint64_t blockNum=0)
Definition: PackerHelp.h:213
std::vector< uint16_t > uhtrData
Definition: PackerHelp.h:151
static const int OFFSET_CAPID
Definition: PackerHelp.h:120
static const int OFFSET_FIBER
Definition: PackerHelp.h:86
static const int MASK_CRATE_ID
Definition: PackerHelp.h:54
static const int MASK_FLAVOR
Definition: PackerHelp.h:142
void addChannel(int uhtrIndex, edm::SortedCollection< HFDataFrame >::const_iterator &qiedf, const HcalElectronicsMap *readoutMap, int verbosity=0)
Definition: PackerHelp.h:462
static const int OFFSET_RES
Definition: PackerHelp.h:46
static const int OFFSET_FIXED_MSB
Definition: PackerHelp.h:31
static const int MASK_PRESAMPLES
Definition: PackerHelp.h:58
static const int MASK_FIBERCHAN
Definition: PackerHelp.h:117
std::vector< uint64_t > AMCHeaders
Definition: PackerHelp.h:154
static const int MASK_M
Definition: PackerHelp.h:78
static const int OFFSET_M
Definition: PackerHelp.h:77
void addChannel(int uhtrIndex, edm::SortedCollection< HcalTriggerPrimitiveDigi >::const_iterator qiedf, int channelid, int verbosity=0)
Definition: PackerHelp.h:496
uint16_t packQIE11header(const QIE11DataFrame &qiedf, const HcalElectronicsId &eid)
Definition: PackerHelp.h:381
static const int MASK_LINK
Definition: PackerHelp.h:134
static const int OFFSET_C
Definition: PackerHelp.h:67
uint16_t packQIE10header(const HcalElectronicsId &eid)
Definition: PackerHelp.h:364
static const int MASK_FIBERERR
Definition: PackerHelp.h:91
int fedId
Definition: PackerHelp.h:156
static const int MASK_CHANID
Definition: PackerHelp.h:136
static const int OFFSET_FIXED_LSB
Definition: PackerHelp.h:37
static const int OFFSET_HEADER_BIT
Definition: PackerHelp.h:126
static const int MASK_V
Definition: PackerHelp.h:70
static const int MASK_FIXED
Definition: PackerHelp.h:64
void resize(size_t newsize)
Definition: FEDRawData.cc:32
static const int MASK_FIXED_LSB
Definition: PackerHelp.h:38
static const int OFFSET_E
Definition: PackerHelp.h:73
static const int MASK_FLAVOR
Definition: PackerHelp.h:93
static const int OFFSET_AMCN_SIZE
Definition: PackerHelp.h:65
std::vector< uint16_t > uhtrData
Definition: PackerHelp.h:296
static const int MASK_CAPID
Definition: PackerHelp.h:89
static const int OFFSET_LE
Definition: PackerHelp.h:107
static const int OFFSET_EVT_TY
Definition: PackerHelp.h:29
DetId detid() const
Get the detector id.
uint16_t packTPheader(const HcalTriggerPrimitiveSample &tpSample, int channelid)
Definition: PackerHelp.h:352
static const int MASK_C
Definition: PackerHelp.h:68
int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
static const int OFFSET_RESERV
Definition: PackerHelp.h:105
static const int OFFSET_RESV
Definition: PackerHelp.h:137
edm::DataFrame::iterator end()
static const int OFFSET_FIBERCHAN
Definition: PackerHelp.h:116
static const int OFFSET_AMC_NO
Definition: PackerHelp.h:59
void addChannel(int uhtrIndex, QIE10DataFrame qiedf, const HcalElectronicsMap *readoutMap, int verbosity=0)
Definition: PackerHelp.h:525
static const int MASK_E
Definition: PackerHelp.h:74
static const int MASK_AMC_NO
Definition: PackerHelp.h:60
void split64bitTo8bit(std::vector< unsigned char > &outVec, const uint64_t &var64bit)
Definition: PackerHelp.h:178
static const int OFFSET_LINK
Definition: PackerHelp.h:133
static const uint64_t FIXED_MSB
Definition: PackerHelp.h:33
UHTRMap uhtrs
Definition: PackerHelp.h:299
Definition: DetId.h:18
static const int MASK_HEADER_BIT
Definition: PackerHelp.h:112
static const int OFFSET_FLAVOR
Definition: PackerHelp.h:124
static const int OFFSET_FLAVOR
Definition: PackerHelp.h:92
static const int MASK_S
Definition: PackerHelp.h:76
static const int MASK_BX_ID
Definition: PackerHelp.h:26
unsigned long long uint64_t
Definition: Time.h:15
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:26
static const int FLAG_WORDS
static const int MASK_RES
Definition: PackerHelp.h:47
static const int HEADER_WORDS
static const int OFFSET_TOWER
Definition: PackerHelp.h:131
static const int OFFSET_HEADER_BIT
Definition: PackerHelp.h:94
static const int OFFSET_FIBERCHAN
Definition: PackerHelp.h:84
static const int OFFSET_ORN
Definition: PackerHelp.h:40
static const int OFFSET_V
Definition: PackerHelp.h:69
static const int MASK_UFOV
Definition: PackerHelp.h:49
FEDHeader * rawFEDHeader
Definition: PackerHelp.h:164
static const int MASK_SLOT_ID
Definition: PackerHelp.h:56
static const int MASK_RESV
Definition: PackerHelp.h:138
static const int OFFSET_CAPID
Definition: PackerHelp.h:88
static const int MASK_EVT_TY
Definition: PackerHelp.h:30
bool exist(int uhtrIndex)
Definition: PackerHelp.h:330
static const int OFFSET_S
Definition: PackerHelp.h:75
data_type * iterator
Definition: DataFrame.h:21
static const int OFFSET_HEADER_BIT
Definition: PackerHelp.h:143
size_type size() const
static const int OFFSET_P
Definition: PackerHelp.h:71
uint64_t Crate
Definition: PackerHelp.h:161
static const int OFFSET_FIBERERR
Definition: PackerHelp.h:90
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
edm::DataFrame::iterator begin()
iterators
uint64_t BxNum
Definition: PackerHelp.h:160
static const int MASK_HEADER_BIT
Definition: PackerHelp.h:144
void formatFEDdata(FEDRawData &rawData)
Definition: PackerHelp.h:242
static const int OFFSET_L
Definition: PackerHelp.h:79
static const int OFFSET_SLOT_ID
Definition: PackerHelp.h:55
static const int OFFSET_NAMC
Definition: PackerHelp.h:44
static const int MASK_LV1_ID
Definition: PackerHelp.h:28
static const int OFFSET_FIBERERR
Definition: PackerHelp.h:122
uint64_t EventNum
Definition: PackerHelp.h:159
edm::DataFrame::iterator end()
static const int OFFSET_H
Definition: PackerHelp.h:19
static const int MASK_LE
Definition: PackerHelp.h:108
int samples() const
total number of samples in the digi
static const int MASK_P
Definition: PackerHelp.h:72
static const int OFFSET_MP
Definition: PackerHelp.h:103
static const int MASK_FLAVOR
Definition: PackerHelp.h:110
static const int MASK_FIBERCHAN
Definition: PackerHelp.h:85
static const int MASK_AMCN_SIZE
Definition: PackerHelp.h:66
HCalFED(int fedId_, uint64_t EventNum_=9999, uint64_t OrbitNum_=999, uint64_t BxNum_=99)
Definition: PackerHelp.h:166
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
static const int OFFSET_FIBERCHAN
Definition: PackerHelp.h:99
bool er() const
is the error bit set?
Definition: HcalQIESample.h:30
void setAMC13Header()
Definition: PackerHelp.h:197
static const int OFFSET_BX_ID
Definition: PackerHelp.h:25
static const int OFFSET_FIBER
Definition: PackerHelp.h:101
static const int OFFSET_UFOV
Definition: PackerHelp.h:48
static const int MASK_NAMC
Definition: PackerHelp.h:45
static const int MASK_TOWER
Definition: PackerHelp.h:132