CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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
19 
20 public:
23 
24  void clear(void) {
26  m_curvilinearOut = 0.;
27  m_cosThetaIn = 0.;
28  m_cosThetaOut = 0.;
30  }
31 
32  const GlobalPoint& position() const { return m_position; }
33 
34  const MaterialAccountingStep& material() const { return m_accounting; }
35 
36  // step holds the length and material infos for a step
37  // begin and end are the curviliniear coordinates
38  void account(const MaterialAccountingStep& step, double begin, double end) {
39  if (end <= m_curvilinearIn)
40  // step before detector
42  else if (begin >= m_curvilinearOut)
43  // step after detector
45  else
46  // step inside detector
47  m_accounting += (m_cosThetaIn + m_cosThetaOut) / 2. * step;
48  }
49 
50 private:
51  GlobalPoint m_position; // roughly the center of the detector
52  double m_curvilinearIn; // beginning of detector coordinate along the track
53  double m_curvilinearOut; // end of detector coordinate along the track
54  double m_cosThetaIn;
55  double m_cosThetaOut;
57 };
58 
59 #endif // MaterialAccountingDetector_h
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const MaterialAccountingStep & material() const
void account(const MaterialAccountingStep &step, double begin, double end)
const GlobalPoint & position() const
string end
Definition: dataset.py:937
step
Definition: StallMonitor.cc:98