CMS 3D CMS Logo

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:
22 
23  void clear(void) {
25  m_curvilinearOut = 0.;
26  m_cosThetaIn = 0.;
27  m_cosThetaOut = 0.;
29  }
30 
31  const GlobalPoint& position() const { return m_position; }
32 
33  const MaterialAccountingStep& material() const { return m_accounting; }
34 
35  // step holds the length and material infos for a step
36  // begin and end are the curviliniear coordinates
37  void account(const MaterialAccountingStep& step, double begin, double end) {
38  if (end <= m_curvilinearIn)
39  // step before detector
41  else if (begin >= m_curvilinearOut)
42  // step after detector
44  else
45  // step inside detector
46  m_accounting += (m_cosThetaIn + m_cosThetaOut) / 2. * step;
47  }
48 
49 private:
50  GlobalPoint m_position; // roughly the center of the detector
51  double m_curvilinearIn; // beginning of detector coordinate along the track
52  double m_curvilinearOut; // end of detector coordinate along the track
53  double m_cosThetaIn;
54  double m_cosThetaOut;
56 };
57 
58 #endif // MaterialAccountingDetector_h
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define end
Definition: vmac.h:39
const MaterialAccountingStep & material() const
void account(const MaterialAccountingStep &step, double begin, double end)
const GlobalPoint & position() const
#define begin
Definition: vmac.h:32
step
Definition: StallMonitor.cc:94