ATLAS Offline Software
RegSelSiLUT.h
Go to the documentation of this file.
1 
17 #ifndef REGSELSILUT_H
18 #define REGSELSILUT_H
19 
20 
21 #include <stdint.h>
22 
23 #include <vector>
24 #include <set>
25 #include <map>
26 #include <iostream>
27 #include <algorithm>
28 
29 #include "RegSelLUT/RegSelRoI.h"
30 #include "RegSelLUT/RegSelName.h"
31 #include "RegSelLUT/RegSelModule.h"
34 
35 
37 
38 
39 
40 
41 class RegSelSiLUT : public RegSelName, virtual public IRegSelLUT {
42 
43 public:
44 
45  typedef enum { UNDEF, PIXEL, SCT, TRT, FTK, MM, sTGC } DET;
46 
47 public:
48 
50  RegSelSiLUT(DET id);
51  RegSelSiLUT(const RegSelSiLUT& r);
52  RegSelSiLUT(const std::string& s);
53 
54  virtual ~RegSelSiLUT() override { }
55 
56 
59  virtual void HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const override;
60 
61  virtual void HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const override;
62 
64  virtual void ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const override;
65 
66  virtual void ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const override;
67 
68 
69 public:
70 
71  void addModule(RegSelModule& module) { m_modules.push_back(module); }
72  void addModules(const std::vector<RegSelModule>& m) { m_modules = m; }
73 
74  // Access the lookup table for data taking
75  const std::vector<RegSelModule>& getModules() const { return m_modules; }
76  bool getRoIData(const RegSelRoI& r, std::vector<const RegSelModule*>& modules) const;
77  bool getRoIData(const RegSelRoI& r, unsigned layer, std::vector<const RegSelModule*>& modules) const;
78  bool getRoIData(const RegSelRoI& r, unsigned subdetector, unsigned layer, std::vector<const RegSelModule*>& modules) const;
79 
80  bool getRoIData(const RegSelRoI& r, std::vector<const RegSelModule*>& modules, double x, double y) const;
81  bool getRoIData(const RegSelRoI& r, unsigned subdetector, unsigned layer, std::vector<const RegSelModule*>& modules, double x, double y) const;
82 
83 
84  DET ID() const { return m_ID; }
85 
86  // reset (empty) the lookup table, back to
87  // main module vector
88  void reset();
89 
90  // initialise (fill) the lookup tables from
91  // the module vector
92  void initialise();
93 
94  // and for the disabled modules
96 
97  // and for the full scan lists
98  void initialiseFullScan();
99 
100  // IO
101  void write(std::ostream& s=std::cout) const;
102  void write(const std::string& filename) const;
103 
104  bool read(std::istream& s);
105  bool read(const std::string& s);
106 
107  // get the sub detectors
108  const std::vector<RegSelSubDetector>& getSubDet() const { return m_SubDet; }
109 
110  // get a module from it's hash id
111  const RegSelModule* Module(const IdentifierHash& h) const;
112 
113 
119  void getModules( unsigned layer, std::vector<const RegSelModule*>& modules) const;
120 
121 
122 
123  // roi access methods
124 
125  // access functions to get the list of hash id's
126  virtual void getHashList(const RegSelRoI& roi, std::vector<IdentifierHash>& hashlist ) const;
127 
128  // access functions to get the list of hash id's
129  virtual void getHashList(const RegSelRoI& roi, std::vector<IdentifierHash>& hashlist, double x, double y) const;
130 
131  // roi layer methods
132  // get the hash id's for a specified layer - see comment above about the layer format
133  virtual void getHashList(const RegSelRoI& roi, unsigned layer, std::vector<IdentifierHash>& hashlist) const;
134 
135  // get the hash id's for the entire detector
136  virtual void getHashList(std::vector<IdentifierHash>& hashlist) const;
137 
138  // get the hash id's for a complete layer - see comment above about the layer format
139  virtual void getHashList(unsigned layer, std::vector<IdentifierHash>& hashlist) const;
140  // void getHashList(long int& layer, std::vector<IdentifierHash>& hashlist ) const { return getHashList( unsigned(layer), hashlist ); }
141 
142 
143 
144 
145  // get the rob id's for a specified layer - see comment above about the layer format
146  virtual void getRobList(const RegSelRoI& roi, unsigned layer, std::vector<uint32_t>& roblist, bool removeduplicates=true ) const;
147 
148  // access functions to get the roblist as wanted by athena
149  virtual void getRobList(const RegSelRoI& roi, std::vector<uint32_t>& roblist, bool removeduplicates=true ) const;
150 
151  // with beam line position
152  // access functions to get the roblist as wanted by athena
153  virtual void getRobList(const RegSelRoI& roi, std::vector<uint32_t>& roblist, double x, double y ) const;
154 
155  // full scan methods
156  // get the rob list for the entire detector
157  virtual void getRobList(std::vector<uint32_t>& roblist) const;
158 
159  // get the rob list for a complete layer - see comment above about the layer format
160  virtual void getRobList(unsigned layer, std::vector<uint32_t>& roblist) const;
161  // void getRobList(long int& layer, std::vector<uint32_t>& roblist) const { return getRobList( unsigned(layer), roblist ); }
162 
163 
164 
165 
166  // get the hash id's and robs for the entire detector
167  virtual void getRobHashList(std::vector<uint32_t>& roblist, std::vector<IdentifierHash>& hashlist) const;
168 
169  // get the rob list and hash id's for an roi
170  virtual void getRobHashList(const RegSelRoI& roi, std::vector<uint32_t>& roblist, std::vector<IdentifierHash>& hashlist) const;
171 
172  // get the rob list and hash id's for an roi - see comment above about the layer format
173  virtual void getRobHashList(const RegSelRoI& roi, unsigned layer, std::vector<uint32_t>& roblist, std::vector<IdentifierHash>& hashlist) const;
174 
175 
176 
177 
178 
179  // disabled module access
180 
181  // get the hash id's of *disabled* modules in a specified layer
182  void getDisabledHashList(const RegSelRoI& roi, unsigned layer, std::vector<IdentifierHash>& hashlist) const;
183 
184  // get get a list of layers with disabled modules from the specified sub-detector component
185  void getDisabledLayers(const RegSelRoI& roi, int subdetector, std::vector<int>& layers) const;
186 
187 
188  // enabling and disabling
189  // enable or disable all the modules in the lookup table
190  void enableRobs();
191  void disableRobs();
192 
193  // enable or disable all the modules in the lookup table
194  void enableModules() { enableRobs(); }
196 
197  // enable or disable the modules corresponding to the robs in the roblist
198  void enableRobList(const std::vector<uint32_t>& roblist);
199  void disableRobList(const std::vector<uint32_t>& roblist);
200 
201  // enable or disable all modules from a list
202  void enableModuleList(const std::vector<IdentifierHash>& hashlist);
203  void disableModuleList(const std::vector<IdentifierHash>& hashlist);
204 
205  // enable/disable individual subdetectors
206  void disableSubDetector(int id);
207  void enableSubDetector(int id);
208 
209  // enable/disable individual layers
210  void disableLayer(int id, unsigned layer);
211  void enableLayer(int id, unsigned layer);
212 
213  // draw the object (??)
214  void drawlayers(std::vector<const ZRObject*>& c) const {
215  for ( unsigned i=0 ; i<m_SubDet.size() ; i++ ) m_SubDet[i].drawlayers(c);
216  }
217 
218 public:
219 
221  template<typename T>
222  static void removeDuplicates(std::vector<T>& vec) {
223  std::sort(vec.begin(), vec.end());
224  vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
225  }
226 
227 protected:
228 
229  virtual void construct();
230 
231 protected:
232 
233  DET m_ID; // pixel (0), sct (1) or trt (2)
234 
235  std::vector<RegSelSubDetector> m_SubDet; // subdetectors
236  std::vector<RegSelModule> m_modules; // actual module store
237 
238  std::vector<RegSelModule*> m_disabled; // disabled module list
239 
240  std::map<const IdentifierHash, const RegSelModule*> m_map; // hashID lookup table
241 
242  // quick look ups for entire detector
243  std::vector<IdentifierHash> m_allHashes; // hashID lookup table
244  std::vector<uint32_t> m_allROBids;
245 
246  std::map<int, int> m_idmap; // hashID lookup table
247 
248 };
249 
250 
251 
252 #endif /* REGSELSILUT_H */
253 
254 
255 
256 
257 
258 
259 
260 
261 
262 
RegSelSiLUT::m_allROBids
std::vector< uint32_t > m_allROBids
Definition: RegSelSiLUT.h:244
beamspotman.r
def r
Definition: beamspotman.py:676
RegSelModule
Definition: RegSelModule.h:38
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
RegSelSiLUT::UNDEF
@ UNDEF
Definition: RegSelSiLUT.h:45
RegSelSiLUT::initialiseDisabledModules
void initialiseDisabledModules()
Definition: RegSelSiLUT.cxx:203
RegSelSiLUT::DET
DET
Definition: RegSelSiLUT.h:45
RegSelSiLUT::FTK
@ FTK
Definition: RegSelSiLUT.h:45
RegSelSiLUT::m_allHashes
std::vector< IdentifierHash > m_allHashes
Definition: RegSelSiLUT.h:243
RegSelSiLUT::getRoIData
bool getRoIData(const RegSelRoI &r, std::vector< const RegSelModule * > &modules) const
Definition: RegSelSiLUT.cxx:244
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
RegSelSiLUT::initialiseFullScan
void initialiseFullScan()
Definition: RegSelSiLUT.cxx:175
RegSelSiLUT::m_modules
std::vector< RegSelModule > m_modules
Definition: RegSelSiLUT.h:236
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
RegSelSiLUT::disableSubDetector
void disableSubDetector(int id)
Definition: RegSelSiLUT.cxx:222
RegSelSiLUT::getDisabledLayers
void getDisabledLayers(const RegSelRoI &roi, int subdetector, std::vector< int > &layers) const
Definition: RegSelSiLUT.cxx:1117
RegSelModule.h
x
#define x
RegSelName.h
RegSelSiLUT::MM
@ MM
Definition: RegSelSiLUT.h:45
RegSelSiLUT::RegSelSiLUT
RegSelSiLUT()
Definition: RegSelSiLUT.h:49
RegSelSiLUT::enableSubDetector
void enableSubDetector(int id)
Definition: RegSelSiLUT.cxx:227
python.PyAthena.module
module
Definition: PyAthena.py:134
RegSelSiLUT::enableModules
void enableModules()
Definition: RegSelSiLUT.h:194
RegSelSiLUT::write
void write(std::ostream &s=std::cout) const
Definition: RegSelSiLUT.cxx:543
RegSelSiLUT::initialise
void initialise()
Definition: RegSelSiLUT.cxx:110
RegSelName
Definition: RegSelName.h:33
RegSelSiLUT::TRT
@ TRT
Definition: RegSelSiLUT.h:45
RegSelSiLUT::enableRobs
void enableRobs()
Definition: RegSelSiLUT.cxx:712
RegSelSiLUT::getSubDet
const std::vector< RegSelSubDetector > & getSubDet() const
Definition: RegSelSiLUT.h:108
lumiFormat.i
int i
Definition: lumiFormat.py:92
RegSelSiLUT::getDisabledHashList
void getDisabledHashList(const RegSelRoI &roi, unsigned layer, std::vector< IdentifierHash > &hashlist) const
Definition: RegSelSiLUT.cxx:1086
RegSelSiLUT::Module
const RegSelModule * Module(const IdentifierHash &h) const
Definition: RegSelSiLUT.cxx:213
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
RegSelSiLUT::getRobList
virtual void getRobList(const RegSelRoI &roi, unsigned layer, std::vector< uint32_t > &roblist, bool removeduplicates=true) const
Definition: RegSelSiLUT.cxx:1003
RegSelSiLUT::HashIDList
virtual void HashIDList(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const override
implementation of the IRegSelUT interface hash id methods
Definition: RegSelSiLUT.cxx:39
RegSelSiLUT::disableLayer
void disableLayer(int id, unsigned layer)
Definition: RegSelSiLUT.cxx:232
RegSelSiLUT::m_ID
DET m_ID
Definition: RegSelSiLUT.h:233
RegSelSiLUT::enableRobList
void enableRobList(const std::vector< uint32_t > &roblist)
Definition: RegSelSiLUT.cxx:750
RegSelSiLUT::enableModuleList
void enableModuleList(const std::vector< IdentifierHash > &hashlist)
Definition: RegSelSiLUT.cxx:787
RegSelSiLUT::m_idmap
std::map< int, int > m_idmap
Definition: RegSelSiLUT.h:246
RegSelSiLUT::enableLayer
void enableLayer(int id, unsigned layer)
Definition: RegSelSiLUT.cxx:237
RegSelSiLUT::SCT
@ SCT
Definition: RegSelSiLUT.h:45
RegSelRoI
Definition: RegSelRoI.h:32
IRegSelLUT.h
IRegSelLUT
Definition: IRegSelLUT.h:25
RegSelSiLUT::getHashList
virtual void getHashList(const RegSelRoI &roi, std::vector< IdentifierHash > &hashlist) const
Definition: RegSelSiLUT.cxx:809
RegSelSiLUT::addModules
void addModules(const std::vector< RegSelModule > &m)
Definition: RegSelSiLUT.h:72
RegSelSiLUT::PIXEL
@ PIXEL
Definition: RegSelSiLUT.h:45
RegSelSiLUT::ROBIDList
virtual void ROBIDList(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const override
rob methods
Definition: RegSelSiLUT.cxx:56
IdentifierHash.h
RegSelSiLUT::construct
virtual void construct()
Definition: RegSelSiLUT.cxx:90
RegSelSiLUT::addModule
void addModule(RegSelModule &module)
Definition: RegSelSiLUT.h:71
RegSelSubDetector.h
RegSelSiLUT::reset
void reset()
Definition: RegSelSiLUT.cxx:100
RegSelSiLUT::m_disabled
std::vector< RegSelModule * > m_disabled
Definition: RegSelSiLUT.h:238
y
#define y
h
RegSelSiLUT::disableModuleList
void disableModuleList(const std::vector< IdentifierHash > &hashlist)
Definition: RegSelSiLUT.cxx:770
RegSelSiLUT::~RegSelSiLUT
virtual ~RegSelSiLUT() override
Definition: RegSelSiLUT.h:54
RegSelSiLUT::disableModules
void disableModules()
Definition: RegSelSiLUT.h:195
RegSelSiLUT::disableRobList
void disableRobList(const std::vector< uint32_t > &roblist)
Definition: RegSelSiLUT.cxx:733
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
RegSelSiLUT::m_map
std::map< const IdentifierHash, const RegSelModule * > m_map
Definition: RegSelSiLUT.h:240
RegSelSiLUT
Definition: RegSelSiLUT.h:41
CaloSwCorrections.removeduplicates
def removeduplicates(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:233
RegSelSiLUT::removeDuplicates
static void removeDuplicates(std::vector< T > &vec)
useful for removing duplicates if required ...
Definition: RegSelSiLUT.h:222
RegSelSiLUT::getRobHashList
virtual void getRobHashList(std::vector< uint32_t > &roblist, std::vector< IdentifierHash > &hashlist) const
Definition: RegSelSiLUT.cxx:938
RegSelSiLUT::drawlayers
void drawlayers(std::vector< const ZRObject * > &c) const
Definition: RegSelSiLUT.h:214
RegSelSiLUT::getModules
const std::vector< RegSelModule > & getModules() const
Definition: RegSelSiLUT.h:75
IdentifierHash
Definition: IdentifierHash.h:38
RegSelSiLUT::read
bool read(std::istream &s)
Definition: RegSelSiLUT.cxx:1175
RegSelSiLUT::sTGC
@ sTGC
Definition: RegSelSiLUT.h:45
RegSelSiLUT::m_SubDet
std::vector< RegSelSubDetector > m_SubDet
Definition: RegSelSiLUT.h:235
python.compressB64.c
def c
Definition: compressB64.py:93
RegSelSiLUT::disableRobs
void disableRobs()
Definition: RegSelSiLUT.cxx:722
RegSelRoI.h
RegSelSiLUT::ID
DET ID() const
Definition: RegSelSiLUT.h:84