CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes
HCalFED Class Reference

#include <PackerHelp.h>

Public Types

typedef std::vector< uint16_t > uhtrData
 

Public Member Functions

void addAMCHeader (uint64_t crate, uint64_t slot, uint64_t AMCsize, uint64_t presamples=10, uint64_t blockNum=0)
 
void addUHTR (uhtrData uhtr, uint64_t crate, uint64_t slot)
 
void formatFEDdata (FEDRawData &rawData)
 
 HCalFED (int fedId_, uint64_t EventNum_=9999, uint64_t OrbitNum_=999, uint64_t BxNum_=99)
 
void setAMC13Header ()
 
void setCDFHeader ()
 
void setNAMC (uint64_t NAMC)
 
void split64bitTo8bit (std::vector< unsigned char > &outVec, const uint64_t &var64bit)
 

Public Attributes

uint64_t AMC13Header
 
std::vector< uint64_t > AMCHeaders
 
uint64_t BxNum
 
unsigned char cdfh [8]
 
uint64_t cdfHeader
 
uint64_t Crate
 
uint64_t EventNum
 
std::vector< unsigned char > fedData
 
int fedId
 
uint64_t OrbitNum
 
FEDHeaderrawFEDHeader
 
std::vector< uhtrDatauhtrs
 

Detailed Description

Definition at line 180 of file PackerHelp.h.

Member Typedef Documentation

◆ uhtrData

typedef std::vector<uint16_t> HCalFED::uhtrData

Definition at line 182 of file PackerHelp.h.

Constructor & Destructor Documentation

◆ HCalFED()

HCalFED::HCalFED ( int  fedId_,
uint64_t  EventNum_ = 9999,
uint64_t  OrbitNum_ = 999,
uint64_t  BxNum_ = 99 
)
inline

Definition at line 197 of file PackerHelp.h.

197  {
198  fedId = fedId_;
199  OrbitNum = OrbitNum_;
200  EventNum = EventNum_;
201  BxNum = BxNum_;
203 
204  setCDFHeader();
205  setAMC13Header();
206  };

References BxNum, Crate, EventNum, fedId, FEDNumbering::MINHCALuTCAFEDID, OrbitNum, setAMC13Header(), and setCDFHeader().

Member Function Documentation

◆ addAMCHeader()

void HCalFED::addAMCHeader ( uint64_t  crate,
uint64_t  slot,
uint64_t  AMCsize,
uint64_t  presamples = 10,
uint64_t  blockNum = 0 
)
inline

Definition at line 238 of file PackerHelp.h.

238  {
239  uint64_t header = 0;
244  header |= (blockNum & AMCHeaderSpec::MASK_BLK_NO) << AMCHeaderSpec::OFFSET_BLK_NO; // Block No.
246  header |= uint64_t(0x1) << AMCHeaderSpec::OFFSET_C; // CRC is valid
247  header |= uint64_t(0x1) << AMCHeaderSpec::OFFSET_V; // EvN, BcN match
248  header |= uint64_t(0x1) << AMCHeaderSpec::OFFSET_P; // Present, header is only made if data is present
249  header |= uint64_t(0x1) << AMCHeaderSpec::OFFSET_E; // Enabled, header is only made if AMC is enabled
250  header |= uint64_t(0x0) << AMCHeaderSpec::OFFSET_S; // Segmented, always zero for unsegmented data
251  header |= uint64_t(0x0) << AMCHeaderSpec::OFFSET_M; // More data
252  header |= uint64_t(0x0) << AMCHeaderSpec::OFFSET_L; // Indicates length error
253 
254  AMCHeaders.push_back(header);
255  }

References AMCHeaders, RecoTauValidation_cfi::header, AMCHeaderSpec::MASK_AMC_NO, AMCHeaderSpec::MASK_AMCN_SIZE, AMCHeaderSpec::MASK_BLK_NO, AMCHeaderSpec::MASK_CRATE_ID, AMCHeaderSpec::MASK_PRESAMPLES, AMCHeaderSpec::MASK_SLOT_ID, AMCHeaderSpec::OFFSET_AMC_NO, AMCHeaderSpec::OFFSET_AMCN_SIZE, AMCHeaderSpec::OFFSET_BLK_NO, AMCHeaderSpec::OFFSET_C, AMCHeaderSpec::OFFSET_CRATE_ID, AMCHeaderSpec::OFFSET_E, AMCHeaderSpec::OFFSET_L, AMCHeaderSpec::OFFSET_M, AMCHeaderSpec::OFFSET_P, AMCHeaderSpec::OFFSET_PRESAMPLES, AMCHeaderSpec::OFFSET_S, AMCHeaderSpec::OFFSET_SLOT_ID, AMCHeaderSpec::OFFSET_V, hcalTTPDigis_cfi::presamples, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by addUHTR().

