ATLAS Offline Software
MuonSpectrometer/MuonPhaseII/MuonG4/MuonSensitiveDetectorsR4/MuonSensitiveDetectorsR4/Utils.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONSENSITIVEDETECTORSR4_UTILS_H
5 #define MUONSENSITIVEDETECTORSR4_UTILS_H
8 
9 
10 #include <G4VTouchable.hh>
11 #include <G4Track.hh>
12 
13 
14 namespace MuonG4R4 {
15 
16 
24  inline Amg::Transform3D getTransform(const G4VTouchable* history, unsigned int level) {
25  return Amg::Translation3D{Amg::Hep3VectorToEigen(history->GetTranslation(level))}*
26  Amg::CLHEPRotationToEigen(*history->GetRotation(level)).inverse();
27  }
28 }
29  inline std::ostream& operator<<(std::ostream& ostr, const G4Track& step) {
30  ostr<<"position: "<<Amg::toString(Amg::Hep3VectorToEigen(step.GetPosition()),2)<<", ";
31  ostr<<"momentum: "<<Amg::toString(Amg::Hep3VectorToEigen(step.GetMomentum()),2)<<", ";
32  ostr<<"velocity: "<<step.GetVelocity()<<", ";
33  ostr<<"time: "<<step.GetGlobalTime()<<", ";
34  ostr<<"mass: "<<step.GetDefinition()->GetPDGMass()<<", ";
35  ostr<<"kinetic energy: "<<step.GetKineticEnergy()<<", ";
36  ostr<<"charge: "<<step.GetDefinition()->GetPDGCharge();
37  return ostr;
38  }
39  inline std::ostream& operator<<(std::ostream& ostr, const G4StepPoint& step) {
40  ostr<<"position: "<<Amg::toString(Amg::Hep3VectorToEigen(step.GetPosition()),2)<<", ";
41  ostr<<"momentum: "<<Amg::toString(Amg::Hep3VectorToEigen(step.GetMomentum()),2)<<", ";
42  ostr<<"time: "<<step.GetGlobalTime()<<", ";
43  ostr<<"mass: "<<step.GetMass()<<", ";
44  ostr<<"kinetic energy: "<<step.GetKineticEnergy()<<", ";
45  ostr<<"charge: "<<step.GetCharge();
46  return ostr;
47  }
48 
49 
50 #endif
MuonG4R4::getTransform
Amg::Transform3D getTransform(const G4VTouchable *history, unsigned int level)
Extracts the local -> global transformation from a TouchableHistory at a given level.
Definition: MuonSpectrometer/MuonPhaseII/MuonG4/MuonSensitiveDetectorsR4/MuonSensitiveDetectorsR4/Utils.h:24
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
Amg::Hep3VectorToEigen
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Definition: CLHEPtoEigenConverter.h:137
MuonG4R4
Include the common definitions from the MuonReadoutGeometry.
Definition: MuonSpectrometer/MuonPhaseII/MuonG4/MuonSensitiveDetectorsR4/MuonSensitiveDetectorsR4/Utils.h:14
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::CLHEPRotationToEigen
RotationMatrix3D CLHEPRotationToEigen(const CLHEP::HepRotation &CLHEProtation)
Converts a CLHEP::HepRotation into an Eigen-based Amg::RotationMatrix3D.
Definition: CLHEPtoEigenConverter.h:63
operator<<
std::ostream & operator<<(std::ostream &ostr, const G4Track &step)
Definition: MuonSpectrometer/MuonPhaseII/MuonG4/MuonSensitiveDetectorsR4/MuonSensitiveDetectorsR4/Utils.h:29
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
LArCellBinning.step
step
Definition: LArCellBinning.py:158
MuonDetectorDefs.h