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
DCCEETCCBlock Class Reference

#include <DCCEETCCBlock.h>

Inheritance diagram for DCCEETCCBlock:
DCCTCCBlock DCCDataBlockPrototype

Public Member Functions

void addTriggerPrimitivesToCollection () override
 
 DCCEETCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpacking)
 
unsigned int getLength () override
 
void updateCollectors () override
 
- Public Member Functions inherited from DCCTCCBlock
 DCCTCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
 
void display (std::ostream &o) override
 
int unpack (const uint64_t **data, unsigned int *dwToEnd, short tccChId=0)
 
- 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

bool checkTccIdAndNumbTTs () override
 

Additional Inherited Members

- Protected Attributes inherited from DCCTCCBlock
unsigned int bx_
 
unsigned int expNumbTTs_
 
unsigned int expTccId_
 
unsigned int l1_
 
unsigned int nTSamples_
 
unsigned int nTTs_
 
EcalPseudoStripInputDigipPS_
 
unsigned int ps_
 
std::unique_ptr
< EcalPSInputDigiCollection > * 
pss_
 
EcalTriggerPrimitiveDigipTP_
 
unsigned int tccId_
 
std::unique_ptr
< EcalTrigPrimDigiCollection > * 
tps_
 
- 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 29 of file DCCEETCCBlock.h.

Constructor & Destructor Documentation

DCCEETCCBlock::DCCEETCCBlock ( DCCDataUnpacker u,
EcalElectronicsMapper m,
DCCEventBlock e,
bool  unpacking 
)

Class constructor

Definition at line 6 of file DCCEETCCBlock.cc.

References DCCDataBlockPrototype::blockLength_.

7  : DCCTCCBlock(u, m, e, unpack) {
8  blockLength_ = 0;
9 }
int unpack(const uint64_t **data, unsigned int *dwToEnd, short tccChId=0)
Definition: DCCTCCBlock.cc:10
DCCTCCBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
Definition: DCCTCCBlock.cc:7

Member Function Documentation

void DCCEETCCBlock::addTriggerPrimitivesToCollection ( )
overridevirtual

Reimplemented from DCCTCCBlock.

Definition at line 16 of file DCCEETCCBlock.cc.

References DCCEventBlock::bx(), DCCDataBlockPrototype::data_, dcc_FOV_0, dcc_FOV_1, dcc_FOV_2, DCCDataBlockPrototype::event_, DCCEventBlock::fov(), EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getPSInputDigiPointer(), EcalElectronicsMapper::getTPPointer(), mps_fire::i, EcalElectronicsMapper::isTCCExternal(), DCCEventBlock::l1A(), DCCDataBlockPrototype::mapper_, DCCTCCBlock::nTTs_, NUMB_PSEUDOSTRIPS, NUMB_TTS_TPG1, NUMB_TTS_TPG2, NUMB_TTS_TPG2_DUPL, hltrates_dqm_sourceclient-live_cfg::offset, DCCTCCBlock::pPS_, DCCTCCBlock::ps_, DCCTCCBlock::pTP_, EcalTriggerPrimitiveDigi::setSample(), EcalPseudoStripInputDigi::setSampleValue(), DCCDataUnpacker::silentMode_, DCCTCCBlock::tccId_, and groupFilesInBlocks::tt.

