CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions
DCCEBEventBlock Class Reference

#include <DCCEBEventBlock.h>

Inheritance diagram for DCCEBEventBlock:
DCCEventBlock

Public Member Functions

 DCCEBEventBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool forceToKeepFRdata)
 
void unpack (uint64_t *buffer, unsigned int bufferSize, unsigned int expFedId)
 
- Public Member Functions inherited from DCCEventBlock
unsigned int bx ()
 
 DCCEventBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool forceToKeepFRdata)
 
void display (std::ostream &o)
 
void enableFeIdChecks ()
 
void enableSyncChecks ()
 
unsigned int fov ()
 
short getHLTChannel (int channel)
 
unsigned int l1A ()
 
unsigned int mem ()
 
void reset ()
 
void setFESyncNumbers (short l1, short bx, short id)
 
void setHLTChannel (int channel, short value)
 
void setSRPSyncNumbers (short l1, short bx)
 
void setTCCSyncNumbers (short l1, short bx, short id)
 
unsigned int smId ()
 
DCCDataUnpackerunpacker ()
 
void updateCollectors ()
 
virtual ~DCCEventBlock ()
 

Protected Member Functions

int unpackTCCBlocks ()
 
- Protected Member Functions inherited from DCCEventBlock
void addHeaderToCollection ()
 

Additional Inherited Members

- Protected Attributes inherited from DCCEventBlock
unsigned int blockLength_
 
unsigned int bx_
 
uint64_t * data_
 
unsigned int dccErrors_
 
std::auto_ptr
< EcalRawDataCollection > * 
dccHeaders_
 
unsigned int detailedTriggerType_
 
unsigned int dwToEnd_
 
unsigned int eventSize_
 
std::vector< short > feBx_
 
std::vector< short > feChStatus_
 
unsigned int fedId_
 
std::vector< short > feLv1_
 
bool feUnpacking_
 
bool forceToKeepFRdata_
 
unsigned int fov_
 
bool headerUnpacking_
 
std::vector< short > hlt_
 
unsigned int l1_
 
EcalElectronicsMappermapper_
 
unsigned int mem_
 
DCCMemBlockmemBlock_
 
bool memUnpacking_
 
unsigned int orbitCounter_
 
unsigned int runNumber_
 
unsigned int runType_
 
unsigned int smId_
 
unsigned int sr_
 
unsigned int srChStatus_
 
DCCSRPBlocksrpBlock_
 
short srpBx_
 
short srpLv1_
 
bool srpUnpacking_
 
DCCTCCBlocktccBlock_
 
std::vector< short > tccBx_
 
std::vector< short > tccChStatus_
 
std::vector< short > tccLv1_
 
bool tccUnpacking_
 
DCCFEBlocktowerBlock_
 
unsigned int triggerType_
 
unsigned int tzs_
 
DCCDataUnpackerunpacker_
 
unsigned int zs_
 

Detailed Description

Definition at line 27 of file DCCEBEventBlock.h.

Constructor & Destructor Documentation

DCCEBEventBlock::DCCEBEventBlock ( DCCDataUnpacker u,
EcalElectronicsMapper m,
bool  hU,
bool  srpU,
bool  tccU,
bool  feU,
bool  memU,
bool  forceToKeepFRdata 
)

Definition at line 18 of file DCCEBEventBlock.cc.

References DCCEventBlock::feUnpacking_, DCCEventBlock::forceToKeepFRdata_, DCCEventBlock::mem_, DCCEventBlock::srpBlock_, DCCEventBlock::srpUnpacking_, DCCEventBlock::tccBlock_, DCCEventBlock::tccUnpacking_, and DCCEventBlock::towerBlock_.

18  :
19  DCCEventBlock(u,m,hU,srpU,tccU,feU,memU,forceToKeepFRdata)
20 {
21 
22  //Builds a tower unpacker block
24 
25  //Builds a srp unpacker block
26  srpBlock_ = new DCCEBSRPBlock(u,m,this,srpUnpacking_);
27 
28  //Builds a tcc unpacker block
29  tccBlock_ = new DCCEBTCCBlock(u,m,this,tccUnpacking_);
30 
31  // This field is not used in EB
32  mem_ = 0;
33 
34 
35 }
bool forceToKeepFRdata_
DCCEventBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool forceToKeepFRdata)
DCCFEBlock * towerBlock_
DCCSRPBlock * srpBlock_
unsigned int mem_
DCCTCCBlock * tccBlock_

