CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 147 of file PackerHelp.h.

Member Typedef Documentation

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

Definition at line 151 of file PackerHelp.h.

Constructor & Destructor Documentation

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

Definition at line 166 of file PackerHelp.h.

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

166  {
167  fedId = fedId_;
168  OrbitNum = OrbitNum_;
169  EventNum = EventNum_;
170  BxNum = BxNum_;
172 
173  setCDFHeader();
174  setAMC13Header();
175 
176  };
void setCDFHeader()
Definition: PackerHelp.h:184
uint64_t OrbitNum
Definition: PackerHelp.h:158
int fedId
Definition: PackerHelp.h:156
uint64_t Crate
Definition: PackerHelp.h:161
uint64_t BxNum
Definition: PackerHelp.h:160
uint64_t EventNum
Definition: PackerHelp.h:159
void setAMC13Header()
Definition: PackerHelp.h:197

Member Function Documentation

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

Definition at line 213 of file PackerHelp.h.

References AMCHeaders, 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, and AMCHeaderSpec::OFFSET_V.

Referenced by addUHTR().

213  {
214 
215  uint64_t header = 0 ;
218  header |= (presamples&AMCHeaderSpec::MASK_PRESAMPLES)<<AMCHeaderSpec::OFFSET_PRESAMPLES ; // boardId
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  }
static const int MASK_BLK_NO
Definition: PackerHelp.h:62
static const int OFFSET_CRATE_ID
Definition: PackerHelp.h:53
static const int OFFSET_BLK_NO
Definition: PackerHelp.h:61
static const int OFFSET_PRESAMPLES
Definition: PackerHelp.h:57
static const int MASK_CRATE_ID
Definition: PackerHelp.h:54
static const int MASK_PRESAMPLES
Definition: PackerHelp.h:58
std::vector< uint64_t > AMCHeaders
Definition: PackerHelp.h:154
static const int OFFSET_M
Definition: PackerHelp.h:77
static const int OFFSET_C
Definition: PackerHelp.h:67
static const int OFFSET_E
Definition: PackerHelp.h:73
static const int OFFSET_AMCN_SIZE
Definition: PackerHelp.h:65
static const int OFFSET_AMC_NO
Definition: PackerHelp.h:59
static const int MASK_AMC_NO
Definition: PackerHelp.h:60
unsigned long long uint64_t
Definition: Time.h:15
static const int OFFSET_V
Definition: PackerHelp.h:69
static const int MASK_SLOT_ID
Definition: PackerHelp.h:56
static const int OFFSET_S
Definition: PackerHelp.h:75
static const int OFFSET_P
Definition: PackerHelp.h:71
static const int OFFSET_L
Definition: PackerHelp.h:79
static const int OFFSET_SLOT_ID
Definition: PackerHelp.h:55
static const int MASK_AMCN_SIZE
Definition: PackerHelp.h:66
void HCalFED::addUHTR ( uhtrData  uhtr,
uint64_t  crate,
uint64_t  slot 
)
inline

Definition at line 234 of file PackerHelp.h.

References addAMCHeader(), and uhtrs.

234  {
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  };
std::vector< uhtrData > uhtrs
Definition: PackerHelp.h:155
void addAMCHeader(uint64_t crate, uint64_t slot, uint64_t AMCsize, uint64_t presamples=10, uint64_t blockNum=0)
Definition: PackerHelp.h:213
void HCalFED::formatFEDdata ( FEDRawData rawData)
inline

Definition at line 242 of file PackerHelp.h.

References AMC13Header, AMCHeaders, cdfHeader, FEDRawData::data(), fedData, i, FEDRawData::resize(), setNAMC(), split64bitTo8bit(), and uhtrs.

242  {
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
251 
252  // set the number of AMCs in the AMC13 header
253  setNAMC(uhtrs.size());
254  // put the AMC13 header into the fed container
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 ;
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  };
uint64_t AMC13Header
Definition: PackerHelp.h:157
std::vector< uhtrData > uhtrs
Definition: PackerHelp.h:155
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned char > fedData
Definition: PackerHelp.h:153
uint64_t cdfHeader
Definition: PackerHelp.h:157
void setNAMC(uint64_t NAMC)
Definition: PackerHelp.h:209
std::vector< uint64_t > AMCHeaders
Definition: PackerHelp.h:154
void resize(size_t newsize)
Definition: FEDRawData.cc:32
void split64bitTo8bit(std::vector< unsigned char > &outVec, const uint64_t &var64bit)
Definition: PackerHelp.h:178
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void HCalFED::setAMC13Header ( )
inline

Definition at line 197 of file PackerHelp.h.

References AMC13Header, AMC13HeaderSpec::FIXED_LSB, AMC13HeaderSpec::MASK_FIXED_LSB, AMC13HeaderSpec::MASK_NAMC, AMC13HeaderSpec::MASK_ORN, AMC13HeaderSpec::MASK_RES, AMC13HeaderSpec::MASK_RESERVED, AMC13HeaderSpec::MASK_UFOV, AMC13HeaderSpec::OFFSET_FIXED_LSB, AMC13HeaderSpec::OFFSET_NAMC, AMC13HeaderSpec::OFFSET_ORN, AMC13HeaderSpec::OFFSET_RES, AMC13HeaderSpec::OFFSET_RESERVED, AMC13HeaderSpec::OFFSET_UFOV, and OrbitNum.

Referenced by HCalFED().

