CMS 3D CMS Logo

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 }
mps_fire.i
i
Definition: mps_fire.py:355
gather_cfg.cout
cout
Definition: gather_cfg.py:144
magneticfield
Definition: MagFieldConfig.h:22
MagBSlab
Definition: MagBSlab.h:23
precomputed_value_sort.h
magneticfield::bSlab::buildMagBSlab
MagBSlab * buildMagBSlab() const
Construct the MagBSlab upon request.
Definition: bSlab.cc:49
end
#define end
Definition: vmac.h:39
geometryDiff.epsilon
int epsilon
Definition: geometryDiff.py:26
magneticfield::bSlab::minPhi
Geom::Phi< float > minPhi() const
Boundary in phi.
Definition: bSlab.cc:45
magneticfield::bSlab::mslab
MagBSlab * mslab
Definition: bSlab.h:47
debug
#define debug
Definition: HDRShower.cc:19
Gflash::Zmax
const double Zmax[kNumberCalorimeter]
Definition: GflashNameSpace.h:29
volumeBasedMagneticField_160812_cfi.volumes
volumes
Definition: volumeBasedMagneticField_160812_cfi.py:57
SurfaceOrientation::zminus
Definition: Surface.h:19
magneticfield::LessDPhi
Definition: BaseVolumeHandle.h:200
bSlab.h
magneticfield::bSlab::maxPhi
Geom::Phi< float > maxPhi() const
Boundary in phi.
Definition: bSlab.cc:47
Geom::Phi< float >
MagBSlab.h
Gflash::Zmin
const double Zmin[kNumberCalorimeter]
Definition: GflashNameSpace.h:28
MagVolume6Faces.h
magneticfield::ExtractPhiMax
Definition: BaseVolumeHandle.h:178
std
Definition: JetResolutionObject.h:76
SurfaceOrientation::zplus
Definition: Surface.h:19
magneticfield::bSlab::volumes
handles volumes
Definition: bSlab.h:46
SurfaceOrientation
Definition: Surface.h:17
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
begin
#define begin
Definition: vmac.h:32
magneticfield::bSlab::debug
bool debug
Definition: bSlab.h:48