CMS 3D CMS Logo

DCCTCCBlock.cc
Go to the documentation of this file.
6 
9 
10 int DCCTCCBlock::unpack(const uint64_t** data, unsigned int* dwToEnd, short tccChId) {
11  dwToEnd_ = dwToEnd;
12  datap_ = data;
13  data_ = *data;
14 
15  // Need at least 1 dw to findout if pseudo-strips readout is enabled
16  if (*dwToEnd == 1) {
18  edm::LogWarning("IncorrectEvent") << "EcalRawToDigi@SUB=DCCTCCBlock:unpack"
19  << "\n Unable to unpack TCC block for event " << event_->l1A() << " in fed "
20  << mapper_->getActiveDCC()
21  << "\n Only 8 bytes are available until the end of event ..."
22  << "\n => Skipping to next fed block...";
23  }
24 
25  //todo : add this to error colection
26 
27  return STOP_EVENT_UNPACKING;
28  }
29 
31 
32  if ((*dwToEnd_) < blockLength_) {
34  edm::LogWarning("IncorrectEvent") << "EcalRawToDigi@SUB=DCCTCCBlock:unpack"
35  << "\n Unable to unpack TCC block for event " << event_->l1A() << " in fed "
36  << mapper_->getActiveDCC() << "\n Only " << ((*dwToEnd_) * 8)
37  << " bytes are available until the end of event while " << (blockLength_ * 8)
38  << " are needed!"
39  << "\n => Skipping to next fed block...";
40  }
41 
42  //todo : add this to error colection
43 
44  return STOP_EVENT_UNPACKING;
45  }
46 
47  if (unpackInternalData_) {
48  // Go to the begining of the tcc block
49  data_++;
50 
51  tccId_ = (*data_) & TCC_ID_MASK;
52  ps_ = (*data_ >> TCC_PS_B) & B_MASK;
53  bx_ = (*data_ >> TCC_BX_B) & TCC_BX_MASK;
54  l1_ = (*data_ >> TCC_L1_B) & TCC_L1_MASK;
55  nTTs_ = (*data_ >> TCC_TT_B) & TCC_TT_MASK;
57 
58  event_->setTCCSyncNumbers(l1_, bx_, tccChId);
59 
60  if (!checkTccIdAndNumbTTs()) {
62  return SKIP_BLOCK_UNPACKING;
63  }
64 
65  // Check synchronization
66  if (sync_) {
67  const unsigned int dccBx = (event_->bx()) & TCC_BX_MASK;
68  const unsigned int dccL1 = (event_->l1A()) & TCC_L1_MASK;
69  const unsigned int fov = (event_->fov()) & H_FOV_MASK;
70 
71  if (!isSynced(dccBx, bx_, dccL1, l1_, TCC_SRP, fov)) {
73  edm::LogWarning("IncorrectBlock")
74  << "Synchronization error for TCC block"
75  << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << ")\n"
76  << " dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
77  << " => TCC block skipped";
78  }
79 
80  //Note : add to error collection ?
82  return SKIP_BLOCK_UNPACKING;
83  }
84  }
85 
86  //check numb of samples
87  /*
88  unsigned int expTriggerTSamples(mapper_->numbTriggerTSamples());
89 
90  if( nTSamples_ != expTriggerTSamples ){
91  edm::LogWarning("IncorrectBlock")
92  <<"Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
93  <<"\n Number of time samples is "<<nTSamples_<<" while "<<expTriggerTSamples<<" is expected"
94  <<"\n TCC block skipped..."<<endl;
95 
96  //Note : add to error collection ?
97  updateEventPointers();
98  return SKIP_BLOCK_UNPACKING;
99  }
100  */
101 
102  // debugging
103  // display(cout);
104 
106  }
107 
109  return BLOCK_UNPACKED;
110 }
111 
112 void DCCTCCBlock::display(std::ostream& o) {
113  o << "\n Unpacked Info for DCC TCC Block"
114  << "\n DW1 ============================="
115  << "\n TCC Id " << tccId_ << "\n Bx " << bx_ << "\n L1 " << l1_ << "\n Numb TT " << nTTs_ << "\n Numb Samp "
116  << nTSamples_;
117 }
void display(std::ostream &o) override
Definition: DCCTCCBlock.cc:112
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)
int unpack(const uint64_t **data, unsigned int *dwToEnd, short tccChId=0)
Definition: DCCTCCBlock.cc:10
void setTCCSyncNumbers(short l1, short bx, short id)
Definition: DCCEventBlock.h:69
unsigned int nTSamples_
Definition: DCCTCCBlock.h:57
virtual unsigned int getLength()
DCCTCCBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
Definition: DCCTCCBlock.cc:7
unsigned int l1_
Definition: DCCTCCBlock.h:55
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 fov()
Definition: DCCEventBlock.h:55
virtual void addTriggerPrimitivesToCollection()
Definition: DCCTCCBlock.h:40
unsigned long long uint64_t
Definition: Time.h:13
unsigned int bx_
Definition: DCCTCCBlock.h:54
unsigned int tccId_
Definition: DCCTCCBlock.h:51
virtual bool checkTccIdAndNumbTTs()
Definition: DCCTCCBlock.h:51
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
unsigned int nTTs_
Definition: DCCTCCBlock.h:56
virtual void updateEventPointers()
EcalElectronicsMapper * mapper_
Log< level::Warning, false > LogWarning
unsigned int ps_
Definition: DCCTCCBlock.h:60
unsigned int l1A()
Definition: DCCEventBlock.h:57