CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MagESector.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.2 $
8  * \author N. Amapane - INFN Torino
9  */
10 
13 
14 // #include "MagneticField/MagLayers/interface/MagVerbosity.h"
15 
16 #include <iostream>
17 
18 using namespace std;
19 
20 MagESector::MagESector(vector<MagELayer*>& layers, Geom::Phi<float> phiMin):
21  theLayers(layers),
22  thePhiMin(phiMin)
23 {}
24 
25 
27  for (vector<MagELayer *>::const_iterator ilay = theLayers.begin();
28  ilay != theLayers.end(); ++ilay) {
29  delete (*ilay);
30  }
31 }
32 
33 
34 MagVolume * MagESector::findVolume(const GlobalPoint & gp, double tolerance) const {
35  MagVolume * result = 0;
36  float Z = gp.z();
37 
38  // int count = 0;
39 
40  // FIXME : use a binfinder
41  for(vector<MagELayer*>::const_reverse_iterator ilay = theLayers.rbegin();
42  ilay != theLayers.rend(); ++ilay) {
43 
44  if (Z+tolerance>(*ilay)->minZ()) {
45  if (Z-tolerance<(*ilay)->maxZ()) {
46 // if (verbose.debugOut) cout << " Trying layer at Z " << (*ilay)->minZ()
47 // << " " << Z << endl ;
48  result = (*ilay)->findVolume(gp, tolerance);
49 // if (verbose.debugOut) {
50 // cout << "***In elayer " << count << " "
51 // << (result==0? " failed " : " OK ") <<endl;
52 // ++count;
53 // }
54  } else {
55  // break; // FIXME: OK if sorted by maxZ
56  }
57  }
58  if (result!=0) return result;
59  }
60 
61  return 0;
62 }
const double Z[kNumberCalorimeter]
T z() const
Definition: PV3DBase.h:63
tuple result
Definition: query.py:137
std::vector< MagELayer * > theLayers
Definition: MagESector.h:35
MagESector(std::vector< MagELayer * > &layers, Geom::Phi< float > phiMin)
Constructor.
Definition: MagESector.cc:20
virtual ~MagESector()
Destructor.
Definition: MagESector.cc:26
MagVolume * findVolume(const GlobalPoint &gp, double tolerance) const
Find the volume containing a point, with a given tolerance.
Definition: MagESector.cc:34