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