ATLAS Offline Software
RegSelectorMap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <cmath>
8 #include <cstring>
9 
10 
11 
12 
14 
15 
17 
18 void RegSelectorMap::HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const {
19  IRegSelLUT::IDList<RegSelectorMap>( roi, idlist, &RegSelectorMap::HashIDList_internal );
20 }
21 
22 void RegSelectorMap::HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const {;
23  IRegSelLUT::IDList_layer<RegSelectorMap>( layer, roi, idlist, &RegSelectorMap::HashIDList_internal );
24 }
25 
27 
28 void RegSelectorMap::ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const {
29  IRegSelLUT::IDList<RegSelectorMap>( roi, roblist, &RegSelectorMap::ROBIDList_internal );
30 }
31 
32 void RegSelectorMap::ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const {
33  IRegSelLUT::IDList_layer<RegSelectorMap>( layer, roi, roblist, &RegSelectorMap::ROBIDList_internal );
34 }
35 
36 
37 
39 
40 void RegSelectorMap::HashIDList_internal( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const {
41  if ( roi.isFullscan() ) regionSelector( TILE, -4.9, 4.9, 0, 2*M_PI, idlist );
42  regionSelector( TILE, roi.etaMinus(), roi.etaPlus(), roi.phiMinus(), roi.phiPlus(), idlist );
43 }
44 
45 void RegSelectorMap::HashIDList_internal( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const {;
46  if ( roi.isFullscan() ) regionSelector( layer, -4.9, 4.9, 0, 2*M_PI, idlist );
47  regionSelector( layer, roi.etaMinus(), roi.etaPlus(), roi.phiMinus(), roi.phiPlus(), idlist );
48 }
49 
51 
52 void RegSelectorMap::ROBIDList_internal( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const {
53  if ( roi.isFullscan() ) regionSelectorRobIdUint( TILE, -4.9, 4.9, 0, 2*M_PI, roblist );
54  regionSelectorRobIdUint( TILE, roi.etaMinus(), roi.etaPlus(), roi.phiMinus(), roi.phiPlus(), roblist );
55 }
56 
57 void RegSelectorMap::ROBIDList_internal( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const {
58  if ( roi.isFullscan() ) regionSelectorRobIdUint( layer, -4.9, 4.9, 0, 2*M_PI, roblist );
59  regionSelectorRobIdUint( layer, roi.etaMinus(), roi.etaPlus(), roi.phiMinus(), roi.phiPlus(), roblist );
60 }
61 
62 
64 
65 double RegSelectorMap::etaminValue(void) const {
66  return m_etaminDet;
67 }
68 
69 double RegSelectorMap::etamaxValue(void) const {
70  return m_etamaxDet;
71 }
72 
73 double RegSelectorMap::phiminValue(void) const {
74  return m_phiminDet;
75 }
76 
77 double RegSelectorMap::phimaxValue(void) const {
78  return m_phimaxDet;
79 }
80 
81 const std::vector<IdentifierHash>& RegSelectorMap::hashIdOut(void) const {
82  return m_hashId;
83 }
84 
85 const std::vector<uint32_t>& RegSelectorMap::robIdOut(void) const {
86  return m_robId;
87 }
88 
89 const std::vector<int>& RegSelectorMap::barORendOut(void) const {
90  return m_barORend;
91 }
92 
93 const std::vector<int>& RegSelectorMap::layORdskOut(void) const {
94  return m_layORdsk;
95 }
96 
97 const std::vector<double>& RegSelectorMap::etaMinOut(void) const {
98  return m_etamin;
99 }
100 
101 const std::vector<double>& RegSelectorMap::etaMaxOut(void) const {
102  return m_etamax;
103 }
104 
105 const std::vector<double>& RegSelectorMap::phiMinOut(void) const {
106  return m_phimin;
107 }
108 
109 const std::vector<double>& RegSelectorMap::phiMaxOut(void) const {
110  return m_phimax;
111 }
112 
114  int nLines = m_barORend.size();
115  int i;
116 
117  for( i = 0; i < nLines; ++i){ // creating list of RegSelectElementUint
119  m_etamin[i], m_etamax[i],
120  m_phimin[i], m_phimax[i],
121  m_hashId[i], m_robId[i] );
122  }
124  // find max and min values of each barrel layer and endcap disk
125  for(it = m_barreldataList.begin();it != m_barreldataList.end(); ++it)
126  (*it).findMaxMinElem();
127  for(it = m_posdataList.begin();it != m_posdataList.end(); ++it)
128  (*it).findMaxMinElem();
129  for(it = m_negdataList.begin();it != m_negdataList.end(); ++it)
130  (*it).findMaxMinElem();
131  // find max and min values of a subdetector
132  m_etaminDet = 1000; m_etamaxDet = -1000;
133  m_phiminDet = 1000; m_phimaxDet = -1000;
137 }
138 
140  double etaminIn, double etamaxIn,
141  double phiminIn, double phimaxIn,
142  std::vector<uint32_t>& outList ) const {
143 
144  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
145 
146  std::list<RegSelectorMapElement>::const_iterator it;
147  std::set<uint32_t> outset;
148  std::set<uint32_t>::const_iterator itset, negbarrelbeg, negbarrelend;
149  bool divideEta = false;
150 
151  for( it = m_barreldataList.begin(); //barrel list
152  it != m_barreldataList.end(); ++it){ // runs trought all RegSelectElementUints
153  (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset );
154  }
155 
156  switch(TYPE){
157  case TILE: divideEta = true; break;
158  default: break;
159  }
160 
161  if( divideEta ){
162  if(etaminIn < 0 || etamaxIn < 0){ // negative data list
163  for(it = m_negdataList.begin();it != m_negdataList.end(); ++it){ // runs trought all RegSelectElementUints
164  (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
165  }
166  }
167 
168  if( etaminIn >= 0 || etamaxIn >= 0 ){ // positive data list
169  for(it = m_posdataList.begin();it != m_posdataList.end(); ++it){ // runs trought all RegSelectElementUints
170  (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
171  }
172  }
173  }
174  else{
175  for(it = m_negdataList.begin();it != m_negdataList.end(); ++it){ // runs trought all RegSelectElementUints
176  (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
177  }
178  for(it = m_posdataList.begin();it != m_posdataList.end(); ++it){ // runs trought all RegSelectElementUints
179  (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
180  }
181  }
182 
183  if (TYPE==TILE){
184  negbarrelbeg = outset.upper_bound(0x51000f);
185  negbarrelend = outset.lower_bound(0x530000);
186  for(itset = negbarrelbeg; itset != negbarrelend; ++itset){
187  outList.push_back(*itset);
188  }
189  for(itset = outset.begin(); itset != negbarrelbeg; ++itset){
190  outList.push_back(*itset);
191  }
192  for(itset = negbarrelend; itset != outset.end(); ++itset){
193  outList.push_back(*itset);
194  }
195  }else{
196  for(itset = outset.begin(); itset != outset.end(); ++itset){
197  outList.push_back(*itset);
198  }
199  }
200 
201 }
202 
204 
205 
206  for( size_t i=0; i< detLut->maxHash(); ++i) {
207  writeLine(detLut->layerDiskPosition(i),
208  detLut->layerDiskNumber(i),
209  detLut->hashId(i),
210  detLut->robId(i),
211  detLut->etaMin(i),
212  detLut->etaMax(i),
213  detLut->phiMin(i),
214  detLut->phiMax(i));
215  // std::cout << "RSDEBUG i=" << i << " hashid=" << detLut.hashId(i) << std::endl;
216  }
217 
218 }
219 
221  double etaminIn, double etamaxIn,
222  double phiminIn, double phimaxIn,
223  std::vector<IdentifierHash>& outList) const {
224 
225  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
226 
227  std::list<RegSelectorMapElement>::const_iterator it;
228  std::set<IdentifierHash> outset;
229  std::set<IdentifierHash>::const_iterator itset, negbarrelbeg,negbarrelend;
230  bool divideEta = false;
231 
232  for(it = m_barreldataList.begin(); //barrel list
233  it != m_barreldataList.end(); ++it){ // runs trought all RegSelectElementUints
234  (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
235  }
236 
237  switch(TYPE){
238  case TILE: divideEta = true; break;
239  default: break;
240  }
241 
242  if( divideEta ){
243  if(etaminIn < 0 || etamaxIn < 0){ // negative data list
244  for(it = m_negdataList.begin();it != m_negdataList.end(); ++it){ // runs trought all RegSelectElementUints
245  (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
246  }
247  }
248 
249  if( etaminIn >= 0 || etamaxIn >= 0 ){ // positive data list
250  for(it = m_posdataList.begin();it != m_posdataList.end(); ++it){ // runs trought all RegSelectElementUints
251  (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
252  }
253  }
254  }
255  else{
256  for(it = m_negdataList.begin();it != m_negdataList.end(); ++it){ // runs trought all RegSelectElementUints
257  (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
258  }
259  for(it = m_posdataList.begin();it != m_posdataList.end(); ++it){ // runs trought all RegSelectElementUints
260  (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
261  }
262  }
263 
264  if (TYPE==TILE){
265  negbarrelbeg = outset.upper_bound(0x3f);
266  negbarrelend = outset.lower_bound(0x80);
267  for(itset = negbarrelbeg; itset != negbarrelend; ++itset){
268  outList.push_back(*itset);
269  }
270  for(itset = outset.begin(); itset != negbarrelbeg; ++itset){
271  outList.push_back(*itset);
272  }
273  for(itset = negbarrelend; itset != outset.end(); ++itset){
274  outList.push_back(*itset);
275  }
276  } else{
277  for(itset = outset.begin(); itset != outset.end(); ++itset){
278  outList.push_back(*itset);
279  }
280  }
281 
282 }
283 
285  double etaminIn, double etamaxIn,
286  double phiminIn, double phimaxIn,
287  std::vector<IdentifierHash>& outList) const {
288 
289  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
290 
291  std::list<RegSelectorMapElement>::const_iterator it;
292  std::set<IdentifierHash> outset;
293  std::set<IdentifierHash>::const_iterator itset;
294  bool posORneg;
295 
296 
297  if( etaminIn > 0 && etamaxIn > 0 ){ //search positive list to find TYPEID
298  posORneg = false; // it's POSITIVE
299  findPosition(typeinID,posORneg, it);
300  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
301  }
302  else if( etaminIn < 0 && etamaxIn < 0 ){ //search negative list to find TYPEID
303  posORneg = true; // it's NEGATIVE
304  findPosition(typeinID,posORneg, it);
305  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
306  }
307  else { //search both list to find TYPEID
308  posORneg = false;
309  findPosition(typeinID,posORneg, it);
310  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
311  posORneg = true;
312  findPosition(typeinID,posORneg, it);
313  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
314  }
315 
316  for(itset = outset.begin(); itset != outset.end(); ++itset){
317  outList.push_back(*itset);
318  }
319 }
320 
321 
322 
323 void RegSelectorMap::regionSelector( long layNumber,
324  double etaminIn, double etamaxIn,
325  double phiminIn, double phimaxIn,
326  std::vector<IdentifierHash>& outList) const {
327 
328  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
329 
330  std::list<RegSelectorMapElement>::const_iterator it, itEnd;
331  std::set<IdentifierHash> outset;
332  std::set<IdentifierHash>::const_iterator itset;
333  bool posORneg;
334 
335 
336  if( etaminIn > 0 && etamaxIn > 0 ){ //search positive list to find layNumber
337  posORneg = false; // it's POSITIVE
338  findPosition(layNumber,posORneg, it);
339  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
340  }
341  else if( etaminIn < 0 && etamaxIn < 0 ){ //search negative list to find layNumber
342  posORneg = true; // it's NEGATIVE
343  findPosition(layNumber,posORneg, it);
344  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
345  }
346 
347  // barrel
348  it = m_barreldataList.begin();
349  itEnd = m_barreldataList.end();
350 
351  while(it != itEnd) {
352  if( (*it).layerDiskNumber() == layNumber ) {
353  (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
354  break;
355  }
356  ++it;
357  }
358 
359  for(itset = outset.begin(); itset != outset.end(); ++itset){
360  outList.push_back(*itset);
361  }
362 
363 }
364 
366 
367  StatusCode sc = StatusCode::SUCCESS;
368 
369  // use path resolver to find full path to file
370  std::string unresolvedFileName(filename);
371  std::string fullFileName = PathResolver::find_file (unresolvedFileName, "DATAPATH");
372  //log << MSG::DEBUG << "PathResolver found " << fullFileName << endmsg;
373  if (fullFileName == "") {
374  //log << MSG::FATAL << "Could not find input file in DATAPATH" << unresolvedFileName<< endmsg;
375  std::cerr << "RegSelectorMap: FATAL: Could not find input file in DATAPATH" << unresolvedFileName<< std::endl;
376  return StatusCode::FAILURE;
377  }
378  //std::cout << "RegSelectDataIdentifierHash::read fullFileName=" << fullFileName << std::endl;
379 
380  switch(type){
381  case TILE:
382  sc = readTILE(fullFileName.c_str());
383  break;
384  default:
387  // ATH_MSG_ERROR( "Don't EVER use this code for anything except the Tile Calorimeter" );
388  sc = StatusCode::FAILURE;
389  }
390  return sc;
391 }
392 
393 void RegSelectorMap::summaryDataFile(std::list<RegSelectorMapElement> &dataList){
395 
396  for(it = dataList.begin(); it != dataList.end(); ++it){ // runs through entire list
397  std::cout << "position: " << (*it).layerDiskPosition() << " number: " << (*it).layerDiskNumber() << std::endl;
398  std::cout << "etamin: " << m_etaminDet << " etamax: " << m_etamaxDet << std::endl;
399  std::cout << "phimin: " << m_phiminDet << " phimax: " << m_phimaxDet << std::endl;
400  std::cout << "hashId: ";
401  std::vector<IdentifierHash> aux = (*it).hashId();
402  for(std::vector<IdentifierHash>::iterator i = aux.begin(); i != aux.end(); ++i)
403  std::cout << (*i) << " ";
404  std::cout << std::endl;
405  std::cin.get();
406  }
407 }
408 
409 
410 
411 void RegSelectorMap::verifyInputsInternal( double &etaminIn, double &etamaxIn,
412  double &phiminIn, double &phimaxIn ) const {
413 
414  while (phiminIn > 2*M_PI) phiminIn -= 2*M_PI;
415  while (phiminIn < 0 ) phiminIn += 2*M_PI;
416  while (phimaxIn > 2*M_PI) phimaxIn -= 2*M_PI;
417  while (phimaxIn < 0 ) phimaxIn += 2*M_PI;
418 
419  if( ( (etaminIn < m_etaminDet) && (etamaxIn < m_etaminDet) ) ||
420  ( (etaminIn > m_etamaxDet) && (etamaxIn > m_etamaxDet) ) ){
421  }
422  else{
423  if( (etaminIn < m_etaminDet) && (etamaxIn > m_etaminDet) ){
424  etaminIn = m_etaminDet;
425  }
426  if( (etamaxIn > m_etamaxDet) && (etaminIn < m_etamaxDet) ){
427  etamaxIn = m_etamaxDet;
428  }
429  }
430 
431 }
432 
433 
434 StatusCode RegSelectorMap::verifyInputs( double &etaminIn, double &etamaxIn,
435  double &phiminIn, double &phimaxIn ) const {
436  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
437  return StatusCode::SUCCESS;
438 }
439 
440 
441 
442 StatusCode RegSelectorMap::verifyInputsMinusPi( double &etaminIn, double &etamaxIn,
443  double &phiminIn, double &phimaxIn) const {
444 
445  StatusCode sc = StatusCode::SUCCESS;
446 
447  while (phiminIn > M_PI) phiminIn -= 2*M_PI;
448  while (phiminIn < -M_PI) phiminIn += 2*M_PI;
449  while (phimaxIn > M_PI) phimaxIn -= 2*M_PI;
450  while (phimaxIn < -M_PI) phimaxIn += 2*M_PI;
451 
452  if( ( (etaminIn < m_etaminDet) && (etamaxIn < m_etaminDet) ) ||
453  ( (etaminIn > m_etamaxDet) && (etamaxIn > m_etamaxDet) ) ){
454  //sc = StatusCode::FAILURE;
455  }
456  else{
457  if( (etaminIn < m_etaminDet) && (etamaxIn > m_etaminDet) ){
458  etaminIn = m_etaminDet;
459  }
460  if( (etamaxIn > m_etamaxDet) && (etaminIn < m_etamaxDet) ){
461  etamaxIn = m_etamaxDet;
462  }
463  }
464 
465  return sc;
466 }
467 
468 void RegSelectorMap::verifyOutput( double etaminIn, double etamaxIn,
469  double phiminIn, double phimaxIn,
470  const std::vector<IdentifierHash>& outputIdlist) const {
471 
472  std::vector<IdentifierHash> outset;
473  int i;
474  unsigned int j;
475  double etamin, etamax, phimin, phimax;
476  int vecsize = m_etamin.size();
477  for( i= 0; i < vecsize; ++i){
478  if(m_etamin[i] > m_etamax[i]){
479  etamin = m_etamax[i]; etamax = m_etamin[i];
480  }
481  else{
482  etamin = m_etamin[i]; etamax = m_etamax[i];
483  }
484  if(m_phimin[i] > m_phimax[i]){
485  phimin = m_phimin[i];
486  phimax = phimaxValue();
487  if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
488  if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
489  outset.push_back(m_hashId[i]);
490  }
491  }
492  phimin = phiminValue();
493  phimax = m_phimax[i];
494  if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
495  if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
496  outset.push_back(m_hashId[i]);
497  }
498  }
499  }
500  else{
501  phimin = m_phimin[i]; phimax = m_phimax[i];
502  if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
503  if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
504  outset.push_back(m_hashId[i]);
505  }
506  }
507  }
508  }
509  if(outset == outputIdlist)
510  std::cout << "equal vectors " << std::endl;
511  std::cout << "desired output ";
512  for( j=0; j < outset.size(); ++j)
513  std::cout << std::dec << outset[j] << " ";
514  std::cout << std::endl;
515  std::cout << "obtained output ";
516  for( j=0; j < outputIdlist.size(); ++j)
517  std::cout << std::dec << outputIdlist[j] << " ";
518  std::cout << std::endl;
519 }
520 
521 
522 void RegSelectorMap::regionSelectorRobIdUint( double etaminIn, double etamaxIn,
523  double phiminIn, double phimaxIn,
524  std::vector<uint32_t>& outList) const {
525 
526  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
527 
528  std::set<uint32_t> outset;
529  int i;
530  unsigned int j;
531  double etamin, etamax, phimin, phimax;
532  std::vector<uint32_t> outvec;
533 
534  int vecsize = m_etamin.size();
535  for( i= 0; i < vecsize; ++i){
536  if(m_etamin[i] > m_etamax[i]){
537  etamin = m_etamax[i]; etamax = m_etamin[i];
538  }
539  else{
540  etamin = m_etamin[i]; etamax = m_etamax[i];
541  }
542  if(m_phimin[i] > m_phimax[i]){
543  phimin = m_phimin[i];
544  phimax = phimaxValue();
545  if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
546  if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
547  outset.insert(m_robId[i]);
548  }
549  }
550  phimin = phiminValue();
551  phimax = m_phimax[i];
552  if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
553  if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
554  outset.insert(m_robId[i]);
555  }
556  }
557  }
558  else{
559  phimin = m_phimin[i]; phimax = m_phimax[i];
560  if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
561  if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
562  outset.insert(m_robId[i]);
563  }
564  }
565  }
566  }
567 
569  for(it = outset.begin(); it != outset.end(); ++it)
570  outvec.push_back(*it);
571 
572  if(outvec == outList)
573  std::cout << "equal vectors " << std::endl;
574  std::cout << "desired output ";
575  for( j=0; j < outvec.size(); ++j)
576  std::cout << std::dec << outvec[j] << " ";
577  std::cout << std::endl;
578  std::cout << "obtained output ";
579  for( j=0; j < outList.size(); ++j)
580  std::cout << std::dec << outList[j] << " ";
581  std::cout << std::endl;
582 }
583 
584 
585 
586 
588  double etaminIn, double etamaxIn,
589  double phiminIn, double phimaxIn,
590  std::vector<uint32_t>& outList) const {
591 
592  verifyInputsInternal( etaminIn, etamaxIn, phiminIn, phimaxIn );
593 
594  std::set<uint32_t> outset;
595  std::list<RegSelectorMapElement>::const_iterator it, itEnd;
596  std::set<uint32_t>::const_iterator itset;
597  bool posORneg;
598 
599 
600  if( etaminIn > 0 && etamaxIn > 0 ){ //search positive list to find layNumber
601  posORneg = false; // it's POSITIVE
602  findPosition(layNumber,posORneg, it);
603  (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
604  }
605  else if( etaminIn < 0 && etamaxIn < 0 ){ //search negative list to find layNumber
606  posORneg = true; // it's NEGATIVE
607  findPosition(layNumber,posORneg, it);
608  (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
609  }
610 
611  // barrel
612  it = m_barreldataList.begin();
613  itEnd = m_barreldataList.end();
614 
615  while(it != itEnd) {
616  if( (*it).layerDiskNumber() == layNumber ) {
617  (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
618  break;
619  }
620  ++it;
621  }
622 
623  for(itset = outset.begin(); itset != outset.end(); ++itset){
624  outList.push_back(*itset);
625  }
626 
627 }
628 
629 void RegSelectorMap::findPosition( TYPEID typeinID, bool posORneg,
630  std::list<RegSelectorMapElement>::const_iterator& it) const {
631 
632  std::list<RegSelectorMapElement>::const_iterator itPos, itNeg, itEnd;
633 
634  itPos = m_posdataList.begin(); // positioning iterator at the begining of POSITIVE eta value list
635  // each element of this list is a EtaPhiMap of a MDT chamber
636  itNeg = m_negdataList.begin(); // NEGATIVE eta value list of MDT chambers
637 
638  if(posORneg == false){ // it's positive
639  it = itPos;
640  itEnd = m_posdataList.end();
641  }
642  else{
643  it = itNeg;
644  itEnd = m_negdataList.end();
645  }
646 
651 
652  while(it != itEnd) {
653  if( (*it).layerDiskNumber() == typeinID )
654  break;
655  ++it;
656  }
657 
658 }
659 
660 void RegSelectorMap::findPosition( long layNumber, bool posORneg,
661  std::list<RegSelectorMapElement>::const_iterator& it) const {
662 
663  std::list<RegSelectorMapElement>::const_iterator itPos, itNeg, itEnd;
664 
665  itPos = m_posdataList.begin(); // positioning iterator at the begining of POSITIVE eta value list
666  itNeg = m_negdataList.begin(); // NEGATIVE eta value list
667 
668  if(posORneg == false){ // it's positive
669  it = itPos;
670  itEnd = m_posdataList.end();
671  }
672  else{
673  it = itNeg;
674  itEnd = m_negdataList.end();
675  }
676 
677  while(it != itEnd) {
678  if( (*it).layerDiskNumber() == layNumber )
679  break;
680  ++it;
681  }
682 
683 }
684 
685 void RegSelectorMap::findMaxMinValues(std::list<RegSelectorMapElement> &dataList) {
686 
688 
689  for(it = dataList.begin(); it != dataList.end(); ++it){ // runs through entire list
690  if( (*it).etaminElem() < m_etaminDet )
691  m_etaminDet = (*it).etaminElem();
692  if( (*it).etamaxElem() > m_etamaxDet )
693  m_etamaxDet = (*it).etamaxElem();
694  if( (*it).phiminElem() < m_phiminDet )
695  m_phiminDet = (*it).phiminElem();
696  if( (*it).phimaxElem() > m_phimaxDet )
697  m_phimaxDet = (*it).phimaxElem();
698  }
699 
700 }
701 
702 RegSelectorMapElement RegSelectorMap::creatingElement( int& positionIn, int& numberIn, //????
703  double& etaminIn, double& etamaxIn,
704  double& phiminIn, double& phimaxIn,
705  IdentifierHash& hashIdIn, uint32_t& robIdIn ) {
706  RegSelectorMapElement newElement;
707 
708  newElement.additem( hashIdIn,
709  etaminIn, etamaxIn,
710  phiminIn, phimaxIn,
711  numberIn, positionIn, robIdIn );
712 
713  return newElement;
714 }
715 
716 void RegSelectorMap::insertList(std::list<RegSelectorMapElement> &dataList, int positionIn,
717  int numberIn, double etaminIn, double etamaxIn,
718  double phiminIn, double phimaxIn,
719  IdentifierHash hashIdIn, uint32_t& robIdIn){
720  bool flag = false;
721  RegSelectorMapElement newElement;
723 
724  for(it = dataList.begin(); it != dataList.end(); ++it){ // runs through entire positive list
725  if( positionIn == (*it).layerDiskPosition() ){ // position already exist
726  flag = false;
727  if( numberIn == (*it).layerDiskNumber() ) {// number already exist
728  (*it).additem( hashIdIn, etaminIn, etamaxIn,
729  phiminIn, phimaxIn, numberIn, positionIn, robIdIn );
730  break;
731  }
732  else
733  flag = true;
734  }
735  else // position & number doesn't exist
736  flag = true;
737  } // end for
738 
739  if(flag == true || dataList.size() == 0){ // inserting new element
740  newElement = creatingElement(positionIn, numberIn,
741  etaminIn,etamaxIn,
742  phiminIn, phimaxIn,
743  hashIdIn, robIdIn);
744  dataList.push_back( std::move(newElement) );
745  }
746 }
747 
748 void RegSelectorMap::insertDataElement(int& positionIn, int& numberIn, double& etaminIn, double& etamaxIn,
749  double& phiminIn, double& phimaxIn, IdentifierHash& hashIdIn, uint32_t& robIdIn){
750  if(positionIn > 0 ){ // list of positive values
751  insertList(m_posdataList, positionIn, numberIn,
752  etaminIn, etamaxIn, phiminIn, phimaxIn, hashIdIn, robIdIn);
753  }
754  else if(positionIn < 0){ // list of negative values
755  insertList(m_negdataList, positionIn, numberIn,
756  etaminIn, etamaxIn, phiminIn, phimaxIn, hashIdIn, robIdIn);
757  }
758  else if(positionIn == 0){
759  insertList(m_barreldataList, positionIn, numberIn,
760  etaminIn, etamaxIn, phiminIn, phimaxIn, hashIdIn, robIdIn);
761  }
762 }
763 
764 void RegSelectorMap::writeLine(int barORend, int layORdsk, IdentifierHash hashId, uint32_t robId,
765  double emin, double emax,
766  double pmin, double pmax){
767 
768  m_barORend.push_back(barORend);
769  m_layORdsk.push_back(layORdsk);
770  m_hashId.push_back(hashId);
771  m_robId.push_back(robId);
772  m_etamin.push_back(emin);
773  m_etamax.push_back(emax);
774  m_phimin.push_back(pmin);
775  m_phimax.push_back(pmax);
776 }
777 
779  StatusCode sc = StatusCode::SUCCESS;
780  char buffer_[256];
781  char *buffer = buffer_;
782  int barORend =0, layORwhe =0;
783  IdentifierHash hashId;
784  double emin, emax, pmin, pmax;
785  uint32_t robid, collid;
786 
787  std::ifstream fin(filename);
788  if(fin.bad()){ //Test if the file failed:
789  sc = StatusCode::FAILURE;
790  return sc;
791  }
792  fin.getline(buffer,128,'\n');
793  while (fin.getline(buffer, 128, '\n')){
794  if (strncmp(buffer,"#",1)!=0){
795  sscanf(buffer, "%x %x %x %lf %lf %lf %lf", &robid, &collid, (unsigned int*)&hashId, &emin, &emax, &pmin, &pmax);
796  writeLine(barORend, layORwhe, hashId, robid, emin, emax, pmin, pmax);
797  }
798  }
799  fin.close();
800 
801  return sc;
802 }
803 
804 
805 
807  double *etaMin, double *etaMax,
808  double *phiMin, double *phiMax) const {
809 
810  (*etaMin) = m_etamin[hashId];
811  (*etaMax) = m_etamax[hashId];
812  (*phiMin) = m_phimin[hashId];
813  (*phiMax) = m_phimax[hashId];
814 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
RegSelectorMap::phimaxValue
double phimaxValue(void) const
Definition: RegSelectorMap.cxx:77
RegSelectorMap::read
StatusCode read(const char *filename, DETID type)
Definition: RegSelectorMap.cxx:365
RegSelectorMap::phiminValue
double phiminValue(void) const
Definition: RegSelectorMap.cxx:73
RegSelectorMap::writeLine
void writeLine(int barORend, int layORdsk, IdentifierHash hashId, uint32_t robId, double emin, double emax, double pmin, double pmax)
Definition: RegSelectorMap.cxx:764
RegSelectorMap::etaminValue
double etaminValue(void) const
the rest of the class starts here
Definition: RegSelectorMap.cxx:65
RegionSelectorLUT::layerDiskPosition
int layerDiskPosition(int hashId) const
Definition: RegionSelectorLUT.cxx:32
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IRoiDescriptor::etaMinus
virtual double etaMinus() const =0
RegSelectorMap::insertList
void insertList(std::list< RegSelectorMapElement > &dataList, int positionIn, int numberIn, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, IdentifierHash hashIdIn, uint32_t &robIdIn)
Definition: RegSelectorMap.cxx:716
RegSelectorMap::etamaxValue
double etamaxValue(void) const
Definition: RegSelectorMap.cxx:69
RegSelectorMapElement
Definition: RegSelectorMapElement.h:17
RegSelectorMap::hashIdOut
const std::vector< IdentifierHash > & hashIdOut(void) const
Definition: RegSelectorMap.cxx:81
RegSelectorMap::getEtaPhi
void getEtaPhi(IdentifierHash hashId, double *etaMin, double *etaMax, double *phiMin, double *phiMax) const
Definition: RegSelectorMap.cxx:806
RegSelectorMap::m_barORend
std::vector< int > m_barORend
Definition: RegSelectorMap.h:152
skel.it
it
Definition: skel.GENtoEVGEN.py:407
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
RegionSelectorLUT::maxHash
unsigned int maxHash(void) const
Definition: RegionSelectorLUT.cxx:68
IRoiDescriptor::etaPlus
virtual double etaPlus() const =0
RegionSelectorLUT::etaMin
double etaMin(int hashId) const
Definition: RegionSelectorLUT.cxx:40
RegSelectorMap::m_phimaxDet
double m_phimaxDet
Definition: RegSelectorMap.h:164
RegSelectorMap::m_posdataList
std::list< RegSelectorMapElement > m_posdataList
Definition: RegSelectorMap.h:150
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
RegSelectorMapElement::additem
void additem(const IdentifierHash hashId, const double etaMin, const double etaMax, const double phiMin, const double phiMax, const int layerDiskNumber, const int layerDiskPosition, const uint32_t robId)
Definition: RegSelectorMapElement.cxx:191
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
RegSelectorMap::verifyInputsMinusPi
StatusCode verifyInputsMinusPi(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
Definition: RegSelectorMap.cxx:442
RegSelectorMap::m_layORdsk
std::vector< int > m_layORdsk
Definition: RegSelectorMap.h:152
DETID
DETID
An enum to define subdetector names.
Definition: RegSelEnums.h:23
RegionSelectorLUT::phiMax
double phiMax(int hashId) const
Definition: RegionSelectorLUT.cxx:52
RegSelectorMap::addLut
void addLut(const RegionSelectorLUT *detLut)
Definition: RegSelectorMap.cxx:203
RegSelectorMap::HashIDList_internal
virtual void HashIDList_internal(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const
internal lookup table access for full interface ...
Definition: RegSelectorMap.cxx:40
RegSelectorMap::layORdskOut
const std::vector< int > & layORdskOut(void) const
Definition: RegSelectorMap.cxx:93
RegSelectorMap::etaMinOut
const std::vector< double > & etaMinOut(void) const
Definition: RegSelectorMap.cxx:97
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:11
lumiFormat.i
int i
Definition: lumiFormat.py:85
RegSelectorMap::creatingElement
RegSelectorMapElement creatingElement(int &positionIn, int &numberIn, double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn, IdentifierHash &hashIdIn, uint32_t &robId)
Definition: RegSelectorMap.cxx:702
RegSelectorMap::barORendOut
const std::vector< int > & barORendOut(void) const
Definition: RegSelectorMap.cxx:89
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
master.flag
bool flag
Definition: master.py:29
RegSelectorMap::ROBIDList_internal
virtual void ROBIDList_internal(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const
Rob identifier methods.
Definition: RegSelectorMap.cxx:52
IRoiDescriptor::phiMinus
virtual double phiMinus() const =0
RegSelectorMap::phiMinOut
const std::vector< double > & phiMinOut(void) const
Definition: RegSelectorMap.cxx:105
RegSelectorMap::ROBIDList
virtual void ROBIDList(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const override
Rob identifier methods.
Definition: RegSelectorMap.cxx:28
TYPEID
TYPEID
An enum to define Muon chambers names.
Definition: RegSelEnums.h:9
IRoiDescriptor::phiPlus
virtual double phiPlus() const =0
extreme phi values
RegSelectorMap.h
TYPE
#define TYPE(CODE, TYP, IOTYP)
RegSelectorMap::regionSelector
void regionSelector(DETID TYPE, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< IdentifierHash > &outList) const
Definition: RegSelectorMap.cxx:220
RegSelectorMap::m_etamin
std::vector< double > m_etamin
Definition: RegSelectorMap.h:158
RegionSelectorLUT::robId
int robId(int hashId) const
Definition: RegionSelectorLUT.cxx:60
PathResolver.h
RegSelectorMap::m_etamaxDet
double m_etamaxDet
Definition: RegSelectorMap.h:162
RegSelectorMap::verifyInputsInternal
void verifyInputsInternal(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
Definition: RegSelectorMap.cxx:411
RegSelectorMap::phiMaxOut
const std::vector< double > & phiMaxOut(void) const
Definition: RegSelectorMap.cxx:109
RegionSelectorLUT::layerDiskNumber
int layerDiskNumber(int hashId) const
Definition: RegionSelectorLUT.cxx:36
RegSelectorMap::insertDataElement
void insertDataElement(int &positionIn, int &numberIn, double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn, IdentifierHash &hashIdIn, uint32_t &robIdIn)
Definition: RegSelectorMap.cxx:748
TILE
@ TILE
Definition: RegSelEnums.h:30
RegSelectorMap::m_etaminDet
double m_etaminDet
Definition: RegSelectorMap.h:162
RegSelectorMap::m_barreldataList
std::list< RegSelectorMapElement > m_barreldataList
Definition: RegSelectorMap.h:150
RegSelectorMap::m_etamax
std::vector< double > m_etamax
Definition: RegSelectorMap.h:158
RegSelectorMap::m_phimin
std::vector< double > m_phimin
Definition: RegSelectorMap.h:160
RegionSelectorLUT::etaMax
double etaMax(int hashId) const
Definition: RegionSelectorLUT.cxx:44
RegSelectorMap::m_phiminDet
double m_phiminDet
Definition: RegSelectorMap.h:164
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
RegSelectorMap::etaMaxOut
const std::vector< double > & etaMaxOut(void) const
Definition: RegSelectorMap.cxx:101
RegSelectorMap::verifyOutput
void verifyOutput(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, const std::vector< IdentifierHash > &outputIdlist) const
Definition: RegSelectorMap.cxx:468
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:220
RegSelectorMap::findPosition
void findPosition(TYPEID typeinID, bool posORneg, std::list< RegSelectorMapElement >::const_iterator &it) const
Definition: RegSelectorMap.cxx:629
zebraShift.outList
list outList
Definition: zebraShift.py:103
RegSelectorMap::m_robId
std::vector< uint32_t > m_robId
Definition: RegSelectorMap.h:156
IRoiDescriptor::isFullscan
virtual bool isFullscan() const =0
is this a full detector RoI?
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:23
RegSelectorMap::HashIDList
virtual void HashIDList(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const override
implementation of the IRegSelUT interface - intentionally inlined
Definition: RegSelectorMap.cxx:18
compute_lumi.fin
fin
Definition: compute_lumi.py:19
RegSelectorMap::findMaxMinValues
void findMaxMinValues(std::list< RegSelectorMapElement > &dataList)
Definition: RegSelectorMap.cxx:685
RegSelectorMap::m_negdataList
std::list< RegSelectorMapElement > m_negdataList
Definition: RegSelectorMap.h:150
RegSelectorMap::summaryDataFile
void summaryDataFile(std::list< RegSelectorMapElement > &dataList)
Definition: RegSelectorMap.cxx:393
RegSelectorMap::robIdOut
const std::vector< uint32_t > & robIdOut(void) const
Definition: RegSelectorMap.cxx:85
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
RegSelectorMap::readTILE
StatusCode readTILE(const char *filename)
Definition: RegSelectorMap.cxx:778
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
RegSelectorMap::regionSelectorRobIdUint
void regionSelectorRobIdUint(DETID TYPE, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< uint32_t > &outList) const
Definition: RegSelectorMap.cxx:139
RegionSelectorLUT::hashId
int hashId(int value) const
Definition: RegionSelectorLUT.cxx:64
RegionSelectorLUT
Definition: RegionSelectorLUT.h:14
RegSelectorMap::m_hashId
std::vector< IdentifierHash > m_hashId
Definition: RegSelectorMap.h:154
RegSelectorMap::m_phimax
std::vector< double > m_phimax
Definition: RegSelectorMap.h:160
RegionSelectorLUT::phiMin
double phiMin(int hashId) const
Definition: RegionSelectorLUT.cxx:48
RegSelectorMap::verifyInputs
StatusCode verifyInputs(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
Definition: RegSelectorMap.cxx:434
RegSelectorMap::mountDataStruct
void mountDataStruct(void)
Definition: RegSelectorMap.cxx:113