Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:33

0001 // #include "Utilities/Configuration/interface/Architecture.h"
0002 
0003 /*
0004  *  See header file for a description of this class.
0005  *
0006  *  \author N. Amapane - INFN Torino
0007  */
0008 
0009 #include "MagneticField/Layers/interface/MagBSlab.h"
0010 #include "MagneticField/VolumeGeometry/interface/MagVolume.h"
0011 #include "MagneticField/VolumeGeometry/interface/MagVolume6Faces.h"
0012 
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include <iostream>
0015 
0016 using namespace std;
0017 
0018 MagBSlab::MagBSlab(const vector<MagVolume*>& volumes, double zMin) : theVolumes(volumes), theZMin(zMin) {}
0019 
0020 MagBSlab::~MagBSlab() {
0021   for (vector<MagVolume*>::const_iterator ivol = theVolumes.begin(); ivol != theVolumes.end(); ++ivol) {
0022     delete (*ivol);
0023   }
0024 }
0025 
0026 const MagVolume* MagBSlab::findVolume(const GlobalPoint& gp, double tolerance) const {
0027   for (vector<MagVolume*>::const_iterator ivol = theVolumes.begin(); ivol != theVolumes.end(); ++ivol) {
0028     // FIXME : use a binfinder
0029     LogTrace("MagGeometry") << "        Trying volume " << (static_cast<MagVolume6Faces*>(*ivol))->volumeNo << endl;
0030     if ((*ivol)->inside(gp, tolerance))
0031       return (*ivol);
0032   }
0033 
0034   return nullptr;
0035 }