CMS 3D CMS Logo

DCCSRPBlock.cc
Go to the documentation of this file.
5 
8  // Todo : include data integrity collections
10  // Set SR flags to zero
11  for (unsigned int i = 0; i < SRP_NUMBFLAGS; i++) {
12  srFlags_[i] = 0;
13  }
14 }
15 
16 int DCCSRPBlock::unpack(const uint64_t** data, unsigned int* dwToEnd, unsigned int numbFlags) {
17  // Set SR flags to zero
18  for (unsigned int i = 0; i < SRP_NUMBFLAGS; i++) {
19  srFlags_[i] = 0;
20  }
21 
22  expNumbSrFlags_ = numbFlags;
23  error_ = false;
24  datap_ = data;
25  data_ = *data;
26  dwToEnd_ = dwToEnd;
27 
28  // Check SRP Length
29  if ((*dwToEnd_) < blockLength_) {
31  edm::LogWarning("IncorrectEvent") << "\n Event " << l1_ << "\n Unable to unpack SRP block for event "
32  << event_->l1A() << " in fed <<" << mapper_->getActiveDCC() << "\n Only "
33  << ((*dwToEnd_) * 8) << " bytes are available while " << (blockLength_ * 8)
34  << " are needed!";
35  }
36 
37  //Note : add to error collection
38 
39  return STOP_EVENT_UNPACKING;
40  }
41 
42  // Point to begin of block
43  data_++;
44 
45  srpId_ = (*data_) & SRP_ID_MASK;
46  bx_ = (*data_ >> SRP_BX_B) & SRP_BX_MASK;
47  l1_ = (*data_ >> SRP_L1_B) & SRP_L1_MASK;
49 
51 
52  if (!checkSrpIdAndNumbSRFlags()) {
54  //return STOP_EVENT_UNPACKING;
56  return SKIP_BLOCK_UNPACKING;
57  }
58 
59  // Check synchronization
60  if (sync_) {
61  const unsigned int dccL1 = (event_->l1A()) & SRP_L1_MASK;
62  const unsigned int dccBx = (event_->bx()) & SRP_BX_MASK;
63  const unsigned int fov = (event_->fov()) & H_FOV_MASK;
64 
65  if (!isSynced(dccBx, bx_, dccL1, l1_, TCC_SRP, fov)) {
67  edm::LogWarning("IncorrectEvent")
68  << "Synchronization error for SRP block"
69  << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << ")\n"
70  << " dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
71  << " => Stop event unpacking";
72  }
73  //Note : add to error collection ?
75  // return STOP_EVENT_UNPACKING;
77  return SKIP_BLOCK_UNPACKING;
78  }
79  }
80 
81  // initialize array, protecting in case of inconsistently formatted data
82  for (int dccCh = 0; dccCh < SRP_NUMBFLAGS; dccCh++)
83  srFlags_[dccCh] = 0;
84 
85  //display(cout);
87 
89 
90  return true;
91 }
92 
93 void DCCSRPBlock::display(std::ostream& o) {
94  o << "\n Unpacked Info for SRP Block"
95  << "\n DW1 ============================="
96  << "\n SRP Id " << srpId_ << "\n Numb Flags " << nSRFlags_ << "\n Bx " << bx_ << "\n L1 " << l1_;
97 
98  for (unsigned int i = 0; i < SRP_NUMBFLAGS; i++) {
99  o << "\n SR flag " << (i + 1) << " = " << (srFlags_[i]);
100  }
101 }
unsigned int srpId_
Definition: DCCSRPBlock.h:43
unsigned short srFlags_[SRP_NUMBFLAGS]
Definition: DCCSRPBlock.h:51
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)
void display(std::ostream &o) override
Definition: DCCSRPBlock.cc:93
unsigned int expNumbSrFlags_
Definition: DCCSRPBlock.h:49
unsigned int l1_
Definition: DCCSRPBlock.h:47
virtual bool checkSrpIdAndNumbSRFlags()
Definition: DCCSRPBlock.h:43
virtual void addSRFlagToCollection()
Definition: DCCSRPBlock.h:41
static std::atomic< bool > silentMode_
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
unsigned int bx()
Definition: DCCEventBlock.h:58
unsigned int bx_
Definition: DCCSRPBlock.h:46
unsigned int fov()
Definition: DCCEventBlock.h:55
DCCSRPBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
Definition: DCCSRPBlock.cc:6
unsigned long long uint64_t
Definition: Time.h:13
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
int unpack(const uint64_t **data, unsigned int *dwToEnd, unsigned int numbFlags=SRP_NUMBFLAGS)
Definition: DCCSRPBlock.cc:16
virtual void updateEventPointers()
EcalElectronicsMapper * mapper_
Log< level::Warning, false > LogWarning
void setSRPSyncNumbers(short l1, short bx)
Definition: DCCEventBlock.h:61
unsigned int nSRFlags_
Definition: DCCSRPBlock.h:48
unsigned int l1A()
Definition: DCCEventBlock.h:57