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 (MagVolume *aVolume, double rMin)
 Constructor for a trivial layer consisting of one single volume. More...
 
 MagBLayer (std::vector< MagBSector * > &sectors, double rMin)
 Constructor. 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.

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 }

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

◆ 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 }

◆ ~MagBLayer()

MagBLayer::~MagBLayer ( )
virtual

Destructor.

Definition at line 35 of file MagBLayer.cc.

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 }

References theBinFinder, theSectors, and theSingleVolume.

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.

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 }

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

◆ minR()

double MagBLayer::minR ( ) const
inline

Lowest radius of the layer.

Definition at line 39 of file MagBLayer.h.

39 { return theRMin; }

References theRMin.

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().

MagBLayer::theSingleVolume
MagVolume * theSingleVolume
Definition: MagBLayer.h:46
MagBLayer::theRMin
double theRMin
Definition: MagBLayer.h:47
Geom::pi
constexpr double pi()
Definition: Pi.h:31
MagVolume::inside
virtual bool inside(const GlobalPoint &gp, double tolerance=0.) const =0
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
MagVolume
Definition: MagVolume.h:13
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:26
Geom::Phi< float >
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
DDAxes::phi
MagBLayer::theSectors
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:45
PeriodicBinFinderInPhi< float >
PeriodicBinFinderInPhi::binIndex
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
Definition: PeriodicBinFinderInPhi.h:25
photonAnalyzer_cfi.rMin
rMin
Definition: photonAnalyzer_cfi.py:90
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
volumeBasedMagneticField_160812_cfi.sectors
sectors
Definition: volumeBasedMagneticField_160812_cfi.py:59
MagBLayer::theBinFinder
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49