CMS 3D CMS Logo

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 
13 
14 #include <iostream>
15 
16 using namespace std;
17 
18 MagESector::MagESector(vector<MagELayer*>& layers, Geom::Phi<float> phiMin) : theLayers(layers), thePhiMin(phiMin) {}
19 
21  for (vector<MagELayer*>::const_iterator ilay = theLayers.begin(); ilay != theLayers.end(); ++ilay) {
22  delete (*ilay);
23  }
24 }
25 
27  const MagVolume* result = nullptr;
28  float Z = gp.z();
29 
30  // FIXME : use a binfinder
31  for (vector<MagELayer*>::const_reverse_iterator ilay = theLayers.rbegin(); ilay != theLayers.rend(); ++ilay) {
32  if (Z + tolerance > (*ilay)->minZ()) {
33  if (Z - tolerance < (*ilay)->maxZ()) {
34 #ifdef MF_DEBUG
35  cout << " Trying elayer at Z " << (*ilay)->minZ() << " " << Z << endl;
36 #endif
37  result = (*ilay)->findVolume(gp, tolerance);
38 #ifdef MF_DEBUG
39  cout << "***In elayer " << (result == 0 ? " failed " : " OK ") << endl;
40 #endif
41  } else {
42  // break; // FIXME: OK if sorted by maxZ
43  }
44  }
45  if (result != nullptr)
46  return result;
47  }
48 
49  return nullptr;
50 }
const double tolerance
const MagVolume * findVolume(const GlobalPoint &gp, double tolerance) const
Find the volume containing a point, with a given tolerance.
Definition: MagESector.cc:26
T z() const
Definition: PV3DBase.h:61
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:20