CMS 3D CMS Logo

MaterialAccountingTrack.cc
Go to the documentation of this file.
1 #include <iostream>
2 
4 #include "G4VPhysicalVolume.hh"
6 
7 void MaterialAccountingTrack::enterDetector(const G4VPhysicalVolume* volume,
8  const GlobalPoint& position,
9  double cosTheta) {
10  if (m_current_volume != nullptr) {
11  // error: entering a volume while inside an other (or the same) one !
12  if (m_current_volume != volume)
13  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: entering volume (" << volume
14  << ") while inside volume (" << m_current_volume << ")" << std::endl;
15  else
16  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: entering volume (" << volume << ") twice"
17  << std::endl;
18  m_detector.clear();
19  return;
20  }
21 
22  m_current_volume = volume;
25  m_detector.m_cosThetaIn = cosTheta;
26 }
27 
28 void MaterialAccountingTrack::leaveDetector(const G4VPhysicalVolume* volume, double cosTheta) {
29  if (m_current_volume != volume) {
30  // error: leaving the wrong (or no) volume !
31  if (m_current_volume)
32  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: leaving volume (" << volume
33  << ") while inside volume (" << m_current_volume << ")" << std::endl;
34  else
35  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: leaving volume (" << volume
36  << ") while not inside any volume" << std::endl;
37  m_detector.clear();
38  return;
39  }
40 
41  m_current_volume = nullptr;
43  m_detector.m_cosThetaOut = cosTheta;
44  m_detectors.push_back(m_detector);
45  m_detector.clear();
46 }
const G4VPhysicalVolume * m_current_volume
std::vector< MaterialAccountingDetector > m_detectors
double length(void) const
MaterialAccountingStep m_total
MaterialAccountingDetector m_detector
void enterDetector(const G4VPhysicalVolume *volume, const GlobalPoint &position, double cosTheta)
static int position[264][3]
Definition: ReadPGInfo.cc:509
void leaveDetector(const G4VPhysicalVolume *volume, double cosTheta)