Member Function Documentation

void DCCEBEventBlock::unpack ( uint64_t *  buffer,
unsigned int  bufferSize,
unsigned int  expFedId 
)
virtual

Reimplemented from DCCEventBlock.

Definition at line 39 of file DCCEBEventBlock.cc.

References DCCEventBlock::addHeaderToCollection(), B_MASK, BLOCK_UNPACKED, DCCEventBlock::blockLength_, DCCEventBlock::bx_, CALIBRATIONTRIGGER, CH_DISABLED, CH_FORCEDZS1, CH_HEADERERR, CH_IFIFOFULL, CH_L1AIFIFOFULL, CH_LENGTHERR, CH_LINKERR, CH_SUPPRESS, CH_TIMEOUT, DCCEventBlock::data_, DCCEventBlock::dccErrors_, DCCEventBlock::detailedTriggerType_, DCCEventBlock::dwToEnd_, EMPTYEVENTSIZE, DCCEventBlock::eventSize_, DCCEventBlock::feChStatus_, DCCEventBlock::fedId_, DCCEventBlock::feUnpacking_, DCCEventBlock::fov_, DCCDataUnpacker::getCCUValue(), H_BX_B, H_BX_MASK, H_CHSTATUS_MASK, H_DET_TTYPE_B, H_DET_TTYPE_MASK, H_ERRORS_B, H_ERRORS_MASK, H_EVLENGTH_MASK, H_FEDID_B, H_FEDID_MASK, H_FOV_B, H_FOV_MASK, H_L1_B, H_L1_MASK, H_ORBITCOUNTER_B, H_ORBITCOUNTER_MASK, H_RNUMB_B, H_RNUMB_MASK, H_RTYPE_MASK, H_SR_B, H_SRCHSTATUS_B, H_TCC1CHSTATUS_B, H_TCC2CHSTATUS_B, H_TCC3CHSTATUS_B, H_TCC4CHSTATUS_B, H_TTYPE_B, H_TTYPE_MASK, H_TZS_B, H_ZS_B, HEADERLENGTH, HEADERSIZE, DCCEventBlock::headerUnpacking_, i, DCCEventBlock::l1_, DCCEventBlock::memBlock_, DCCEventBlock::memUnpacking_, DCCEventBlock::orbitCounter_, PHYSICTRIGGER, DCCEventBlock::reset(), DCCEventBlock::runNumber_, DCCEventBlock::runType_, edm::shift, DCCDataUnpacker::silentMode_, DCCEventBlock::sr_, DCCEventBlock::srChStatus_, DCCSRPBlock::srFlag(), SRP_FULLREADOUT, SRP_SRVAL_MASK, DCCEventBlock::srpBlock_, DCCEventBlock::srpUnpacking_, STOP_EVENT_UNPACKING, DCCEventBlock::tccChStatus_, DCCEventBlock::towerBlock_, DCCEventBlock::triggerType_, DCCEventBlock::tzs_, DCCFEBlock::unpack(), DCCSRPBlock::unpack(), DCCMemBlock::unpack(), DCCEventBlock::unpacker_, unpackTCCBlocks(), and DCCEventBlock::zs_.

Referenced by DCCDataUnpacker::unpack().

