CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MagBLayer Class Reference

#include <MagBLayer.h>

Public Member Functions

const MagVolumefindVolume (const GlobalPoint &gp, double tolerance) const
 Find the volume containing a point, with a given tolerance. More...
 
 MagBLayer (std::vector< MagBSector * > &sectors, double rMin)
 Constructor. More...
 
 MagBLayer (MagVolume *aVolume, double rMin)
 Constructor for a trivial layer consisting of one single volume. More...
 
double minR () const
 Lowest radius of the layer. More...
 
virtual ~MagBLayer ()
 Destructor. More...
 

Private Attributes

PeriodicBinFinderInPhi< float > * theBinFinder
 
double theRMin
 
std::vector< MagBSector * > theSectors
 
MagVolumetheSingleVolume
 

Detailed Description

A barrel layer (MagBLayer) groups volumes at the same distance to the origin. It consists of either 1 single volume (a cylinder) or 12 sectors in phi (MagBSector). Each sector consists of one or more rods (MagBRods) of equal width in phi. Rods consist of one or more slabs (MagBSlab); each one consisting of one or, in few cases, several volumes with the same lenght in Z.

Author
N. Amapane - INFN Torino

Definition at line 23 of file MagBLayer.h.

Constructor & Destructor Documentation

MagBLayer::MagBLayer ( std::vector< MagBSector * > &  sectors,
double  rMin 
)

Constructor.

Definition at line 21 of file MagBLayer.cc.

References Geom::pi(), theBinFinder, and theSectors.

21  :
22  theSectors(sectors),
23  theSingleVolume(nullptr),
24  theRMin(rMin),
25  theBinFinder(nullptr)
26 {
27  // TOFIX
28 // if (verbose.debugOut) cout << "Building MagBLayer with " << theSectors.size()
29 // << " sectors, minR " << theRMin << endl;
30  //FIXME: PeriodicBinFinderInPhi gets *center* of first bin
31  theBinFinder = new PeriodicBinFinderInPhi<float>(theSectors.front()->minPhi()+Geom::pi()/12.,12);
32 
33 }
double theRMin
Definition: MagBLayer.h:46
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:48
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:44
MagVolume * theSingleVolume
Definition: MagBLayer.h:45
constexpr double pi()
Definition: Pi.h:31
MagBLayer::MagBLayer ( MagVolume aVolume,
double  rMin 
)

Constructor for a trivial layer consisting of one single volume.

Definition at line 36 of file MagBLayer.cc.

36  :
37  theSingleVolume(nullptr),
38  theRMin(rMin),
39  theBinFinder(nullptr)
40 {
41  // TOFIX
42 // if (verbose.debugOut) cout << "Building MagBLayer with " << 0
43 // << " sectors, minR " << theRMin << endl;
44 }
double theRMin
Definition: MagBLayer.h:46
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:48
MagVolume * theSingleVolume
Definition: MagBLayer.h:45
MagBLayer::~MagBLayer ( )
virtual

Destructor.

Definition at line 48 of file MagBLayer.cc.

References theBinFinder, theSectors, and theSingleVolume.

48  {
49  delete theBinFinder;
50 
51  delete theSingleVolume;
52 
53  for (vector<MagBSector *>::const_iterator isec = theSectors.begin();
54  isec != theSectors.end(); ++isec) {
55  delete (*isec);
56  }
57 }
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:48
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:44
MagVolume * theSingleVolume
Definition: MagBLayer.h:45

Member Function Documentation

const MagVolume * MagBLayer::findVolume ( const GlobalPoint gp,
double  tolerance 
) const

Find the volume containing a point, with a given tolerance.

Definition at line 60 of file MagBLayer.cc.

References stringResolutionProvider_cfi::bin, PeriodicBinFinderInPhi< T >::binIndex(), gather_cfg::cout, verbose::debugOut, MagVolume::inside(), phi, PV3DBase< T, PVType, FrameType >::phi(), mps_fire::result, theBinFinder, theSectors, and theSingleVolume.

60  {
61  const MagVolume * result = nullptr;
62 
63  //In case the layer is composed of a single volume...
64  if (theSingleVolume) {
65  // TOFIX
66 // if (verbose.debugOut) cout << " Trying the unique volume " << endl;
67  if (theSingleVolume->inside(gp, tolerance)) {
68  result = theSingleVolume;
69  // TOFIX
70 // if (verbose.debugOut) cout << "***In unique bsector"
71 // << (result==0? " failed " : " OK ") <<endl;
72  }
73  return result;
74  }
75 
76  // Normal cases - query the sectors.
77 
78  Geom::Phi<float> phi = gp.phi();
79 
80  // FIXME assume sectors are sorted in phi!
81  int bin= theBinFinder->binIndex(phi);
82  // TOFIX
83  if (verbose::debugOut) cout << " Trying sector at phi " << theSectors[bin]->minPhi()
84  << " " << phi << endl ;
85  result = theSectors[bin]->findVolume(gp, tolerance);
86  // TOFIX
87  if (verbose::debugOut) cout << "***In guessed bsector"
88  << (result==nullptr? " failed " : " OK ") <<endl;
89 
90  if (result==nullptr) { // If fails, can be in previous bin.
91  // TOFIX
92  if (verbose::debugOut) cout << " Trying sector at phi "
93  << theSectors[theBinFinder->binIndex(bin-1)]->minPhi()
94  << " " << phi << endl ;
95 
96  result = theSectors[theBinFinder->binIndex(bin-1)]->findVolume(gp, tolerance);
97  // TOFIX
98  if (verbose::debugOut) cout << "***In previous bsector"
99  << (result==nullptr? " failed " : " OK ") <<endl;
100 
101  }
102  return result;
103 
104 }
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:48
const double tolerance
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
virtual bool inside(const GlobalPoint &gp, double tolerance=0.) const =0
bin
set the eta bin as selection string.
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:44
MagVolume * theSingleVolume
Definition: MagBLayer.h:45
static constexpr bool debugOut
Definition: MagVerbosity.h:17
double MagBLayer::minR ( ) const
inline

Lowest radius of the layer.

Definition at line 38 of file MagBLayer.h.

References theRMin.

38 {return theRMin;}
double theRMin
Definition: MagBLayer.h:46

Member Data Documentation

PeriodicBinFinderInPhi<float>* MagBLayer::theBinFinder
private

Definition at line 48 of file MagBLayer.h.

Referenced by findVolume(), MagBLayer(), and ~MagBLayer().

double MagBLayer::theRMin
private

Definition at line 46 of file MagBLayer.h.

Referenced by minR().

std::vector<MagBSector*> MagBLayer::theSectors
private

Definition at line 44 of file MagBLayer.h.

Referenced by findVolume(), MagBLayer(), and ~MagBLayer().

MagVolume* MagBLayer::theSingleVolume
private

Definition at line 45 of file MagBLayer.h.

Referenced by findVolume(), and ~MagBLayer().