◆ addUHTR()

void HCalFED::addUHTR ( uhtrData  uhtr,
uint64_t  crate,
uint64_t  slot 
)
inline

Definition at line 257 of file PackerHelp.h.

257  {
258  // push uhtr data into FED container
259  uhtrs.push_back(uhtr);
260  // create the corresponding AMC header
261  addAMCHeader(crate, slot, uhtr.size() / 4);
262  };

References addAMCHeader(), and uhtrs.

◆ formatFEDdata()

void HCalFED::formatFEDdata ( FEDRawData rawData)
inline

Definition at line 265 of file PackerHelp.h.

265  {
266  //std::vector<unsigned char> output;
267  if (uhtrs.size() != AMCHeaders.size()) {
268  return;
269  }
270 
271  // put common data format header in fed container
273 
274  // set the number of AMCs in the AMC13 header
275  setNAMC(uhtrs.size());
276  // put the AMC13 header into the fed container
278 
279  // fill fedData with AMC headers
280  for (unsigned int iAMC = 0; iAMC < AMCHeaders.size(); ++iAMC) {
281  // adjust the AMCsize bits to match uhtr header
282  //AMCHeaders[iAMC] |= uint64_t(uhtrs[iAMC][1]&0xF)<<51 ;
283  //AMCHeaders[iAMC] |= uint64_t(uhtrs[iAMC][0]&0xFFFF)<<47 ;
285  }
286 
287  // fill fedData with AMC data
288  for (unsigned int iAMC = 0; iAMC < uhtrs.size(); ++iAMC) {
289  unsigned int nWords16 = uhtrs[iAMC].size();
290  for (unsigned int amcWord = 0; amcWord < nWords16; ++amcWord) {
291  fedData.push_back((uhtrs[iAMC][amcWord] >> 0) & 0xFF); // split 16-bit words into 8-bit
292  fedData.push_back((uhtrs[iAMC][amcWord] >> 8) & 0xFF);
293  } // end loop over uhtr words
294  } // end loop over uhtrs
295 
296  // fedData should be a integer number of 64 bit words
297  while (fedData.size() % 8 != 0)
298  fedData.push_back(0);
299 
300  // convert to the correct format
301  rawData.resize(fedData.size());
302  unsigned char* words = reinterpret_cast<unsigned char*>(rawData.data());
303 
304  for (unsigned int i = 0; i < fedData.size(); ++i) {
305  *words = fedData[i];
306  words++;
307  }
308  };

References AMC13Header, AMCHeaders, cdfHeader, fedData, mps_fire::i, l1tstage2_dqm_sourceclient-live_cfg::rawData, setNAMC(), split64bitTo8bit(), and uhtrs.

◆ setAMC13Header()

void HCalFED::setAMC13Header ( )
inline

◆ setCDFHeader()

void HCalFED::setCDFHeader ( )
inline

◆ setNAMC()

void HCalFED::setNAMC ( uint64_t  NAMC)
inline

◆ split64bitTo8bit()

void HCalFED::split64bitTo8bit ( std::vector< unsigned char > &  outVec,
const uint64_t &  var64bit 
)
inline

Definition at line 208 of file PackerHelp.h.

208  {
209  for (int is = 0; is < 8; is++) { // 64/8 = 8
210  outVec.push_back((var64bit >> (is * 8)) & 0xFF);
211  }
212  }

Referenced by formatFEDdata().

Member Data Documentation

◆ AMC13Header

uint64_t HCalFED::AMC13Header

Definition at line 188 of file PackerHelp.h.

Referenced by formatFEDdata(), setAMC13Header(), and setNAMC().

◆ AMCHeaders

std::vector<uint64_t> HCalFED::AMCHeaders

Definition at line 185 of file PackerHelp.h.

Referenced by addAMCHeader(), and formatFEDdata().

◆ BxNum

uint64_t HCalFED::BxNum

Definition at line 191 of file PackerHelp.h.

Referenced by HCalFED(), and setCDFHeader().

◆ cdfh

unsigned char HCalFED::cdfh[8]

Definition at line 194 of file PackerHelp.h.

◆ cdfHeader

uint64_t HCalFED::cdfHeader

Definition at line 188 of file PackerHelp.h.

Referenced by formatFEDdata(), and setCDFHeader().

◆ Crate

