CMS 3D CMS Logo

MaterialAccountingTrack.h
Go to the documentation of this file.
1 #ifndef MaterialAccountingTrack_h
2 #define MaterialAccountingTrack_h
3 
4 #include <vector>
8 
9 // keep material accounting informations on a per-track basis
11 private:
12  // this values are optimized to avoid resizing
13  enum { kSteps = 600, kDetectors = 30 };
14 
15 public:
17  m_steps.reserve(kSteps);
18  m_detectors.reserve(kDetectors);
19  }
20 
21  void reset(void) {
22  m_total.clear();
23  m_steps.clear();
24  m_steps.reserve(kSteps);
25  m_steps.push_back(m_total);
26  m_detector.clear();
27  m_detectors.clear();
28  m_detectors.reserve(kDetectors);
29  }
30 
32  m_total += step;
33  m_steps.push_back(step);
34  }
35 
36  void enterDetector(const GlobalPoint& position, double cosTheta);
37  void leaveDetector(double cosTheta);
38 
39  const MaterialAccountingStep& summary() const { return m_total; }
40 
41  const std::vector<MaterialAccountingDetector>& detectors() const { return m_detectors; }
42 
43  std::vector<MaterialAccountingDetector>& detectors() { return m_detectors; }
44 
45  const std::vector<MaterialAccountingStep>& steps() const { return m_steps; }
46 
47  std::vector<MaterialAccountingStep>& steps() { return m_steps; }
48 
49 private:
50  MaterialAccountingStep m_total; // cache position along track (length and material)
51  MaterialAccountingDetector m_detector; // keep track of current detector
52  std::vector<MaterialAccountingStep> m_steps;
53  std::vector<MaterialAccountingDetector> m_detectors;
54 };
55 
56 #endif // MaterialAccountingTrack_h
void leaveDetector(double cosTheta)
void enterDetector(const GlobalPoint &position, double cosTheta)
std::vector< MaterialAccountingDetector > m_detectors
std::vector< MaterialAccountingStep > m_steps
MaterialAccountingStep m_total
void step(const MaterialAccountingStep &step)
const std::vector< MaterialAccountingDetector > & detectors() const
std::vector< MaterialAccountingDetector > & detectors()
MaterialAccountingDetector m_detector
std::vector< MaterialAccountingStep > & steps()
const MaterialAccountingStep & summary() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
step
Definition: StallMonitor.cc:98
const std::vector< MaterialAccountingStep > & steps() const