ATLAS Offline Software
RegSelectorMapElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <stdio.h>
8 #include <iostream>
9 
10 
12  m_position = 0;
13  m_number = 0;
14  m_etaminValue = 1000;
15  m_etamaxValue = -1000;
16  m_phiminValue = 1000;
17  m_phimaxValue = -1000;
18 }
19 
21  return m_position;
22 }
23 
25  return m_number;
26 }
27 
28 const std::vector<IdentifierHash>& RegSelectorMapElement::hashId() const {
29  return m_hashId;
30 }
31 
32 void RegSelectorMapElement::insertElementInVector(double etaminIn, double etamaxIn, double phiminIn,
33  double phimaxIn, IdentifierHash hashIdIn,
34  uint32_t robIdIn){
35  if(etaminIn > etamaxIn){
36  m_etamin.push_back(etamaxIn);
37  m_etamax.push_back(etaminIn);
38  }
39  else{
40  m_etamin.push_back(etaminIn);
41  m_etamax.push_back(etamaxIn);
42  }
43 
44  m_phimin.push_back(phiminIn);
45  m_phimax.push_back(phimaxIn);
46  m_hashId.push_back(hashIdIn);
47  m_robId.push_back(robIdIn);
48 }
49 
51  m_number = numberIn;
52 }
53 
55  m_position = positionIn;
56 }
57 
58 void RegSelectorMapElement::findHash( double etaminIn, double etamaxIn,
59  double phiminIn, double phimaxIn,
60  std::set<IdentifierHash> &outset ) const {
61  int vecsize = m_etamin.size();
62  double phiTmpMin = phiminElem();
63  double phiTmpMax = phimaxElem();
64 
65  for(int i= 0; i < vecsize; i++){
66  if( (etaminIn <= m_etamax[i]) && (etamaxIn >= m_etamin[i]) ){
67  if( m_phimin[i] < m_phimax[i]){
68  if( (phiminIn <= m_phimax[i]) && (phimaxIn >= m_phimin[i]) )
69  outset.insert(m_hashId[i]);
70  }
71  else{
72  if( ((phiminIn <= m_phimax[i]) && (phimaxIn >= phiTmpMin )) ||
73  ((phiminIn <= phiTmpMax ) && (phimaxIn >= m_phimin[i])) )
74  outset.insert(m_hashId[i]);
75  }
76  }
77  }
78 }
79 
80 void RegSelectorMapElement::findRobId( double etaminIn, double etamaxIn,
81  double phiminIn, double phimaxIn,
82  std::set<uint32_t>& outset ) const {
83  int vecsize = m_etamin.size();
84  double phiTmpMin = phiminElem();
85  double phiTmpMax = phimaxElem();
86 
87  for(int i= 0; i < vecsize; i++){
88  if( (etaminIn <= m_etamax[i]) && (etamaxIn >= m_etamin[i]) ){
89  if( m_phimin[i] < m_phimax[i]){
90  if( (phiminIn <= m_phimax[i]) && (phimaxIn >= m_phimin[i]) )
91  outset.insert( m_robId[i]);
92  }
93  else{
94  if( ((phiminIn <= m_phimax[i]) && (phimaxIn >= phiTmpMin )) ||
95  ((phiminIn <= phiTmpMax ) && (phimaxIn >= m_phimin[i])) )
96  outset.insert( m_robId[i]);
97  }
98  }
99  }
100 }
101 
102 double RegSelectorMapElement::etaMin( const IdentifierHash hashId ) const {
103  return m_etamin[ hashId ];
104 }
105 
107  return m_etamax[ hashId ];
108 }
109 
111  return m_phimin[ hashId ];
112 }
113 
115  return m_phimax[ hashId ];
116 }
117 
119  return m_etaminValue;
120 }
121 
123  return m_etamaxValue;
124 }
125 
143 
145  if(m_phiminValue < -M_PI/2)
146  m_phiminValue = -M_PI;
147  else
148  m_phiminValue = 0;
149  return m_phiminValue;
150 }
151 
153  if(m_phimaxValue > (3*M_PI)/2)
154  m_phimaxValue = 2*M_PI;
155  else
157  return m_phimaxValue;
158 }
159 
161  if(m_phiminValue < -M_PI/2)
162  return -M_PI;
163  else
164  return 0;
165 }
166 
168  if(m_phimaxValue > (3*M_PI)/2)
169  return 2*M_PI;
170  else
171  return M_PI;
172 }
173 
174 
176  m_etaminValue = 1000; m_etamaxValue = -1000;
177  m_phiminValue = 1000; m_phimaxValue = -1000;
178  int vecsize = m_etamin.size();
179  for(int i = 0; i < vecsize; i++){
180  if( m_etamin[i] < m_etaminValue )
182  if( m_etamax[i] > m_etamaxValue )
184  if( m_phimin[i] < m_phiminValue )
186  if( m_phimax[i] > m_phimaxValue )
188  }
189 }
190 
191 void RegSelectorMapElement::additem(const IdentifierHash hashId, const double etaMin,
192  const double etaMax, const double phiMin, const double phiMax,
193  const int layerDiskNumber, const int layerDiskPosition,
194  const uint32_t robId){
195 
199 }
200 
201 void RegSelectorMapElement::selection( double etaminIn, double etamaxIn,
202  double phiminIn, double phimaxIn,
203  std::set<IdentifierHash> &outset) const {
204  if(phiminIn > phimaxIn){
205  double tmp = phimaxElem();
206  findHash(etaminIn, etamaxIn, phiminIn, tmp, outset);
207  tmp = phiminElem();
208  findHash(etaminIn, etamaxIn, tmp, phimaxIn, outset);
209  }
210  else{
211  findHash(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
212  }
213 }
214 
215 void RegSelectorMapElement::selectionRobIdUint( double etaminIn, double etamaxIn,
216  double phiminIn, double phimaxIn,
217  std::set<uint32_t> &outset ) const {
218  if(phiminIn > phimaxIn){
219  double tmp = phimaxElem();
220  findRobId(etaminIn, etamaxIn, phiminIn, tmp, outset);
221  tmp = phiminElem();
222  findRobId(etaminIn, etamaxIn, tmp, phimaxIn, outset);
223  }
224  else{
225  findRobId(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
226  }
227 }
RegSelectorMapElement::hashId
const std::vector< IdentifierHash > & hashId() const
Definition: RegSelectorMapElement.cxx:28
RegSelectorMapElement::insertNumberElement
void insertNumberElement(int numberIn)
Definition: RegSelectorMapElement.cxx:50
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RegSelectorMapElement::etamaxElem
double etamaxElem() const
Definition: RegSelectorMapElement.cxx:122
RegSelectorMapElement::findRobId
void findRobId(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< uint32_t > &outset) const
Definition: RegSelectorMapElement.cxx:80
RegSelectorMapElement::findHash
void findHash(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< IdentifierHash > &outset) const
Definition: RegSelectorMapElement.cxx:58
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
RegSelectorMapElement::etaMax
double etaMax(IdentifierHash hashId) const
Definition: RegSelectorMapElement.cxx:106
RegSelectorMapElement::m_phimaxValue
double m_phimaxValue
Definition: RegSelectorMapElement.h:66
RegSelectorMapElement::m_number
int m_number
Definition: RegSelectorMapElement.h:60
RegSelectorMapElement::layerDiskNumber
int layerDiskNumber() const
Definition: RegSelectorMapElement.cxx:24
RegSelectorMapElement::insertPositionElement
void insertPositionElement(int position)
Definition: RegSelectorMapElement.cxx:54
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
lumiFormat.i
int i
Definition: lumiFormat.py:85
RegSelectorMapElement::layerDiskPosition
int layerDiskPosition() const
Definition: RegSelectorMapElement.cxx:20
RegSelectorMapElement::insertElementInVector
void insertElementInVector(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, IdentifierHash hashIdIn, uint32_t robIdIn)
Definition: RegSelectorMapElement.cxx:32
RegSelectorMapElement::m_etamaxValue
double m_etamaxValue
Definition: RegSelectorMapElement.h:65
RegSelectorMapElement::m_etaminValue
double m_etaminValue
Definition: RegSelectorMapElement.h:65
RegSelectorMapElement::findMaxMinElem
void findMaxMinElem(void)
Definition: RegSelectorMapElement.cxx:175
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
RegSelectorMapElement::selectionRobIdUint
void selectionRobIdUint(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< uint32_t > &outset) const
Definition: RegSelectorMapElement.cxx:215
RegSelectorMapElement::m_position
int m_position
Definition: RegSelectorMapElement.h:59
RegSelectorMapElement::m_etamin
std::vector< double > m_etamin
Definition: RegSelectorMapElement.h:61
RegSelectorMapElement.h
RegSelectorMapElement::m_phimin
std::vector< double > m_phimin
Definition: RegSelectorMapElement.h:62
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
RegSelectorMapElement::phiminElem
double phiminElem() const
Definition: RegSelectorMapElement.cxx:160
RegSelectorMapElement::m_phimax
std::vector< double > m_phimax
Definition: RegSelectorMapElement.h:62
RegSelectorMapElement::etaminElem
double etaminElem() const
Definition: RegSelectorMapElement.cxx:118
RegSelectorMapElement::m_robId
std::vector< uint32_t > m_robId
Definition: RegSelectorMapElement.h:64
RegSelectorMapElement::RegSelectorMapElement
RegSelectorMapElement()
Definition: RegSelectorMapElement.cxx:11
RegSelectorMapElement::m_hashId
std::vector< IdentifierHash > m_hashId
Definition: RegSelectorMapElement.h:63
RegSelectorMapElement::m_phiminValue
double m_phiminValue
Definition: RegSelectorMapElement.h:66
RegSelectorMapElement::etaMin
double etaMin(const IdentifierHash hashId) const
Definition: RegSelectorMapElement.cxx:102
RegSelectorMapElement::phiMin
double phiMin(IdentifierHash hashId) const
Definition: RegSelectorMapElement.cxx:110
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
RegSelectorMapElement::m_etamax
std::vector< double > m_etamax
Definition: RegSelectorMapElement.h:61
RegSelectorMapElement::selection
void selection(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< IdentifierHash > &outset) const
Definition: RegSelectorMapElement.cxx:201
RegSelectorMapElement::phiMax
double phiMax(IdentifierHash hashId) const
Definition: RegSelectorMapElement.cxx:114
RegSelectorMapElement::phimaxElem
double phimaxElem() const
Definition: RegSelectorMapElement.cxx:167