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::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  // TOFIX
24  // if (verbose.debugOut) cout << "Building MagBLayer with " << theSectors.size()
25  // << " sectors, minR " << theRMin << endl;
26  //FIXME: PeriodicBinFinderInPhi gets *center* of first bin
27  theBinFinder = new PeriodicBinFinderInPhi<float>(theSectors.front()->minPhi() + Geom::pi() / 12., 12);
28 }
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::MagBLayer ( MagVolume aVolume,
double  rMin 
)

Constructor for a trivial layer consisting of one single volume.

Definition at line 31 of file MagBLayer.cc.

31  : theSingleVolume(nullptr), theRMin(rMin), theBinFinder(nullptr) {
32  // TOFIX
33  // if (verbose.debugOut) cout << "Building MagBLayer with " << 0
34  // << " sectors, minR " << theRMin << endl;
35 }
double theRMin
Definition: MagBLayer.h:47
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49
MagVolume * theSingleVolume
Definition: MagBLayer.h:46
MagBLayer::~MagBLayer ( )
virtual

Destructor.

Definition at line 37 of file MagBLayer.cc.

References theBinFinder, theSectors, and theSingleVolume.

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

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 47 of file MagBLayer.cc.

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

47  {
48  const MagVolume* result = nullptr;
49 
50  //In case the layer is composed of a single volume...
51  if (theSingleVolume) {
52  // TOFIX
53  // if (verbose.debugOut) cout << " Trying the unique volume " << endl;
54  if (theSingleVolume->inside(gp, tolerance)) {
55  result = theSingleVolume;
56  // TOFIX
57  // if (verbose.debugOut) cout << "***In unique bsector"
58  // << (result==0? " failed " : " OK ") <<endl;
59  }
60  return result;
61  }
62 
63  // Normal cases - query the sectors.
64 
65  Geom::Phi<float> phi = gp.phi();
66 
67  // FIXME assume sectors are sorted in phi!
68  int bin = theBinFinder->binIndex(phi);
69  // TOFIX
71  cout << " Trying sector at phi " << theSectors[bin]->minPhi() << " " << phi << endl;
72  result = theSectors[bin]->findVolume(gp, tolerance);
73  // TOFIX
75  cout << "***In guessed bsector" << (result == nullptr ? " failed " : " OK ") << endl;
76 
77  if (result == nullptr) { // If fails, can be in previous bin.
78  // TOFIX
80  cout << " Trying sector at phi " << theSectors[theBinFinder->binIndex(bin - 1)]->minPhi() << " " << phi << endl;
81 
82  result = theSectors[theBinFinder->binIndex(bin - 1)]->findVolume(gp, tolerance);
83  // TOFIX
85  cout << "***In previous bsector" << (result == nullptr ? " failed " : " OK ") << endl;
86  }
87  return result;
88 }
PeriodicBinFinderInPhi< float > * theBinFinder
Definition: MagBLayer.h:49
const double tolerance
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
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
std::vector< MagBSector * > theSectors
Definition: MagBLayer.h:45
MagVolume * theSingleVolume
Definition: MagBLayer.h:46
static constexpr bool debugOut
Definition: MagVerbosity.h:17
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

PeriodicBinFinderInPhi<float>* MagBLayer::theBinFinder
private

Definition at line 49 of file MagBLayer.h.

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

double MagBLayer::theRMin
private

Definition at line 47 of file MagBLayer.h.

Referenced by minR().

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

Definition at line 45 of file MagBLayer.h.

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

MagVolume* MagBLayer::theSingleVolume
private

Definition at line 46 of file MagBLayer.h.

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