CMS 3D CMS Logo

EcalElectronicsMapper.cc
Go to the documentation of this file.
7 
9  : pathToMapFile_(""),
10  numbXtalTSamples_(numbXtalTSamples),
11  numbTriggerTSamples_(numbTriggerTSamples),
12  mappingBuilder_(nullptr) {
13  resetPointers();
14  setupGhostMap();
15 }
16 
18  // Reset Arrays
19  for (unsigned int sm = 0; sm < NUMB_SM; sm++) {
20  for (unsigned int fe = 0; fe < NUMB_FE; fe++) {
21  for (unsigned int strip = 0; strip < NUMB_STRIP; strip++) {
22  for (unsigned int xtal = 0; xtal < NUMB_XTAL; xtal++) {
23  //Reset DFrames and xtalDetIds
24  xtalDetIds_[sm][fe][strip][xtal] = nullptr;
25  }
26  }
27 
28  //Reset SC Det Ids
29  //scDetIds_[sm][fe]=0;
30  scEleIds_[sm][fe] = nullptr;
31  //srFlags_[sm][fe]=0;
32  }
33  }
34 
35  //Reset TT det Ids
36  for (unsigned int tccid = 0; tccid < NUMB_TCC; tccid++) {
37  for (unsigned int tpg = 0; tpg < NUMB_FE; tpg++) {
38  ttDetIds_[tccid][tpg] = nullptr;
39  ttTPIds_[tccid][tpg] = nullptr;
40  ttEleIds_[tccid][tpg] = nullptr;
41  }
42  }
43 
44  // reset trigger electronics Id
45  for (int tccid = 0; tccid < NUMB_TCC; tccid++) {
46  for (int ttid = 0; ttid < TCC_EB_NUMBTTS; ttid++) {
47  for (int ps = 0; ps < NUMB_STRIP; ps++) {
48  psInput_[tccid][ttid][ps] = nullptr;
49  }
50  }
51  }
52 
53  // initialize TCC maps
55  for (int psCounter = 0; psCounter < EcalTrigTowerDetId::kEBTowersPerSM * 5; psCounter++) {
56  for (int u = 0; u < 2; u++) {
57  tTandPs_[tccId][psCounter][u] = -1;
58  }
59  }
60  }
61 
62  //Fill map sm id to tcc ids
63  std::vector<unsigned int>* ids;
64  ids = new std::vector<unsigned int>;
65  ids->push_back(1);
66  ids->push_back(18);
67  ids->push_back(19);
68  ids->push_back(36);
69  mapSmIdToTccIds_[1] = ids;
70 
71  ids = new std::vector<unsigned int>;
72  ids->push_back(2);
73  ids->push_back(3);
74  ids->push_back(20);
75  ids->push_back(21);
76  mapSmIdToTccIds_[2] = ids;
77 
78  ids = new std::vector<unsigned int>;
79  ids->push_back(4);
80  ids->push_back(5);
81  ids->push_back(22);
82  ids->push_back(23);
83  mapSmIdToTccIds_[3] = ids;
84 
85  ids = new std::vector<unsigned int>;
86  ids->push_back(6);
87  ids->push_back(7);
88  ids->push_back(24);
89  ids->push_back(25);
90  mapSmIdToTccIds_[4] = ids;
91 
92  ids = new std::vector<unsigned int>;
93  ids->push_back(8);
94  ids->push_back(9);
95  ids->push_back(26);
96  ids->push_back(27);
97  mapSmIdToTccIds_[5] = ids;
98 
99  ids = new std::vector<unsigned int>;
100  ids->push_back(10);
101  ids->push_back(11);
102  ids->push_back(28);
103  ids->push_back(29);
104  mapSmIdToTccIds_[6] = ids;
105 
106  ids = new std::vector<unsigned int>;
107  ids->push_back(12);
108  ids->push_back(13);
109  ids->push_back(30);
110  ids->push_back(31);
111  mapSmIdToTccIds_[7] = ids;
112 
113  ids = new std::vector<unsigned int>;
114  ids->push_back(14);
115  ids->push_back(15);
116  ids->push_back(32);
117  ids->push_back(33);
118  mapSmIdToTccIds_[8] = ids;
119 
120  ids = new std::vector<unsigned int>;
121  ids->push_back(16);
122  ids->push_back(17);
123  ids->push_back(34);
124  ids->push_back(35);
125  mapSmIdToTccIds_[9] = ids;
126 
127  ids = new std::vector<unsigned int>;
128  ids->push_back(73);
129  ids->push_back(90);
130  ids->push_back(91);
131  ids->push_back(108);
132  mapSmIdToTccIds_[46] = ids;
133 
134  ids = new std::vector<unsigned int>;
135  ids->push_back(74);
136  ids->push_back(75);
137  ids->push_back(92);
138  ids->push_back(93);
139  mapSmIdToTccIds_[47] = ids;
140 
141  ids = new std::vector<unsigned int>;
142  ids->push_back(76);
143  ids->push_back(77);
144  ids->push_back(94);
145  ids->push_back(95);
146  mapSmIdToTccIds_[48] = ids;
147 
148  ids = new std::vector<unsigned int>;
149  ids->push_back(78);
150  ids->push_back(79);
151  ids->push_back(96);
152  ids->push_back(97);
153  mapSmIdToTccIds_[49] = ids;
154 
155  ids = new std::vector<unsigned int>;
156  ids->push_back(80);
157  ids->push_back(81);
158  ids->push_back(98);
159  ids->push_back(99);
160  mapSmIdToTccIds_[50] = ids;
161 
162  ids = new std::vector<unsigned int>;
163  ids->push_back(82);
164  ids->push_back(83);
165  ids->push_back(100);
166  ids->push_back(101);
167  mapSmIdToTccIds_[51] = ids;
168 
169  ids = new std::vector<unsigned int>;
170  ids->push_back(84);
171  ids->push_back(85);
172  ids->push_back(102);
173  ids->push_back(103);
174  mapSmIdToTccIds_[52] = ids;
175 
176  ids = new std::vector<unsigned int>;
177  ids->push_back(86);
178  ids->push_back(87);
179  ids->push_back(104);
180  ids->push_back(105);
181  mapSmIdToTccIds_[53] = ids;
182 
183  ids = new std::vector<unsigned int>;
184  ids->push_back(88);
185  ids->push_back(89);
186  ids->push_back(106);
187  ids->push_back(107);
188  mapSmIdToTccIds_[54] = ids;
189 
190  //Compute data block sizes
194 }
195 
197 
199  //DETETE ARRAYS
200  for (unsigned int sm = 0; sm < NUMB_SM; sm++) {
201  for (unsigned int fe = 0; fe < NUMB_FE; fe++) {
202  for (unsigned int strip = 0; strip < NUMB_STRIP; strip++) {
203  for (unsigned int xtal = 0; xtal < NUMB_XTAL; xtal++)
204  delete xtalDetIds_[sm][fe][strip][xtal];
205  }
206 
207  // if(scDetIds_[sm][fe]){
208  // delete scDetIds_[sm][fe];
209  // delete scEleIds_[sm][fe];
210  for (size_t i = 0; i < srFlags_[sm][fe].size(); ++i)
211  delete srFlags_[sm][fe][i];
212  srFlags_[sm][fe].clear();
213 
214  delete scEleIds_[sm][fe];
215  }
216  }
217 
218  // delete trigger electronics Id
219  for (int tccid = 0; tccid < NUMB_TCC; tccid++) {
220  for (int ttid = 0; ttid < TCC_EB_NUMBTTS; ttid++) {
221  for (int ps = 0; ps < NUMB_STRIP; ps++) {
222  delete psInput_[tccid][ttid][ps];
223  }
224  }
225  }
226 
227  for (unsigned int tccid = 0; tccid < NUMB_TCC; tccid++) {
228  for (unsigned int tpg = 0; tpg < NUMB_FE; tpg++) {
229  if (ttDetIds_[tccid][tpg]) {
230  delete ttDetIds_[tccid][tpg];
231  delete ttTPIds_[tccid][tpg];
232  delete ttEleIds_[tccid][tpg];
233  }
234  }
235  }
236 
237  pathToMapFile_.clear();
238 
239  std::map<unsigned int, std::vector<unsigned int>*>::iterator it;
240  for (it = mapSmIdToTccIds_.begin(); it != mapSmIdToTccIds_.end(); it++) {
241  delete (*it).second;
242  }
243 
244  mapSmIdToTccIds_.clear();
245 }
246 
248  mappingBuilder_ = m;
249  fillMaps();
250 }
251 
253  bool ret(true);
254 
255  //Update active dcc and associated smId
256  dccId_ = dccId;
257 
258  smId_ = getSMId(dccId_);
259 
260  if (!smId_)
261  ret = false;
262 
263  return ret;
264 }
265 
267  //try to open a dccMapFile in the given path
268  std::ifstream dccMapFile_(aPath_.c_str());
269 
270  //if not successful return false
271  if (!dccMapFile_.is_open())
272  return false;
273 
274  //else close file and accept given path
275  dccMapFile_.close();
276  pathToMapFile_ = aPath_;
277 
278  return true;
279 }
280 
281 // bool EcalElectronicsMapper::readDCCMapFile(){
282 
283 // //try to open a dccMapFile in the given path
284 // std::ifstream dccMapFile_(pathToMapFile_.c_str());
285 
286 // //if not successful return false
287 // if(!dccMapFile_.is_open()) return false;
288 
289 // char lineBuf_[100];
290 // unsigned int SMId_,DCCId_;
291 // // loop while extraction from file is possible
292 // dccMapFile_.getline(lineBuf_,10); //read line from file
293 // while (dccMapFile_.good()) {
294 // sscanf(lineBuf_,"%u:%u",&SMId_,&DCCId_);
295 // myDCCMap_[SMId_] = DCCId_;
296 // dccMapFile_.getline(lineBuf_,10); //read line from file
297 // }
298 
299 // return true;
300 
301 // }
302 
303 // bool EcalElectronicsMapper::readDCCMapFile(std::string aPath_){
304 // //test if path is good
305 // edm::FileInPath eff(aPath_);
306 
307 // if(!setDCCMapFilePath(eff.fullPath())) return false;
308 
309 // //read DCC map file
310 // readDCCMapFile();
311 // return true;
312 // }
313 
314 bool EcalElectronicsMapper::makeMapFromVectors(std::vector<int>& orderedFedUnpackList,
315  std::vector<int>& orderedDCCIdList) {
316  // in case as non standard set of DCCId:FedId pairs was provided
317  if (orderedFedUnpackList.size() == orderedDCCIdList.size() && !orderedFedUnpackList.empty()) {
318  edm::LogInfo("EcalElectronicsMapper") << "DCCIdList/FedUnpackList lists given. Being loaded.";
319 
320  std::string correspondence("list of pairs DCCId:FedId : ");
321  char onePair[50];
322  for (int v = 0; v < ((int)orderedFedUnpackList.size()); v++) {
323  myDCCMap_[orderedDCCIdList[v]] = orderedFedUnpackList[v];
324 
325  sprintf(onePair, " %d:%d", orderedDCCIdList[v], orderedFedUnpackList[v]);
326  std::string tmp(onePair);
327  correspondence += tmp;
328  }
329  edm::LogInfo("EcalElectronicsMapper") << correspondence;
330 
331  } else { // default set of DCCId:FedId for ECAL
332 
333  edm::LogInfo("EcalElectronicsMapper") << "No input DCCIdList/FedUnpackList lists given for ECAL unpacker"
334  << "(or given with different number of elements). "
335  << " Loading default association DCCIdList:FedUnpackList,"
336  << "i.e. 1:601 ... 53:653, 54:654.";
337 
338  for (unsigned int v = 1; v <= 54; v++) {
339  myDCCMap_[v] = (v + 600);
340  }
341  }
342 
343  return true;
344 }
345 
346 std::ostream& operator<<(std::ostream& o, const EcalElectronicsMapper& aMapper_) {
347  //print class information
348  o << "---------------------------------------------------------";
349 
350  if (aMapper_.pathToMapFile_.empty()) {
351  o << "No correct input for DCC map has been given yet...";
352  } else {
353  o << "DCC Map (Map file: " << aMapper_.pathToMapFile_ << " )"
354  << "SM id\t\tDCCid ";
355 
356  //get DCC map and iterator
357  std::map<unsigned int, unsigned int> aMap;
358  aMap = aMapper_.myDCCMap_;
359  std::map<unsigned int, unsigned int>::iterator iter;
360 
361  //print info contained in map
362  for (iter = aMap.begin(); iter != aMap.end(); iter++)
363  o << iter->first << "\t\t" << iter->second;
364  }
365 
366  o << "---------------------------------------------------------";
367  return o;
368 }
369 
371  return ((numbXtalTSamples_ - 2) / 4 + 1) * 25 + 1;
372 }
373 
375  unsigned int nTT = 68;
376  unsigned int tf;
377 
378  //TCC block size: header (8 bytes) + 17 words with 4 trigger primitives (17*8bytes)
379  if ((nTT * numbTriggerTSamples_) < 4 || (nTT * numbTriggerTSamples_) % 4)
380  tf = 1;
381  else
382  tf = 0;
383 
384  return 1 + ((nTT * numbTriggerTSamples_) / 4) + tf;
385 }
386 
388  //Todo : implement multiple tt samples for the endcap
389  return 9;
390 }
391 
392 bool EcalElectronicsMapper::isTCCExternal(unsigned int TCCId) {
393  if ((NUMB_TCC_EE_MIN_EXT_MIN <= TCCId && TCCId <= NUMB_TCC_EE_MIN_EXT_MAX) ||
394  (NUMB_TCC_EE_PLU_EXT_MIN <= TCCId && TCCId <= NUMB_TCC_EE_PLU_EXT_MAX))
395  return true;
396  else
397  return false;
398 }
399 
400 unsigned int EcalElectronicsMapper::getDCCId(unsigned int aSMId_) const {
401  //get iterator for SM id
402  std::map<unsigned int, unsigned int>::const_iterator it = myDCCMap_.find(aSMId_);
403 
404  //check if SMid exists and return DCC id
405  if (it != myDCCMap_.end())
406  return it->second;
407 
408  //error return
410  edm::LogError("IncorrectMapping") << "DCC requested for SM id: " << aSMId_ << " not found";
411  }
412  return 0;
413 }
414 
415 unsigned int EcalElectronicsMapper::getSMId(unsigned int aDCCId_) const {
416  //get iterator map
417  std::map<unsigned int, unsigned int>::const_iterator it;
418 
419  //try to find SM id for given DCC id
420  for (it = myDCCMap_.begin(); it != myDCCMap_.end(); it++)
421  if (it->second == aDCCId_)
422  return it->first;
423 
424  //error return
426  edm::LogError("IncorrectMapping") << "SM requested DCC id: " << aDCCId_ << " not found";
427  }
428  return 0;
429 }
430 
432  for (int smId = 1; smId <= 54; smId++) {
433  // Fill EB arrays
434  if (smId > 9 && smId < 46) {
435  for (int feChannel = 1; feChannel <= 68; feChannel++) {
436  unsigned int tccId = smId + TCCID_SMID_SHIFT_EB;
437 
438  // Builds Ecal Trigger Tower Det Id
439 
440  unsigned int rawid = (mappingBuilder_->getTrigTowerDetId(tccId, feChannel)).rawId();
441  EcalTrigTowerDetId* ttDetId = new EcalTrigTowerDetId(rawid);
442  ttDetIds_[tccId - 1][feChannel - 1] = ttDetId;
443  EcalElectronicsId* ttEleId = new EcalElectronicsId(smId, feChannel, 1, 1);
444  ttEleIds_[tccId - 1][feChannel - 1] = ttEleId;
447  for (unsigned int i = 0; i < numbTriggerTSamples_; i++) {
449  }
450  ttTPIds_[tccId - 1][feChannel - 1] = tp;
451 
452  // build pseudostrip input data digi
453  for (int ps = 1; ps <= 5; ps++) {
454  psInput_[tccId - 1][feChannel - 1][ps - 1] =
455  new EcalPseudoStripInputDigi(EcalTriggerElectronicsId(tccId, feChannel, ps, 1));
456  psInput_[tccId - 1][feChannel - 1][ps - 1]->setSize(1);
457  psInput_[tccId - 1][feChannel - 1][ps - 1]->setSample(0, EcalPseudoStripInputSample(0));
458  }
459 
460  // Buil SRP Flag
461  srFlags_[smId - 1][feChannel - 1].push_back(new EBSrFlag(*ttDetId, 0));
462 
463  //only one element for barrel: 1-to-1 correspondance between
464  //DCC channels and EB trigger tower:
465  assert(srFlags_[smId - 1][feChannel - 1].size() == 1);
466 
467  for (unsigned int stripId = 1; stripId <= 5; stripId++) {
468  for (unsigned int xtalId = 1; xtalId <= 5; xtalId++) {
469  EcalElectronicsId eid(smId, feChannel, stripId, xtalId);
470  EBDetId* detId = new EBDetId((mappingBuilder_->getDetId(eid)).rawId());
471  xtalDetIds_[smId - 1][feChannel - 1][stripId - 1][xtalId - 1] = detId;
472 
473  } // close loop over xtals
474  } // close loop over strips
475 
476  } // close loop over fechannels
477 
478  } //close loop over sm ids in the EB
479  // Fill EE arrays (Todo : waiting SC correction)
480 
481  else {
482  std::vector<unsigned int>* pTCCIds = mapSmIdToTccIds_[smId];
483  std::vector<unsigned int>::iterator it;
484 
485  for (it = pTCCIds->begin(); it != pTCCIds->end(); it++) {
486  unsigned int tccId = *it;
487 
488  // creating arrays of pointers for trigger objects
489  for (unsigned int towerInTCC = 1; towerInTCC <= numChannelsInDcc_[smId - 1]; towerInTCC++) {
490  // Builds Ecal Trigger Tower Det Id
491  EcalTrigTowerDetId ttDetId = mappingBuilder_->getTrigTowerDetId(tccId, towerInTCC);
492 
493  ttDetIds_[tccId - 1][towerInTCC - 1] = new EcalTrigTowerDetId(ttDetId.rawId());
495  tp->setSize(numbTriggerTSamples_);
496  for (unsigned int i = 0; i < numbTriggerTSamples_; i++) {
497  tp->setSample(i, EcalTriggerPrimitiveSample(0));
498  }
499 
500  ttTPIds_[tccId - 1][towerInTCC - 1] = tp;
501 
502  // build pseudostrip input data digi
503  for (int ps = 1; ps <= 5; ps++) {
504  psInput_[tccId - 1][towerInTCC - 1][ps - 1] =
505  new EcalPseudoStripInputDigi(EcalTriggerElectronicsId(tccId, towerInTCC, ps, 1));
506  psInput_[tccId - 1][towerInTCC - 1][ps - 1]->setSize(1);
507  psInput_[tccId - 1][towerInTCC - 1][ps - 1]->setSample(0, EcalPseudoStripInputSample(0));
508  }
509  }
510  }
511 
512  // creating arrays of pointers for digi objects
513  for (unsigned int feChannel = 1; feChannel <= numChannelsInDcc_[smId - 1]; feChannel++) {
514  // to avoid gap in CCU_id's
515  if ((smId == SECTOR_EEM_CCU_JUMP || smId == SECTOR_EEP_CCU_JUMP) &&
516  (MIN_CCUID_JUMP <= feChannel && feChannel <= MAX_CCUID_JUMP))
517  continue;
518 
519  std::vector<EcalScDetId> scDetIds = mappingBuilder_->getEcalScDetId(smId, feChannel);
520  // scDetIds_[smId-1][feChannel-1] = new EcalScDetId(scDetId.rawId());
521  scEleIds_[smId - 1][feChannel - 1] = new EcalElectronicsId(smId, feChannel, 1, 1);
522 
523  for (size_t i = 0; i < scDetIds.size(); ++i) {
524  // std::cout << __FILE__ << ":" << __LINE__ << ": "
525  // << "(DCC,RU) = (" << smId << "," << feChannel
526  // << ") -> " << scDetIds[i] << "\n";
527 
528  srFlags_[smId - 1][feChannel - 1].push_back(new EESrFlag(EcalScDetId(scDetIds[i].rawId()), 0));
529  }
530  //usually only one element 1 DCC channel <-> 1 SC
531  //in few case two or three elements: partial SCs grouped.
532  assert(srFlags_[smId - 1][feChannel - 1].size() <= 3);
533 
534  std::vector<DetId> ecalDetIds = mappingBuilder_->dccTowerConstituents(smId, feChannel);
535  std::vector<DetId>::iterator it;
536 
537  //EEDetIds
538  for (it = ecalDetIds.begin(); it != ecalDetIds.end(); it++) {
540 
541  int stripId = ids.stripId();
542  int xtalId = ids.xtalId();
543 
544  EEDetId* detId = new EEDetId((*it).rawId());
545  xtalDetIds_[smId - 1][feChannel - 1][stripId - 1][xtalId - 1] = detId;
546  } // close loop over tower constituents
547 
548  } // close loop over FE Channels
549 
550  } // closing loop over sm ids in EE
551  }
552 
553  // developing mapping for pseudostrip input data: (tccId,psNumber)->(tccId,towerId,psId)
554  // initializing array for pseudostrip data
557  for (int tt = 0; tt < EcalTrigTowerDetId::kEBTowersPerSM; tt++) {
558  numStripInTT[tccId][tt] = -2;
559  }
560  }
561 
562  // assumption: if ps_max is the largest pseudostripId within a trigger tower
563  // all the pseudostrip 1 ... ps_max are actually present
564  std::vector<DetId>::iterator theTCCConstituent;
566  // loop over all constituents of a TCC and collect
567  // the largest pseudostripId within each trigger tower
568  std::vector<DetId> tccConstituents = mappingBuilder_->tccConstituents(tccId + 1);
569 
570  for (theTCCConstituent = tccConstituents.begin(); theTCCConstituent != tccConstituents.end(); theTCCConstituent++) {
571  int towerId = (mappingBuilder_->getTriggerElectronicsId(*theTCCConstituent)).ttId();
572  int ps = (mappingBuilder_->getTriggerElectronicsId(*theTCCConstituent)).pseudoStripId();
573  if (ps > numStripInTT[tccId][towerId - 1])
574  numStripInTT[tccId][towerId - 1] = ps;
575 
576  //std::cout << "tccId: " << (tccId+1) << " towerId: " << towerId
577  // << " ps: " << ps << " numStripInTT: " << numStripInTT[tccId][towerId-1] << std::endl;
578 
579  } // loop on TCC constituents
580 
581  } // loop on TCC's
582 
583  int psCounter;
585  // resetting pseudostrip counter at each new TCC
586  psCounter = 0;
588  // if there's not a given towerId, numStripInTT==-1
589  for (int ps = 0; ps < numStripInTT[tccId][towerId]; ps++) {
590  tTandPs_[tccId][psCounter][0] = towerId + 1;
591  tTandPs_[tccId][psCounter][1] = ps + 1;
592  psCounter++;
593  } // loop on TCC's
594  } // loop on towers in TCC
595  } // loop in ps in tower
596 
597  // for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++) {
598  // for (int psCounter=0; psCounter<EcalTrigTowerDetId::kEBTowersPerSM*5; psCounter++) {
599  // std::cout << "tccId: " << (tccId+1) << " counter: " << (psCounter+1)
600  // << " tt: " << tTandPs_[tccId][psCounter][0]
601  // << " ps: " << tTandPs_[tccId][psCounter][1]
602  // << std::endl;
603  // } }
604 
605  // Note:
606  // for TCC 48 in EE, pseudostrip data in the interval:
607  // + 1-30 is good pseudostrip data
608  // + 31-42 is a duplication of the last 12 ps of the previous block, and needs be ignored
609  // + 43-60 is further good pseudostrip data
610 
612  int tccId = tcc - 1;
613  short tTandPs_tmp[18][2];
614 
615  // store entries _after_ the pseudostrip data which gets duplicated
616  for (int psCounter = 30; psCounter < 48; psCounter++) {
617  tTandPs_tmp[psCounter - 30][0] = tTandPs_[tccId][psCounter][0];
618  tTandPs_tmp[psCounter - 30][1] = tTandPs_[tccId][psCounter][1];
619  }
620 
621  // duplication
622  for (int psCounter = 18; psCounter < 30; psCounter++) {
623  tTandPs_[tccId][psCounter + 12][0] = tTandPs_[tccId][psCounter][0];
624  tTandPs_[tccId][psCounter + 12][1] = tTandPs_[tccId][psCounter][1];
625  }
626 
627  // append stoed
628  for (int psCounter = 42; psCounter < 60; psCounter++) {
629  tTandPs_[tccId][psCounter][0] = tTandPs_tmp[psCounter - 42][0];
630  tTandPs_[tccId][psCounter][1] = tTandPs_tmp[psCounter - 42][1];
631  }
632 
633  } // loop on EEM TCC's
634 
636  int tccId = tcc - 1;
637  short tTandPs_tmp[18][2];
638 
639  // store entries _after_ the pseudostrip data which gets duplicated
640  for (int psCounter = 30; psCounter < 48; psCounter++) {
641  tTandPs_tmp[psCounter - 30][0] = tTandPs_[tccId][psCounter][0];
642  tTandPs_tmp[psCounter - 30][1] = tTandPs_[tccId][psCounter][1];
643  }
644 
645  // duplication
646  for (int psCounter = 18; psCounter < 30; psCounter++) {
647  tTandPs_[tccId][psCounter + 12][0] = tTandPs_[tccId][psCounter][0];
648  tTandPs_[tccId][psCounter + 12][1] = tTandPs_[tccId][psCounter][1];
649  }
650 
651  // append stoed
652  for (int psCounter = 42; psCounter < 60; psCounter++) {
653  tTandPs_[tccId][psCounter][0] = tTandPs_tmp[psCounter - 42][0];
654  tTandPs_[tccId][psCounter][1] = tTandPs_tmp[psCounter - 42][1];
655  }
656 
657  } // loop on EEP TCC's
658 
659  //for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++) {
660  //for (int psCounter=0; psCounter<EcalTrigTowerDetId::kEBTowersPerSM*5; psCounter++) {
661  //std::cout << "AF tccId: " << (tccId+1) << " counter: " << (psCounter+1)
662  //<< " tt: " << tTandPs_[tccId][psCounter][0]
663  //<< " ps: " << tTandPs_[tccId][psCounter][1]
664  //<< std::endl;
665  // } }
666 }
667 
669  // number of 'ghost' VFEs
670  const int n = 44;
671 
672  // here is a list of all 'ghost' VFEs
673  // in format {FED, CCU, VFE}
674  const struct {
675  int FED, CCU, VFE;
676  } v[n] = {{601, 10, 5}, {601, 34, 3}, {601, 34, 4}, {601, 34, 5}, {602, 32, 5}, {603, 12, 5}, {603, 30, 5},
677  {604, 12, 5}, {604, 30, 5}, {605, 32, 5}, {606, 10, 5}, {606, 34, 3}, {606, 34, 4}, {606, 34, 5},
678  {608, 27, 3}, {608, 27, 4}, {608, 27, 5}, {608, 3, 3}, {608, 3, 4}, {608, 3, 5}, {608, 30, 5},
679  {608, 6, 5}, {646, 10, 5}, {646, 34, 3}, {646, 34, 4}, {646, 34, 5}, {647, 32, 5}, {648, 12, 5},
680  {648, 30, 5}, {649, 12, 5}, {649, 30, 5}, {650, 32, 5}, {651, 10, 5}, {651, 34, 3}, {651, 34, 4},
681  {651, 34, 5}, {653, 27, 3}, {653, 27, 4}, {653, 27, 5}, {653, 3, 3}, {653, 3, 4}, {653, 3, 5},
682  {653, 30, 5}, {653, 6, 5}};
683 
684  for (int i = 0; i < n; ++i)
685  ghost_[v[i].FED][v[i].CCU][v[i].VFE] = true;
686 }
687 
688 bool EcalElectronicsMapper::isGhost(const int FED, const int CCU, const int VFE) {
689  if (ghost_.find(FED) == ghost_.end())
690  return false;
691 
692  if (ghost_[FED].find(CCU) == ghost_[FED].end())
693  return false;
694 
695  if (ghost_[FED][CCU].find(VFE) == ghost_[FED][CCU].end())
696  return false;
697 
698  return true;
699 }
700 
701 // number of readout channels (TT in EB, SC in EE) in a DCC
703  34, 32, 33, 33, 32, 34, 33, 41, 33, // EE -
704  68, 68, 68, 68, 68, 68, 68, 68, 68, 68, // EB-
705  68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, // EB+
706  68, 68, 68, 68, 68, 68, 68, 68, 34, 32, 33, 33, 32, 34, 33, 41, 33}; // EE+
size
Write out results.
unsigned int getSMId(unsigned int aDCCId) const
int xtalId() const
get the channel id
std::map< unsigned int, std::vector< unsigned int > * > mapSmIdToTccIds_
const EcalElectronicsMapping * mappingBuilder_
int stripId() const
get the tower id
std::vector< DetId > tccConstituents(int tccId) const
Get the constituent detids for this dccId.
ret
prodAgent to be discontinued
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
EcalTriggerPrimitiveDigi * ttTPIds_[NUMB_TCC][NUMB_FE]
EcalElectronicsId * ttEleIds_[NUMB_TCC][NUMB_FE]
#define nullptr
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
unsigned tccId(DetId const &)
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned ttId(DetId const &)
void setEcalElectronicsMapping(const EcalElectronicsMapping *)
std::map< unsigned int, unsigned int > myDCCMap_
#define nTT
Definition: TMEGeom.h:6
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
EcalPseudoStripInputDigi * psInput_[NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP]
unsigned int getDCCId(unsigned int aSMId) const
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
static const unsigned int numChannelsInDcc_[NUMB_SM]
static std::atomic< bool > silentMode_
bool setActiveDCC(unsigned int dccId)
bool makeMapFromVectors(std::vector< int > &, std::vector< int > &)
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
unsigned int computeEETCCBlockLength()
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
bool isGhost(const int FED, const int CCU, const int VFE)
EcalTrigTowerDetId * ttDetIds_[NUMB_TCC][NUMB_FE]
void setSample(int i, const EcalPseudoStripInputSample &sam)
std::vector< EcalSrFlag * > srFlags_[NUMB_SM][NUMB_FE]
EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples)
bool setDCCMapFilePath(std::string)
short tTandPs_[NUMB_TCC][5 *EcalTrigTowerDetId::kEBTowersPerSM][2]
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
l1t::HGCalTowerID towerId
Definition: classes.h:36
unsigned int computeUnfilteredFEBlockLength()
std::map< int, std::map< int, std::map< int, bool > > > ghost_
bool isTCCExternal(unsigned int TCCId)
unsigned int computeEBTCCBlockLength()
static const int kEBTowersPerSM
tmp
align.sh
Definition: createJobs.py:716
DetId * xtalDetIds_[NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL]
unsigned dccId(DetId const &)
friend std::ostream & operator<<(std::ostream &o, const EcalElectronicsMapper &aEcalElectronicsMapper)
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
EcalElectronicsId * scEleIds_[NUMB_SM][NUMB_FE]