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, RPC } 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 protected:
219 
220  virtual void construct();
221 
222 protected:
223 
224  DET m_ID; // pixel (0), sct (1) or trt (2)
225 
226  std::vector<RegSelSubDetector> m_SubDet; // subdetectors
227  std::vector<RegSelModule> m_modules; // actual module store
228 
229  std::vector<RegSelModule*> m_disabled; // disabled module list
230 
231  std::map<const IdentifierHash, const RegSelModule*> m_map; // hashID lookup table
232 
233  // quick look ups for entire detector
234  std::vector<IdentifierHash> m_allHashes; // hashID lookup table
235  std::vector<uint32_t> m_allROBids;
236 
237  std::map<int, int> m_idmap; // hashID lookup table
238 
239 
240 protected:
241 
245 
246  static void cleanup( std::vector<IdentifierHash>& idvec ) {
247  for ( size_t i=idvec.size() ; i-- ; ) idvec[i] = IdentifierHash( ((unsigned)idvec[i]) & 0xfff );
249  }
250 
251 
253 
255 
256  virtual void HashIDList_internal( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const;
257 
258  virtual void HashIDList_internal( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const;
259 
261  virtual void ROBIDList_internal( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const;
262 
263  virtual void ROBIDList_internal( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const;
264 
265 
266 };
267 
268 
269 
270 #endif /* REGSELSILUT_H */
271 
272 
273 
274 
275 
276 
277 
278 
279 
280 
RegSelSiLUT::m_allROBids
std::vector< uint32_t > m_allROBids
Definition: RegSelSiLUT.h:235
RegSelSiLUT::ROBIDList_internal
virtual void ROBIDList_internal(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const
rob methods
Definition: RegSelSiLUT.cxx:85
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:232
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:234
RegSelSiLUT::getRoIData
bool getRoIData(const RegSelRoI &r, std::vector< const RegSelModule * > &modules) const
Definition: RegSelSiLUT.cxx:273
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
RegSelSiLUT::initialiseFullScan
void initialiseFullScan()
Definition: RegSelSiLUT.cxx:204
RegSelSiLUT::m_modules
std::vector< RegSelModule > m_modules
Definition: RegSelSiLUT.h:227
RegSelSiLUT::disableSubDetector
void disableSubDetector(int id)
Definition: RegSelSiLUT.cxx:251
RegSelSiLUT::getDisabledLayers
void getDisabledLayers(const RegSelRoI &roi, int subdetector, std::vector< int > &layers) const
Definition: RegSelSiLUT.cxx:1146
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:256
python.PyAthena.module
module
Definition: PyAthena.py:131
RegSelSiLUT::enableModules
void enableModules()
Definition: RegSelSiLUT.h:194
RegSelSiLUT::write
void write(std::ostream &s=std::cout) const
Definition: RegSelSiLUT.cxx:572
RegSelSiLUT::initialise
void initialise()
Definition: RegSelSiLUT.cxx:139
RegSelName
Definition: RegSelName.h:33
RegSelSiLUT::TRT
@ TRT
Definition: RegSelSiLUT.h:45
RegSelSiLUT::enableRobs
void enableRobs()
Definition: RegSelSiLUT.cxx:741
RegSelSiLUT::getSubDet
const std::vector< RegSelSubDetector > & getSubDet() const
Definition: RegSelSiLUT.h:108
lumiFormat.i
int i
Definition: lumiFormat.py:85
RegSelSiLUT::getDisabledHashList
void getDisabledHashList(const RegSelRoI &roi, unsigned layer, std::vector< IdentifierHash > &hashlist) const
Definition: RegSelSiLUT.cxx:1115
RegSelSiLUT::Module
const RegSelModule * Module(const IdentifierHash &h) const
Definition: RegSelSiLUT.cxx:242
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:1032
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:261
RegSelSiLUT::m_ID
DET m_ID
Definition: RegSelSiLUT.h:224
RegSelSiLUT::enableRobList
void enableRobList(const std::vector< uint32_t > &roblist)
Definition: RegSelSiLUT.cxx:779
RegSelSiLUT::enableModuleList
void enableModuleList(const std::vector< IdentifierHash > &hashlist)
Definition: RegSelSiLUT.cxx:816
RegSelSiLUT::m_idmap
std::map< int, int > m_idmap
Definition: RegSelSiLUT.h:237
RegSelSiLUT::HashIDList_internal
virtual void HashIDList_internal(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const
horrible internal interface methods
Definition: RegSelSiLUT.cxx:68
RegSelSiLUT::enableLayer
void enableLayer(int id, unsigned layer)
Definition: RegSelSiLUT.cxx:266
RegSelSiLUT::SCT
@ SCT
Definition: RegSelSiLUT.h:45
RegSelRoI
Definition: RegSelRoI.h:32
IRegSelLUT.h
IRegSelLUT
Definition: IRegSelLUT.h:26
RegSelSiLUT::getHashList
virtual void getHashList(const RegSelRoI &roi, std::vector< IdentifierHash > &hashlist) const
Definition: RegSelSiLUT.cxx:838
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:53
IdentifierHash.h
DetDescrDictionaryDict::idvec
DataVector< Identifier > idvec
Definition: DetDescrDictionaryDict.h:14
RegSelSiLUT::construct
virtual void construct()
Definition: RegSelSiLUT.cxx:119
RegSelSiLUT::cleanup
static void cleanup(std::vector< IdentifierHash > &idvec)
annoying cleanup function specifically for the RPC, but we have to add it here since we have abstract...
Definition: RegSelSiLUT.h:246
RegSelSiLUT::addModule
void addModule(RegSelModule &module)
Definition: RegSelSiLUT.h:71
RegSelSubDetector.h
RegSelSiLUT::reset
void reset()
Definition: RegSelSiLUT.cxx:129
RegSelSiLUT::m_disabled
std::vector< RegSelModule * > m_disabled
Definition: RegSelSiLUT.h:229
y
#define y
h
RegSelSiLUT::disableModuleList
void disableModuleList(const std::vector< IdentifierHash > &hashlist)
Definition: RegSelSiLUT.cxx:799
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:762
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
RegSelSiLUT::m_map
std::map< const IdentifierHash, const RegSelModule * > m_map
Definition: RegSelSiLUT.h:231
RegSelSiLUT
Definition: RegSelSiLUT.h:41
CaloSwCorrections.removeduplicates
def removeduplicates(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:233
RegSelSiLUT::getRobHashList
virtual void getRobHashList(std::vector< uint32_t > &roblist, std::vector< IdentifierHash > &hashlist) const
Definition: RegSelSiLUT.cxx:967
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
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
RegSelSiLUT::read
bool read(std::istream &s)
Definition: RegSelSiLUT.cxx:1204
RegSelSiLUT::sTGC
@ sTGC
Definition: RegSelSiLUT.h:45
RegSelSiLUT::m_SubDet
std::vector< RegSelSubDetector > m_SubDet
Definition: RegSelSiLUT.h:226
IRegSelLUT::removeDuplicates
static void removeDuplicates(std::vector< T > &vec)
useful for removing duplicates if required ...
Definition: IRegSelLUT.h:78
python.compressB64.c
def c
Definition: compressB64.py:93
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
RegSelSiLUT::disableRobs
void disableRobs()
Definition: RegSelSiLUT.cxx:751
RegSelSiLUT::RPC
@ RPC
Definition: RegSelSiLUT.h:45
RegSelRoI.h
RegSelSiLUT::ID
DET ID() const
Definition: RegSelSiLUT.h:84