test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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(0)
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 = 0;
51  float Z = gp.z();
52 
53  int bin = 0;
54  if (theBinFinder!=0) { // 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==0? " failed " : " OK ") <<endl;
65 
66  return result;
67 }
68 
69 
70 
const double Z[kNumberCalorimeter]
MagBinFinders::GeneralBinFinderInZ< double > * theBinFinder
Definition: MagBRod.h:42
virtual int binIndex(T z) const
returns an index in the valid range for the bin closest to Z
const MagVolume * findVolume(const GlobalPoint &gp, double tolerance) const
Find the volume containing a point, with a given tolerance.
Definition: MagBRod.cc:49
tuple result
Definition: mps_fire.py:84
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
tuple cout
Definition: gather_cfg.py:145
static constexpr bool debugOut
Definition: MagVerbosity.h:17
std::vector< MagBSlab * > theSlabs
Definition: MagBRod.h:40