CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MaterialAccountingDetector.h
Go to the documentation of this file.
1 #ifndef MaterialAccountingDetector_h
2 #define MaterialAccountingDetector_h
3 
4 #include <iostream>
5 #include <sstream>
6 #include <string>
7 #include <vector>
8 #include <cmath>
9 
10 // CMSSW
13 
14 // struct to keep material accounting and geometrical informations on a per-detector basis, along a track
18 
19 public:
21  m_position (),
22  m_curvilinearIn ( 0. ),
23  m_curvilinearOut ( 0. ),
24  m_cosThetaIn ( 0. ),
25  m_cosThetaOut ( 0. ),
26  m_accounting ()
27  { }
28 
29  void clear( void ) {
31  m_curvilinearIn = 0.;
32  m_curvilinearOut = 0.;
33  m_cosThetaIn = 0.;
34  m_cosThetaOut = 0.;
36  }
37 
38  const GlobalPoint & position() const {
39  return m_position;
40  }
41 
42  const MaterialAccountingStep & material() const {
43  return m_accounting;
44  }
45 
46  // step holds the length and material infos for a step
47  // begin and end are the curviliniear coordinates
48  void account( const MaterialAccountingStep & step, double begin, double end )
49  {
50  if (end <= m_curvilinearIn)
51  // step before detector
53  else if (begin >= m_curvilinearOut)
54  // step after detector
56  else
57  // step inside detector
58  m_accounting += (m_cosThetaIn + m_cosThetaOut ) / 2. * step;
59  }
60 
61 private:
62  GlobalPoint m_position; // roughly the center of the detector
63  double m_curvilinearIn; // beginning of detector coordinate along the track
64  double m_curvilinearOut; // end of detector coordinate along the track
65  double m_cosThetaIn;
66  double m_cosThetaOut;
68 };
69 
70 #endif // MaterialAccountingDetector_h
list step
Definition: launcher.py:15
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define end
Definition: vmac.h:38
const MaterialAccountingStep & material() const
void account(const MaterialAccountingStep &step, double begin, double end)
const GlobalPoint & position() const
#define begin
Definition: vmac.h:31