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