test
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 | Protected Attributes
DCCFEBlock Class Reference

#include <DCCFEBlock.h>

Inheritance diagram for DCCFEBlock:
DCCDataBlockPrototype DCCSCBlock DCCTowerBlock

Public Member Functions

 DCCFEBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack, bool forceToKeepFRdata)
 
void display (std::ostream &o)
 
void enableFeIdChecks ()
 
unsigned int getLength ()
 
int unpack (const uint64_t **data, unsigned int *dwToEnd, bool zs, unsigned int expectedTowerID)
 
virtual void updateCollectors ()
 
void zsFlag (bool zs)
 
virtual ~DCCFEBlock ()
 
- Public Member Functions inherited from DCCDataBlockPrototype
 DCCDataBlockPrototype (DCCDataUnpacker *unpacker, EcalElectronicsMapper *mapper, DCCEventBlock *event, bool unpack=true)
 
void enableSyncChecks ()
 
virtual int unpack (const uint64_t **data, unsigned int *dwToEnd)
 
virtual void updateEventPointers ()
 
virtual ~DCCDataBlockPrototype ()
 

Protected Member Functions

virtual void fillEcalElectronicsError (std::auto_ptr< EcalElectronicsIdCollection > *)
 
virtual int unpackXtalData (unsigned int stripID, unsigned int xtalID)
 

Protected Attributes

unsigned int blockSize_
 
unsigned int bx_
 
bool checkFeId_
 
unsigned int expTowerID_
 
unsigned int expXtalTSamples_
 
bool forceToKeepFRdata_
 
std::auto_ptr
< EcalElectronicsIdCollection > * 
invalidBlockLengths_
 
std::auto_ptr
< EcalElectronicsIdCollection > * 
invalidTTIds_
 
std::auto_ptr
< EcalElectronicsIdCollection > * 
invalidZSXtalIds_
 
unsigned int l1_
 
unsigned int lastStripId_
 
unsigned int lastXtalId_
 
unsigned int nTSamples_
 
unsigned int numbDWInXtalBlock_
 
unsigned int towerId_
 
unsigned int unfilteredDataBlockLength_
 
unsigned int xtalBlockSize_
 
short * xtalGains_
 
bool zs_
 
- Protected Attributes inherited from DCCDataBlockPrototype
unsigned int blockLength_
 
const uint64_t * data_
 
const uint64_t ** datap_
 
unsigned int * dwToEnd_
 
bool error_
 
DCCEventBlockevent_
 
EcalElectronicsMappermapper_
 
bool sync_
 
DCCDataUnpackerunpacker_
 
bool unpackInternalData_
 

Detailed Description

Definition at line 22 of file DCCFEBlock.h.

Constructor & Destructor Documentation

DCCFEBlock::DCCFEBlock ( DCCDataUnpacker u,
EcalElectronicsMapper m,
DCCEventBlock e,
bool  unpack,
bool  forceToKeepFRdata 
)

Definition at line 9 of file DCCFEBlock.cc.

References expXtalTSamples_, EcalElectronicsMapper::getUnfilteredTowerBlockLength(), DCCDataBlockPrototype::mapper_, numbDWInXtalBlock_, EcalElectronicsMapper::numbXtalTSamples(), unfilteredDataBlockLength_, and xtalGains_.

10  : DCCDataBlockPrototype(u,m,e,unpack), checkFeId_(false), forceToKeepFRdata_(forceToKeepFRdata) {
11 
15  xtalGains_ = new short[expXtalTSamples_];
16 
17 }
int unpack(const uint64_t **data, unsigned int *dwToEnd, bool zs, unsigned int expectedTowerID)
Definition: DCCFEBlock.cc:29
bool forceToKeepFRdata_
Definition: DCCFEBlock.h:51
unsigned int expXtalTSamples_
Definition: DCCFEBlock.h:52
unsigned int getUnfilteredTowerBlockLength()
unsigned int numbDWInXtalBlock_
Definition: DCCFEBlock.h:58
unsigned int unfilteredDataBlockLength_
Definition: DCCFEBlock.h:53
EcalElectronicsMapper * mapper_
DCCDataBlockPrototype(DCCDataUnpacker *unpacker, EcalElectronicsMapper *mapper, DCCEventBlock *event, bool unpack=true)
short * xtalGains_
Definition: DCCFEBlock.h:66
bool checkFeId_
Definition: DCCFEBlock.h:49
virtual DCCFEBlock::~DCCFEBlock ( )
inlinevirtual

