27 const std::vector<MagBLayer*>& tbl,
28 const std::vector<MagESector*>& tes,
29 const std::vector<MagVolume6Faces*>& tbv,
30 const std::vector<MagVolume6Faces*>& tev)
38 const std::vector<MagBLayer const*>& tbl,
39 const std::vector<MagESector const*>& tes,
40 const std::vector<MagVolume6Faces const*>& tbv,
41 const std::vector<MagVolume6Faces const*>& tev)
49 vector<double> rBorders;
51 for (vector<MagBLayer const*>::const_iterator ilay =
theBLayers.begin(); ilay !=
theBLayers.end(); ++ilay) {
53 cout <<
" Barrel layer at " << (*ilay)->minR() << endl;
55 rBorders.push_back((*ilay)->minR());
61 for (vector<MagESector const*>::const_iterator isec =
theESectors.begin(); isec !=
theESectors.end(); ++isec) {
62 cout <<
" Endcap sector at " << (*isec)->minPhi() << endl;
79 for (vector<MagBLayer const*>::const_iterator ilay =
theBLayers.begin(); ilay !=
theBLayers.end(); ++ilay) {
83 for (vector<MagESector const*>::const_iterator ilay =
theESectors.begin(); ilay !=
theESectors.end(); ++ilay) {
100 LogWarning(
"InvalidInput") <<
"Input value invalid (not a number): " << gp << endl;
103 LogWarning(
"MagneticField") <<
"MagGeometry::fieldInTesla: failed to find volume for " << gp << endl;
115 if ((*
v) ==
nullptr) {
116 cout << endl <<
"***ERROR: MagGeometry::findVolume: MagVolume for barrel not set" << endl;
123 if ((*v)->inside(gp, tolerance)) {
131 if ((*
v) ==
nullptr) {
132 cout << endl <<
"***ERROR: MagGeometry::findVolume: MagVolume for endcap not set" << endl;
139 if ((*v)->inside(gp, tolerance)) {
152 auto lastVolumeCheck =
lastVolume.load(std::memory_order_acquire);
153 if (lastVolumeCheck !=
nullptr && lastVolumeCheck->inside(gp)) {
154 return lastVolumeCheck;
159 double R = gp.
perp();
163 for (
int bin1 = bin; bin1 >=
max(0, bin - 3); --bin1) {
165 cout <<
"Trying layer at R " <<
theBLayers[bin1]->minR() <<
" " << R << endl;
166 result =
theBLayers[bin1]->findVolume(gp, tolerance);
168 cout <<
"***In blayer " << bin1 - bin <<
" " << (result ==
nullptr ?
" failed " :
" OK ") << endl;
169 if (result !=
nullptr)
178 cout <<
"Trying endcap sector at phi " <<
theESectors[
bin]->minPhi() <<
" " << phi << endl;
181 cout <<
"***In guessed esector " << (result ==
nullptr ?
" failed " :
" OK ") << endl;
186 if (result ==
nullptr && tolerance < 0.0001) {
191 cout <<
"Increasing the tolerance to 0.03" << endl;
196 lastVolume.store(result, std::memory_order_release);
202 float Z = fabs(gp.
z());
207 return (Z < 350. || (R > 172.4 && Z < 633.29) || (R > 308.735 && Z < 662.01));
209 return (Z < 350. || (R > 172.4 && Z < 633.89) || (R > 308.755 && Z < 662.01));
211 return (Z < 350. || (R > 172.4 && Z < 633.29) || (R > 308.755 && Z < 661.01));
Surface::GlobalVector GlobalVector
constexpr bool isNotFinite(T x)
std::atomic< MagVolume const * > lastVolume
Geom::Phi< T > phi() const
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
~MagGeometry()
Destructor.
bool inBarrel(const GlobalPoint &gp) const
MagVolume const * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
std::vector< MagESector const * > theESectors
PeriodicBinFinderInPhi< float > const * theEndcapBinFinder
MagVolume const * findVolume1(const GlobalPoint &gp, double tolerance=0.) const
int binIndex(T R) const override
std::vector< MagBLayer const * > theBLayers
std::vector< MagVolume6Faces const * > theBVolumes
LocalVector fieldInTesla(const LocalPoint &lp) const
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
MagGeometry(int geomVersion, const std::vector< MagBLayer * > &, const std::vector< MagESector * > &, const std::vector< MagVolume6Faces * > &, const std::vector< MagVolume6Faces * > &)
Constructor.
std::vector< MagVolume6Faces const * > theEVolumes
static constexpr bool debugOut
MagBinFinders::GeneralBinFinderInR< double > const * theBarrelBinFinder