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  * $Date: 2008/03/29 14:29:11 $
5  * $Revision: 1.6 $
6  * \author N. Amapane - INFN Torino
7  */
8 
13 
15 
16 using namespace SurfaceOrientation;
17 using namespace std;
18 
20 
21 MagGeoBuilderFromDDD::bSlab::bSlab(handles::const_iterator begin, handles::const_iterator end) :
22  volumes(begin, end),
23  mslab(0)
24 {
25  if (volumes.size() > 1) {
26  // Sort volumes by dphi i.e. phi(j)-phi(i) > 0 if j>1.
27  precomputed_value_sort(volumes.begin(), volumes.end(),
28  ExtractPhiMax(), LessDPhi());
29 
30  if (MagGeoBuilderFromDDD::debug) cout << " Slab has " << volumes.size()
31  << " volumes" << endl;
32 
33  // Check that all volumes have the same dZ
34  handles::const_iterator i = volumes.begin();
35  float Zmax = (*i)->surface(zplus).position().z();
36  float Zmin= (*i)->surface(zminus).position().z();
37  for (++i; i != volumes.end(); ++i){
38  const float epsilon = 0.001;
39  if (fabs(Zmax - (*i)->surface(zplus).position().z()) > epsilon ||
40  fabs(Zmin - (*i)->surface(zminus).position().z()) > epsilon) {
41  if (MagGeoBuilderFromDDD::debug) cout << "*** WARNING: slabs Z coords not matching: D_Zmax = "
42  << fabs(Zmax - (*i)->surface(zplus).position().z())
43  << " D_Zmin = "
44  << fabs(Zmin - (*i)->surface(zminus).position().z())
45  << endl;
46  }
47  }
48  }
49 }
50 
52  return volumes.front()->minPhi();
53 }
54 
56  return volumes.back()->maxPhi();
57 }
58 
59 
61  if (mslab==0) {
62  vector<MagVolume*> mVols;
63  for (handles::const_iterator vol = volumes.begin();
64  vol!=volumes.end(); ++vol) {
65  mVols.push_back((*vol)->magVolume);
66  }
67  mslab = new MagBSlab(mVols, volumes.front()->surface(zminus).position().z()); //FIXME
68  }
69  return mslab;
70 }
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:21
~bSlab()
Destructor.
Definition: bSlab.cc:19
#define end
Definition: vmac.h:38
MagBSlab * buildMagBSlab() const
Construct the MagBSlab upon request.
Definition: bSlab.cc:60
const double Zmin[kNumberCalorimeter]
#define begin
Definition: vmac.h:31
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:55
Geom::Phi< float > minPhi() const
Boundary in phi.
Definition: bSlab.cc:51