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 }
MaterialAccountingDetector::m_cosThetaOut
double m_cosThetaOut
Definition: MaterialAccountingDetector.h:55
MaterialAccountingTrack::enterDetector
void enterDetector(const G4VPhysicalVolume *volume, const GlobalPoint &position, double cosTheta)
Definition: MaterialAccountingTrack.cc:7
MaterialAccountingDetector::m_cosThetaIn
double m_cosThetaIn
Definition: MaterialAccountingDetector.h:54
MaterialAccountingTrack::m_detectors
std::vector< MaterialAccountingDetector > m_detectors
Definition: MaterialAccountingTrack.h:56
MaterialAccountingDetector::m_curvilinearIn
double m_curvilinearIn
Definition: MaterialAccountingDetector.h:52
MaterialAccountingDetector::m_curvilinearOut
double m_curvilinearOut
Definition: MaterialAccountingDetector.h:53
MaterialAccountingTrack::leaveDetector
void leaveDetector(const G4VPhysicalVolume *volume, double cosTheta)
Definition: MaterialAccountingTrack.cc:28
MaterialAccountingTrack.h
Point3DBase< float, GlobalTag >
MaterialAccountingTrack::m_detector
MaterialAccountingDetector m_detector
Definition: MaterialAccountingTrack.h:54
MaterialAccountingTrack::m_total
MaterialAccountingStep m_total
Definition: MaterialAccountingTrack.h:52
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
MaterialAccountingDetector::clear
void clear(void)
Definition: MaterialAccountingDetector.h:24
MaterialAccountingStep::length
double length(void) const
Definition: MaterialAccountingStep.h:32
MaterialAccountingDetector::m_position
GlobalPoint m_position
Definition: MaterialAccountingDetector.h:51
MaterialAccountingTrack::m_current_volume
const G4VPhysicalVolume * m_current_volume
Definition: MaterialAccountingTrack.h:53
GlobalPoint.h