DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4TouchableHandler.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
17 
18 #include <G4Step.hh>
19 #include <G4VTouchable.hh>
20 
21 using namespace dd4hep::sim;
22 
24 Geant4TouchableHandler::Geant4TouchableHandler(const G4Step* step, bool use_post_step_point) {
25  const G4StepPoint* p = use_post_step_point ? step->GetPostStepPoint() : step->GetPreStepPoint();
26  touchable = p->GetTouchable();
27 }
28 
31  touchable = step->GetPreStepPoint()->GetTouchable();
32 }
33 
36  return touchable->GetHistoryDepth();
37 }
38 
41  Geant4PlacementPath path_val;
42  if ( touchable ) {
43  int i, n=touchable->GetHistoryDepth();
44  path_val.reserve(n);
45  for (i=0; i < n; ++i) {
46  G4VPhysicalVolume* pv = touchable->GetVolume(i);
47  path_val.emplace_back(pv);
48  }
49  return path_val;
50  }
51  if ( exception ) {
52  except("Geant4TouchableHandler", "Attempt to access invalid G4 touchable object.");
53  }
54  return path_val;
55 }
56 
58 std::string Geant4TouchableHandler::path() const {
60 }
61 
dd4hep::sim::Geant4GeometryInfo::placementPath
static std::string placementPath(const Geant4PlacementPath &path, bool reverse=true)
Assemble Geant4 volume path.
Definition: Geant4GeometryInfo.cpp:24
Geant4GeometryInfo.h
dd4hep::sim::Geant4TouchableHandler::placementPath
Geant4PlacementPath placementPath(bool exception=false) const
Helper: Generate placement path from touchable object.
Definition: Geant4TouchableHandler.cpp:40
dd4hep::exception
void exception(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:69
dd4hep::sim::Geant4TouchableHandler::Geant4PlacementPath
std::vector< const G4VPhysicalVolume * > Geant4PlacementPath
Definition: Geant4TouchableHandler.h:47
dd4hep::sim::Geant4TouchableHandler::depth
int depth() const
Touchable history depth.
Definition: Geant4TouchableHandler.cpp:35
dd4hep::sim::Geant4TouchableHandler::touchable
const G4VTouchable * touchable
Data member of the helper objects.
Definition: Geant4TouchableHandler.h:49
Geant4TouchableHandler.h
dd4hep::sim::Geant4TouchableHandler::Geant4TouchableHandler
Geant4TouchableHandler(const G4VTouchable *t)
Default constructor.
Definition: Geant4TouchableHandler.h:52
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: Geant4Output2EDM4hep.cpp:49
dd4hep::sim::Geant4TouchableHandler::path
std::string path() const
Helper: Access the placement path of a Geant4 touchable object as a string.
Definition: Geant4TouchableHandler.cpp:58