CMS 3D CMS Logo

Public Member Functions | Private Attributes

MagESector Class Reference

#include <MagESector.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.
 MagESector (std::vector< MagELayer * > &layers, Geom::Phi< float > phiMin)
 Constructor.
Geom::Phi< float > minPhi () const
 Phi of sector start.
virtual ~MagESector ()
 Destructor.

Private Attributes

std::vector< MagELayer * > theLayers
Geom::Phi< float > thePhiMin

Detailed Description

A sector of volumes in the endcap. One sector is composed of several layers (MagELayer)

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

Definition at line 20 of file MagESector.h.


Constructor & Destructor Documentation

MagESector::MagESector ( std::vector< MagELayer * > &  layers,
Geom::Phi< float >  phiMin 
)

Constructor.

Definition at line 20 of file MagESector.cc.

                                                                       :
  theLayers(layers),
  thePhiMin(phiMin) 
{}
MagESector::~MagESector ( ) [virtual]

Destructor.

Definition at line 26 of file MagESector.cc.

References theLayers.

                       {
  for (vector<MagELayer *>::const_iterator ilay = theLayers.begin();
       ilay != theLayers.end(); ++ilay) {
    delete (*ilay);
  }
}

Member Function Documentation

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

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

Definition at line 34 of file MagESector.cc.

References query::result, theLayers, PV3DBase< T, PVType, FrameType >::z(), and Gflash::Z.

                                                                                 {
  MagVolume * result = 0;
  float Z = gp.z();

  //  int count = 0;

  // FIXME : use a binfinder
  for(vector<MagELayer*>::const_reverse_iterator ilay = theLayers.rbegin();
        ilay != theLayers.rend(); ++ilay) {

    if (Z+tolerance>(*ilay)->minZ()) {
      if (Z-tolerance<(*ilay)->maxZ()) {
//      if (verbose.debugOut) cout << "  Trying layer at Z " << (*ilay)->minZ()
//                      << " " << Z << endl ;
        result = (*ilay)->findVolume(gp, tolerance);
//      if (verbose.debugOut) {
//        cout << "***In elayer " << count << " " 
//             << (result==0? " failed " : " OK ") <<endl;
//        ++count;
//      }
      } else {
        // break;  // FIXME: OK if sorted by maxZ
      }
    }
    if (result!=0) return result;
  }

  return 0;
}
Geom::Phi<float> MagESector::minPhi ( ) const [inline]

Phi of sector start.

Definition at line 32 of file MagESector.h.

References thePhiMin.

{return thePhiMin;}

Member Data Documentation

std::vector<MagELayer*> MagESector::theLayers [private]

Definition at line 35 of file MagESector.h.

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

Geom::Phi<float> MagESector::thePhiMin [private]

Definition at line 36 of file MagESector.h.

Referenced by minPhi().