Definition at line 28 of file DCCFEBlock.h.

References xtalGains_.

28 { delete [] xtalGains_;}
short * xtalGains_
Definition: DCCFEBlock.h:66

Member Function Documentation

void DCCFEBlock::display ( std::ostream &  o)
virtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 254 of file DCCFEBlock.cc.

References DCCDataBlockPrototype::blockLength_, bx_, l1_, nTSamples_, and towerId_.

254  {
255 
256  o<<"\n Unpacked Info for DCC Tower Block"
257  <<"\n DW1 ============================="
258  <<"\n Tower Id "<<towerId_
259  <<"\n Numb Samp "<<nTSamples_
260  <<"\n Bx "<<bx_
261  <<"\n L1 "<<l1_
262  <<"\n blockLength "<<blockLength_;
263 }
unsigned int towerId_
Definition: DCCFEBlock.h:57
unsigned int nTSamples_
Definition: DCCFEBlock.h:60
unsigned int l1_
Definition: DCCFEBlock.h:64
unsigned int bx_
Definition: DCCFEBlock.h:63
void DCCFEBlock::enableFeIdChecks ( )
inline

Definition at line 32 of file DCCFEBlock.h.

References checkFeId_.

Referenced by DCCEventBlock::enableFeIdChecks().

32 {checkFeId_= true;}
bool checkFeId_
Definition: DCCFEBlock.h:49
virtual void DCCFEBlock::fillEcalElectronicsError ( std::auto_ptr< EcalElectronicsIdCollection > *  )
inlineprotectedvirtual

Reimplemented in DCCSCBlock, and DCCTowerBlock.

Definition at line 45 of file DCCFEBlock.h.

Referenced by unpack().

45 {};
unsigned int DCCFEBlock::getLength ( )
inlinevirtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 40 of file DCCFEBlock.h.

References DCCDataBlockPrototype::blockLength_.

40 {return blockLength_; }
int DCCFEBlock::unpack ( const uint64_t **  data,
unsigned int *  dwToEnd,
bool  zs,
unsigned int  expectedTowerID 
)

Definition at line 29 of file DCCFEBlock.cc.

References BLOCK_UNPACKED, DCCDataBlockPrototype::blockLength_, blockSize_, DCCEventBlock::bx(), bx_, checkFeId_, data, DCCDataBlockPrototype::data_, DCCDataBlockPrototype::datap_, DCCDataBlockPrototype::dwToEnd_, DCCDataBlockPrototype::event_, expTowerID_, expXtalTSamples_, FE_MEM, fillEcalElectronicsError(), forceToKeepFRdata_, DCCEventBlock::fov(), EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getActiveSM(), DCCEventBlock::getHLTChannel(), EcalElectronicsMapper::getNumChannelsInDcc(), H_FOV_MASK, invalidBlockLengths_, invalidTTIds_, isSynced(), l1_, DCCEventBlock::l1A(), lastStripId_, lastXtalId_, DCCDataBlockPrototype::mapper_, nTSamples_, numbDWInXtalBlock_, DCCEventBlock::setFESyncNumbers(), DCCDataUnpacker::silentMode_, SKIP_BLOCK_UNPACKING, STOP_EVENT_UNPACKING, DCCDataBlockPrototype::sync_, TCC_BX_MASK, TCC_L1_MASK, TOWER_BX_B, TOWER_BX_MASK, TOWER_ID_MASK, TOWER_L1_B, TOWER_L1_MASK, TOWER_LENGTH_B, TOWER_LENGTH_MASK, TOWER_NSAMP_B, TOWER_NSAMP_MASK, towerId_, unfilteredDataBlockLength_, unpackXtalData(), DCCDataBlockPrototype::updateEventPointers(), xtalBlockSize_, and zs_.

Referenced by DCCEEEventBlock::unpack(), and DCCEBEventBlock::unpack().

