ATLAS Offline Software
Loading...
Searching...
No Matches
Geo2G4STParameterisation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "G4AutoDelete.hh"
7#include "G4VPhysicalVolume.hh"
9#include "CLHEP/Geometry/Transform3D.h"
10
12 unsigned int copies):
13 m_function(func->clone()),
14 m_nCopies(copies)
15{
16}
17
19 G4VPhysicalVolume* physVol) const
20{
21 HepGeom::Transform3D transform = Amg::EigenTransformToCLHEP((*m_function)(copyNo));
22 G4ThreeVector translation = transform.getTranslation();
23
24 // keep thread-local rotation matrix (see discussion on atlas/athena!58732)
25 static G4ThreadLocal G4RotationMatrix* rotation = nullptr;
26 if (!rotation) {
27 rotation = new G4RotationMatrix();
28 G4AutoDelete::Register(rotation);
29 }
30 *rotation = transform.getRotation().inverse();
31
32 physVol->SetTranslation(translation);
33 physVol->SetRotation(rotation);
34}
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
Geo2G4STParameterisation(const GeoXF::Function *func, unsigned int copies)
const GeoXF::Function * m_function
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.