test
CMS 3D CMS Logo

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