CMS 3D CMS Logo

eLayer.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author N. Amapane - INFN Torino
5  */
6 
7 #include "eLayer.h"
10 
12 
13 using namespace SurfaceOrientation;
14 using namespace std;
15 using namespace magneticfield;
16 
17 //The ctor is in charge of finding sectors inside the layer.
18 eLayer::eLayer(handles::const_iterator begin, handles::const_iterator end) : theVolumes(begin, end), mlayer(nullptr) {
19  // bool debug=MagGeoBuilderFromDDD::debug;
20 
21  // Sort in R
23 
24  // if (debug) {
25  // cout << " elements: " << theVolumes.size() << " unique volumes: ";
26  // volumeHandle::printUniqueNames(theVolumes.begin(), theVolumes.end());
27  // }
28 }
29 
30 // double MagGeoBuilderFromDDD::eLayer::minR() const {
31 // // ASSUMPTION: a layer is only 1 volume thick (by construction).
32 // return theVolumes.front()->minR();
33 // }
34 
35 // double MagGeoBuilderFromDDD::eLayer::maxR() const {
36 // // ASSUMPTION: a layer is only 1 volume thick (by construction).
37 // return theVolumes.front()->maxR();
38 // }
39 
41  if (mlayer == nullptr) {
42  //FIXME not guaranteed that all volumes in layer have the same zmin
43  // and zmax!
44  double zmin = 1e19;
45  double zmax = -1e19;
46  vector<MagVolume*> mVols;
47  for (handles::const_iterator vol = theVolumes.begin(); vol != theVolumes.end(); ++vol) {
48  mVols.push_back((*vol)->magVolume);
49  zmin = min(zmin, (*vol)->minZ());
50  zmax = max(zmax, (*vol)->maxZ());
51  }
52  mlayer = new MagELayer(mVols, zmin, zmax);
53  }
54  return mlayer;
55 }
MagELayer * mlayer
Definition: eLayer.h:31
handles theVolumes
Definition: eLayer.h:30
MagELayer * buildMagELayer() const
Construct the MagELayer upon request.
Definition: eLayer.cc:40
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)