CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/MagneticField/Layers/src/MagELayer.cc

Go to the documentation of this file.
00001 // #include "Utilities/Configuration/interface/Architecture.h"
00002 
00003 /*
00004  *  See header file for a description of this class.
00005  *
00006  *  $Date: 2013/05/30 21:57:40 $
00007  *  $Revision: 1.3 $
00008  *  \author N. Amapane - INFN Torino
00009  */
00010 
00011 #include "MagneticField/Layers/interface/MagELayer.h"
00012 #include "MagneticField/VolumeGeometry/interface/MagVolume.h"
00013 #include "MagneticField/VolumeGeometry/interface/MagVolume6Faces.h"
00014 
00015 // #include "MagneticField/MagLayers/interface/MagVerbosity.h"
00016 #include <iostream>
00017 
00018 using namespace std;
00019 
00020 
00021 MagELayer::MagELayer(const vector<MagVolume*>& volumes, double zMin, double zMax) :
00022   theVolumes(volumes),
00023   theZMin(zMin),
00024   theZMax(zMax)
00025 {}
00026 
00027 MagELayer::~MagELayer(){
00028   for (vector<MagVolume *>::const_iterator ivol = theVolumes.begin();
00029        ivol != theVolumes.end(); ++ivol) {
00030     delete (*ivol);
00031   }
00032 }
00033 
00034 
00035 MagVolume * 
00036 MagELayer::findVolume(const GlobalPoint & gp, double tolerance) const {
00037   for(vector<MagVolume*>::const_iterator ivol = theVolumes.begin();
00038         ivol != theVolumes.end(); ++ivol) {
00039     // FIXME : use a binfinder
00040     // TOFIX
00041 //     if (verbose.debugOut) cout << "        Trying volume "
00042 //                  << (static_cast<MagVolume6Faces*> (*ivol))->name << endl;
00043     if ( (*ivol)->inside(gp,tolerance) ) return (*ivol);
00044   }
00045 
00046   return 0;
00047 }
00048