CMS 3D CMS Logo

Public Member Functions | Private Attributes

MagBLayer Class Reference

#include <MagBLayer.h>

List of all members.

Public Member Functions

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

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.

Date:
2007/02/03 16:08:50
Revision:
1.2
Author:
N. Amapane - INFN Torino

Definition at line 25 of file MagBLayer.h.


Constructor & Destructor Documentation

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

Constructor.

MagBLayer::MagBLayer ( MagVolume aVolume,
double  rMin 
)

Constructor for a trivial layer consisting of one single volume.

Definition at line 38 of file MagBLayer.cc.

                                                    :
  theSingleVolume(0),
  theRMin(rMin),
  theBinFinder(0) 
{
  // TOFIX
//   if (verbose.debugOut) cout << "Building MagBLayer with " << 0
//                << " sectors, minR " << theRMin << endl;    
}
MagBLayer::~MagBLayer ( ) [virtual]

Destructor.

Definition at line 50 of file MagBLayer.cc.

References theBinFinder, theSectors, and theSingleVolume.

                      {
  delete theBinFinder;
  
  delete theSingleVolume;

  for (vector<MagBSector *>::const_iterator isec = theSectors.begin();
       isec != theSectors.end(); ++isec) {
    delete (*isec);
  }
}

Member Function Documentation

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

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

Definition at line 62 of file MagBLayer.cc.

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

                                                                               {
  MagVolume * result = 0;

  //In case the layer is composed of a single volume...
  if (theSingleVolume) {
    // TOFIX
//     if (verbose.debugOut) cout << "   Trying the unique volume " << endl;
    if (theSingleVolume->inside(gp, tolerance)) {
      result = theSingleVolume;
    // TOFIX
//       if (verbose.debugOut) cout << "***In unique bsector"
//                << (result==0? " failed " : " OK ") <<endl;
    }
    return result;
  }

  // Normal cases - query the sectors.
  
  Geom::Phi<float> phi = gp.phi();

  // FIXME assume sectors are sorted in phi!
  int bin= theBinFinder->binIndex(phi);
    // TOFIX
  if (verbose::debugOut) cout << "   Trying sector at phi " << theSectors[bin]->minPhi()
                              << " " << phi << endl ;
  result = theSectors[bin]->findVolume(gp, tolerance);
    // TOFIX
  if (verbose::debugOut) cout << "***In guessed bsector"
                             << (result==0? " failed " : " OK ") <<endl;

  if (result==0) { // If fails, can be in previous bin.
    // TOFIX
    if (verbose::debugOut) cout << "   Trying sector at phi "
                               << theSectors[theBinFinder->binIndex(bin-1)]->minPhi()
                               << " " << phi << endl ;
    
    result = theSectors[theBinFinder->binIndex(bin-1)]->findVolume(gp, tolerance);
    // TOFIX
    if (verbose::debugOut) cout << "***In previous bsector"
                               << (result==0? " failed " : " OK ") <<endl;

  }
  return result;

}
double MagBLayer::minR ( ) const [inline]

Lowest radius of the layer.

Definition at line 40 of file MagBLayer.h.

References theRMin.

{return theRMin;}

Member Data Documentation

Definition at line 50 of file MagBLayer.h.

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

double MagBLayer::theRMin [private]

Definition at line 48 of file MagBLayer.h.

Referenced by minR().

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

Definition at line 46 of file MagBLayer.h.

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

Definition at line 47 of file MagBLayer.h.

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