ATLAS Offline Software
Loading...
Searching...
No Matches
RegSelLayer Class Reference

#include <RegSelLayer.h>

Inheritance diagram for RegSelLayer:
Collaboration diagram for RegSelLayer:

Classes

class  PhiCluster

Public Member Functions

 RegSelLayer ()
 RegSelLayer (double rmin, double rmax, double zmin, double zmax)
void reset ()
void addModule (const RegSelModule &module)
void setupDisabledModuleList ()
void getModules (const RegSelRoI &roi, std::vector< const RegSelModule * > &modules) const
 Fixme: This is the completely correct solution, where each module is allowed to be at a completely different radius.
void getModules (std::vector< const RegSelModule * > &modules) const
void getDisabledModules (const RegSelRoI &roi, std::vector< const RegSelModule * > &modules) const
int ID () const
int ID (int id)
int size () const
void createMaps ()
double phiMin () const
double phiMax () const
double phiMin (double phimin)
double phiMax (double phimax)
virtual bool inRoI (const RegSelRoI &roi) const
double rMin () const
double rMin (double rmin)
double rMax () const
double rMax (double rmax)
double zMin () const
double zMin (double zmin)
double zMax () const
double zMax (double zmax)
double z2Min () const
double z2Min (double zmin)
double z2Max () const
double z2Max (double zmax)
bool enabled () const
bool enable ()
bool disable ()
double _etaMin (double z=0) const
double _etaMax (double z=0) const

Protected Attributes

double m_rMin
double m_rMax
double m_zMin
double m_zMax
double m_z2Min
double m_z2Max
bool m_enabled

Private Member Functions

int clusterModules () const

Private Attributes

bool m_set
int m_ID
std::vector< const RegSelModule * > m_modules
std::vector< const RegSelModule * > m_disabled
int m_Nphi
double m_ideltaphi
double m_phiMin
double m_phiMax
std::vector< std::vector< const RegSelModule * > > m_phimaps

Detailed Description

Definition at line 39 of file RegSelLayer.h.

Constructor & Destructor Documentation

◆ RegSelLayer() [1/2]

RegSelLayer::RegSelLayer ( )
inline

Definition at line 43 of file RegSelLayer.h.

43 :
44 ZRObject(0,0,0,0),
45 m_set(false), m_ID(0),
46 m_modules(0), m_disabled(0), m_Nphi(0),
47 m_ideltaphi(0), m_phiMin(0), m_phiMax(0), m_phimaps(0) { }
std::vector< const RegSelModule * > m_disabled
std::vector< std::vector< const RegSelModule * > > m_phimaps
double m_phiMax
std::vector< const RegSelModule * > m_modules
double m_phiMin
double m_ideltaphi
ZRObject()
Definition ZRObject.h:45

◆ RegSelLayer() [2/2]

RegSelLayer::RegSelLayer ( double rmin,
double rmax,
double zmin,
double zmax )
inline

Definition at line 49 of file RegSelLayer.h.

49 :
50 ZRObject(rmin, rmax, zmin, zmax),
51 m_set(true), m_ID(0), m_modules(0), m_disabled(0), m_Nphi(0),
52 m_ideltaphi(0), m_phiMin(0), m_phiMax(0), m_phimaps(0) { }

Member Function Documentation

◆ _etaMax()

double ZRObject::_etaMax ( double z = 0) const
inlineinherited

Definition at line 109 of file ZRObject.h.

109 {
110 double eta1 = calceta( rMin(), zMax()-z);
111 double eta2 = calceta( rMax(), z2Max()-z);
112 if ( eta1>eta2 ) return eta1;
113 else return eta2;
114 }
#define z
double calceta(double r, double z)
Definition ZRObject.h:33
double rMax() const
Definition ZRObject.h:81
double rMin() const
Definition ZRObject.h:80
double zMax() const
Definition ZRObject.h:84
double z2Max() const
Definition ZRObject.h:87
setEt setPhi setE277 setWeta2 eta1

◆ _etaMin()

double ZRObject::_etaMin ( double z = 0) const
inlineinherited

Definition at line 102 of file ZRObject.h.

