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/MagBRod.h" 00012 #include "MagneticField/Layers/interface/MagBSlab.h" 00013 00014 #include "MagneticField/Layers/interface/MagVerbosity.h" 00015 00016 #include <iostream> 00017 00018 using namespace std; 00019 00020 MagBRod::MagBRod(vector<MagBSlab*>& slabs, Geom::Phi<float> phiMin) : 00021 theSlabs(slabs), 00022 thePhiMin(phiMin), 00023 theBinFinder(0) 00024 { 00025 // TOFIX 00026 // if (verbose.debugOut) cout << "Building MagBRod with " << theSlabs.size() 00027 // << " slabs, minPhi " << thePhiMin << endl; 00028 00029 if (theSlabs.size()>1) { // Set the binfinder 00030 vector<double> zBorders; 00031 for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin(); 00032 islab != theSlabs.end(); ++islab) { 00033 // TOFIX 00034 if (verbose::debugOut) cout << (*islab)->minZ() <<endl; 00035 //FIXME assume layers are already sorted in Z 00036 zBorders.push_back((*islab)->minZ()); 00037 } 00038 theBinFinder = new MagBinFinders::GeneralBinFinderInZ<double>(zBorders); 00039 } 00040 } 00041 00042 MagBRod::~MagBRod() { 00043 delete theBinFinder; 00044 00045 for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin(); 00046 islab != theSlabs.end(); ++islab) { 00047 delete (*islab); 00048 } 00049 } 00050 00051 MagVolume * MagBRod::findVolume(const GlobalPoint & gp, double tolerance) const { 00052 MagVolume * result = 0; 00053 float Z = gp.z(); 00054 00055 int bin = 0; 00056 if (theBinFinder!=0) { // true if there is > 1 bin 00057 bin = theBinFinder->binIndex(Z); 00058 } 00059 00060 // TOFIX 00061 if (verbose::debugOut) cout << " Trying slab at Z " << theSlabs[bin]->minZ() 00062 << " " << Z << endl ; 00063 result = theSlabs[bin]->findVolume(gp, tolerance); 00064 // TOFIX 00065 if (verbose::debugOut) cout << "***In guessed bslab" 00066 << (result==0? " failed " : " OK ") <<endl; 00067 00068 return result; 00069 } 00070 00071 00072