ATLAS Offline Software
RegSelectorHashMap.h
Go to the documentation of this file.
1 // emacs: this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef REGSELECTORHASHMAP_H
7 #define REGSELECTORHASHMAP_H
8 
9 // Includes --------------------------------------------------------------
10 #include "RegSelectorMapElement.h"
11 #include "RegionSelectorLUT.h"
13 #include "GaudiKernel/StatusCode.h"
14 
16 
17 #include <vector>
18 #include <list>
19 #include <set>
20 #include <cstdint>
21 
22 class RegionSelectorLUT;
23 
24 #define INITHASH 30000 // nonexistent hashID number (init value)
25 
26 struct equalsUint{
27  bool operator() (uint32_t i, uint32_t j) const{
28  return i==j;
29  }
30 };
31 
32 struct equals{
33  bool operator() (int i, int j) const{
34  return i==j;
35  }
36 };
37 
38 
39 // Class RegSelectorHashMap ----------------------------------------------------
40 class RegSelectorHashMap : virtual public IRegSelLUT {
41 
42 public:
43 
45 
47 
48  virtual void HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const override;
49 
50  virtual void HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const override;
51 
53 
54  virtual void ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const override;
55 
56  virtual void ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const override;
57 
58  virtual ~RegSelectorHashMap() override = default;
59 
60 public:
61 
62  double etaminValue() const ;
63  double etamaxValue() const ;
64  double phiminValue() const ;
65  double phimaxValue() const ;
66 
67  const std::vector<double>& etaMinOut(void) const ;
68  const std::vector<double>& etaMaxOut(void) const ;
69  const std::vector<double>& phiMinOut(void) const ;
70  const std::vector<double>& phiMaxOut(void) const ;
71 
72  void mountDataStruct(void);
73 
74  const std::vector<IdentifierHash>& hashIdOut(void) const ;
75  const std::vector<std::vector<uint32_t> >& robIdOut(void) const ;
76  const std::vector<int>& sampleOut(void) const ;
77  const std::vector<int>& layerOut(void) const ;
78 
79  void regionSelectorRobIdUint(double etaminIn, double etamaxIn,
80  double phiminIn, double phimaxIn,
81  std::vector<uint32_t>& outRobIDList) const;
82 
83  void regionSelectorRobIdUint(int sampling,
84  double etaminIn, double etamaxIn,
85  double phiminIn, double phimaxIn,
86  std::vector<uint32_t>& outRobIDList) const;
87 
88  void regionSelector(double etaminIn, double etamaxIn,
89  double phiminIn, double phimaxIn,
90  std::vector<IdentifierHash> & outList) const;
91 
92  void regionSelector(int sampling,
93  double etaminIn, double etamaxIn,
94  double phiminIn, double phimaxIn,
95  std::vector<IdentifierHash> & outList) const;
96 
97  void initvar(void);
98  StatusCode read(const char *filename);
99  void addLut(const RegionSelectorLUT *detLut);
100  void summaryDataFile(std::list<RegSelectorMapElement> &dataList);
101  void verifyInputs(double &etaminIn, double &etamaxIn,double &phiminIn, double &phimaxIn) const;
102 
103  void verifyROBIDOutput(double etaminIn, double etamaxIn,
104  double phiminIn, double phimaxIn,
105  std::vector<uint32_t>& outputIdlist) const ;
106 
107  void verifyROBIDOutput(int sampling,
108  double etaminIn, double etamaxIn,
109  double phiminIn, double phimaxIn,
110  std::vector<uint32_t>& outputIdlist) const;
111 
112  void verifyOutput(double etaminIn, double etamaxIn,
113  double phiminIn, double phimaxIn,
114  std::vector<IdentifierHash>* outputIdlist) const;
115 
116  void verifyOutput(int sampling, double etaminIn, double etamaxIn,
117  double phiminIn, double phimaxIn,
118  std::vector<IdentifierHash>* outputIdlist) const;
119 
120  void getEtaPhi(IdentifierHash hashId,
121  double *etaMin, double *etaMax,
122  double *phiMin, double *phiMax) const;
123 
124  void DisableMissingROBs(const std::vector<uint32_t>& vec);
125 
126 
127  private:
128 
130 
131  std::list<RegSelectorMapElement> m_dataList;
132  std::vector<int> m_sample, m_layer;
133  std::vector<IdentifierHash> m_hashId;
134  std::vector<double> m_etamin, m_etamax;
135  std::vector<double> m_phimin, m_phimax;
136  std::vector<std::vector<uint32_t> > m_robId;
142  std::vector<std::vector<uint32_t> > m_robIDMap;
143  std::vector<IdentifierHash> m_hashIDMap;
144 
145  void populateMatrix(int iPage,IdentifierHash value);
146  void populateMatrixRobId(int iPage, uint32_t value);
147  void initMatrix(void);
148  void writeLine(const int& layer, const IdentifierHash& hashId, const std::vector<uint32_t>& robId, const double& emin,
149  const double& emax, const double& pmin, const double& pmax, const int& samp);
150  int MyRound(double pdValue);
151  void regionSelectorIN(const int& sampling, const double& etaminIn,
152  const double& etamaxIn, const double& phiminIn, const double& phimaxIn,
153  std::vector<IdentifierHash>* outListIH ) const;
154 
155  void regionSelectorINROB(const int& sampling, const double& etaminIn,
156  const double& etamaxIn, const double& phiminIn, const double& phimaxIn,
157  std::vector<uint32_t>* outList) const;
158 
159  void phiCondition(const std::vector<IdentifierHash>& identifier, int i,
160  double etaminIn, double etamaxIn,
161  double phiminIn, double phimaxIn,
162  double etamin, double etamax,
163  std::set<IdentifierHash>* outset) const;
164 
165  void phiConditionRobId(const std::vector<std::vector<uint32_t> >& identifier, int i,
166  double etaminIn, double etamaxIn,
167  double phiminIn, double phimaxIn,
168  double etamin, double etamax,
169  std::set<uint32_t>* outset) const;
170 
171  //LRSIdentHash
172  void findIdentifier(std::vector<IdentifierHash> &auxsetIH,
173  const int iXBeg, const int iXEnd,
174  const int iYBeg, const int iYEnd,
175  const int iPage) const;
176 
177  //LRSUint
178  void findIdentifierROB(std::vector<uint32_t> &auxset,
179  const int iXBeg, const int iXEnd,
180  const int iYBeg, const int iYEnd,
181  const int iPage) const;
182 
183 
184 protected:
185 
187 
189 
190  virtual void HashIDList_internal( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const;
191 
192  virtual void HashIDList_internal( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const;
193 
195 
196  virtual void ROBIDList_internal( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const;
197 
198  virtual void ROBIDList_internal( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const;
199 
200 
201 };
202 #endif
203 
204 
205 
206 
RegSelectorHashMap::sampleOut
const std::vector< int > & sampleOut(void) const
Definition: RegSelectorHashMap.cxx:94
RegSelectorHashMap::m_hashId
std::vector< IdentifierHash > m_hashId
Definition: RegSelectorHashMap.h:133
RegSelectorHashMap::verifyROBIDOutput
void verifyROBIDOutput(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< uint32_t > &outputIdlist) const
Definition: RegSelectorHashMap.cxx:719
RegSelectorHashMap::m_iColumns
int m_iColumns
Definition: RegSelectorHashMap.h:140
RegSelectorHashMap::m_phiminDet
double m_phiminDet
Definition: RegSelectorHashMap.h:138
RegSelectorHashMap::populateMatrix
void populateMatrix(int iPage, IdentifierHash value)
Definition: RegSelectorHashMap.cxx:227
RegionSelectorLUT.h
RegSelectorHashMap::findIdentifierROB
void findIdentifierROB(std::vector< uint32_t > &auxset, const int iXBeg, const int iXEnd, const int iYBeg, const int iYEnd, const int iPage) const
Definition: RegSelectorHashMap.cxx:993
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RegSelectorHashMap::ROBIDList_internal
virtual void ROBIDList_internal(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const
rob methods
Definition: RegSelectorHashMap.cxx:56
RegSelectorHashMap::populateMatrixRobId
void populateMatrixRobId(int iPage, uint32_t value)
Definition: RegSelectorHashMap.cxx:251
RegSelectorHashMap
Definition: RegSelectorHashMap.h:40
RegSelectorHashMap::layerOut
const std::vector< int > & layerOut(void) const
Definition: RegSelectorHashMap.cxx:98
RegSelectorHashMap::m_phimaxDet
double m_phimaxDet
Definition: RegSelectorHashMap.h:138
RegSelectorHashMap::etamaxValue
double etamaxValue() const
Definition: RegSelectorHashMap.cxx:74
RegSelectorHashMap::m_robId
std::vector< std::vector< uint32_t > > m_robId
Definition: RegSelectorHashMap.h:136
RegSelectorHashMap::addLut
void addLut(const RegionSelectorLUT *detLut)
Definition: RegSelectorHashMap.cxx:611
RegSelectorHashMap::regionSelectorIN
void regionSelectorIN(const int &sampling, const double &etaminIn, const double &etamaxIn, const double &phiminIn, const double &phimaxIn, std::vector< IdentifierHash > *outListIH) const
Definition: RegSelectorHashMap.cxx:305
RegSelectorHashMap::etaMaxOut
const std::vector< double > & etaMaxOut(void) const
Definition: RegSelectorHashMap.cxx:106
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
athena.value
value
Definition: athena.py:124
RegSelectorHashMap::ROBIDList
virtual void ROBIDList(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const override
rob methods
Definition: RegSelectorHashMap.cxx:30
RegSelectorHashMap::findIdentifier
void findIdentifier(std::vector< IdentifierHash > &auxsetIH, const int iXBeg, const int iXEnd, const int iYBeg, const int iYEnd, const int iPage) const
Definition: RegSelectorHashMap.cxx:971
RegSelectorHashMap::m_robIDMap
std::vector< std::vector< uint32_t > > m_robIDMap
Definition: RegSelectorHashMap.h:142
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
RegSelectorHashMap::hashIdOut
const std::vector< IdentifierHash > & hashIdOut(void) const
Definition: RegSelectorHashMap.cxx:86
RegSelectorHashMap::m_etamax
std::vector< double > m_etamax
Definition: RegSelectorHashMap.h:134
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
RegSelectorHashMap::getEtaPhi
void getEtaPhi(IdentifierHash hashId, double *etaMin, double *etaMax, double *phiMin, double *phiMax) const
Definition: RegSelectorHashMap.cxx:1019
equalsUint::operator()
bool operator()(uint32_t i, uint32_t j) const
Definition: RegSelectorHashMap.h:27
RegSelectorHashMap::m_etaminDet
double m_etaminDet
Definition: RegSelectorHashMap.h:137
RegSelectorHashMap::HashIDList_internal
virtual void HashIDList_internal(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const
internal implementation of the IRegSelUT interface
Definition: RegSelectorHashMap.cxx:44
RegSelectorHashMap::m_iLines
int m_iLines
Definition: RegSelectorHashMap.h:140
RegSelectorHashMap::initvar
void initvar(void)
Definition: RegSelectorHashMap.cxx:546
RegSelectorHashMap::m_stepMinPhi
double m_stepMinPhi
Definition: RegSelectorHashMap.h:129
equals::operator()
bool operator()(int i, int j) const
Definition: RegSelectorHashMap.h:33
RegSelectorHashMap::m_dataList
std::list< RegSelectorMapElement > m_dataList
Definition: RegSelectorHashMap.h:131
RegSelectorHashMap::m_phimax
std::vector< double > m_phimax
Definition: RegSelectorHashMap.h:135
RegSelectorHashMap::phimaxValue
double phimaxValue() const
Definition: RegSelectorHashMap.cxx:82
RegSelectorHashMap::HashIDList
virtual void HashIDList(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const override
implementation of the IRegSelUT interface
Definition: RegSelectorHashMap.cxx:20
RegSelectorHashMap::phiMinOut
const std::vector< double > & phiMinOut(void) const
Definition: RegSelectorHashMap.cxx:110
RegSelectorHashMap::regionSelectorINROB
void regionSelectorINROB(const int &sampling, const double &etaminIn, const double &etamaxIn, const double &phiminIn, const double &phimaxIn, std::vector< uint32_t > *outList) const
Definition: RegSelectorHashMap.cxx:382
RegSelectorHashMap::etaminValue
double etaminValue() const
rest of the class implementation
Definition: RegSelectorHashMap.cxx:70
RegSelectorHashMap::etaMinOut
const std::vector< double > & etaMinOut(void) const
Definition: RegSelectorHashMap.cxx:102
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
RegSelectorHashMap::m_etamaxDet
double m_etamaxDet
Definition: RegSelectorHashMap.h:137
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
RegSelectorHashMap::m_stepMinEta
double m_stepMinEta
Definition: RegSelectorHashMap.h:129
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
RegSelectorHashMap::m_sample
std::vector< int > m_sample
Definition: RegSelectorHashMap.h:132
RegSelectorHashMap::writeLine
void writeLine(const int &layer, const IdentifierHash &hashId, const std::vector< uint32_t > &robId, const double &emin, const double &emax, const double &pmin, const double &pmax, const int &samp)
Definition: RegSelectorHashMap.cxx:275
RegSelectorHashMap::verifyInputs
void verifyInputs(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
Definition: RegSelectorHashMap.cxx:690
equalsUint
Definition: RegSelectorHashMap.h:26
RegSelectorHashMap::DisableMissingROBs
void DisableMissingROBs(const std::vector< uint32_t > &vec)
Definition: RegSelectorHashMap.cxx:1029
RegSelectorHashMap::m_etamin
std::vector< double > m_etamin
Definition: RegSelectorHashMap.h:134
RegSelectorHashMap::m_readFromFile
bool m_readFromFile
Definition: RegSelectorHashMap.h:141
RegSelectorHashMap::m_phimin
std::vector< double > m_phimin
Definition: RegSelectorHashMap.h:135
IRegSelLUT.h
RegSelectorHashMap::m_layer
std::vector< int > m_layer
Definition: RegSelectorHashMap.h:132
IRegSelLUT
Definition: IRegSelLUT.h:26
RegSelectorHashMap::phiminValue
double phiminValue() const
Definition: RegSelectorHashMap.cxx:78
RegSelectorHashMap::phiCondition
void phiCondition(const std::vector< IdentifierHash > &identifier, int i, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, double etamin, double etamax, std::set< IdentifierHash > *outset) const
Definition: RegSelectorHashMap.cxx:462
RegSelectorHashMap::regionSelectorRobIdUint
void regionSelectorRobIdUint(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< uint32_t > &outRobIDList) const
Definition: RegSelectorHashMap.cxx:215
equals
Definition: RegSelectorHashMap.h:32
RegSelectorHashMap::verifyOutput
void verifyOutput(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< IdentifierHash > *outputIdlist) const
Definition: RegSelectorHashMap.cxx:850
RegSelectorHashMap::robIdOut
const std::vector< std::vector< uint32_t > > & robIdOut(void) const
Definition: RegSelectorHashMap.cxx:90
RegSelectorHashMap::phiMaxOut
const std::vector< double > & phiMaxOut(void) const
Definition: RegSelectorHashMap.cxx:114
RegSelectorHashMap::mountDataStruct
void mountDataStruct(void)
Definition: RegSelectorHashMap.cxx:118
RegSelectorMapElement.h
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
RegSelectorHashMap::read
StatusCode read(const char *filename)
Definition: RegSelectorHashMap.cxx:554
RegSelectorHashMap::initMatrix
void initMatrix(void)
Definition: RegSelectorHashMap.cxx:263
zebraShift.outList
list outList
Definition: zebraShift.py:103
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
RegSelectorHashMap::regionSelector
void regionSelector(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< IdentifierHash > &outList) const
Definition: RegSelectorHashMap.cxx:530
RegSelectorHashMap::phiConditionRobId
void phiConditionRobId(const std::vector< std::vector< uint32_t > > &identifier, int i, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, double etamin, double etamax, std::set< uint32_t > *outset) const
Definition: RegSelectorHashMap.cxx:496
RegSelectorHashMap::m_NumSamples
int m_NumSamples
Definition: RegSelectorHashMap.h:139
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
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
RegSelectorHashMap::MyRound
int MyRound(double pdValue)
Definition: RegSelectorHashMap.cxx:291
RegSelEnums.h
RegionSelectorLUT
Definition: RegionSelectorLUT.h:14
RegSelectorHashMap::~RegSelectorHashMap
virtual ~RegSelectorHashMap() override=default
RegSelectorHashMap::summaryDataFile
void summaryDataFile(std::list< RegSelectorMapElement > &dataList)
Definition: RegSelectorHashMap.cxx:675
RegSelectorHashMap::m_hashIDMap
std::vector< IdentifierHash > m_hashIDMap
Definition: RegSelectorHashMap.h:143