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