29  {
30 
31  zs_ = zs;
32  datap_ = data;
33  data_ = *data;
34  dwToEnd_ = dwToEnd;
35 
36  const unsigned int activeDCC = mapper_->getActiveSM();
37 
38  if( (*dwToEnd_)<1){
40  edm::LogWarning("IncorrectEvent")
41  <<"\n Unable to unpack Tower block for event "<<event_->l1A()<<" in fed "<<activeDCC
42  <<"\n The end of event was reached "
43  <<"\n(or, previously, pointers intended to navigate outside of FedBlock (based on block sizes), and were stopped by setting dwToEnd_ to zero)" ;
44  //TODO : add this to a dcc event size collection error?
45  }
46  return STOP_EVENT_UNPACKING;
47  }
48 
49  lastStripId_ = 0;
50  lastXtalId_ = 0;
51  expTowerID_ = expectedTowerID;
52 
53 
54  //Point to begin of block
55  data_++;
56 
57  towerId_ = ( *data_ ) & TOWER_ID_MASK;
62 
64 
65  //debugging
66  //display(cout);
67 
68 
69 
71  // check that expected fe_id==fe_expected is on
72  if (checkFeId_ &&
73  expTowerID_ != towerId_ &&
74  expTowerID_ <= mapper_->getNumChannelsInDcc(activeDCC) ){ // fe_id must be within range foreseen in the FED
76  edm::LogWarning("IncorrectBlock")
77  << "Expected tower ID is " << expTowerID_ << " while " << towerId_ << " was found"
78  << " (L1A " << event_->l1A() << " fed " << mapper_->getActiveDCC() << ")\n"
79  << " => Skipping to next FE block...";
80  }
81 
83 
85  return SKIP_BLOCK_UNPACKING;
86  }
87 
89  // check that expected fe_id==fe_expected is off
90  else if( (!checkFeId_) &&
91  towerId_ > mapper_->getNumChannelsInDcc(activeDCC) ){ // fe_id must still be within range foreseen in the FED
93  edm::LogWarning("IncorrectBlock")
94  <<"For event "<<event_->l1A()<<" and fed "<<mapper_->getActiveDCC()<<" (there's no check fe_id==dcc_channel)"
95  <<"\n the FE_id found: "<<towerId_<<" exceeds max number of FE foreseen in fed"
96  <<"\n => Skipping to next FE block...";
97  }
98 
100  return SKIP_BLOCK_UNPACKING;
101  }
102 
103  // Check synchronization
104  if (sync_) {
105  const unsigned int dccBx = (event_->bx()) & TCC_BX_MASK;
106  const unsigned int dccL1 = (event_->l1A()) & TCC_L1_MASK;
107  const unsigned int fov = (event_->fov()) & H_FOV_MASK;
108 
109  if (! isSynced(dccBx, bx_, dccL1, l1_, FE_MEM, fov)) {
111  // TODO: add check for status from Channel Status DB
112 
113  edm::LogWarning("IncorrectBlock")
114  << "Synchronization error for Tower Block"
115  << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << " tower " << towerId_ << ")\n"
116  << " dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
117  << " => Skipping to next tower block";
118  }
119 
120  //Note : add to error collection ?
122  return SKIP_BLOCK_UNPACKING;
123  }
124  }
125 
126  // check number of samples
127  if( nTSamples_ != expXtalTSamples_ ){
129  edm::LogWarning("IncorrectBlock")
130  <<"Unable to unpack Tower Block "<<towerId_<<" for event L1A "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
131  <<"\n Number of time samples "<<nTSamples_<<" is not the same as expected ("<<expXtalTSamples_<<")"
132  <<"\n => Skipping to next tower block...";
133  }
134  //Note : add to error collection ?
136  return SKIP_BLOCK_UNPACKING;
137  }
138 
139 
142 
143  if((*dwToEnd_)<blockLength_){
145  edm::LogWarning("IncorrectEvent")
146  <<"\n Unable to unpack Tower Block "<<towerId_<<" for event L1A "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
147  <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available while "<<blockSize_<<" are needed!"
148  <<"\n => Skipping to next fed block...";
149  }
150  //TODO : add to error collections
151  return STOP_EVENT_UNPACKING;
152  }
153 
154 
155  if(!zs_ && !forceToKeepFRdata_){
156 
159  edm::LogWarning("IncorrectEvent")
160  <<"\n For event L1A "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
161  <<"\n Expected block size is "<<(unfilteredDataBlockLength_*8)<<" bytes while "<<(blockLength_*8)<<" was found"
162  <<"\n => Skipping to next fed block...";
163  }
164 
166 
167  //Safer approach... - why pointers do not navigate in this case?
168  return STOP_EVENT_UNPACKING;
169 
170 
171  }
172 
173 
174  }
175  else if (!zs && forceToKeepFRdata_){
176 
179  edm::LogWarning("IncorrectBlock")
180  <<"For event L1A "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
181  <<"\n Expected block size is "<<(unfilteredDataBlockLength_*8)<<" bytes while "<<(blockLength_*8)<<" was found"
182  <<"\n => Keeps unpacking as the unpacker was forced to keep FR data (by configuration) ...";
183  }
184 
186  }
187 
188  }
191  edm::LogWarning("IncorrectEvent")
192  <<"\n For event L1A "<<event_->l1A()<<" and fed "<<mapper_->getActiveDCC()
193  <<"\n The tower "<<towerId_<<" has a wrong number of bytes : "<<(blockLength_*8)
194  <<"\n => Skipping to next fed block...";
195  }
196 
198 
199 
200  //Safer approach... - why pointers do not navigate in this case?
201  return STOP_EVENT_UNPACKING;
202  }
203 
204 
205 
206  // If the HLT says to skip this tower we skip it...
207  if( ! event_->getHLTChannel(towerId_) ){
209  return SKIP_BLOCK_UNPACKING;
210  }
212 
213 
214 
215 
216 
217  unsigned int numbOfXtalBlocks = (blockLength_-1)/numbDWInXtalBlock_;
218 
219  // get XTAL Data
220  unsigned int expStripID(0), expXtalID(0);
221  //point to xtal data
222  data_++;
223 
224  int statusUnpackXtal =0;
225 
226  for(unsigned int numbXtal=1; numbXtal <= numbOfXtalBlocks && statusUnpackXtal!= SKIP_BLOCK_UNPACKING; numbXtal++){
227 
228 
229  if(!zs_ && ! forceToKeepFRdata_){
230  expStripID = ( numbXtal-1)/5 + 1;
231  expXtalID = numbXtal - (expStripID-1)*5;
232  }
233 
234  statusUnpackXtal = unpackXtalData(expStripID,expXtalID);
235  if (statusUnpackXtal== SKIP_BLOCK_UNPACKING)
236  {
238  edm::LogWarning("IncorrectBlock")
239  <<"For event L1A "<<event_->l1A()<<" and fed "<<mapper_->getActiveDCC()
240  <<"\n The tower "<<towerId_<<" won't be unpacked further";
241  }
242  }
243 
244  }// end loop over xtals of given FE
245 
247  return BLOCK_UNPACKED;
248 
249 }
unsigned int towerId_
Definition: DCCFEBlock.h:57
bool isSynced(const unsigned int dccBx, const unsigned int bx, const unsigned int dccL1, const unsigned int l1, const BlockType type, const unsigned int fov)
unsigned int blockSize_
Definition: DCCFEBlock.h:62
unsigned int expTowerID_
Definition: DCCFEBlock.h:50
std::auto_ptr< EcalElectronicsIdCollection > * invalidTTIds_
Definition: DCCFEBlock.h:67
bool zs_
Definition: DCCFEBlock.h:45
unsigned int xtalBlockSize_
Definition: DCCFEBlock.h:59
unsigned int getNumChannelsInDcc(unsigned int aDCCId)
std::auto_ptr< EcalElectronicsIdCollection > * invalidBlockLengths_
Definition: DCCFEBlock.h:69
unsigned int nTSamples_
Definition: DCCFEBlock.h:60
static std::atomic< bool > silentMode_
unsigned int lastXtalId_
Definition: DCCFEBlock.h:55
unsigned int bx()
Definition: DCCEventBlock.h:55
unsigned int fov()
Definition: DCCEventBlock.h:52
void setFESyncNumbers(short l1, short bx, short id)
Definition: DCCEventBlock.h:59
unsigned int l1_
Definition: DCCFEBlock.h:64
bool forceToKeepFRdata_
Definition: DCCFEBlock.h:51
unsigned int bx_
Definition: DCCFEBlock.h:63
unsigned int expXtalTSamples_
Definition: DCCFEBlock.h:52
unsigned int lastStripId_
Definition: DCCFEBlock.h:54
virtual int unpackXtalData(unsigned int stripID, unsigned int xtalID)
Definition: DCCFEBlock.h:44
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
short getHLTChannel(int channel)
Definition: DCCEventBlock.h:62
virtual void updateEventPointers()
unsigned int numbDWInXtalBlock_
Definition: DCCFEBlock.h:58
unsigned int unfilteredDataBlockLength_
Definition: DCCFEBlock.h:53
EcalElectronicsMapper * mapper_
virtual void fillEcalElectronicsError(std::auto_ptr< EcalElectronicsIdCollection > *)
Definition: DCCFEBlock.h:45
bool checkFeId_
Definition: DCCFEBlock.h:49
unsigned int l1A()
Definition: DCCEventBlock.h:54
virtual int DCCFEBlock::unpackXtalData ( unsigned int  stripID,
unsigned int  xtalID 
)
inlineprotectedvirtual

