ATLAS Offline Software
Loading...
Searching...
No Matches
VolumeTreeNavigator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6// //
7// VolumeTreeNavigator.h //
8// Class containing functions to allow a general //
9// navigation of uniquely specified GEANT4 volumes //
10// and collection of their tree patterns and locations. //
11// //
12// Written by Kevin Sapp //
13// University of Pittsburgh //
14// kcs34@pitt.edu //
15// Last update 02.02.10 //
16// //
17// //
19
20#ifndef VolumeTreeNavigator_H
21#define VolumeTreeNavigator_H
22
23#include <string>
24#include <vector>
25#include <stdarg.h>
26
28
29class G4Step;
30class G4Track;
31class G4StepPoint;
32class G4TouchableHistory;
33class G4VPhysicalVolume;
34
35typedef std::pair<G4VPhysicalVolume*,int> VolID;
36typedef std::vector<VolID> VolTree;
37typedef VolTree::iterator VolNav;
38
40 public:
41 VolumeTreeNavigator(const G4Step*);
42
43 void SetDepthCutSimple(const int, const int, const int, const int);
44 void SetDepthCutDetail(const char*);
46 bool Ascend(int levels = 1);
47 bool Descend(int levels = 1);
48 bool KillProcesses(const int, const char*, ...);
49
51 G4VPhysicalVolume* GetVolume(int rel = 0) const;
52 int GetCopyNumber(int rel = 0) const;
53 const G4Track* GetTrack() const;
54 const G4StepPoint* GetPreStepPoint() const;
55 const G4StepPoint* GetPostStepPoint() const;
56 int GetStepNumber() const;
57 const VolTree& GetHistory() const;
58 int GetFullDepth() const;
59
60 private:
61 G4Track* m_track;
62 G4StepPoint* m_preStepPoint;
63 G4StepPoint* m_postStepPoint;
64 const G4TouchableHistory* m_preHistory;
66
70};
71
72template <class T>
73inline std::string stringify(T obj)
74{
75 std::ostringstream ss;
76 ss << obj;
77 return ss.str();
78}
79
80template<class T>
81inline std::string cleanstr(T obj)
82{
83 std::string s = stringify(std::move(obj));
84 std::string::size_type col = s.find_first_of(":");
85 while (col != std::string::npos) {
86 (s.substr(col,2) == "::") ? s.replace(col,2,"_") : s.replace(col,1,"-");
87 col = s.find_first_of(":");
88 }
89 std::string::size_type sp = s.find_first_of(" ");
90 while (sp != std::string::npos) {
91 s.erase(sp,1);
92 sp = s.find_first_of(" ");
93 }
94 return s;
95}
96
98#endif
static Double_t sp
static Double_t ss
std::vector< VolID > VolTree
std::pair< G4VPhysicalVolume *, int > VolID
std::string cleanstr(T obj)
VolTree::iterator VolNav
std::string stringify(T obj)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
bool KillProcesses(const int, const char *,...)
int m_stepNo
depth of volume tree, step number
int GetStepNumber() const
bool Ascend(int levels=1)
VolNav m_h_end
specifies cut termination in history
G4VPhysicalVolume * GetVolume(int rel=0) const
const G4StepPoint * GetPostStepPoint() const
const G4Track * GetTrack() const
int GetCopyNumber(int rel=0) const
VolTree m_history
full volume history, cast as const after preparation
void SetDepthCutDetail(const char *)
bool Descend(int levels=1)
G4Track * m_track
current track
const VolTree & GetHistory() const
const G4TouchableHistory * m_preHistory
touchable history containing current volume's history
void SetDepthCutSimple(const int, const int, const int, const int)
VolumeTreeNavigator(const G4Step *)
G4StepPoint * m_preStepPoint
volume/process/etc.
G4StepPoint * m_postStepPoint
volume/process/etc.
VolNav m_h_nav
VolTree iterator with no access below cut.
const G4StepPoint * GetPreStepPoint() const
int GetFullDepth() const