102 {
103 double eta1 = calceta( rMin(), zMin()-z);
104 double eta2 = calceta( rMax(), z2Min()-z);
105 if ( eta1<eta2 ) return eta1;
106 else return eta2;
107 }
double z2Min() const
Definition ZRObject.h:86
double zMin() const
Definition ZRObject.h:83

◆ addModule()

void RegSelLayer::addModule ( const RegSelModule & module)

Definition at line 130 of file RegSelLayer.cxx.

130 {
131 m_modules.push_back(&module);
132
133 // if ( module.enabled() ) m_enabledmodules.push_back(&module);
134 // m_enabledmodules.push_back(&module);
135
136 // std::cout << module
137 // << "\t rmin=" << rMin() << "\t module.rMin=" << module.rMin()
138 // << "\t zmin=" << zMin() << "\t module.zMin=" << module.zMin() << std::endl;
139
140 if ( m_set ) {
141 if ( module.rMin()<rMin()) rMin(module.rMin());
142 if ( module.rMax()>rMax()) rMax(module.rMax());
143
144 if ( module.zMin()<zMin()) zMin(module.zMin());
145 if ( module.zMax()>zMax()) zMax(module.zMax());
146
147 if ( module.phiMin()<phiMin()) phiMin(module.phiMin());
148 if ( module.phiMax()>phiMax()) phiMax(module.phiMax());
149 }
150 else {
151 m_set = true;
152 rMin(module.rMin());
153 rMax(module.rMax());
154 zMin(module.zMin());
155 zMax(module.zMax());
156 phiMin(module.phiMin());
157 phiMax(module.phiMax());
158 }
159
160}
double phiMin() const
Definition RegSelLayer.h:71
double phiMax() const
Definition RegSelLayer.h:72

◆ clusterModules()

int RegSelLayer::clusterModules ( ) const
private

Definition at line 50 of file RegSelLayer.cxx.

50 {
51
52 // if multiple radial "layers" in this actual layer (as in the TRT
53 // barrel, or the SCT endcaps) just find the inner most layer, as
54 // this will have the largest segmentation in phi
55
56 if ( m_modules.size()==0 ) return 0;
57
58 double r_in = m_modules.back()->rMax();
59
60 for ( int i=m_modules.size()-1 ; i-- ; ) {
61 double mod_rmax = m_modules[i]->rMax();
62 if ( mod_rmax<r_in ) r_in=mod_rmax;
63 }
64
65 // now cluster the ends of these innermost modules to calcute how
66 // many phi segments to use
67
68 // cluster vectors
69 PhiCluster cluster;
70
71 // use the minimum rMax+4mm just in case the detector has "moved"
72 double r2_in = 2*(r_in+4);
73
74 for ( int i=m_modules.size() ; i-- ; ) {
75 if ( (m_modules[i]->rMin()+m_modules[i]->rMax())<r2_in ) cluster.addModule(*m_modules[i]);
76 }
77
78 return cluster.size();
79}
unsigned size() const
Definition RegSelLayer.h:88

◆ createMaps()

void RegSelLayer::createMaps ( )

can this really ever happen?

Definition at line 334 of file RegSelLayer.cxx.

