CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DCCEBSRPBlock.cc
Go to the documentation of this file.
6 
8  : DCCSRPBlock(u, m, e, unpack) {
10 }
11 
13  // Set SR flag digis
15 }
16 
18  // Point to SR flags
19  data_++;
20  const uint16_t *my16Bitp_ = reinterpret_cast<const uint16_t *>(data_);
21 
22  unsigned int towersInPhi = EcalElectronicsMapper::kTowersInPhi;
23 
24  unsigned int fov = event_->fov();
25 
26  for (unsigned int n = 0; n < expNumbSrFlags_; n++) {
27  if (n > 0 && n % 4 == 0)
28  my16Bitp_++;
29 
30  unsigned short srFlag = (*my16Bitp_ >> ((n - (n / 4) * 4) * 3)) & SRP_SRFLAG_MASK;
31 
32  unsigned int theSRPi = n;
33 
34  if (NUMB_SM_EB_PLU_MIN <= mapper_->getActiveSM() && mapper_->getActiveSM() <= NUMB_SM_EB_PLU_MAX && fov >= 1) {
35  unsigned int u = n % towersInPhi;
36  u = towersInPhi - u;
37  theSRPi = (n / towersInPhi) * towersInPhi + u - 1;
38  }
39 
40  srFlags_[theSRPi] = srFlag;
41 
42  if (unpackInternalData_) {
43  std::vector<EcalSrFlag *> srs = mapper_->getSrFlagPointer(theSRPi + 1);
44 
45  for (size_t i = 0; i < srs.size(); ++i) {
46  srs[i]->setValue(srFlag);
47  (*ebSrFlagsDigis_)->push_back(*((EBSrFlag *)srs[i]));
48  }
49  }
50  }
51 }
52 
54  //todo : check srp id based on sm...
55 
56  // Check number of SR flags
57  if (nSRFlags_ != expNumbSrFlags_) {
59  edm::LogWarning("IncorrectBlock") << "Unable to unpack SRP block for event " << event_->l1A() << " in fed <<"
60  << mapper_->getActiveDCC() << "\nNumber of flags " << nSRFlags_
61  << " is different from expected " << expNumbSrFlags_;
62  }
63  //Note : add to error collection ?
64  return false;
65  }
66  return true;
67 }
std::unique_ptr< EBSrFlagCollection > * ebSrFlagsCollection()
std::unique_ptr< EBSrFlagCollection > * ebSrFlagsDigis_
Definition: DCCEBSRPBlock.h:41
unsigned short srFlags_[SRP_NUMBFLAGS]
Definition: DCCSRPBlock.h:51
std::vector< EcalSrFlag * > getSrFlagPointer(unsigned int feChannel)
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
unsigned int expNumbSrFlags_
Definition: DCCSRPBlock.h:49
void updateCollectors() override
void addSRFlagToCollection() override
static std::atomic< bool > silentMode_
unsigned short srFlag(unsigned int feChannel)
Definition: DCCSRPBlock.h:38
DCCEBSRPBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
Definition: DCCEBSRPBlock.cc:7
unsigned int fov()
Definition: DCCEventBlock.h:55
bool checkSrpIdAndNumbSRFlags() override
DCCDataUnpacker * unpacker_
EcalElectronicsMapper * mapper_
Log< level::Warning, false > LogWarning
unsigned int nSRFlags_
Definition: DCCSRPBlock.h:48
unsigned int l1A()
Definition: DCCEventBlock.h:57