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  * $Date: 2007/02/03 16:15:59 $
7  * $Revision: 1.3 $
8  * \author N. Amapane - INFN Torino
9  */
10 
13 
15 
16 #include <iostream>
17 
18 using namespace std;
19 
20 MagBRod::MagBRod(vector<MagBSlab*>& slabs, Geom::Phi<float> phiMin) :
21  theSlabs(slabs),
22  thePhiMin(phiMin),
23  theBinFinder(0)
24 {
25  // TOFIX
26 // if (verbose.debugOut) cout << "Building MagBRod with " << theSlabs.size()
27 // << " slabs, minPhi " << thePhiMin << endl;
28 
29  if (theSlabs.size()>1) { // Set the binfinder
30  vector<double> zBorders;
31  for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin();
32  islab != theSlabs.end(); ++islab) {
33  // TOFIX
34  if (verbose::debugOut) cout << (*islab)->minZ() <<endl;
35  //FIXME assume layers are already sorted in Z
36  zBorders.push_back((*islab)->minZ());
37  }
39  }
40 }
41 
43  delete theBinFinder;
44 
45  for (vector<MagBSlab *>::const_iterator islab = theSlabs.begin();
46  islab != theSlabs.end(); ++islab) {
47  delete (*islab);
48  }
49 }
50 
51 MagVolume * MagBRod::findVolume(const GlobalPoint & gp, double tolerance) const {
52  MagVolume * result = 0;
53  float Z = gp.z();
54 
55  int bin = 0;
56  if (theBinFinder!=0) { // true if there is > 1 bin
57  bin = theBinFinder->binIndex(Z);
58  }
59 
60  // TOFIX
61  if (verbose::debugOut) cout << " Trying slab at Z " << theSlabs[bin]->minZ()
62  << " " << Z << endl ;
63  result = theSlabs[bin]->findVolume(gp, tolerance);
64  // TOFIX
65  if (verbose::debugOut) cout << "***In guessed bslab"
66  << (result==0? " failed " : " OK ") <<endl;
67 
68  return result;
69 }
70 
71 
72 
const double Z[kNumberCalorimeter]
MagBinFinders::GeneralBinFinderInZ< double > * theBinFinder
Definition: MagBRod.h:44
virtual int binIndex(T z) const
returns an index in the valid range for the bin closest to Z
static bool debugOut
Definition: MagVerbosity.h:14
virtual ~MagBRod()
Destructor.
Definition: MagBRod.cc:42
MagBRod(std::vector< MagBSlab * > &slabs, Geom::Phi< float > phiMin)
Constructor.
Definition: MagBRod.cc:20
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
MagVolume * findVolume(const GlobalPoint &gp, double tolerance) const
Find the volume containing a point, with a given tolerance.
Definition: MagBRod.cc:51
tuple cout
Definition: gather_cfg.py:121
std::vector< MagBSlab * > theSlabs
Definition: MagBRod.h:42