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 24 of file MagBLayer.h.

Constructor & Destructor Documentation

◆ MagBLayer() [1/2]

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

Constructor.

Definition at line 21 of file MagBLayer.cc.

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

22  : theSectors(sectors), theSingleVolume(nullptr), theRMin(rMin), theBinFinder(nullptr) {
23  // LogTrace("MagGeometry") << "Building MagBLayer with " << theSectors.size()
24  // << " sectors, minR " << theRMin << endl;
25  //FIXME: PeriodicBinFinderInPhi gets *center* of first bin
26  theBinFinder = new PeriodicBinFinderInPhi<float>(theSectors.front()->minPhi() + Geom::pi() / 12., 12);
27 }
double theRMin
Definition: MagBLayer.h:47
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:45
MagVolume * theSingleVolume
Definition: MagBLayer.h:46
constexpr double pi()
Definition: Pi.h:31

◆ MagBLayer() [2/2]

MagBLayer::MagBLayer ( MagVolume aVolume,
double  rMin 
)

Constructor for a trivial layer consisting of one single volume.

Definition at line 30 of file MagBLayer.cc.

30  : theSingleVolume(nullptr), theRMin(rMin), theBinFinder(nullptr) {
31  // LogTrace("MagGeometry") << "Building MagBLayer with " << 0
32  // << " sectors, minR " << theRMin << endl;
33 }
double theRMin
Definition: MagBLayer.h:47
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49
MagVolume * theSingleVolume
Definition: MagBLayer.h:46

◆ ~MagBLayer()

MagBLayer::~MagBLayer ( )
virtual

Destructor.

Definition at line 35 of file MagBLayer.cc.

References theBinFinder, theSectors, and theSingleVolume.

35  {
36  delete theBinFinder;
37 
38  delete theSingleVolume;
39 
40  for (vector<MagBSector*>::const_iterator isec = theSectors.begin(); isec != theSectors.end(); ++isec) {
41  delete (*isec);
42  }
43 }
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:45
MagVolume * theSingleVolume
Definition: MagBLayer.h:46

Member Function Documentation

◆ findVolume()

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

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

Definition at line 45 of file MagBLayer.cc.

References newFWLiteAna::bin, PeriodicBinFinderInPhi< T >::binIndex(), runTauDisplay::gp, MagVolume::inside(), LogTrace, phi, mps_fire::result, theBinFinder, theSectors, theSingleVolume, and tolerance.

45  {
46  const MagVolume* result = nullptr;
47 
48  //In case the layer is composed of a single volume...
49  if (theSingleVolume) {
50  // LogTrace("MagGeometry") << " Trying the unique volume " << endl;
53  // LogTrace("MagGeometry") << "***In unique bsector"
54  // << (result==0? " failed " : " OK ") <<endl;
55  }
56  return result;
57  }
58 
59  // Normal cases - query the sectors.
60 
61  Geom::Phi<float> phi = gp.phi();
62 
63  // FIXME assume sectors are sorted in phi!
64  int bin = theBinFinder->binIndex(phi);
65  LogTrace("MagGeometry") << " Trying sector at phi " << theSectors[bin]->minPhi() << " " << phi << endl;
66  result = theSectors[bin]->findVolume(gp, tolerance);
67  LogTrace("MagGeometry") << "***In guessed bsector" << (result == nullptr ? " failed " : " OK ") << endl;
68 
69  if (result == nullptr) { // If fails, can be in previous bin.
70  LogTrace("MagGeometry") << " Trying sector at phi " << theSectors[theBinFinder->binIndex(bin - 1)]->minPhi()
71  << " " << phi << endl;
72 
73  result = theSectors[theBinFinder->binIndex(bin - 1)]->findVolume(gp, tolerance);
74  LogTrace("MagGeometry") << "***In previous bsector" << (result == nullptr ? " failed " : " OK ") << endl;
75  }
76  return result;
77 }
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
const double tolerance
#define LogTrace(id)
virtual bool inside(const GlobalPoint &gp, double tolerance=0.) const =0
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:45
MagVolume * theSingleVolume
Definition: MagBLayer.h:46

◆ minR()

double MagBLayer::minR ( ) const
inline

Lowest radius of the layer.

Definition at line 39 of file MagBLayer.h.

References theRMin.

39 { return theRMin; }
double theRMin
Definition: MagBLayer.h:47

Member Data Documentation

◆ theBinFinder

PeriodicBinFinderInPhi<float>* MagBLayer::theBinFinder
private

Definition at line 49 of file MagBLayer.h.

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

◆ theRMin

double MagBLayer::theRMin
private

Definition at line 47 of file MagBLayer.h.

Referenced by minR().

◆ theSectors

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

Definition at line 45 of file MagBLayer.h.

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

◆ theSingleVolume

MagVolume* MagBLayer::theSingleVolume
private

Definition at line 46 of file MagBLayer.h.

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