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  :
18  m_total(),
20  m_detector(),
21  m_steps(),
22  m_detectors()
23  {
24  m_steps.reserve(kSteps);
25  m_detectors.reserve(kDetectors);
26  }
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 51 of file MaterialAccountingTrack.h.

References m_detectors.

Referenced by TrackingMaterialAnalyser::split().

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

Definition at line 55 of file MaterialAccountingTrack.h.

References m_detectors.

55  {
56  return m_detectors;
57  }
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().

7  {
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 }
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 24 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().

24  {
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 MaterialAccountingTrack::reset ( void  )
inline
void MaterialAccountingTrack::step ( const MaterialAccountingStep step)
inline

Definition at line 39 of file MaterialAccountingTrack.h.

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

39  {
40  m_total += step;
41  m_steps.push_back( step );
42  }
std::vector< MaterialAccountingStep > m_steps
MaterialAccountingStep m_total
void step(const MaterialAccountingStep &step)
const std::vector<MaterialAccountingStep>& MaterialAccountingTrack::steps ( ) const
inline

Definition at line 59 of file MaterialAccountingTrack.h.

References m_steps.

Referenced by TrackingMaterialAnalyser::split().

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

Definition at line 63 of file MaterialAccountingTrack.h.

References m_steps.

63  {
64  return m_steps;
65  }
std::vector< MaterialAccountingStep > m_steps
const MaterialAccountingStep& MaterialAccountingTrack::summary ( void  ) const
inline

Definition at line 47 of file MaterialAccountingTrack.h.

References m_total.

Referenced by TrackingMaterialAnalyser::split().

47  {
48  return m_total;
49  }
MaterialAccountingStep m_total

Member Data Documentation

const G4VPhysicalVolume* MaterialAccountingTrack::m_current_volume
private

Definition at line 69 of file MaterialAccountingTrack.h.

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

MaterialAccountingDetector MaterialAccountingTrack::m_detector
private

Definition at line 70 of file MaterialAccountingTrack.h.

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

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

Definition at line 72 of file MaterialAccountingTrack.h.

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

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

Definition at line 71 of file MaterialAccountingTrack.h.

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

MaterialAccountingStep MaterialAccountingTrack::m_total
private

Definition at line 68 of file MaterialAccountingTrack.h.

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