CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
MaterialAccountingTrack Class Reference

#include <MaterialAccountingTrack.h>

Public Member Functions

const std::vector< MaterialAccountingDetector > & detectors () const
 
std::vector< MaterialAccountingDetector > & detectors ()
 
void enterDetector (const G4VPhysicalVolume *volume, const GlobalPoint &position, double cosTheta)
 
void leaveDetector (const G4VPhysicalVolume *volume, double cosTheta)
 
 MaterialAccountingTrack (void)
 
void reset (void)
 
void step (const MaterialAccountingStep &step)
 
const std::vector< MaterialAccountingStep > & steps () const
 
std::vector< MaterialAccountingStep > & steps ()
 
const MaterialAccountingStepsummary () const
 

Private Types

enum  { kSteps = 600, kDetectors = 30 }
 

Private Attributes

const G4VPhysicalVolume * m_current_volume
 
MaterialAccountingDetector m_detector
 
std::vector< MaterialAccountingDetectorm_detectors
 
std::vector< MaterialAccountingStepm_steps
 
MaterialAccountingStep m_total
 

Detailed Description

Definition at line 11 of file MaterialAccountingTrack.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kSteps 
kDetectors 

Definition at line 14 of file MaterialAccountingTrack.h.

Constructor & Destructor Documentation

MaterialAccountingTrack::MaterialAccountingTrack ( void  )
inline

Definition at line 17 of file MaterialAccountingTrack.h.

References kDetectors, kSteps, m_detectors, and m_steps.

17  : m_total(), m_current_volume(nullptr), m_detector(), m_steps(), m_detectors() {
18  m_steps.reserve(kSteps);
19  m_detectors.reserve(kDetectors);
20  }
const G4VPhysicalVolume * m_current_volume
std::vector< MaterialAccountingDetector > m_detectors
std::vector< MaterialAccountingStep > m_steps
MaterialAccountingStep m_total
MaterialAccountingDetector m_detector

Member Function Documentation

const std::vector<MaterialAccountingDetector>& MaterialAccountingTrack::detectors ( ) const
inline

Definition at line 43 of file MaterialAccountingTrack.h.

References m_detectors.

Referenced by TrackingMaterialAnalyser::split().

43 { return m_detectors; }
std::vector< MaterialAccountingDetector > m_detectors
std::vector<MaterialAccountingDetector>& MaterialAccountingTrack::detectors ( )
inline

Definition at line 45 of file MaterialAccountingTrack.h.

References m_detectors.

45 { return m_detectors; }
std::vector< MaterialAccountingDetector > m_detectors
void MaterialAccountingTrack::enterDetector ( const G4VPhysicalVolume *  volume,
const GlobalPoint position,
double  cosTheta 
)

Definition at line 7 of file MaterialAccountingTrack.cc.

References MessageLogger_cfi::cerr, MaterialAccountingDetector::clear(), MaterialAccountingStep::length(), MaterialAccountingDetector::m_cosThetaIn, m_current_volume, MaterialAccountingDetector::m_curvilinearIn, m_detector, MaterialAccountingDetector::m_position, m_total, and position.

Referenced by step().

9  {
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 }
const G4VPhysicalVolume * m_current_volume
double length(void) const
MaterialAccountingStep m_total
MaterialAccountingDetector m_detector
static int position[264][3]
Definition: ReadPGInfo.cc:509
void MaterialAccountingTrack::leaveDetector ( const G4VPhysicalVolume *  volume,
double  cosTheta 
)

Definition at line 28 of file MaterialAccountingTrack.cc.

References MessageLogger_cfi::cerr, MaterialAccountingDetector::clear(), MaterialAccountingStep::length(), MaterialAccountingDetector::m_cosThetaOut, m_current_volume, MaterialAccountingDetector::m_curvilinearOut, m_detector, m_detectors, and m_total.

Referenced by step().

28  {
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 MaterialAccountingTrack::reset ( void  )
inline

Definition at line 22 of file MaterialAccountingTrack.h.

References MaterialAccountingStep::clear(), MaterialAccountingDetector::clear(), kDetectors, kSteps, m_current_volume, m_detector, m_detectors, m_steps, and m_total.

22  {
23  m_total.clear();
24  m_current_volume = nullptr;
25  m_steps.clear();
26  m_steps.reserve(kSteps);
27  m_steps.push_back(m_total);
28  m_detector.clear();
29  m_detectors.clear();
30  m_detectors.reserve(kDetectors);
31  }
const G4VPhysicalVolume * m_current_volume
std::vector< MaterialAccountingDetector > m_detectors
std::vector< MaterialAccountingStep > m_steps
MaterialAccountingStep m_total
MaterialAccountingDetector m_detector
void MaterialAccountingTrack::step ( const MaterialAccountingStep step)
inline

Definition at line 33 of file MaterialAccountingTrack.h.

References enterDetector(), leaveDetector(), m_steps, m_total, and position.

33  {
34  m_total += step;
35  m_steps.push_back(step);
36  }
std::vector< MaterialAccountingStep > m_steps
MaterialAccountingStep m_total
void step(const MaterialAccountingStep &step)
const std::vector<MaterialAccountingStep>& MaterialAccountingTrack::steps ( ) const
inline

Definition at line 47 of file MaterialAccountingTrack.h.

References m_steps.

Referenced by TrackingMaterialAnalyser::split().

47 { return m_steps; }
std::vector< MaterialAccountingStep > m_steps
std::vector<MaterialAccountingStep>& MaterialAccountingTrack::steps ( )
inline

Definition at line 49 of file MaterialAccountingTrack.h.

References m_steps.

49 { return m_steps; }
std::vector< MaterialAccountingStep > m_steps
const MaterialAccountingStep& MaterialAccountingTrack::summary ( ) const
inline

Definition at line 41 of file MaterialAccountingTrack.h.

References m_total.

Referenced by TrackingMaterialAnalyser::split().

41 { return m_total; }
MaterialAccountingStep m_total

Member Data Documentation

const G4VPhysicalVolume* MaterialAccountingTrack::m_current_volume
private

Definition at line 53 of file MaterialAccountingTrack.h.

Referenced by enterDetector(), leaveDetector(), and reset().

MaterialAccountingDetector MaterialAccountingTrack::m_detector
private

Definition at line 54 of file MaterialAccountingTrack.h.

Referenced by enterDetector(), leaveDetector(), and reset().

std::vector<MaterialAccountingDetector> MaterialAccountingTrack::m_detectors
private

Definition at line 56 of file MaterialAccountingTrack.h.

Referenced by detectors(), leaveDetector(), MaterialAccountingTrack(), and reset().

std::vector<MaterialAccountingStep> MaterialAccountingTrack::m_steps
private

Definition at line 55 of file MaterialAccountingTrack.h.

Referenced by MaterialAccountingTrack(), reset(), step(), and steps().

MaterialAccountingStep MaterialAccountingTrack::m_total
private

Definition at line 52 of file MaterialAccountingTrack.h.

Referenced by enterDetector(), leaveDetector(), reset(), step(), and summary().