#include <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 | |
unsigned | 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(), CosmicsPD_Skims::radius, and ExpressReco_HICollisions_FallBack::step.
: pMF_(pMF), geometry_(myGeo), bins(101), fieldBarrelHistos(200,static_cast<std::vector<double> > (std::vector<double>(bins,static_cast<double>(0.)))), fieldEndcapHistos(200,static_cast<std::vector<double> > (std::vector<double>(bins,static_cast<double>(0.)))), fieldBarrelBinWidth(200,static_cast<double>(0.)), fieldBarrelZMin(200,static_cast<double>(0.)), fieldEndcapBinWidth(200,static_cast<double>(0.)), fieldEndcapRMin(200,static_cast<double>(0.)) { std::list<TrackerLayer>::const_iterator cyliter; std::list<TrackerLayer>::const_iterator cylitBeg=geometry_->cylinderBegin(); std::list<TrackerLayer>::const_iterator cylitEnd=geometry_->cylinderEnd(); // Prepare the histograms // std::cout << "Prepare magnetic field local database for FAMOS speed-up" << std::endl; for ( cyliter=cylitBeg; cyliter != cylitEnd; ++cyliter ) { int layer = cyliter->layerNumber(); // cout << " Fill Histogram " << hist << endl; // Cylinder bounds double zmin = 0.; double zmax; double rmin = 0.; double rmax; if ( cyliter->forward() ) { zmax = cyliter->disk()->position().z(); rmax = cyliter->disk()->outerRadius(); } else { zmax = cyliter->cylinder()->bounds().length()/2.; rmax = cyliter->cylinder()->bounds().width()/2. - cyliter->cylinder()->bounds().thickness()/2.; } // Histograms double step; // Disk histogram characteristics step = (rmax-rmin)/(bins-1); fieldEndcapBinWidth[layer] = step; fieldEndcapRMin[layer] = rmin; // Fill the histo int endcapBin = 0; for ( double radius=rmin+step/2.; radius<rmax+step; radius+=step ) { double field = inTeslaZ(GlobalPoint(radius,0.,zmax)); fieldEndcapHistos[layer][endcapBin++] = field; } // Barrel Histogram characteritics step = (zmax-zmin)/(bins-1); fieldBarrelBinWidth[layer] = step; fieldBarrelZMin[layer] = zmin; // Fill the histo int barrelBin = 0; for ( double zed=zmin+step/2.; zed<zmax+step; zed+=step ) { double field = inTeslaZ(GlobalPoint(rmax,0.,zed)); fieldBarrelHistos[layer][barrelBin++] = field; } } }
const GlobalVector MagneticFieldMap::inInverseGeV | ( | const GlobalPoint & | gp | ) | const |
Definition at line 107 of file MagneticFieldMap.cc.
References inKGauss().
{ return inKGauss(gp) * 2.99792458e-4; }
double MagneticFieldMap::inInverseGeVZ | ( | const GlobalPoint & | gp | ) | const |
Definition at line 168 of file MagneticFieldMap.cc.
References inKGaussZ().
{ return inKGaussZ(gp) * 2.99792458e-4; }
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().
{ return inTesla(gp) * 10.; }
double MagneticFieldMap::inKGaussZ | ( | const GlobalPoint & | gp | ) | const |
Definition at line 161 of file MagneticFieldMap.cc.
References inTeslaZ().
Referenced by inInverseGeVZ().
{ return inTeslaZ(gp)/10.; }
const GlobalVector MagneticFieldMap::inTesla | ( | const TrackerLayer & | aLayer, |
double | coord, | ||
int | success | ||
) | const |
Definition at line 89 of file MagneticFieldMap.cc.
References inTeslaZ(), and pMF_.
{ if (!pMF_) { return GlobalVector( 0., 0., 4.); } else { return GlobalVector(0.,0.,inTeslaZ(aLayer,coord,success)); } }
const GlobalVector MagneticFieldMap::inTesla | ( | const GlobalPoint & | gp | ) | const |
Definition at line 78 of file MagneticFieldMap.cc.
References MagneticField::inTesla(), and pMF_.
Referenced by inKGauss().
{ if (!pMF_) { return GlobalVector( 0., 0., 4.); } else { return pMF_->inTesla(gp); } }
double MagneticFieldMap::inTeslaZ | ( | const TrackerLayer & | aLayer, |
double | coord, | ||
int | success | ||
) | const |
Definition at line 121 of file MagneticFieldMap.cc.
References newFWLiteAna::bin, bins, fieldBarrelBinWidth, fieldBarrelZMin, fieldEndcapBinWidth, fieldEndcapRMin, TrackerLayer::layerNumber(), pMF_, theFieldBarrelHisto(), theFieldEndcapHisto(), and ExpressReco_HICollisions_FallBack::x.
{ if (!pMF_) { return 4.; } else { // Find the relevant histo double theBinWidth; double theXMin; unsigned layer = aLayer.layerNumber(); const std::vector<double>* theHisto; if ( success == 1 ) { theHisto = theFieldBarrelHisto(layer); theBinWidth = fieldBarrelBinWidth[layer]; theXMin = fieldBarrelZMin[layer]; } else { theHisto = theFieldEndcapHisto(layer); theBinWidth = fieldEndcapBinWidth[layer]; theXMin = fieldEndcapRMin[layer]; } // Find the relevant bin double x = fabs(coord); unsigned bin = (unsigned) ((x-theXMin)/theBinWidth); if ( bin+1 == (unsigned)bins ) bin -= 1; // Add a protection against coordinates near the layer edge double x1 = theXMin + (bin-0.5)*theBinWidth; double x2 = x1+theBinWidth; // Determine the field double field1 = (*theHisto)[bin]; double field2 = (*theHisto)[bin+1]; return field1 + (field2-field1) * (x-x1)/(x2-x1); } }
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().
{ 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().
{ return &(fieldEndcapHistos[layer]); }
unsigned MagneticFieldMap::bins [private] |
Definition at line 49 of file MagneticFieldMap.h.
Referenced by inTeslaZ(), and MagneticFieldMap().
std::vector<double> MagneticFieldMap::fieldBarrelBinWidth [private] |
Definition at line 52 of file MagneticFieldMap.h.
Referenced by inTeslaZ(), and MagneticFieldMap().
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] |
Definition at line 53 of file MagneticFieldMap.h.
Referenced by inTeslaZ(), and MagneticFieldMap().
std::vector<double> MagneticFieldMap::fieldEndcapBinWidth [private] |
Definition at line 54 of file MagneticFieldMap.h.
Referenced by inTeslaZ(), and MagneticFieldMap().
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] |
Definition at line 55 of file MagneticFieldMap.h.
Referenced by inTeslaZ(), and MagneticFieldMap().
const TrackerInteractionGeometry* MagneticFieldMap::geometry_ [private] |
Definition at line 48 of file MagneticFieldMap.h.
Referenced by MagneticFieldMap().
const MagneticField* MagneticFieldMap::pMF_ [private] |
Definition at line 47 of file MagneticFieldMap.h.
Referenced by inTesla(), inTeslaZ(), and magneticField().