CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
bSlab.cc
Go to the documentation of this file.
1 /* \file
2  * See header file for a description of this class.
3  *
4  * \author N. Amapane - INFN Torino
5  */
6 
11 
13 
14 using namespace SurfaceOrientation;
15 using namespace std;
16 
18 
19 MagGeoBuilderFromDDD::bSlab::bSlab(handles::const_iterator begin, handles::const_iterator end) :
20  volumes(begin, end),
21  mslab(0)
22 {
23  if (volumes.size() > 1) {
24  // Sort volumes by dphi i.e. phi(j)-phi(i) > 0 if j>1.
25  precomputed_value_sort(volumes.begin(), volumes.end(),
26  ExtractPhiMax(), LessDPhi());
27 
28  if (MagGeoBuilderFromDDD::debug) cout << " Slab has " << volumes.size()
29  << " volumes" << endl;
30 
31  // Check that all volumes have the same dZ
32  handles::const_iterator i = volumes.begin();
33  float Zmax = (*i)->surface(zplus).position().z();
34  float Zmin= (*i)->surface(zminus).position().z();
35  for (++i; i != volumes.end(); ++i){
36  const float epsilon = 0.001;
37  if (fabs(Zmax - (*i)->surface(zplus).position().z()) > epsilon ||
38  fabs(Zmin - (*i)->surface(zminus).position().z()) > epsilon) {
39  if (MagGeoBuilderFromDDD::debug) cout << "*** WARNING: slabs Z coords not matching: D_Zmax = "
40  << fabs(Zmax - (*i)->surface(zplus).position().z())
41  << " D_Zmin = "
42  << fabs(Zmin - (*i)->surface(zminus).position().z())
43  << endl;
44  }
45  }
46  }
47 }
48 
50  return volumes.front()->minPhi();
51 }
52 
54  return volumes.back()->maxPhi();
55 }
56 
57 
59  if (mslab==0) {
60  vector<MagVolume*> mVols;
61  for (handles::const_iterator vol = volumes.begin();
62  vol!=volumes.end(); ++vol) {
63  mVols.push_back((*vol)->magVolume);
64  }
65  mslab = new MagBSlab(mVols, volumes.front()->surface(zminus).position().z()); //FIXME
66  }
67  return mslab;
68 }
int i
Definition: DBlmapReader.cc:9
const double Zmax[kNumberCalorimeter]
bSlab(handles::const_iterator begin, handles::const_iterator end)
Constructor from list of volumes.
Definition: bSlab.cc:19
~bSlab()
Destructor.
Definition: bSlab.cc:17
#define end
Definition: vmac.h:37
MagBSlab * buildMagBSlab() const
Construct the MagBSlab upon request.
Definition: bSlab.cc:58
const double Zmin[kNumberCalorimeter]
#define begin
Definition: vmac.h:30
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
tuple cout
Definition: gather_cfg.py:121
const double epsilon
Geom::Phi< float > maxPhi() const
Boundary in phi.
Definition: bSlab.cc:53
Geom::Phi< float > minPhi() const
Boundary in phi.
Definition: bSlab.cc:49