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

#include <VertexBeamCondPositioner.h>

Inheritance diagram for Simulation::VertexBeamCondPositioner:
Collaboration diagram for Simulation::VertexBeamCondPositioner:

Public Member Functions

 VertexBeamCondPositioner (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
 ~VertexBeamCondPositioner ()=default
 Destructor. More...
 
StatusCode initialize () override final
 Athena algtool's Hooks. More...
 
StatusCode finalize () override final
 Athena algtool's Hooks. More...
 
CLHEP::HepLorentzVector * generate (const EventContext &ctx) const override final
 computes the vertex displacement More...
 

Private Attributes

SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
 
ServiceHandle< IAthRNGSvcm_rndGenSvc {this, "RandomSvc", "AthRNGSvc"}
 
ATHRNG::RNGWrapper *m_randomEngine ATLAS_THREAD_SAFE {}
 Slot-local RNG. More...
 
Gaudi::Property< std::string > m_randomEngineName {this, "RandomStream", "VERTEX"}
 Name of the random number stream. More...
 
Gaudi::Property< bool > m_timeSmearing {this, "SimpleTimeSmearing", false}
 Do time smearing. More...
 
Gaudi::Property< float > m_timeWidth {this, "TimeWidth", 0.}
 Width of time for smearing. More...
 

Detailed Description

This AthenaTool computes geometrical shifts for the initial GenEvent vertices.

based on: https://svnweb.cern.ch/trac/atlasoff/browser/Simulation/G4Atlas/G4AtlasUtilities/trunk/src/VertexPositioner.cxx

Author
Andreas.Salzburger -at- cern.ch , Elmar.Ritsch -at- cern.ch

Definition at line 33 of file VertexBeamCondPositioner.h.

Constructor & Destructor Documentation

◆ VertexBeamCondPositioner()

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

Constructor with parameters.

Constructor.

Definition at line 25 of file VertexBeamCondPositioner.cxx.

28  : base_class(t,n,p)
29  {
30  }

◆ ~VertexBeamCondPositioner()

Simulation::VertexBeamCondPositioner::~VertexBeamCondPositioner ( )
default

Destructor.

Member Function Documentation

◆ finalize()

StatusCode Simulation::VertexBeamCondPositioner::finalize ( )
finaloverride

Athena algtool's Hooks.

Definition at line 50 of file VertexBeamCondPositioner.cxx.

51  {
52  ATH_MSG_VERBOSE("Finalizing ...");
53  return StatusCode::SUCCESS;
54  }

◆ generate()

CLHEP::HepLorentzVector * Simulation::VertexBeamCondPositioner::generate ( const EventContext &  ctx) const
finaloverride

computes the vertex displacement

Definition at line 57 of file VertexBeamCondPositioner.cxx.

58  {
59  // Prepare the random engine
60  m_randomEngine->setSeed( name(), ctx );
61  CLHEP::HepRandomEngine* randomEngine(m_randomEngine->getEngine(ctx));
63  // See jira issue ATLASSIM-497 for an explanation of why calling
64  // shoot outside the CLHEP::HepLorentzVector constructor is
65  // necessary/preferable.
66  float vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(0);
67  float vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(1);
68  float vertexZ = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(2);
69  // calculate the vertexSmearing
70  CLHEP::HepLorentzVector *vertexSmearing =
71  new CLHEP::HepLorentzVector( vertexX, vertexY, vertexZ, 0. );
72 
73  // (1) code from: Simulation/G4Atlas/G4AtlasUtilities/VertexPositioner.cxx
74  const double tx = tan( beamSpotHandle->beamTilt(1) );
75  const double ty = tan( beamSpotHandle->beamTilt(0) );
76 
77  const double sqrt_abc = sqrt(1. + tx*tx + ty*ty);
78  const double sqrt_fgh = sqrt(1. + ty*ty);
79 
80  const double a = ty/sqrt_abc;
81  const double b = tx/sqrt_abc;
82  const double c = 1./sqrt_abc;
83 
84  HepGeom::Point3D<double> from1(0,0,1);
85  HepGeom::Point3D<double> to1(a,b,c);
86 
87  const double f = 1./sqrt_fgh;
88  const double g = 0.;
89  const double h = -(ty)/sqrt_fgh;
90 
91  HepGeom::Point3D<double> from2(1,0,0);
92  HepGeom::Point3D<double> to2(f,g,h);
93 
94  // first rotation, then translation
96  HepGeom::Rotate3D(from1, from2, to1, to2).getRotation(),
97  CLHEP::Hep3Vector( beamSpotHandle->beamPos().x(),
98  beamSpotHandle->beamPos().y(),
99  beamSpotHandle->beamPos().z() )
100  );
101 
102  // FIXME: don't use endl in MsgStream printouts
103  ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << beamSpotHandle->beamPos() << std::endl
104  << "\tWidth is (" << beamSpotHandle->beamSigma(0)
105  << ", " << beamSpotHandle->beamSigma(1) << ", "
106  << beamSpotHandle->beamSigma(2) << ")" << std::endl
107  << "\tTime smearing is " << (m_timeSmearing ? "on" : "off") << " with width " << m_timeWidth << std::endl
108  << "\tTilts are " << beamSpotHandle->beamTilt(0) << " and " << beamSpotHandle->beamTilt(1) << std::endl
109  << "\tVertex Position before transform: " << *vertexSmearing);
110 
111  // update with the tilt
112  *vertexSmearing = transform * HepGeom::Point3D<double>(*vertexSmearing);
113 
114  float vertexT = m_timeSmearing ? CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_timeWidth*Gaudi::Units::c_light : 0.;
115  vertexSmearing->setT(vertexT);
116 
117  // and return it
118  return vertexSmearing;
119  }

◆ initialize()

StatusCode Simulation::VertexBeamCondPositioner::initialize ( )
finaloverride

Athena algtool's Hooks.

Definition at line 33 of file VertexBeamCondPositioner.cxx.

34  {
35  ATH_MSG_VERBOSE("Initializing ...");
36 
37  // retrieve the random number service
38  ATH_CHECK(m_rndGenSvc.retrieve());
39  m_randomEngine = m_rndGenSvc->getEngine(this, m_randomEngineName);
40  if (!m_randomEngine) {
41  ATH_MSG_ERROR("Could not get random number engine from RandomNumberService. Abort.");
42  return StatusCode::FAILURE;
43  }
45  // everything set up properly
46  return StatusCode::SUCCESS;
47  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

ATHRNG::RNGWrapper* m_randomEngine Simulation::VertexBeamCondPositioner::ATLAS_THREAD_SAFE {}
private

Slot-local RNG.

Definition at line 54 of file VertexBeamCondPositioner.h.

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> Simulation::VertexBeamCondPositioner::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
private

Definition at line 52 of file VertexBeamCondPositioner.h.

◆ m_randomEngineName

Gaudi::Property<std::string> Simulation::VertexBeamCondPositioner::m_randomEngineName {this, "RandomStream", "VERTEX"}
private

Name of the random number stream.

Definition at line 56 of file VertexBeamCondPositioner.h.

◆ m_rndGenSvc

ServiceHandle<IAthRNGSvc> Simulation::VertexBeamCondPositioner::m_rndGenSvc {this, "RandomSvc", "AthRNGSvc"}
private

Definition at line 53 of file VertexBeamCondPositioner.h.

◆ m_timeSmearing

Gaudi::Property<bool> Simulation::VertexBeamCondPositioner::m_timeSmearing {this, "SimpleTimeSmearing", false}
private

Do time smearing.

Definition at line 57 of file VertexBeamCondPositioner.h.

◆ m_timeWidth

Gaudi::Property<float> Simulation::VertexBeamCondPositioner::m_timeWidth {this, "TimeWidth", 0.}
private

Width of time for smearing.

Definition at line 58 of file VertexBeamCondPositioner.h.


The documentation for this class was generated from the following files:
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Simulation::VertexBeamCondPositioner::m_randomEngineName
Gaudi::Property< std::string > m_randomEngineName
Name of the random number stream.
Definition: VertexBeamCondPositioner.h:56
Simulation::VertexBeamCondPositioner::m_timeSmearing
Gaudi::Property< bool > m_timeSmearing
Do time smearing.
Definition: VertexBeamCondPositioner.h:57
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Simulation::VertexBeamCondPositioner::m_rndGenSvc
ServiceHandle< IAthRNGSvc > m_rndGenSvc
Definition: VertexBeamCondPositioner.h:53
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
beamspotman.n
n
Definition: beamspotman.py:731
Simulation::VertexBeamCondPositioner::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: VertexBeamCondPositioner.h:52
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Simulation::VertexBeamCondPositioner::m_timeWidth
Gaudi::Property< float > m_timeWidth
Width of time for smearing.
Definition: VertexBeamCondPositioner.h:58
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hist_file_dump.f
f
Definition: hist_file_dump.py:135
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
a
TList * a
Definition: liststreamerinfos.cxx:10
h
python.compressB64.c
def c
Definition: compressB64.py:93
TileDCSDataPlotter.tx
tx
Definition: TileDCSDataPlotter.py:878