Reimplemented in DCCSCBlock, and DCCTowerBlock.

Definition at line 44 of file DCCFEBlock.h.

References BLOCK_UNPACKED.

Referenced by unpack().

void DCCFEBlock::updateCollectors ( )
virtual

Reimplemented from DCCDataBlockPrototype.

Reimplemented in DCCSCBlock, and DCCTowerBlock.

Definition at line 20 of file DCCFEBlock.cc.

References invalidBlockLengths_, DCCDataUnpacker::invalidBlockLengthsCollection(), invalidTTIds_, DCCDataUnpacker::invalidTTIdsCollection(), invalidZSXtalIds_, DCCDataUnpacker::invalidZSXtalIdsCollection(), and DCCDataBlockPrototype::unpacker_.

Referenced by DCCSCBlock::updateCollectors(), DCCTowerBlock::updateCollectors(), and DCCEventBlock::updateCollectors().

20  {
21 
25 }
std::auto_ptr< EcalElectronicsIdCollection > * invalidTTIdsCollection()
std::auto_ptr< EcalElectronicsIdCollection > * invalidTTIds_
Definition: DCCFEBlock.h:67
std::auto_ptr< EcalElectronicsIdCollection > * invalidBlockLengths_
Definition: DCCFEBlock.h:69
std::auto_ptr< EcalElectronicsIdCollection > * invalidZSXtalIds_
Definition: DCCFEBlock.h:68
std::auto_ptr< EcalElectronicsIdCollection > * invalidZSXtalIdsCollection()
DCCDataUnpacker * unpacker_
std::auto_ptr< EcalElectronicsIdCollection > * invalidBlockLengthsCollection()
void DCCFEBlock::zsFlag ( bool  zs)
inline

