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  // TOFIX
21  // if (verbose.debugOut) cout << "Building MagBRod with " << theSlabs.size()
22  // << " slabs, minPhi " << thePhiMin << endl;
23 
24  if (theSlabs.size() > 1) { // Set the binfinder
25  vector<double> zBorders;
26  for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin(); islab != theSlabs.end(); ++islab) {
27  // TOFIX
29  cout << (*islab)->minZ() << endl;
30  //FIXME assume layers are already sorted in Z
31  zBorders.push_back((*islab)->minZ());
32  }
34  }
35 }
36 
38  delete theBinFinder;
39 
40  for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin(); islab != theSlabs.end(); ++islab) {
41  delete (*islab);
42  }
43 }
44 
45 const MagVolume *MagBRod::findVolume(const GlobalPoint &gp, double tolerance) const {
46  const MagVolume *result = nullptr;
47  float Z = gp.z();
48 
49  int bin = 0;
50  if (theBinFinder != nullptr) { // true if there is > 1 bin
51  bin = theBinFinder->binIndex(Z);
52  }
53 
54  // TOFIX
56  cout << " Trying slab at Z " << theSlabs[bin]->minZ() << " " << Z << endl;
57  result = theSlabs[bin]->findVolume(gp, tolerance);
58  // TOFIX
60  cout << "***In guessed bslab" << (result == nullptr ? " failed " : " OK ") << endl;
61 
62  return result;
63 }
MagBinFinders::GeneralBinFinderInZ< double > * theBinFinder
Definition: MagBRod.h:42
const double tolerance
#define nullptr
const MagVolume * findVolume(const GlobalPoint &gp, double tolerance) const
Find the volume containing a point, with a given tolerance.
Definition: MagBRod.cc:45
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:37
MagBRod(std::vector< MagBSlab * > &slabs, Geom::Phi< float > phiMin)
Constructor.
Definition: MagBRod.cc:18
T z() const
Definition: PV3DBase.h:61
static constexpr bool debugOut
Definition: MagVerbosity.h:17
std::vector< MagBSlab * > theSlabs
Definition: MagBRod.h:40