CMS 3D CMS Logo

MagBRod.cc
Go to the documentation of this file.
1 // #include "Utilities/Configuration/interface/Architecture.h"
2 
3 /*
4  * See header file for a description of this class.
5  *
6  * \author N. Amapane - INFN Torino
7  */
8 
11 
13 
14 #include <iostream>
15 
16 using namespace std;
17 
18 MagBRod::MagBRod(vector<MagBSlab *> &slabs, Geom::Phi<float> phiMin)
19  : theSlabs(slabs), thePhiMin(phiMin), theBinFinder(nullptr) {
20  // LogTrace("MagGeometry") << "Building MagBRod with " << theSlabs.size()
21  // << " slabs, minPhi " << thePhiMin << endl;
22 
23  if (theSlabs.size() > 1) { // Set the binfinder
24  vector<double> zBorders;
25  for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin(); islab != theSlabs.end(); ++islab) {
26  LogTrace("MagGeoBuilder") << " MagBSlab minZ=" << (*islab)->minZ() << endl;
27  //FIXME assume layers are already sorted in Z
28  zBorders.push_back((*islab)->minZ());
29  }
31  }
32 }
33 
35  delete theBinFinder;
36 
37  for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin(); islab != theSlabs.end(); ++islab) {
38  delete (*islab);
39  }
40 }
41 
42 const MagVolume *MagBRod::findVolume(const GlobalPoint &gp, double tolerance) const {
43  const MagVolume *result = nullptr;
44  float Z = gp.z();
45 
46  int bin = 0;
47  if (theBinFinder != nullptr) { // true if there is > 1 bin
49  }
50 
51  LogTrace("MagGeometry") << " Trying slab at Z " << theSlabs[bin]->minZ() << " " << Z << endl;
52  result = theSlabs[bin]->findVolume(gp, tolerance);
53  LogTrace("MagGeometry") << "***In guessed bslab" << (result == nullptr ? " failed " : " OK ") << endl;
54 
55  return result;
56 }
MagBinFinders::GeneralBinFinderInZ< double > * theBinFinder
Definition: MagBRod.h:42
const double tolerance
#define LogTrace(id)
int binIndex(T z) const override
returns an index in the valid range for the bin closest to Z
virtual ~MagBRod()
Destructor.
Definition: MagBRod.cc:34
const MagVolume * findVolume(const GlobalPoint &gp, double tolerance) const
Find the volume containing a point, with a given tolerance.
Definition: MagBRod.cc:42
MagBRod(std::vector< MagBSlab *> &slabs, Geom::Phi< float > phiMin)
Constructor.
Definition: MagBRod.cc:18
std::vector< MagBSlab * > theSlabs
Definition: MagBRod.h:40