test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, const GlobalPoint& position, double cosTheta ) {
8  if (m_current_volume != 0) {
9  // error: entering a volume while inside an other (or the same) one !
10  if (m_current_volume != volume)
11  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: entering volume (" << volume << ") while inside volume (" << m_current_volume << ")" << std::endl;
12  else
13  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: entering volume (" << volume << ") twice" << std::endl;
14  m_detector.clear();
15  return;
16  }
17 
18  m_current_volume = volume;
21  m_detector.m_cosThetaIn = cosTheta;
22 }
23 
24 void MaterialAccountingTrack::leaveDetector( const G4VPhysicalVolume* volume, double cosTheta ) {
25  if (m_current_volume != volume) {
26  // error: leaving the wrong (or no) volume !
27  if (m_current_volume)
28  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: leaving volume (" << volume << ") while inside volume (" << m_current_volume << ")" << std::endl;
29  else
30  std::cerr << "MaterialAccountingTrack::leaveDetector(...): ERROR: leaving volume (" << volume << ") while not inside any volume" << std::endl;
31  m_detector.clear();
32  return;
33  }
34 
35  m_current_volume = 0;
37  m_detector.m_cosThetaOut = cosTheta;
38  m_detectors.push_back( m_detector );
39  m_detector.clear();
40 }
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)