39  {
40 
41  reset();
42 
43  eventSize_ = numbBytes;
44  data_ = buffer;
45 
46  // First Header Word of fed block
47  fedId_ = ((*data_)>>H_FEDID_B) & H_FEDID_MASK;
48  bx_ = ((*data_)>>H_BX_B ) & H_BX_MASK;
49  l1_ = ((*data_)>>H_L1_B ) & H_L1_MASK;
50  triggerType_ = ((*data_)>>H_TTYPE_B) & H_TTYPE_MASK;
51 
52  // Check if fed id is the same as expected...
53  if( fedId_ != expFedId ){
54 
56  edm::LogWarning("IncorrectEvent")
57  <<"\n For event L1A: "<<l1_
58  <<"\n Expected FED id is: "<<expFedId<<" while current FED id is: "<<fedId_
59  <<"\n => Skipping to next fed block...";
60  }
61 
62  //TODO : add this to an error event collection
63 
64  return;
65  }
66 
67  // Check if this event is an empty event
68  if( eventSize_ == EMPTYEVENTSIZE ){
70  edm::LogWarning("IncorrectEvent")
71  <<"\n Event L1A: "<<l1_<<" is empty for fed: "<<fedId_
72  <<"\n => Skipping to next fed block...";
73  }
74  return;
75 
76  }
77 
78  //Check if event size allows at least building the header
79  else if( eventSize_ < HEADERSIZE ){
81  edm::LogError("IncorrectEvent")
82  <<"\n Event L1A: "<<l1_<<" in fed: "<< fedId_
83  <<"\n Event size is "<<eventSize_<<" bytes while the minimum is "<<HEADERSIZE<<" bytes"
84  <<"\n => Skipping to next fed block...";
85  }
86 
87  //TODO : add this to a dcc size error collection
88 
89  return;
90 
91  }
92 
93  //Second Header Word of fed block
94  data_++;
95 
96  blockLength_ = (*data_ ) & H_EVLENGTH_MASK;
97  dccErrors_ = ((*data_)>>H_ERRORS_B) & H_ERRORS_MASK;
98  runNumber_ = ((*data_)>>H_RNUMB_B ) & H_RNUMB_MASK;
99 
100 
101  if( eventSize_ != blockLength_*8 ){
103  edm::LogError("IncorrectEvent")
104  <<"\n Event L1A: "<<l1_<<" in fed: "<< fedId_
105  <<"\n size is "<<eventSize_<<" bytes while "<<(blockLength_*8)<<" are set in the event header "
106  <<"\n => Skipping to next fed block...";
107  //TODO : add this to a dcc size error collection
108  }
109  return;
110 
111  }
112 
113  //Third Header Word of fed block
114  data_++;
115 
116 
117  // bits 0.. 31 of the 3rd DCC header word
118  runType_ = (*data_) & H_RTYPE_MASK;
119 
120  fov_ = ((*data_)>>H_FOV_B) & H_FOV_MASK;
121 
122  // bits 32.. 47 of the 3rd DCC header word
124 
125  //Forth Header Word
126  data_++;
128  sr_ = ((*data_)>>H_SR_B) & B_MASK;
129  zs_ = ((*data_)>>H_ZS_B) & B_MASK;
130  tzs_ = ((*data_)>>H_TZS_B) & B_MASK;
132 
133 
134  bool ignoreSR(true);
135 
136  // getting TCC channel status bits
137  tccChStatus_[0] = ((*data_)>>H_TCC1CHSTATUS_B) & H_CHSTATUS_MASK;
138  tccChStatus_[1] = ((*data_)>>H_TCC2CHSTATUS_B) & H_CHSTATUS_MASK;
139  tccChStatus_[2] = ((*data_)>>H_TCC3CHSTATUS_B) & H_CHSTATUS_MASK;
140  tccChStatus_[3] = ((*data_)>>H_TCC4CHSTATUS_B) & H_CHSTATUS_MASK;
141 
142  // FE channel Status data
143  int channel(0);
144  for( int dw = 0; dw<5; dw++ ){
145  data_++;
146  for( int i = 0; i<14; i++, channel++){
147  unsigned int shift = i*4; //each channel has 4 bits
148  feChStatus_[channel] = ( (*data_)>>shift ) & H_CHSTATUS_MASK ;
149  }
150  }
151 
152  // debugging
153  //display(cout);
154 
155  // Update number of available dwords
157 
158  int STATUS = unpackTCCBlocks();
159 
160  if( STATUS != STOP_EVENT_UNPACKING && (feUnpacking_ || srpUnpacking_) ){
161 
162  //NMGA note : SR comes before TCC blocks
163  // Emmanuelle please change this in the digi to raw
164 
165  // Unpack SRP block
167  STATUS = srpBlock_->unpack(&data_,&dwToEnd_);
168  if ( STATUS == BLOCK_UNPACKED ){ ignoreSR = false; }
169  }
170 
171  }
172 
173 
174 
175 
176 
177  // See number of FE channels that we need according to the trigger type //
178  // TODO : WHEN IN LOCAL MODE WE SHOULD CHECK RUN TYPE
179  unsigned int numbChannels(0);
180 
181  if( triggerType_ == PHYSICTRIGGER ){ numbChannels = 68; }
182  else if ( triggerType_ == CALIBRATIONTRIGGER ){ numbChannels = 70; }
183  else {
185  edm::LogError("IncorrectEvent")
186  <<"\n Event L1A: "<<l1_<<" in fed: "<< fedId_
187  <<"\n Event has an unsupported trigger type "<<triggerType_
188  <<"\n => Skipping to next fed block...";
189  //TODO : add this to a dcc trigger type error collection
190  }
191  return;
192  }
193 
194  // note: there is no a-priori check that number_active_channels_from_header
195  // equals number_channels_found_in_data.
196  // The checks are doing f.e. by f.e. only.
197 
198  if( feUnpacking_ || memUnpacking_ ){
199  // pointer for the
200  std::vector<short>::iterator it = feChStatus_.begin();
201 
202  // looping over FE channels, i.e. tower blocks
203  for (unsigned int chNumber=1; chNumber<= numbChannels && STATUS!=STOP_EVENT_UNPACKING; chNumber++, it++ ){
204  //for( unsigned int i=1; chNumber<= numbChannels; chNumber++, it++ ){
205 
206  const short chStatus(*it);
207 
208  // regular cases
209  const bool regular = (chStatus == CH_DISABLED ||
210  chStatus == CH_SUPPRESS);
211 
212  // problematic cases
213  const bool problematic = (chStatus == CH_TIMEOUT ||
214  chStatus == CH_HEADERERR ||
215  chStatus == CH_LINKERR ||
216  chStatus == CH_LENGTHERR ||
217  chStatus == CH_IFIFOFULL ||
218  chStatus == CH_L1AIFIFOFULL);
219 
220  // issuiung messages for problematic cases, even though handled by the DCC
221  if (problematic) {
223  const int val = unpacker_->getCCUValue(fedId_, chNumber);
224  const bool ttProblem = (val == 13) || (val == 14);
225  if (! ttProblem) {
226  edm::LogWarning("IncorrectBlock")
227  << "Bad DCC channel status: " << chStatus
228  << " (LV1 " << l1_ << " fed " << fedId_ << " tower " << chNumber << ")\n"
229  << " => DCC channel is not being unpacked";
230  }
231  }
232  }
233 
234  // skip unpack in case of bad status
235  if (regular || problematic) {
236  continue;
237  }
238 
239  // Unpack Tower (Xtal Block) in case of SR (data are 0 suppressed)
240  if(feUnpacking_ && sr_ && chNumber<=68)
241  {
242 
243  if( fov_ > 0){
244  bool applyZS(true);
245 
246  if( !ignoreSR && chStatus != CH_FORCEDZS1
247  && (srpBlock_->srFlag(chNumber) & SRP_SRVAL_MASK) == SRP_FULLREADOUT){ applyZS = false; }
248 
249  STATUS = towerBlock_->unpack(&data_,&dwToEnd_,applyZS,chNumber);
250 
251  // If there is an action to suppress SR channel the associated channel status should be updated
252  // so we can remove this piece of code
253  // if ( ( srpBlock_->srFlag(chNumber) & SRP_SRVAL_MASK) != SRP_NREAD ){
254  //
255  // STATUS = towerBlock_->unpack(&data_,&dwToEnd_,applyZS,chNumber);
256  //}
257 
258  }
259  else{
260 
261  // introduced to keep backward compatibility with FOV = 0;
262  STATUS = towerBlock_->unpack(&data_,&dwToEnd_,true,chNumber);
263 
264  }
265 
266  }
267 
268 
269  // Unpack Tower (Xtal Block) for no SR (possibly 0 suppression flags)
270  else if (feUnpacking_ && chNumber<=68)
271  {
272  // if tzs_ data are not really suppressed, even though zs flags are calculated
273  if(tzs_){ zs_ = false;}
274  STATUS = towerBlock_->unpack(&data_,&dwToEnd_,zs_,chNumber);
275  }
276 
277 
278  // Unpack Mem blocks
279  if(memUnpacking_ && chNumber>68 )
280  {
281  STATUS = memBlock_->unpack(&data_,&dwToEnd_,chNumber);
282  }
283 
284  }
285  // closing loop over FE/TTblock channels
286 
287  }// check if we need to perform unpacking of FE or mem data
288 
289 
291 
292 
293 }
int unpack(uint64_t **data, unsigned int *dwToEnd, unsigned int numbFlags=SRP_NUMBFLAGS)
Definition: DCCSRPBlock.cc:19
int i
Definition: DBlmapReader.cc:9
unsigned int runType_
Definition: DCCEventBlock.h:98
DCCFEBlock * towerBlock_
DCCSRPBlock * srpBlock_
unsigned int dwToEnd_
Definition: DCCEventBlock.h:76
DCCMemBlock * memBlock_
unsigned int srChStatus_
Definition: DCCEventBlock.h:87
static bool silentMode_
int unpack(uint64_t **data, unsigned int *dwToEnd, unsigned int expectedTowerID)
Definition: DCCMemBlock.cc:41
unsigned int detailedTriggerType_
Definition: DCCEventBlock.h:99
unsigned int blockLength_
Definition: DCCEventBlock.h:95
unsigned int triggerType_
Definition: DCCEventBlock.h:93
DCCDataUnpacker * unpacker_
Definition: DCCEventBlock.h:73
unsigned int runNumber_
Definition: DCCEventBlock.h:97
unsigned int sr_
unsigned short srFlag(unsigned int feChannel)
Definition: DCCSRPBlock.h:45
unsigned int l1_
Definition: DCCEventBlock.h:92
unsigned int eventSize_
Definition: DCCEventBlock.h:75
uint64_t * data_
Definition: DCCEventBlock.h:74
uint16_t getCCUValue(const int fed, const int ccu) const
unsigned int orbitCounter_
std::vector< short > feChStatus_
Definition: DCCEventBlock.h:78
unsigned int fov_
Definition: DCCEventBlock.h:89
int unpack(uint64_t **data, unsigned int *dwToEnd, bool zs, unsigned int expectedTowerID)
Definition: DCCFEBlock.cc:29
unsigned int bx_
Definition: DCCEventBlock.h:91
static unsigned int const shift
unsigned int zs_
void addHeaderToCollection()
unsigned int tzs_
std::vector< short > tccChStatus_
Definition: DCCEventBlock.h:79
unsigned int fedId_
Definition: DCCEventBlock.h:90
unsigned int dccErrors_
Definition: DCCEventBlock.h:96
int DCCEBEventBlock::unpackTCCBlocks ( )
protectedvirtual

Reimplemented from DCCEventBlock.

Definition at line 298 of file DCCEBEventBlock.cc.

References BLOCK_UNPACKED, CH_DISABLED, CH_TIMEOUT, DCCEventBlock::data_, DCCEventBlock::dwToEnd_, DCCEventBlock::tccBlock_, DCCEventBlock::tccChStatus_, and DCCTCCBlock::unpack().

Referenced by unpack().

298  {
299 
301  return tccBlock_->unpack(&data_,&dwToEnd_);
302  else return BLOCK_UNPACKED;
303 
304 }
unsigned int dwToEnd_
Definition: DCCEventBlock.h:76
int unpack(uint64_t **data, unsigned int *dwToEnd, short tccChId=0)
Definition: DCCTCCBlock.cc:11
uint64_t * data_
Definition: DCCEventBlock.h:74
DCCTCCBlock * tccBlock_
std::vector< short > tccChStatus_
Definition: DCCEventBlock.h:79