CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/MagneticField/Layers/src/MagBSlab.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: 2007/02/03 16:15:59 $
00007  *  $Revision: 1.3 $
00008  *  \author N. Amapane - INFN Torino
00009  */
00010 
00011 #include "MagneticField/Layers/interface/MagBSlab.h"
00012 #include "MagneticField/VolumeGeometry/interface/MagVolume.h"
00013 #include "MagneticField/VolumeGeometry/interface/MagVolume6Faces.h"
00014 
00015 #include "MagneticField/Layers/interface/MagVerbosity.h"
00016 #include <iostream>
00017 
00018 using namespace std;
00019 
00020 MagBSlab::MagBSlab(vector<MagVolume*> volumes, double zMin) :
00021   theVolumes(volumes),
00022   theZMin(zMin)
00023 {}
00024 
00025 MagBSlab::~MagBSlab(){  
00026   for (vector<MagVolume *>::const_iterator ivol = theVolumes.begin();
00027        ivol != theVolumes.end(); ++ivol) {
00028     delete (*ivol);
00029   }
00030 }
00031 
00032 
00033 MagVolume* MagBSlab::findVolume(const GlobalPoint & gp, double tolerance) const {
00034   for(vector<MagVolume*>::const_iterator ivol = theVolumes.begin();
00035         ivol != theVolumes.end(); ++ivol) {
00036     // FIXME : use a binfinder
00037     // TOFIX
00038     if (verbose::debugOut) cout << "        Trying volume "
00039                                << (static_cast<MagVolume6Faces*>(*ivol))->name << endl;
00040     if ( (*ivol)->inside(gp,tolerance) ) return (*ivol);
00041   }
00042 
00043   return 0;
00044 }