197  {
198 
199  AMC13Header = 0;
206 
207  }
uint64_t AMC13Header
Definition: PackerHelp.h:157
static const int MASK_RESERVED
Definition: PackerHelp.h:43
static const int FIXED_LSB
Definition: PackerHelp.h:39
static const int OFFSET_RESERVED
Definition: PackerHelp.h:42
uint64_t OrbitNum
Definition: PackerHelp.h:158
static const int MASK_ORN
Definition: PackerHelp.h:41
static const int OFFSET_RES
Definition: PackerHelp.h:46
static const int OFFSET_FIXED_LSB
Definition: PackerHelp.h:37
static const int MASK_FIXED_LSB
Definition: PackerHelp.h:38
unsigned long long uint64_t
Definition: Time.h:15
static const int MASK_RES
Definition: PackerHelp.h:47
static const int OFFSET_ORN
Definition: PackerHelp.h:40
static const int MASK_UFOV
Definition: PackerHelp.h:49
static const int OFFSET_NAMC
Definition: PackerHelp.h:44
static const int OFFSET_UFOV
Definition: PackerHelp.h:48
static const int MASK_NAMC
Definition: PackerHelp.h:45
void HCalFED::setCDFHeader ( )
inline

Definition at line 184 of file PackerHelp.h.

References BxNum, cdfHeader, fedId, CDFHeaderSpec::FIXED_MSB, CDFHeaderSpec::MASK_BX_ID, CDFHeaderSpec::MASK_EVT_TY, CDFHeaderSpec::MASK_FIXED_MSB, CDFHeaderSpec::MASK_FOV, CDFHeaderSpec::MASK_H, CDFHeaderSpec::MASK_LV1_ID, CDFHeaderSpec::MASK_SOURCE_ID, CDFHeaderSpec::OFFSET_BX_ID, CDFHeaderSpec::OFFSET_EVT_TY, CDFHeaderSpec::OFFSET_FIXED_MSB, CDFHeaderSpec::OFFSET_FOV, CDFHeaderSpec::OFFSET_H, CDFHeaderSpec::OFFSET_LV1_ID, and CDFHeaderSpec::OFFSET_SOURCE_ID.

Referenced by HCalFED().

184  {
185 
186  cdfHeader = 0 ;
190  cdfHeader |= (BxNum&CDFHeaderSpec::MASK_BX_ID)<<CDFHeaderSpec::OFFSET_BX_ID; // needs to be configurable
194 
195  }
static const int MASK_H
Definition: PackerHelp.h:20
static const uint64_t OFFSET_LV1_ID
Definition: PackerHelp.h:27
static const int MASK_FOV
Definition: PackerHelp.h:22
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 OFFSET_SOURCE_ID
Definition: PackerHelp.h:23
static const int OFFSET_FOV
Definition: PackerHelp.h:21
static const int OFFSET_FIXED_MSB
Definition: PackerHelp.h:31
int fedId
Definition: PackerHelp.h:156
static const int OFFSET_EVT_TY
Definition: PackerHelp.h:29
static const uint64_t FIXED_MSB
Definition: PackerHelp.h:33
static const int MASK_BX_ID
Definition: PackerHelp.h:26
unsigned long long uint64_t
Definition: Time.h:15
static const int MASK_EVT_TY
Definition: PackerHelp.h:30
uint64_t BxNum
Definition: PackerHelp.h:160
static const int MASK_LV1_ID
Definition: PackerHelp.h:28
static const int OFFSET_H
Definition: PackerHelp.h:19
static const int OFFSET_BX_ID
Definition: PackerHelp.h:25
void HCalFED::setNAMC ( uint64_t  NAMC)
inline

Definition at line 209 of file PackerHelp.h.

References AMC13Header, AMC13HeaderSpec::MASK_NAMC, and AMC13HeaderSpec::OFFSET_NAMC.

Referenced by formatFEDdata().

209  {
211  }
uint64_t AMC13Header
Definition: PackerHelp.h:157
static const int OFFSET_NAMC
Definition: PackerHelp.h:44
static const int MASK_NAMC
Definition: PackerHelp.h:45
void HCalFED::split64bitTo8bit ( std::vector< unsigned char > &  outVec,
const uint64_t &  var64bit 
)
inline

Definition at line 178 of file PackerHelp.h.

Referenced by formatFEDdata().

178  {
179  for(int is=0; is<8; is++){ // 64/8 = 8
180  outVec.push_back( (var64bit>> (is*8) ) & 0xFF);
181  }
182  }

Member Data Documentation

uint64_t HCalFED::AMC13Header

Definition at line 157 of file PackerHelp.h.

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

std::vector<uint64_t> HCalFED::AMCHeaders

Definition at line 154 of file PackerHelp.h.

Referenced by addAMCHeader(), and formatFEDdata().

uint64_t HCalFED::BxNum

Definition at line 160 of file PackerHelp.h.

Referenced by HCalFED(), and setCDFHeader().

unsigned char HCalFED::cdfh[8]

Definition at line 163 of file PackerHelp.h.

uint64_t HCalFED::cdfHeader

Definition at line 157 of file PackerHelp.h.

Referenced by formatFEDdata(), and setCDFHeader().

uint64_t HCalFED::Crate

Definition at line 161 of file PackerHelp.h.

Referenced by HCalFED().

uint64_t HCalFED::EventNum

Definition at line 159 of file PackerHelp.h.

Referenced by HCalFED().

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

Definition at line 153 of file PackerHelp.h.

Referenced by formatFEDdata().

int HCalFED::fedId

Definition at line 156 of file PackerHelp.h.

Referenced by HCalFED(), and setCDFHeader().

uint64_t HCalFED::OrbitNum

Definition at line 158 of file PackerHelp.h.

Referenced by HCalFED(), and setAMC13Header().

FEDHeader* HCalFED::rawFEDHeader

Definition at line 164 of file PackerHelp.h.

std::vector<uhtrData> HCalFED::uhtrs

Definition at line 155 of file PackerHelp.h.

Referenced by addUHTR(), and formatFEDdata().