334 {
335
336 // std::cout << "RegSelLayer::createMaps() " << *this << std::endl;
337
339
340 if ( m_Nphi == 0 ) return;
341
342 // std::cout << "\t\t\tRegSelLayer::createMaps() layer with " << m_Nphi << " phi segments" << std::endl;
343
344 m_phimaps.resize(m_Nphi);
345
346 m_phiMin = -M_PI+0.001;
347 m_phiMax = M_PI+0.001;
348
349 m_ideltaphi = 0.5*m_Nphi/M_PI;
350
351 // std::map<const RegSelModule*, const RegSelModule*> tmap;
352 std::set<const RegSelModule*> tmap;
353
354 double trmax = 0;
355
356 std::vector<const RegSelModule*>::const_iterator mptr(m_modules.begin());
357 for ( ; mptr!=m_modules.end() ; ++mptr ) {
358
359 double phicent = 0.5*((*mptr)->phiMax()+(*mptr)->phiMin());
360
361 if ( (*mptr)->rMax()>trmax ) trmax = (*mptr)->rMax();
362
363 // if cell spans pi boundary
364 if ( (*mptr)->phiMax()<(*mptr)->phiMin() ) phicent += M_PI;
365
366 if ( phicent>M_PI ) phicent -= 2*M_PI;
367 if ( phicent<-M_PI ) phicent += 2*M_PI;
368
369 int phibin = ((int)((phicent-phiMin())*m_ideltaphi))%m_Nphi;
370
371 // std::cout << "phibin=" << (int)phibin
372 // << "\tphicent=" << phicent
373 // << "\t [ " << (*mptr)->phiMin() << " - " << (*mptr)->phiMax() << " ]" << std::endl;
374
375 // check module isn't already in another phi segment
376 if ( tmap.find(*mptr)!=tmap.end() ) continue;
377
378 // tmap[*mptr] = *mptr;
379 tmap.insert(*mptr);
380 m_phimaps[phibin].push_back(*mptr);
381
382 }
383
384 // std::cout << "RegSelLayer::createMaps() exiting" << std::endl;
385}
#define M_PI
int clusterModules() const

◆ disable()

bool ZRObject::disable ( )
inlineinherited

Definition at line 100 of file ZRObject.h.

100{ return m_enabled=false; }
bool m_enabled
Definition ZRObject.h:122

◆ enable()

bool ZRObject::enable ( )
inlineinherited

Definition at line 99 of file ZRObject.h.

99{ return m_enabled=true; }

◆ enabled()

bool ZRObject::enabled ( ) const
inlineinherited

Definition at line 98 of file ZRObject.h.

98{ return m_enabled; }

◆ getDisabledModules()

void RegSelLayer::getDisabledModules ( const RegSelRoI & roi,
std::vector< const RegSelModule * > & modules ) const

Definition at line 314 of file RegSelLayer.cxx.

314 {
315
316 // std::cout << "RegSelLayer::getDisabledModules() " << *this << std::endl;
317 // std::cout << "RegSelLayer::getDisabledModules() m_disabled.size()=" << m_disabled.size() < std::endl;
318
319 std::vector<const RegSelModule*>::const_iterator mptr(m_disabled.begin());
320 // std::vector<const RegSelModule*>::const_iterator mptr(m_modules.begin());
321
322 for ( ; mptr!=m_disabled.end() ; ++mptr ) {
323 // is the module inside the RoI ???
324 if ( (*mptr)->enabled()==false && (*mptr)->inRoI(roi) ) {
325 // then add them to the list
326 modules.push_back(*mptr);
327 }
328 }
329
330}

◆ getModules() [1/2]

void RegSelLayer::getModules ( const RegSelRoI & roi,
std::vector< const RegSelModule * > & modules ) const

Fixme: This is the completely correct solution, where each module is allowed to be at a completely different radius.

If we want to approximate that all the modules are at the same radius within a layer, then we only have to calculate the RoI z end points in this layer once and then just do the comparisons. it will save 2 multiplications and two additions per module, but only for those in the RoI in the phi region, since those outside the RoI in phi aren't even considered at the moment. Tried this, hardly quicker.

NB. Using segmentation in phi and (or) z should speed things up. This implements segmentation in phi only as the z didn't appear much faster.

Definition at line 197 of file RegSelLayer.cxx.

