CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  :
23  theSingleVolume(0),
24  theRMin(rMin),
25  theBinFinder(0)
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
double pi()
Definition: Pi.h:31
MagVolume * theSingleVolume
Definition: MagBLayer.h:45
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(0),
38  theRMin(rMin),
39  theBinFinder(0)
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 newFWLiteAna::bin, PeriodicBinFinderInPhi< T >::binIndex(), gather_cfg::cout, verbose::debugOut, MagVolume::inside(), phi, PV3DBase< T, PVType, FrameType >::phi(), query::result, theBinFinder, theSectors, and theSingleVolume.

60  {
61  const MagVolume * result = 0;
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==0? " failed " : " OK ") <<endl;
89 
90  if (result==0) { // 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==0? " failed " : " OK ") <<endl;
100 
101  }
102  return result;
103 
104 }
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:48
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
virtual bool inside(const GlobalPoint &gp, double tolerance=0.) const =0
tuple result
Definition: query.py:137
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:44
MagVolume * theSingleVolume
Definition: MagBLayer.h:45
tuple cout
Definition: gather_cfg.py:145
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().