CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MaterialAccountingTrack.h
Go to the documentation of this file.
1 #ifndef MaterialAccountingTrack_h
2 #define MaterialAccountingTrack_h
3 
4 #include <vector>
6 #include "G4VPhysicalVolume.hh"
9 
10 // keep material accounting informations on a per-track basis
12 private:
13  // this values are optimized to avoid resizing
14  enum { kSteps = 600, kDetectors = 30 };
15 
16 public:
18  m_total(),
20  m_detector(),
21  m_steps(),
22  m_detectors()
23  {
24  m_steps.reserve(kSteps);
25  m_detectors.reserve(kDetectors);
26  }
27 
28  void reset(void) {
29  m_total.clear();
30  m_current_volume = 0;
31  m_steps.clear();
32  m_steps.reserve(kSteps);
33  m_steps.push_back( m_total );
34  m_detector.clear();
35  m_detectors.clear();
36  m_detectors.reserve(kDetectors);
37  }
38 
39  void step( const MaterialAccountingStep & step ) {
40  m_total += step;
41  m_steps.push_back( step );
42  }
43 
44  void enterDetector( const G4VPhysicalVolume* volume, const GlobalPoint& position, double cosTheta );
45  void leaveDetector( const G4VPhysicalVolume* volume, double cosTheta );
46 
48  return m_total;
49  }
50 
51  const std::vector<MaterialAccountingDetector> & detectors() {
52  return m_detectors;
53  }
54 
55  const std::vector<MaterialAccountingStep> & steps() {
56  return m_steps;
57  }
58 
59 public:
60  MaterialAccountingStep m_total; // cache position along track (length and material)
61  mutable const G4VPhysicalVolume * m_current_volume; // keep track of current G4 volume
62  mutable MaterialAccountingDetector m_detector; // keep track of current detector
63  std::vector<MaterialAccountingStep> m_steps;
64  std::vector<MaterialAccountingDetector> m_detectors;
65 };
66 
67 #endif // MaterialAccountingTrack_h
const G4VPhysicalVolume * m_current_volume
const MaterialAccountingStep & summary(void)
std::vector< MaterialAccountingDetector > m_detectors
std::vector< MaterialAccountingStep > m_steps
MaterialAccountingStep m_total
void step(const MaterialAccountingStep &step)
MaterialAccountingDetector m_detector
const std::vector< MaterialAccountingDetector > & detectors()
void enterDetector(const G4VPhysicalVolume *volume, const GlobalPoint &position, double cosTheta)
static int position[264][3]
Definition: ReadPGInfo.cc:509
const std::vector< MaterialAccountingStep > & steps()
void leaveDetector(const G4VPhysicalVolume *volume, double cosTheta)