197 {
198
199 // std::cout << "RegSelLayer::getModules() " << *this << std::endl;
200
201#if 0
202
203 // look through all the modules in this layer and
204 // don't use the phi segmentation speed up
205
206 std::vector<const RegSelModule*>::const_iterator mptr(m_modules.begin());
207
208 for ( ; mptr!=m_modules.end() ; mptr++ ) {
209 // is the module inside the RoI ???
210 if ( (*mptr)->enabled() && (*mptr)->inRoI(roi) ) {
211 // then add them to the list
212 modules.push_back(*mptr);
213 }
214 }
215
216#else
217
218 // std::cout << "\tRegSelLayer::getModules() " << roi << std::endl;
219
220 // get the list of all modules in the phi segments
221 // corresponding to this RoI
222
223 int roi_phiMin = (int) ((roi.getphiMin()-phiMin())*m_ideltaphi-1); // look at adjacent segments
224 int roi_phiMax = (int) ((roi.getphiMax()-phiMin())*m_ideltaphi+1); // also, hence the +-1
225
226 int roi_phiWidth = roi_phiMax-roi_phiMin;
227
228 // have to see if the RoI spans the phi=pi boundary,
229 // and also whether we need to check segments that span the booundary
230 bool noswap = true;
231
232
233 // there MUST be a simpler way to do it than all these add hoc conditions
234 // there just has to be, this is *awful* code
235 if ( roi_phiWidth>=m_Nphi ) {
236 if ( roi_phiMin>roi_phiMax ) noswap = false;
237 roi_phiMin = 0;
238 roi_phiMax = m_Nphi-1;
239 }
240 else {
241
242 if ( roi.getphiWidth()*m_ideltaphi>=m_Nphi-2 ) roi_phiMax = roi_phiMin+m_Nphi-1;
243
244 if ( roi_phiMax>=m_Nphi ) { roi_phiMax -= m_Nphi; noswap=false; }
245 if ( roi_phiMin<0 ) { roi_phiMin += m_Nphi; noswap=false; }
246 if ( roi_phiMin==0 && roi_phiMax<m_Nphi-1 && roi_phiMax!=0 ) { roi_phiMin = m_Nphi-1; noswap=false; }
247 // if ( roi_phiMin==0 && roi_phiMax==0 ) { roi_phiMin = m_Nphi-1; noswap=false; }
248
249 }
250
251 // std::cout << "roi phimin=" << roi.getphiMin() << "\tphimax=" << roi.getphiMax() << std::endl;
252 // std::cout << "roi iphimin=" << roi_phiMin << "\tiphimax=" << roi_phiMax << std::endl;
253
254 // roi_phiWidth = roi_phiMax-roi_phiMin;
255
256 // if roi not in phi boundary
257 if ( roi.getphiMin()<=roi.getphiMax() && noswap ) {
258 for ( int i=roi_phiMin ; i<=roi_phiMax ; i++ ) {
259 std::vector<const RegSelModule*>::const_iterator mptr(m_phimaps[i].begin());
260 std::vector<const RegSelModule*>::const_iterator eptr(m_phimaps[i].end());
261 for ( ; mptr!=eptr ; ++mptr ) {
262 if ( (*mptr)->enabled() && (*mptr)->inRoI(roi) ) modules.push_back(*mptr);
263 }
264 }
265 }
266 else {
267 // roi spans phi=pi boundary
268 // do phi<0 part of roi
269 for ( int i=0 ; i<=roi_phiMax ; i++ ) {
270 std::vector<const RegSelModule*>::const_iterator mptr(m_phimaps[i].begin());
271 std::vector<const RegSelModule*>::const_iterator eptr(m_phimaps[i].end());
272 for ( ; mptr!=eptr ; ++mptr ) {
273 if ( (*mptr)->enabled() && (*mptr)->inRoI(roi) ) modules.push_back(*mptr);
274 }
275 }
276 // do phi>0 part of roi
277 // this is needed in case the max and min phi slice are the same
278 // so the modules aren't added twice
279 int firstbin = (roi_phiMin<roi_phiMax?roi_phiMax+1:roi_phiMin);
280 for ( int i=firstbin ; i<m_Nphi ; i++ ) {
281 std::vector<const RegSelModule*>::const_iterator mptr(m_phimaps[i].begin());
282 std::vector<const RegSelModule*>::const_iterator eptr(m_phimaps[i].end());
283 for ( ; mptr!=eptr ; ++mptr ) {
284 if ( (*mptr)->enabled() && (*mptr)->inRoI(roi) ) modules.push_back(*mptr);
285 }
286 }
287 }
288
289#endif
290
291}
double getphiWidth() const
Definition RegSelRoI.h:54
double getphiMin() const
Definition RegSelRoI.h:46
double getphiMax() const
Definition RegSelRoI.h:47

◆ getModules() [2/2]