16  {
17  //point to trigger data
18  data_++;
19 
20  bool processTPG2(true);
21  unsigned int psInputCounter(0);
22 
23  const uint16_t* tccP_ = reinterpret_cast<const uint16_t*>(data_);
24 
25  int dccFOV = event_->fov();
26  if (!(dccFOV == dcc_FOV_0 || dccFOV == dcc_FOV_1 || dccFOV == dcc_FOV_2)) {
28  edm::LogWarning("IncorrectEvent") << "\n FOV value in data is: " << dccFOV << "At event: " << event_->l1A()
29  << " with bx " << event_->bx() << " in fed <<" << mapper_->getActiveDCC()
30  << "\n TCC id " << tccId_ << " FOV " << dccFOV
31  << " which is not a foreseen value. Setting it to: " << dcc_FOV_2;
32  }
33  dccFOV = dcc_FOV_2;
34  }
35 
37  // MC raw data based on CMS NOTE 2005/021
38  // (and raw data when FOV was unassigned, earlier than mid 2008)
39  if (dccFOV == dcc_FOV_0) {
40  // Unpack TPG1 pseudostrip input block
41  if (ps_) {
42  for (unsigned int i = 1; i <= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++) {
43  pPS_ = mapper_->getPSInputDigiPointer(tccId_, psInputCounter);
44  if (!pPS_)
45  continue;
46  pPS_->setSampleValue(0, *tccP_);
47  (*pss_)->push_back(*pPS_);
48  }
49  }
50 
51  // Unpack TPG1 trigger primitive block
52  // loop over tp_counter=i and navigate forward in raw (tccP_)
53  for (unsigned int i = 1; i <= NUMB_TTS_TPG1; i++, tccP_++) { //16
54 
55  if (i <= nTTs_) {
56  pTP_ = mapper_->getTPPointer(tccId_, i); // pointer to tp digi container
57  if (pTP_)
58  pTP_->setSample(0, *tccP_); // fill it
59  } else {
60  processTPG2 = false;
61  break;
62  }
63  // adding trigger primitive digi to the collection
64  if (pTP_)
65  (*tps_)->push_back(*pTP_);
66  else
67  edm::LogError("IncorrectBlock") << "trigger primitive digi was not aquired";
68  }
69 
70  if (processTPG2) {
71  // Unpack TPG2 pseudostrip input block
72  if (ps_) {
73  for (unsigned int i = 1; i <= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++) {
74  if (i <= NUMB_TTS_TPG2_DUPL)
75  continue;
76  //fill pseudostrip container
77  pPS_ = mapper_->getPSInputDigiPointer(tccId_, psInputCounter);
78  if (!pPS_)
79  continue;
80  pPS_->setSampleValue(0, *tccP_);
81  (*pss_)->push_back(*pPS_);
82  }
83  }
84 
85  // Unpack TPG2 trigger primitive block
86  for (unsigned int i = 1; i <= NUMB_TTS_TPG2; i++, tccP_++) { //12
87  unsigned int tt = i + NUMB_TTS_TPG1;
88 
89  if (tt <= nTTs_) {
91  if (pTP_)
92  pTP_->setSample(0, *tccP_);
93  } else
94  break;
95  // adding trigger primitive digi to the collection
96  (*tps_)->push_back(*pTP_);
97  }
98 
99  } // end if(processTPG2)
100 
101  } // end FOV==0
102 
104  // real data since ever FOV was initialized; only 2 used >= June 09
105  else if (dccFOV == dcc_FOV_1 || dccFOV == dcc_FOV_2) {
106  // Unpack TPG1 pseudostrip input block
107  if (ps_) {
108  for (unsigned int i = 1; i <= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++) {
109  pPS_ = mapper_->getPSInputDigiPointer(tccId_, psInputCounter);
110  if (!pPS_)
111  continue;
112  pPS_->setSampleValue(0, *tccP_);
113  (*pss_)->push_back(*pPS_);
114  }
115  }
116 
117  int offset(0);
118  // Unpack TPG1 trigger primitive block
119  // loop over tp_counter=i and navigate forward in raw (tccP_)
120  for (unsigned int i = 1; i <= NUMB_TTS_TPG1; i++, tccP_++) { //16
121 
122  if (i <= nTTs_) {
123  if (mapper_->isTCCExternal(tccId_)) {
124  if (i > 8 && i <= 16)
125  continue; // skip blank tp's [9,16]
126  if (i > 8)
127  offset = 8; //
128  if (i > 24)
129  continue; // skip blank tp's [25, 28]
130  }
131 
132  pTP_ = mapper_->getTPPointer(tccId_, i - offset); // pointer to tp digi container
133  if (pTP_)
134  pTP_->setSample(0, *tccP_); // fill it
135 
136  } else {
137  processTPG2 = false;
138  break;
139  }
140  // adding trigger primitive digi to the collection
141  if (pTP_)
142  (*tps_)->push_back(*pTP_);
143  else
144  edm::LogError("IncorrectBlock") << "trigger primitive digi was not aquired";
145  }
146 
147  if (processTPG2) {
148  // Unpack TPG2 pseudostrip input block
149  if (ps_) {
150  for (unsigned int i = 1; i <= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++) {
151  if (i <= NUMB_TTS_TPG2_DUPL)
152  continue;
153  //fill pseudostrip container
154  pPS_ = mapper_->getPSInputDigiPointer(tccId_, psInputCounter);
155  if (!pPS_)
156  continue;
157  pPS_->setSampleValue(0, *tccP_);
158  (*pss_)->push_back(*pPS_);
159  }
160  }
161 
162  // Unpack TPG2 trigger primitive block
163  for (unsigned int i = 1; i <= NUMB_TTS_TPG2; i++, tccP_++) { //12
164  unsigned int tt = i + NUMB_TTS_TPG1;
165 
166  if (i <= nTTs_) {
167  if (mapper_->isTCCExternal(tccId_)) {
168  if (tt > 8 && tt <= 16)
169  continue; // skip blank tp's [9,16]
170  if (tt > 8)
171  offset = 8; //
172  if (tt > 24)
173  continue; // skip blank tp's [25, 28]
174  }
175 
177  if (pTP_)
178  pTP_->setSample(0, *tccP_);
179  } else
180  break;
181  // adding trigger primitive digi to the collection
182  (*tps_)->push_back(*pTP_);
183  }
184  } // end if(processTPG2)
185  } // end FOV==1 or 2
186 }
EcalPseudoStripInputDigi * pPS_
Definition: DCCTCCBlock.h:63
Log< level::Error, false > LogError
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
static std::atomic< bool > silentMode_
unsigned int bx()
Definition: DCCEventBlock.h:58
EcalTriggerPrimitiveDigi * pTP_
Definition: DCCTCCBlock.h:62
unsigned int fov()
Definition: DCCEventBlock.h:55
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId)
unsigned int tccId_
Definition: DCCTCCBlock.h:51
unsigned int nTTs_
Definition: DCCTCCBlock.h:56
EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower)
bool isTCCExternal(unsigned int TCCId)
EcalElectronicsMapper * mapper_
Log< level::Warning, false > LogWarning
void setSampleValue(int i, uint16_t value)
unsigned int ps_
Definition: DCCTCCBlock.h:60
unsigned int l1A()
Definition: DCCEventBlock.h:57
bool DCCEETCCBlock::checkTccIdAndNumbTTs ( )
overrideprotectedvirtual

