DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4TouchableHandler.cpp
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
18 
19 #include "G4Step.hh"
20 #include "G4VTouchable.hh"
21 
22 // C/C++ include files
23 #include <stdexcept>
24 
25 using namespace DD4hep::Simulation;
26 
28 Geant4TouchableHandler::Geant4TouchableHandler(const G4Step* step, bool use_post_step_point) {
29  const G4StepPoint* p = use_post_step_point ? step->GetPostStepPoint() : step->GetPreStepPoint();
30  touchable = p->GetTouchable();
31 }
32 
35  touchable = step->GetPreStepPoint()->GetTouchable();
36 }
37 
40  return touchable->GetHistoryDepth();
41 }
42 
45  Geant4PlacementPath path_val;
46  if ( touchable ) {
47  int i, n=touchable->GetHistoryDepth();
48  path_val.reserve(n);
49  for (i=0; i < n; ++i) {
50  G4VPhysicalVolume* pv = touchable->GetVolume(i);
51  path_val.push_back(pv);
52  }
53  return path_val;
54  }
55  if ( exception ) {
56  throw std::runtime_error("Attempt to access invalid G4 touchable object.");
57  }
58  return path_val;
59 }
60 
62 std::string Geant4TouchableHandler::path() const {
64 }
65 
std::vector< const G4VPhysicalVolume * > Geant4PlacementPath
std::string path() const
Helper: Access the placement path of a Geant4 touchable object as a string.
Geant4TouchableHandler(const G4VTouchable *t)
Default constructor.
const G4VTouchable * touchable
Data member of the helper objects.
Geant4PlacementPath placementPath(bool exception=false) const
Helper: Generate placement path from touchable object.
int depth() const
Touchable history depth.
std::string placementPath(const Geant4PlacementPath &path, bool reverse=true)
Assemble Geant4 volume path.