void RegSelLayer::getModules ( std::vector< const RegSelModule * > & modules) const

Definition at line 295 of file RegSelLayer.cxx.

295 {
296 std::vector<const RegSelModule*>::const_iterator mptr(m_modules.begin());
297 std::vector<const RegSelModule*>::const_iterator eptr(m_modules.end());
298 for ( ; mptr!=eptr ; ++mptr ) if ( (*mptr)->enabled() ) modules.push_back(*mptr);
299}

◆ ID() [1/2]

int RegSelLayer::ID ( ) const
inline

Definition at line 64 of file RegSelLayer.h.

64{ return m_ID; }

◆ ID() [2/2]

int RegSelLayer::ID ( int id)
inline

Definition at line 65 of file RegSelLayer.h.

◆ inRoI()

virtual bool ZRObject::inRoI ( const RegSelRoI & roi) const
inlinevirtualinherited

Reimplemented in RegSelModule.

Definition at line 71 of file ZRObject.h.

71 {
72 if ( !enabled() ) return false;
73 if ( (roi.getzMax(rMin())<zMin() && roi.getzMax(rMax())<z2Min()) ||
74 (roi.getzMin(rMin())>zMax() && roi.getzMin(rMax())>z2Max()) ) {
75 return false;
76 }
77 return true;
78 }
double getzMin() const
Definition RegSelRoI.h:44
double getzMax() const
Definition RegSelRoI.h:45
bool enabled() const
Definition ZRObject.h:98

◆ phiMax() [1/2]

double RegSelLayer::phiMax ( ) const
inline

Definition at line 72 of file RegSelLayer.h.

72{ return m_phiMax; }

◆ phiMax() [2/2]

double RegSelLayer::phiMax ( double phimax)
inline

Definition at line 75 of file RegSelLayer.h.

75{ return m_phiMax=phimax; }

◆ phiMin() [1/2]

double RegSelLayer::phiMin ( ) const
inline

Definition at line 71 of file RegSelLayer.h.

71{ return m_phiMin; }

◆ phiMin() [2/2]

double RegSelLayer::phiMin ( double phimin)
inline

Definition at line 74 of file RegSelLayer.h.

74{ return m_phiMin=phimin; }

◆ reset()

void RegSelLayer::reset ( )

Definition at line 38 of file RegSelLayer.cxx.

38 {
39 m_modules.clear();
40 m_disabled.clear();
41 std::vector<std::vector<const RegSelModule*> >::iterator itr(m_phimaps.begin()) ;
42 for ( ; itr!=m_phimaps.end() ; ++itr ) (*itr).clear();
43 m_set = false;
44}

◆ rMax() [1/2]

double ZRObject::rMax ( ) const
inlineinherited

Definition at line 81 of file ZRObject.h.

81{ return m_rMax; }
double m_rMax
Definition ZRObject.h:118

◆ rMax() [2/2]

double ZRObject::rMax ( double rmax)
inlineinherited

Definition at line 90 of file ZRObject.h.

90{ m_rMax = rmax; return m_rMax; }

◆ rMin() [1/2]

double ZRObject::rMin ( ) const
inlineinherited

Definition at line 80 of file ZRObject.h.

80{ return m_rMin; }
double m_rMin
Definition ZRObject.h:118

◆ rMin() [2/2]

double ZRObject::rMin ( double rmin)
inlineinherited

Definition at line 89 of file ZRObject.h.

89{ m_rMin = rmin; return m_rMin; }

◆ setupDisabledModuleList()

void RegSelLayer::setupDisabledModuleList ( )

Definition at line 166 of file RegSelLayer.cxx.

166 {
167 // std::cout << "RegSelLayer::setupDisabledModuleList() clear() m_disabled.size()=" << m_disabled.size() << std::endl;
168 m_disabled.clear();
169 // std::cout << "RegSelLayer::setupDisabledModuleList() going into loop m_modules.size()=" << m_modules.size() << std::endl;
170 std::vector<const RegSelModule*>::const_iterator mptr(m_modules.begin());
171 for ( ; mptr!=m_modules.end() ; ++mptr ) {
172 if ( !(*mptr)->enabled() ) m_disabled.push_back(*mptr);
173 }
174 // std::cout << "RegSelLayer::setupDisabledModuleList() disabled " << m_disabled.size() << " modules" << std::endl;
175}