Reimplemented from DCCTCCBlock.

Definition at line 188 of file DCCEETCCBlock.cc.

References DCCEventBlock::bx(), DCCDataBlockPrototype::event_, EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getActiveSM(), EcalElectronicsMapper::getTccs(), DCCEventBlock::l1A(), visualization-live-secondInstance_cfg::m, DCCDataBlockPrototype::mapper_, DCCTCCBlock::nTTs_, DCCDataUnpacker::silentMode_, and DCCTCCBlock::tccId_.

188  {
189  bool tccFound(false);
190  bool errorOnNumbOfTTs(false);
191  const int activeDCC = mapper_->getActiveSM();
192  std::vector<unsigned int>* m = mapper_->getTccs(activeDCC);
193  std::vector<unsigned int>::iterator it;
194  for (it = m->begin(); it != m->end(); it++) {
195  if ((*it) == tccId_) {
196  tccFound = true;
197 
198  /*
199  expNumbTTs_= 28; //separate from inner and outer tcc
200  For inner TCCs you expect 28 TTs (4 in phi, 7 in eta).
201  For outer TCCs you expect 16 TTs (4 in phi, 4 in eta).
202  to implement : map tccid-> number of tts
203 
204  Pascal P.: For outer board, only 16 TPs are meaningful but 28 are sent.
205  - [1,8] are meaningful
206  - [9,16] are empty ie should be skipped by unpacker
207  - [17, 24] are meaningful
208  - [25, 28] are empty ie should be skipped by unpacker
209  */
210 
211  if (nTTs_ != 28 && nTTs_ != 16) {
213  edm::LogWarning("IncorrectBlock")
214  << "Error on event " << event_->l1A() << " with bx " << event_->bx() << " in fed <<"
215  << mapper_->getActiveDCC() << "\n TCC id " << tccId_ << " has " << nTTs_
216  << " Trigger Towers (only 28 or 16 are the expected values in EE)"
217  << "\n => Skipping to next fed block...";
218  errorOnNumbOfTTs = true;
219  //todo : add to error collection
220  }
221  }
222  }
223  }
224 
225  if (!tccFound) {
227  edm::LogWarning("IncorrectBlock") << "Error on event " << event_->l1A() << " with bx " << event_->bx()
228  << " in fed <<" << mapper_->getActiveDCC() << "\n TCC id " << tccId_
229  << " is not valid for this dcc "
230  << "\n => Skipping to next fed block...";
231  //todo : add to error collection
232  }
233  }
234 
235  return (tccFound || errorOnNumbOfTTs);
236 }
std::vector< unsigned int > * getTccs(unsigned int smId)
static std::atomic< bool > silentMode_
unsigned int bx()
Definition: DCCEventBlock.h:58
unsigned int tccId_
Definition: DCCTCCBlock.h:51
unsigned int nTTs_
Definition: DCCTCCBlock.h:56
EcalElectronicsMapper * mapper_
Log< level::Warning, false > LogWarning
unsigned int l1A()
Definition: DCCEventBlock.h:57
unsigned int DCCEETCCBlock::getLength ( )
overridevirtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 238 of file DCCEETCCBlock.cc.

