![]() |
![]() |
#include <FastSimulation/ParticlePropagator/interface/MagneticFieldMap.h>
Public Member Functions | |
const GlobalVector | inInverseGeV (const GlobalPoint &) const |
double | inInverseGeVZ (const GlobalPoint &) const |
const GlobalVector | inKGauss (const GlobalPoint &) const |
double | inKGaussZ (const GlobalPoint &) const |
const GlobalVector | inTesla (const TrackerLayer &aLayer, double coord, int success) const |
const GlobalVector | inTesla (const GlobalPoint &) const |
double | inTeslaZ (const TrackerLayer &aLayer, double coord, int success) const |
double | inTeslaZ (const GlobalPoint &) const |
const MagneticField & | magneticField () const |
MagneticFieldMap (const MagneticField *pmF, const TrackerInteractionGeometry *myGeo) | |
Private Member Functions | |
void | initialize () |
const std::vector< double > * | theFieldBarrelHisto (unsigned layer) const |
const std::vector< double > * | theFieldEndcapHisto (unsigned layer) const |
Private Attributes | |
int | bins |
std::vector< double > | fieldBarrelBinWidth |
std::vector< std::vector < double > > | fieldBarrelHistos |
std::vector< double > | fieldBarrelZMin |
std::vector< double > | fieldEndcapBinWidth |
std::vector< std::vector < double > > | fieldEndcapHistos |
std::vector< double > | fieldEndcapRMin |
const TrackerInteractionGeometry * | geometry_ |
const MagneticField * | pMF_ |
Definition at line 18 of file MagneticFieldMap.h.
MagneticFieldMap::MagneticFieldMap | ( | const MagneticField * | pmF, | |
const TrackerInteractionGeometry * | myGeo | |||
) |
Definition at line 7 of file MagneticFieldMap.cc.
References bins, TrackerInteractionGeometry::cylinderBegin(), TrackerInteractionGeometry::cylinderEnd(), fieldBarrelBinWidth, fieldBarrelHistos, fieldBarrelZMin, fieldEndcapBinWidth, fieldEndcapHistos, fieldEndcapRMin, geometry_, inTeslaZ(), radius(), and cmsRelvalreportInput::step.
00008 : 00009 pMF_(pMF), 00010 geometry_(myGeo), 00011 bins(101), 00012 fieldBarrelHistos(200,static_cast<std::vector<double> > 00013 (std::vector<double>(bins,static_cast<double>(0.)))), 00014 fieldEndcapHistos(200,static_cast<std::vector<double> > 00015 (std::vector<double>(bins,static_cast<double>(0.)))), 00016 fieldBarrelBinWidth(200,static_cast<double>(0.)), 00017 fieldBarrelZMin(200,static_cast<double>(0.)), 00018 fieldEndcapBinWidth(200,static_cast<double>(0.)), 00019 fieldEndcapRMin(200,static_cast<double>(0.)) 00020 00021 { 00022 00023 std::list<TrackerLayer>::const_iterator cyliter; 00024 std::list<TrackerLayer>::const_iterator cylitBeg=geometry_->cylinderBegin(); 00025 std::list<TrackerLayer>::const_iterator cylitEnd=geometry_->cylinderEnd(); 00026 00027 // Prepare the histograms 00028 // std::cout << "Prepare magnetic field local database for FAMOS speed-up" << std::endl; 00029 for ( cyliter=cylitBeg; cyliter != cylitEnd; ++cyliter ) { 00030 int layer = cyliter->layerNumber(); 00031 // cout << " Fill Histogram " << hist << endl; 00032 00033 // Cylinder bounds 00034 double zmin = 0.; 00035 double zmax; 00036 double rmin = 0.; 00037 double rmax; 00038 if ( cyliter->forward() ) { 00039 zmax = cyliter->disk()->position().z(); 00040 rmax = cyliter->disk()->outerRadius(); 00041 } else { 00042 zmax = cyliter->cylinder()->bounds().length()/2.; 00043 rmax = cyliter->cylinder()->bounds().width()/2. 00044 - cyliter->cylinder()->bounds().thickness()/2.; 00045 } 00046 00047 // Histograms 00048 double step; 00049 00050 // Disk histogram characteristics 00051 step = (rmax-rmin)/(bins-1); 00052 fieldEndcapBinWidth[layer] = step; 00053 fieldEndcapRMin[layer] = rmin; 00054 00055 // Fill the histo 00056 int endcapBin = 0; 00057 for ( double radius=rmin+step/2.; radius<rmax+step; radius+=step ) { 00058 double field = inTeslaZ(GlobalPoint(radius,0.,zmax)); 00059 fieldEndcapHistos[layer][endcapBin++] = field; 00060 } 00061 00062 // Barrel Histogram characteritics 00063 step = (zmax-zmin)/(bins-1); 00064 fieldBarrelBinWidth[layer] = step; 00065 fieldBarrelZMin[layer] = zmin; 00066 00067 // Fill the histo 00068 int barrelBin = 0; 00069 for ( double zed=zmin+step/2.; zed<zmax+step; zed+=step ) { 00070 double field = inTeslaZ(GlobalPoint(rmax,0.,zed)); 00071 fieldBarrelHistos[layer][barrelBin++] = field; 00072 } 00073 } 00074 }
const GlobalVector MagneticFieldMap::inInverseGeV | ( | const GlobalPoint & | gp | ) | const |
Definition at line 107 of file MagneticFieldMap.cc.
References inKGauss().
00107 { 00108 00109 return inKGauss(gp) * 2.99792458e-4; 00110 00111 }
double MagneticFieldMap::inInverseGeVZ | ( | const GlobalPoint & | gp | ) | const |
Definition at line 168 of file MagneticFieldMap.cc.
References inKGaussZ().
00168 { 00169 00170 return inKGaussZ(gp) * 2.99792458e-4; 00171 00172 }
void MagneticFieldMap::initialize | ( | ) | [private] |
const GlobalVector MagneticFieldMap::inKGauss | ( | const GlobalPoint & | gp | ) | const |
Definition at line 100 of file MagneticFieldMap.cc.
References inTesla().
Referenced by inInverseGeV().
00100 { 00101 00102 return inTesla(gp) * 10.; 00103 00104 }
double MagneticFieldMap::inKGaussZ | ( | const GlobalPoint & | gp | ) | const |
Definition at line 161 of file MagneticFieldMap.cc.
References inTeslaZ().
Referenced by inInverseGeVZ().
00161 { 00162 00163 return inTeslaZ(gp)/10.; 00164 00165 }
const GlobalVector MagneticFieldMap::inTesla | ( | const TrackerLayer & | aLayer, | |
double | coord, | |||
int | success | |||
) | const |
Definition at line 89 of file MagneticFieldMap.cc.
References inTeslaZ(), and pMF_.
00089 { 00090 00091 if (!pMF_) { 00092 return GlobalVector( 0., 0., 4.); 00093 } else { 00094 return GlobalVector(0.,0.,inTeslaZ(aLayer,coord,success)); 00095 } 00096 00097 }
const GlobalVector MagneticFieldMap::inTesla | ( | const GlobalPoint & | gp | ) | const |
Definition at line 78 of file MagneticFieldMap.cc.
References MagneticField::inTesla(), and pMF_.
Referenced by inKGauss().
00078 { 00079 00080 if (!pMF_) { 00081 return GlobalVector( 0., 0., 4.); 00082 } else { 00083 return pMF_->inTesla(gp); 00084 } 00085 00086 }
double MagneticFieldMap::inTeslaZ | ( | const TrackerLayer & | aLayer, | |
double | coord, | |||
int | success | |||
) | const |
Definition at line 121 of file MagneticFieldMap.cc.
References bins, fieldBarrelBinWidth, fieldBarrelZMin, fieldEndcapBinWidth, fieldEndcapRMin, TrackerLayer::layerNumber(), pMF_, theFieldBarrelHisto(), theFieldEndcapHisto(), and x.
00122 { 00123 00124 if (!pMF_) { 00125 return 4.; 00126 } else { 00127 // Find the relevant histo 00128 double theBinWidth; 00129 double theXMin; 00130 unsigned layer = aLayer.layerNumber(); 00131 const std::vector<double>* theHisto; 00132 00133 if ( success == 1 ) { 00134 theHisto = theFieldBarrelHisto(layer); 00135 theBinWidth = fieldBarrelBinWidth[layer]; 00136 theXMin = fieldBarrelZMin[layer]; 00137 } else { 00138 theHisto = theFieldEndcapHisto(layer); 00139 theBinWidth = fieldEndcapBinWidth[layer]; 00140 theXMin = fieldEndcapRMin[layer]; 00141 } 00142 00143 // Find the relevant bin 00144 double x = fabs(coord); 00145 unsigned bin = (unsigned) ((x-theXMin)/theBinWidth); 00146 if ( bin+1 == bins ) bin -= 1; // Add a protection against coordinates near the layer edge 00147 double x1 = theXMin + (bin-0.5)*theBinWidth; 00148 double x2 = x1+theBinWidth; 00149 00150 // Determine the field 00151 double field1 = (*theHisto)[bin]; 00152 double field2 = (*theHisto)[bin+1]; 00153 00154 return field1 + (field2-field1) * (x-x1)/(x2-x1); 00155 00156 } 00157 00158 }
double MagneticFieldMap::inTeslaZ | ( | const GlobalPoint & | gp | ) | const |
Definition at line 114 of file MagneticFieldMap.cc.
References MagneticField::inTesla(), pMF_, and PV3DBase< T, PVType, FrameType >::z().
Referenced by ParticlePropagator::fieldMap(), inKGaussZ(), inTesla(), and MagneticFieldMap().
const MagneticField& MagneticFieldMap::magneticField | ( | ) | const [inline] |
const std::vector<double>* MagneticFieldMap::theFieldBarrelHisto | ( | unsigned | layer | ) | const [inline, private] |
Definition at line 44 of file MagneticFieldMap.h.
References fieldBarrelHistos.
Referenced by inTeslaZ().
00045 { return &(fieldBarrelHistos[layer]); }
const std::vector<double>* MagneticFieldMap::theFieldEndcapHisto | ( | unsigned | layer | ) | const [inline, private] |
Definition at line 41 of file MagneticFieldMap.h.
References fieldEndcapHistos.
Referenced by inTeslaZ().
00042 { return &(fieldEndcapHistos[layer]); }
int MagneticFieldMap::bins [private] |
std::vector<double> MagneticFieldMap::fieldBarrelBinWidth [private] |
std::vector<std::vector<double> > MagneticFieldMap::fieldBarrelHistos [private] |
Definition at line 50 of file MagneticFieldMap.h.
Referenced by MagneticFieldMap(), and theFieldBarrelHisto().
std::vector<double> MagneticFieldMap::fieldBarrelZMin [private] |
std::vector<double> MagneticFieldMap::fieldEndcapBinWidth [private] |
std::vector<std::vector<double> > MagneticFieldMap::fieldEndcapHistos [private] |
Definition at line 51 of file MagneticFieldMap.h.
Referenced by MagneticFieldMap(), and theFieldEndcapHisto().
std::vector<double> MagneticFieldMap::fieldEndcapRMin [private] |
const TrackerInteractionGeometry* MagneticFieldMap::geometry_ [private] |
const MagneticField* MagneticFieldMap::pMF_ [private] |
Definition at line 47 of file MagneticFieldMap.h.
Referenced by inTesla(), inTeslaZ(), and magneticField().