◆ size()

int RegSelLayer::size ( ) const
inline

Definition at line 67 of file RegSelLayer.h.

67{ return m_modules.size(); }

◆ z2Max() [1/2]

double ZRObject::z2Max ( ) const
inlineinherited

Definition at line 87 of file ZRObject.h.

87{ return m_z2Max; }
double m_z2Max
Definition ZRObject.h:120

◆ z2Max() [2/2]

double ZRObject::z2Max ( double zmax)
inlineinherited

Definition at line 96 of file ZRObject.h.

◆ z2Min() [1/2]

double ZRObject::z2Min ( ) const
inlineinherited

Definition at line 86 of file ZRObject.h.

86{ return m_z2Min; }
double m_z2Min
Definition ZRObject.h:120

◆ z2Min() [2/2]

double ZRObject::z2Min ( double zmin)
inlineinherited

Definition at line 95 of file ZRObject.h.

◆ zMax() [1/2]

double ZRObject::zMax ( ) const
inlineinherited

Definition at line 84 of file ZRObject.h.

84{ return m_zMax; }
double m_zMax
Definition ZRObject.h:119

◆ zMax() [2/2]

double ZRObject::zMax ( double zmax)
inlineinherited

Definition at line 93 of file ZRObject.h.

93{ m_zMax = zmax; return m_zMax; }

◆ zMin() [1/2]

double ZRObject::zMin ( ) const
inlineinherited

Definition at line 83 of file ZRObject.h.

83{ return m_zMin; }
double m_zMin
Definition ZRObject.h:119

◆ zMin() [2/2]

double ZRObject::zMin ( double zmin)
inlineinherited

Definition at line 92 of file ZRObject.h.

92{ m_zMin = zmin; return m_zMin; }

Member Data Documentation

◆ m_disabled

std::vector<const RegSelModule*> RegSelLayer::m_disabled
private

Definition at line 103 of file RegSelLayer.h.

◆ m_enabled

bool ZRObject::m_enabled
protectedinherited

Definition at line 122 of file ZRObject.h.

◆ m_ID

int RegSelLayer::m_ID
private

Definition at line 100 of file RegSelLayer.h.

◆ m_ideltaphi

double RegSelLayer::m_ideltaphi
private

Definition at line 110 of file RegSelLayer.h.

◆ m_modules

std::vector<const RegSelModule*> RegSelLayer::m_modules
private

Definition at line 102 of file RegSelLayer.h.

◆ m_Nphi

int RegSelLayer::m_Nphi
private

Definition at line 108 of file RegSelLayer.h.

◆ m_phimaps

std::vector<std::vector<const RegSelModule*> > RegSelLayer::m_phimaps
private

Definition at line 115 of file RegSelLayer.h.

◆ m_phiMax

double RegSelLayer::m_phiMax
private

Definition at line 113 of file RegSelLayer.h.

◆ m_phiMin

double RegSelLayer::m_phiMin
private

Definition at line 112 of file RegSelLayer.h.

◆ m_rMax

double ZRObject::m_rMax
protectedinherited

Definition at line 118 of file ZRObject.h.

◆ m_rMin

double ZRObject::m_rMin
protectedinherited

Definition at line 118 of file ZRObject.h.

◆ m_set

bool RegSelLayer::m_set
private

Definition at line 99 of file RegSelLayer.h.

◆ m_z2Max

double ZRObject::m_z2Max
protectedinherited

Definition at line 120 of file ZRObject.h.

◆ m_z2Min

double ZRObject::m_z2Min
protectedinherited

Definition at line 120 of file ZRObject.h.

◆ m_zMax

double ZRObject::m_zMax
protectedinherited

Definition at line 119 of file ZRObject.h.

◆ m_zMin

double ZRObject::m_zMin
protectedinherited

Definition at line 119 of file ZRObject.h.


The documentation for this class was generated from the following files: