ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Simulation::GenEventRotator Class Reference

#include <GenEventRotator.h>

Inheritance diagram for Simulation::GenEventRotator:
Collaboration diagram for Simulation::GenEventRotator:

Public Member Functions

 GenEventRotator (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
StatusCode initialize () override final
 Athena algtool's Hooks. More...
 
StatusCode finalize () override final
 Athena algtool's Hooks. More...
 
StatusCode initializeAthenaEvent ()
 
StatusCode manipulate (HepMC::GenEvent &ge, const EventContext &ctx) const override final
 modifies the given GenEvent More...
 

Private Member Functions

StatusCode initializeGenEvent (CLHEP::HepLorentzRotation &transform, const EventContext &ctx) const
 calculate the transformations that we want to apply to the particles in the current GenEvent More...
 
void rotateParticle (HepMC::GenParticlePtr &p, const CLHEP::HepLorentzRotation &transform) const
 apply rotations to individual GenParticles More...
 

Private Attributes

Gaudi::Property< double > m_xangle {this, "xAngle", 0.0, "rotation about x-axis"}
 
Gaudi::Property< double > m_yangle {this, "yAngle", 0.0, "rotation about y-axis"}
 
Gaudi::Property< double > m_zangle {this, "zAngle", 0.0, "rotation about z-axis"}
 

Detailed Description

This tool takes a HepMC::GenEvent and applies rotations See https://twiki.cern.ch/twiki/bin/viewauth/Atlas/AtlasG4EventFilters for more details.

Definition at line 28 of file GenEventRotator.h.

Constructor & Destructor Documentation

◆ GenEventRotator()

Simulation::GenEventRotator::GenEventRotator ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor with parameters.

Constructor.

Definition at line 22 of file GenEventRotator.cxx.

25  : base_class(t,n,p)
26  {
27  }

Member Function Documentation

◆ finalize()

StatusCode Simulation::GenEventRotator::finalize ( )
finaloverride

Athena algtool's Hooks.

Definition at line 37 of file GenEventRotator.cxx.

38  {
39  ATH_MSG_VERBOSE("Finalizing ...");
40  return StatusCode::SUCCESS;
41  }

◆ initialize()

StatusCode Simulation::GenEventRotator::initialize ( )
finaloverride

Athena algtool's Hooks.

Definition at line 30 of file GenEventRotator.cxx.

31  {
32  ATH_MSG_VERBOSE("Initializing ...");
33  return StatusCode::SUCCESS;
34  }

◆ initializeAthenaEvent()

StatusCode Simulation::GenEventRotator::initializeAthenaEvent ( )

Definition at line 43 of file GenEventRotator.cxx.

44  {
45  return StatusCode::SUCCESS;
46  }

◆ initializeGenEvent()

StatusCode Simulation::GenEventRotator::initializeGenEvent ( CLHEP::HepLorentzRotation &  transform,
const EventContext &  ctx 
) const
private

calculate the transformations that we want to apply to the particles in the current GenEvent

Definition at line 48 of file GenEventRotator.cxx.

49  {
50  // Reset the transformation
51  transform = CLHEP::HepLorentzRotation(); //TODO drop this
52 
53  // Setting up three rotation matrices, via 3x3 rep. rather than even more messy EulerAngles
54  const double sinX = sin(m_xangle*CLHEP::deg);
55  const double cosX = cos(m_xangle*CLHEP::deg);
56  const CLHEP::HepRotation rotx(CLHEP::HepRep3x3(1.0,0.0,0.0, 0.0,cosX,-sinX, 0.0,sinX,cosX));
57  const double sinY = sin(m_yangle*CLHEP::deg);
58  const double cosY = cos(m_yangle*CLHEP::deg);
59  const CLHEP::HepRotation roty(CLHEP::HepRep3x3(cosY,0.0,sinY, 0.0,1.0,0.0, -sinY,0.0,cosY));
60  const double sinZ = sin(m_zangle*CLHEP::deg);
61  const double cosZ = cos(m_zangle*CLHEP::deg);
62  const CLHEP::HepRotation rotz(CLHEP::HepRep3x3(cosZ,-sinZ,0.0, sinZ,cosZ,0.0, 0.0,0.0,1.0));
63  // Combine the three rotations - order of trf execution is unimportant as they are orthogonal.
64  const CLHEP::HepRotation rot = rotx*roty*rotz;
65  transform.set(rot);
66  return StatusCode::SUCCESS;
67  }

◆ manipulate()

StatusCode Simulation::GenEventRotator::manipulate ( HepMC::GenEvent &  ge,
const EventContext &  ctx 
) const
finaloverride

modifies the given GenEvent

modifies (displaces) the given GenEvent

Definition at line 70 of file GenEventRotator.cxx.

71  {
72  // Obtain the transformation
73  CLHEP::HepLorentzRotation transform = CLHEP::HepLorentzRotation();
75 
76  for(auto particleIter: ge) {
77  rotateParticle(particleIter, transform);
78  }
79  return StatusCode::SUCCESS;
80  }

◆ rotateParticle()

void Simulation::GenEventRotator::rotateParticle ( HepMC::GenParticlePtr p,
const CLHEP::HepLorentzRotation &  transform 
) const
private

apply rotations to individual GenParticles

Definition at line 82 of file GenEventRotator.cxx.

84  {
85  // Apply the same transformation for EVERY HepMC::GenParticle
86  const HepMC::FourVector mom = p->momentum();
87  CLHEP::HepLorentzVector hv(mom.px(), mom.py(), mom.pz(), mom.e()); //TODO check units
88  ATH_MSG_VERBOSE("initial momentum " << hv );
89  hv.transform(transform);
90  ATH_MSG_VERBOSE("transformed momentum " << hv);
91  p->set_momentum(HepMC::FourVector(hv.px(),hv.py(),hv.pz(),hv.e())); //TODO check units
92  }

Member Data Documentation

◆ m_xangle

Gaudi::Property<double> Simulation::GenEventRotator::m_xangle {this, "xAngle", 0.0, "rotation about x-axis"}
private

Definition at line 49 of file GenEventRotator.h.

◆ m_yangle

Gaudi::Property<double> Simulation::GenEventRotator::m_yangle {this, "yAngle", 0.0, "rotation about y-axis"}
private

Definition at line 50 of file GenEventRotator.h.

◆ m_zangle

Gaudi::Property<double> Simulation::GenEventRotator::m_zangle {this, "zAngle", 0.0, "rotation about z-axis"}
private

Definition at line 51 of file GenEventRotator.h.


The documentation for this class was generated from the following files:
deg
#define deg
Definition: SbPolyhedron.cxx:17
Simulation::GenEventRotator::m_yangle
Gaudi::Property< double > m_yangle
Definition: GenEventRotator.h:50
Simulation::GenEventRotator::m_zangle
Gaudi::Property< double > m_zangle
Definition: GenEventRotator.h:51
Simulation::GenEventRotator::initializeGenEvent
StatusCode initializeGenEvent(CLHEP::HepLorentzRotation &transform, const EventContext &ctx) const
calculate the transformations that we want to apply to the particles in the current GenEvent
Definition: GenEventRotator.cxx:48
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
beamspotman.n
n
Definition: beamspotman.py:731
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Simulation::GenEventRotator::m_xangle
Gaudi::Property< double > m_xangle
Definition: GenEventRotator.h:49
Simulation::GenEventRotator::rotateParticle
void rotateParticle(HepMC::GenParticlePtr &p, const CLHEP::HepLorentzRotation &transform) const
apply rotations to individual GenParticles
Definition: GenEventRotator.cxx:82
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36