References B_MASK, DCCDataBlockPrototype::data_, NUMB_PSEUDOSTRIPS, NUMB_TTS_TPG1, NUMB_TTS_TPG2, DCCTCCBlock::ps_, TCC_PS_B, and groupFilesInBlocks::temp.

238  {
239  const uint64_t* temp = data_;
240  temp++;
241 
242  ps_ = (*temp >> TCC_PS_B) & B_MASK;
243 
244  unsigned int numbTps = (NUMB_TTS_TPG1 + NUMB_TTS_TPG2);
245  if (ps_) {
246  numbTps += 2 * NUMB_PSEUDOSTRIPS;
247  }
248 
249  unsigned int length = numbTps / 4 + 2; //header and trailer
250  if (numbTps % 4)
251  length++;
252 
253  return length;
254 }
unsigned long long uint64_t
Definition: Time.h:13
unsigned int ps_
Definition: DCCTCCBlock.h:60
void DCCEETCCBlock::updateCollectors ( )
overridevirtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 11 of file DCCEETCCBlock.cc.

References DCCDataUnpacker::ecalPSsCollection(), DCCDataUnpacker::ecalTpsCollection(), DCCTCCBlock::pss_, DCCTCCBlock::tps_, and DCCDataBlockPrototype::unpacker_.

11  {
14 }
std::unique_ptr< EcalPSInputDigiCollection > * ecalPSsCollection()
std::unique_ptr< EcalTrigPrimDigiCollection > * tps_
Definition: DCCTCCBlock.h:64
std::unique_ptr< EcalPSInputDigiCollection > * pss_
Definition: DCCTCCBlock.h:65
DCCDataUnpacker * unpacker_
std::unique_ptr< EcalTrigPrimDigiCollection > * ecalTpsCollection()