CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 
7 #include "bSlab.h"
10 
12 
13 #include <iostream>
14 
15 using namespace SurfaceOrientation;
16 using namespace std;
17 using namespace magneticfield;
18 
19 bSlab::bSlab(handles::const_iterator begin, handles::const_iterator end, bool debugVal)
20  : volumes(begin, end), mslab(nullptr), debug(debugVal) {
21  if (volumes.size() > 1) {
22  // Sort volumes by dphi i.e. phi(j)-phi(i) > 0 if j>1.
24 
25  if (debug)
26  cout << " Slab has " << volumes.size() << " volumes" << endl;
27 
28  // Check that all volumes have the same dZ
29  handles::const_iterator i = volumes.begin();
30  float Zmax = (*i)->surface(zplus).position().z();
31  float Zmin = (*i)->surface(zminus).position().z();
32  for (++i; i != volumes.end(); ++i) {
33  const float epsilon = 0.001;
34  if (fabs(Zmax - (*i)->surface(zplus).position().z()) > epsilon ||
35  fabs(Zmin - (*i)->surface(zminus).position().z()) > epsilon) {
36  if (debug)
37  cout << "*** WARNING: slabs Z coords not matching: D_Zmax = "
38  << fabs(Zmax - (*i)->surface(zplus).position().z())
39  << " D_Zmin = " << fabs(Zmin - (*i)->surface(zminus).position().z()) << endl;
40  }
41  }
42  }
43 }
44 
45 Geom::Phi<float> bSlab::minPhi() const { return volumes.front()->minPhi(); }
46 
47 Geom::Phi<float> bSlab::maxPhi() const { return volumes.back()->maxPhi(); }
48 
50  if (mslab == nullptr) {
51  vector<MagVolume*> mVols;
52  for (handles::const_iterator vol = volumes.begin(); vol != volumes.end(); ++vol) {
53  mVols.push_back((*vol)->magVolume);
54  }
55  mslab = new MagBSlab(mVols, volumes.front()->surface(zminus).position().z()); //FIXME
56  }
57  return mslab;
58 }
Geom::Phi< float > maxPhi() const
Boundary in phi.
Definition: bSlab.cc:47
const double Zmax[kNumberCalorimeter]
const double Zmin[kNumberCalorimeter]
#define debug
Definition: HDRShower.cc:19
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
MagBSlab * mslab
Definition: bSlab.h:47
handles volumes
Definition: bSlab.h:46
string end
Definition: dataset.py:937
tuple cout
Definition: gather_cfg.py:144
Geom::Phi< float > minPhi() const
Boundary in phi.
Definition: bSlab.cc:45
MagBSlab * buildMagBSlab() const
Construct the MagBSlab upon request.
Definition: bSlab.cc:49