uint64_t HCalFED::Crate

Definition at line 192 of file PackerHelp.h.

Referenced by HCalFED().

◆ EventNum

uint64_t HCalFED::EventNum

Definition at line 190 of file PackerHelp.h.

Referenced by HCalFED().

◆ fedData

std::vector<unsigned char> HCalFED::fedData

Definition at line 184 of file PackerHelp.h.

Referenced by formatFEDdata().

◆ fedId

int HCalFED::fedId

Definition at line 187 of file PackerHelp.h.

Referenced by HCalFED(), and setCDFHeader().

◆ OrbitNum

uint64_t HCalFED::OrbitNum

Definition at line 189 of file PackerHelp.h.

Referenced by HCalFED(), and setAMC13Header().

◆ rawFEDHeader

FEDHeader* HCalFED::rawFEDHeader

Definition at line 195 of file PackerHelp.h.

◆ uhtrs

std::vector<uhtrData> HCalFED::uhtrs

Definition at line 186 of file PackerHelp.h.

Referenced by addUHTR(), and formatFEDdata().

AMCHeaderSpec::MASK_BLK_NO
static const int MASK_BLK_NO
Definition: PackerHelp.h:63
AMCHeaderSpec::OFFSET_BLK_NO
static const int OFFSET_BLK_NO
Definition: PackerHelp.h:62
AMC13HeaderSpec::MASK_RES
static const int MASK_RES
Definition: PackerHelp.h:48
HCalFED::AMC13Header
uint64_t AMC13Header
Definition: PackerHelp.h:188
mps_fire.i
i
Definition: mps_fire.py:428
HCalFED::BxNum
uint64_t BxNum
Definition: PackerHelp.h:191
AMCHeaderSpec::MASK_AMCN_SIZE
static const int MASK_AMCN_SIZE
Definition: PackerHelp.h:67
CDFHeaderSpec::MASK_H
static const int MASK_H
Definition: PackerHelp.h:21
HCalFED::Crate
uint64_t Crate
Definition: PackerHelp.h:192
CDFHeaderSpec::OFFSET_LV1_ID
static const uint64_t OFFSET_LV1_ID
Definition: PackerHelp.h:28
FEDNumbering::MINHCALuTCAFEDID
Definition: FEDNumbering.h:103
AMC13HeaderSpec::MASK_ORN
static const int MASK_ORN
Definition: PackerHelp.h:42
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:163
AMCHeaderSpec::OFFSET_M
static const int OFFSET_M
Definition: PackerHelp.h:78
AMCHeaderSpec::MASK_PRESAMPLES
static const int MASK_PRESAMPLES
Definition: PackerHelp.h:59
AMCHeaderSpec::OFFSET_CRATE_ID
static const int OFFSET_CRATE_ID
Definition: PackerHelp.h:54
HCalFED::setNAMC
void setNAMC(uint64_t NAMC)
Definition: PackerHelp.h:236
HCalFED::setCDFHeader
void setCDFHeader()
Definition: PackerHelp.h:214
CDFHeaderSpec::OFFSET_FOV
static const int OFFSET_FOV
Definition: PackerHelp.h:22
AMC13HeaderSpec::MASK_RESERVED
static const int MASK_RESERVED
Definition: PackerHelp.h:44
AMCHeaderSpec::MASK_CRATE_ID
static const int MASK_CRATE_ID
Definition: PackerHelp.h:55
CDFHeaderSpec::MASK_SOURCE_ID
static const int MASK_SOURCE_ID
Definition: PackerHelp.h:25
CDFHeaderSpec::OFFSET_FIXED_MSB
static const int OFFSET_FIXED_MSB
Definition: PackerHelp.h:32
CDFHeaderSpec::OFFSET_SOURCE_ID
static const int OFFSET_SOURCE_ID
Definition: PackerHelp.h:24
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
AMCHeaderSpec::OFFSET_PRESAMPLES
static const int OFFSET_PRESAMPLES
Definition: PackerHelp.h:58
AMC13HeaderSpec::OFFSET_ORN
static const int OFFSET_ORN
Definition: PackerHelp.h:41
AMCHeaderSpec::OFFSET_E
static const int OFFSET_E
Definition: PackerHelp.h:74
AMCHeaderSpec::OFFSET_AMC_NO
static const int OFFSET_AMC_NO
Definition: PackerHelp.h:60
HCalFED::split64bitTo8bit
void split64bitTo8bit(std::vector< unsigned char > &outVec, const uint64_t &var64bit)
Definition: PackerHelp.h:208
CDFHeaderSpec::OFFSET_EVT_TY
static const int OFFSET_EVT_TY
Definition: PackerHelp.h:30
hcalTTPDigis_cfi.presamples
presamples
Definition: hcalTTPDigis_cfi.py:9
AMC13HeaderSpec::OFFSET_NAMC
static const int OFFSET_NAMC
Definition: PackerHelp.h:45
HCalFED::fedId
int fedId
Definition: PackerHelp.h:187
AMCHeaderSpec::OFFSET_C
static const int OFFSET_C
Definition: PackerHelp.h:68
HCalFED::cdfHeader
uint64_t cdfHeader
Definition: PackerHelp.h:188
AMC13HeaderSpec::MASK_FIXED_LSB
static const int MASK_FIXED_LSB
Definition: PackerHelp.h:39
HCalFED::uhtrs
std::vector< uhtrData > uhtrs
Definition: PackerHelp.h:186
CDFHeaderSpec::MASK_BX_ID
static const int MASK_BX_ID
Definition: PackerHelp.h:27
AMCHeaderSpec::OFFSET_AMCN_SIZE
static const int OFFSET_AMCN_SIZE
Definition: PackerHelp.h:66
AMCHeaderSpec::MASK_AMC_NO
static const int MASK_AMC_NO
Definition: PackerHelp.h:61
AMC13HeaderSpec::OFFSET_RES
static const int OFFSET_RES
Definition: PackerHelp.h:47
HCalFED::EventNum
uint64_t EventNum
Definition: PackerHelp.h:190
CDFHeaderSpec::MASK_EVT_TY
static const int MASK_EVT_TY
Definition: PackerHelp.h:31
AMCHeaderSpec::OFFSET_SLOT_ID
static const int OFFSET_SLOT_ID
Definition: PackerHelp.h:56
CDFHeaderSpec::OFFSET_H
static const int OFFSET_H
Definition: PackerHelp.h:20
CDFHeaderSpec::FIXED_MSB
static const uint64_t FIXED_MSB
Definition: PackerHelp.h:34
AMCHeaderSpec::OFFSET_P
static const int OFFSET_P
Definition: PackerHelp.h:72
AMC13HeaderSpec::OFFSET_UFOV
static const int OFFSET_UFOV
Definition: PackerHelp.h:49
HCalFED::fedData
std::vector< unsigned char > fedData
Definition: PackerHelp.h:184
CDFHeaderSpec::OFFSET_BX_ID
static const int OFFSET_BX_ID
Definition: PackerHelp.h:26
AMCHeaderSpec::MASK_SLOT_ID
static const int MASK_SLOT_ID
Definition: PackerHelp.h:57
AMCHeaderSpec::OFFSET_L
static const int OFFSET_L
Definition: PackerHelp.h:80
AMCHeaderSpec::OFFSET_S
static const int OFFSET_S
Definition: PackerHelp.h:76
HCalFED::AMCHeaders
std::vector< uint64_t > AMCHeaders
Definition: PackerHelp.h:185
AMC13HeaderSpec::MASK_NAMC
static const int MASK_NAMC
Definition: PackerHelp.h:46
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
AMCHeaderSpec::OFFSET_V
static const int OFFSET_V
Definition: PackerHelp.h:70
HCalFED::setAMC13Header
void setAMC13Header()
Definition: PackerHelp.h:226
AMC13HeaderSpec::OFFSET_RESERVED
static const int OFFSET_RESERVED
Definition: PackerHelp.h:43
HCalFED::OrbitNum
uint64_t OrbitNum
Definition: PackerHelp.h:189
CDFHeaderSpec::MASK_LV1_ID
static const int MASK_LV1_ID
Definition: PackerHelp.h:29
AMC13HeaderSpec::FIXED_LSB
static const int FIXED_LSB
Definition: PackerHelp.h:40
AMC13HeaderSpec::OFFSET_FIXED_LSB
static const int OFFSET_FIXED_LSB
Definition: PackerHelp.h:38
CDFHeaderSpec::MASK_FOV
static const int MASK_FOV
Definition: PackerHelp.h:23
HCalFED::addAMCHeader
void addAMCHeader(uint64_t crate, uint64_t slot, uint64_t AMCsize, uint64_t presamples=10, uint64_t blockNum=0)
Definition: PackerHelp.h:238
AMC13HeaderSpec::MASK_UFOV
static const int MASK_UFOV
Definition: PackerHelp.h:50
CDFHeaderSpec::MASK_FIXED_MSB
static const int MASK_FIXED_MSB
Definition: PackerHelp.h:33