File indexing completed on 2023-03-17 10:59:40
0001 #include "EventFilter/EcalRawToDigi/interface/DCCEBTCCBlock.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include "EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h"
0004 #include "EventFilter/EcalRawToDigi/interface/DCCDataUnpacker.h"
0005
0006 DCCEBTCCBlock::DCCEBTCCBlock(DCCDataUnpacker* u, EcalElectronicsMapper* m, DCCEventBlock* e, bool unpack)
0007 : DCCTCCBlock(u, m, e, unpack) {
0008 blockLength_ = mapper_->getEBTCCBlockLength();
0009 expNumbTTs_ = TCC_EB_NUMBTTS;
0010 }
0011
0012 void DCCEBTCCBlock::updateCollectors() { tps_ = unpacker_->ecalTpsCollection(); }
0013
0014 bool DCCEBTCCBlock::checkTccIdAndNumbTTs() {
0015 expTccId_ = mapper_->getActiveSM() + TCCID_SMID_SHIFT_EB;
0016
0017 if (tccId_ != expTccId_) {
0018 if (!DCCDataUnpacker::silentMode_) {
0019 edm::LogWarning("IncorrectBlock") << "Error on event " << event_->l1A() << " with bx " << event_->bx()
0020 << " in fed " << mapper_->getActiveDCC() << "\n TCC id is " << tccId_
0021 << " while expected is " << expTccId_ << "\n TCC Block Skipped ...";
0022
0023 }
0024 return false;
0025 }
0026
0027
0028 if (nTTs_ != expNumbTTs_) {
0029 if (!DCCDataUnpacker::silentMode_) {
0030 edm::LogWarning("IncorrectBlock") << "Unable to unpack TCC block for event " << event_->l1A() << " in fed "
0031 << mapper_->getActiveDCC() << "\n Number of TTs " << nTTs_
0032 << " is different from expected " << expNumbTTs_ << "\n TCC Block Skipped ...";
0033
0034 }
0035 return false;
0036 }
0037 return true;
0038 }
0039
0040 void DCCEBTCCBlock::addTriggerPrimitivesToCollection() {
0041
0042 data_++;
0043
0044 unsigned int towersInPhi = EcalElectronicsMapper::kTowersInPhi;
0045
0046 const uint16_t* tccP_ = reinterpret_cast<const uint16_t*>(data_);
0047
0048 for (unsigned int i = 1; i <= expNumbTTs_; i++) {
0049 unsigned int theTT = i;
0050
0051 if (NUMB_SM_EB_PLU_MIN <= mapper_->getActiveSM() && mapper_->getActiveSM() <= NUMB_SM_EB_PLU_MAX) {
0052 unsigned int u = (i - 1) % towersInPhi;
0053 u = towersInPhi - u;
0054 theTT = ((i - 1) / towersInPhi) * towersInPhi + u;
0055 }
0056
0057 pTP_ = mapper_->getTPPointer(tccId_, theTT);
0058 for (unsigned int ns = 0; ns < nTSamples_; ns++, tccP_++) {
0059 pTP_->setSampleValue(ns, (*tccP_));
0060 (*tps_)->push_back(*pTP_);
0061 }
0062 }
0063 }