Definition at line 30 of file DCCFEBlock.h.

References zs_.

30 { zs_ = zs;}
bool zs_
Definition: DCCFEBlock.h:45

Member Data Documentation

unsigned int DCCFEBlock::blockSize_
protected

Definition at line 62 of file DCCFEBlock.h.

Referenced by unpack().

unsigned int DCCFEBlock::bx_
protected

Definition at line 63 of file DCCFEBlock.h.

Referenced by display(), and unpack().

bool DCCFEBlock::checkFeId_
protected

Definition at line 49 of file DCCFEBlock.h.

Referenced by enableFeIdChecks(), and unpack().

unsigned int DCCFEBlock::expTowerID_
protected
unsigned int DCCFEBlock::expXtalTSamples_
protected

Definition at line 52 of file DCCFEBlock.h.

Referenced by DCCFEBlock(), and unpack().

bool DCCFEBlock::forceToKeepFRdata_
protected

Definition at line 51 of file DCCFEBlock.h.

Referenced by unpack().

std::auto_ptr<EcalElectronicsIdCollection>* DCCFEBlock::invalidBlockLengths_
protected

Definition at line 69 of file DCCFEBlock.h.

Referenced by unpack(), and updateCollectors().

std::auto_ptr<EcalElectronicsIdCollection>* DCCFEBlock::invalidTTIds_
protected

Definition at line 67 of file DCCFEBlock.h.

Referenced by unpack(), and updateCollectors().

std::auto_ptr<EcalElectronicsIdCollection>* DCCFEBlock::invalidZSXtalIds_
protected
unsigned int DCCFEBlock::l1_
protected

Definition at line 64 of file DCCFEBlock.h.

Referenced by display(), and unpack().

unsigned int DCCFEBlock::lastStripId_
protected

Definition at line 54 of file DCCFEBlock.h.

Referenced by unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().

unsigned int DCCFEBlock::lastXtalId_
protected

Definition at line 55 of file DCCFEBlock.h.

Referenced by unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().

unsigned int DCCFEBlock::nTSamples_
protected
unsigned int DCCFEBlock::numbDWInXtalBlock_
protected
unsigned int DCCFEBlock::towerId_
protected
unsigned int DCCFEBlock::unfilteredDataBlockLength_
protected

Definition at line 53 of file DCCFEBlock.h.

Referenced by DCCFEBlock(), and unpack().

unsigned int DCCFEBlock::xtalBlockSize_
protected

Definition at line 59 of file DCCFEBlock.h.

Referenced by unpack().

short* DCCFEBlock::xtalGains_
protected
bool DCCFEBlock::zs_
protected