CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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) override
 
void enableFeIdChecks ()
 
unsigned int getLength () override
 
int unpack (const uint64_t **data, unsigned int *dwToEnd, bool zs, unsigned int expectedTowerID)
 
void updateCollectors () override
 
void zsFlag (bool zs)
 
 ~DCCFEBlock () override
 
- 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::unique_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::unique_ptr
< EcalElectronicsIdCollection > * 
invalidBlockLengths_
 
std::unique_ptr
< EcalElectronicsIdCollection > * 
invalidTTIds_
 
std::unique_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 7 of file DCCFEBlock.cc.

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

9  : DCCDataBlockPrototype(u, m, e, unpack), checkFeId_(false), forceToKeepFRdata_(forceToKeepFRdata) {
11  numbDWInXtalBlock_ = (expXtalTSamples_ - 2) / 4 + 1;
13  xtalGains_ = new short[expXtalTSamples_];
14 }
int unpack(const uint64_t **data, unsigned int *dwToEnd, bool zs, unsigned int expectedTowerID)
Definition: DCCFEBlock.cc:22
bool forceToKeepFRdata_
Definition: DCCFEBlock.h:47
unsigned int expXtalTSamples_
Definition: DCCFEBlock.h:48
unsigned int getUnfilteredTowerBlockLength()
unsigned int numbDWInXtalBlock_
Definition: DCCFEBlock.h:54
unsigned int unfilteredDataBlockLength_
Definition: DCCFEBlock.h:49
EcalElectronicsMapper * mapper_
DCCDataBlockPrototype(DCCDataUnpacker *unpacker, EcalElectronicsMapper *mapper, DCCEventBlock *event, bool unpack=true)
short * xtalGains_
Definition: DCCFEBlock.h:62
bool checkFeId_
Definition: DCCFEBlock.h:45
DCCFEBlock::~DCCFEBlock ( )
inlineoverride

Definition at line 26 of file DCCFEBlock.h.

References xtalGains_.

26 { delete[] xtalGains_; }
short * xtalGains_
Definition: DCCFEBlock.h:62

Member Function Documentation

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

Reimplemented from DCCDataBlockPrototype.

Definition at line 225 of file DCCFEBlock.cc.

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

225  {
226  o << "\n Unpacked Info for DCC Tower Block"
227  << "\n DW1 ============================="
228  << "\n Tower Id " << towerId_ << "\n Numb Samp " << nTSamples_ << "\n Bx " << bx_ << "\n L1 " << l1_
229  << "\n blockLength " << blockLength_;
230 }
unsigned int towerId_
Definition: DCCFEBlock.h:53
unsigned int nTSamples_
Definition: DCCFEBlock.h:56
unsigned int l1_
Definition: DCCFEBlock.h:60
unsigned int bx_
Definition: DCCFEBlock.h:59
void DCCFEBlock::enableFeIdChecks ( )
inline

Definition at line 30 of file DCCFEBlock.h.

References checkFeId_.

Referenced by DCCEventBlock::enableFeIdChecks().

30 { checkFeId_ = true; }
bool checkFeId_
Definition: DCCFEBlock.h:45
virtual void DCCFEBlock::fillEcalElectronicsError ( std::unique_ptr< EcalElectronicsIdCollection > *  )
inlineprotectedvirtual

Reimplemented in DCCSCBlock, and DCCTowerBlock.

Definition at line 42 of file DCCFEBlock.h.

Referenced by unpack().

42 {};
unsigned int DCCFEBlock::getLength ( )
inlineoverridevirtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 38 of file DCCFEBlock.h.

References DCCDataBlockPrototype::blockLength_.

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

Definition at line 22 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().

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

Reimplemented in DCCSCBlock, and DCCTowerBlock.

Definition at line 41 of file DCCFEBlock.h.

References BLOCK_UNPACKED.

Referenced by unpack().

void DCCFEBlock::updateCollectors ( )
overridevirtual

Reimplemented from DCCDataBlockPrototype.

Reimplemented in DCCSCBlock, and DCCTowerBlock.

Definition at line 16 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().

16  {
20 }
std::unique_ptr< EcalElectronicsIdCollection > * invalidTTIds_
Definition: DCCFEBlock.h:63
std::unique_ptr< EcalElectronicsIdCollection > * invalidBlockLengths_
Definition: DCCFEBlock.h:65
std::unique_ptr< EcalElectronicsIdCollection > * invalidTTIdsCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidBlockLengthsCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidZSXtalIdsCollection()
DCCDataUnpacker * unpacker_
std::unique_ptr< EcalElectronicsIdCollection > * invalidZSXtalIds_
Definition: DCCFEBlock.h:64
void DCCFEBlock::zsFlag ( bool  zs)
inline

Definition at line 28 of file DCCFEBlock.h.

References zs_.

28 { zs_ = zs; }
bool zs_
Definition: DCCFEBlock.h:42

Member Data Documentation

unsigned int DCCFEBlock::blockSize_
protected

Definition at line 58 of file DCCFEBlock.h.

Referenced by unpack().

unsigned int DCCFEBlock::bx_
protected

Definition at line 59 of file DCCFEBlock.h.

Referenced by display(), and unpack().

bool DCCFEBlock::checkFeId_
protected

Definition at line 45 of file DCCFEBlock.h.

Referenced by enableFeIdChecks(), and unpack().

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

Definition at line 48 of file DCCFEBlock.h.

Referenced by DCCFEBlock(), and unpack().

bool DCCFEBlock::forceToKeepFRdata_
protected

Definition at line 47 of file DCCFEBlock.h.

Referenced by unpack().

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

Definition at line 65 of file DCCFEBlock.h.

Referenced by unpack(), and updateCollectors().

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

Definition at line 63 of file DCCFEBlock.h.

Referenced by unpack(), and updateCollectors().

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

Definition at line 60 of file DCCFEBlock.h.

Referenced by display(), and unpack().

unsigned int DCCFEBlock::lastStripId_
protected

Definition at line 50 of file DCCFEBlock.h.

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

unsigned int DCCFEBlock::lastXtalId_
protected

Definition at line 51 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 49 of file DCCFEBlock.h.

Referenced by DCCFEBlock(), and unpack().

unsigned int DCCFEBlock::xtalBlockSize_
protected

Definition at line 55 of file DCCFEBlock.h.

Referenced by unpack().

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