CMS 3D CMS Logo

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