ATLAS Offline Software
Loading...
Searching...
No Matches
SimHitHandle_ForwardHit.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class SimHitHandle_ForwardHit //
9// //
10// Author: Thomas Keck (t.keck@cern.ch) //
11// Initial version: July 2013 //
12// //
14
16#include "VP1Base/VP1Msg.h"
17#include "VP1Utils/VP1DetInfo.h"
20
25#include "TrkSurfaces/Surface.h"
26
28
31
32
33//____________________________________________________________________
35public:
36 Imp( const SimulationHit * h ) : thehit(h){}
38};
39
40
41//____________________________________________________________________
43 : SimHitHandleBase(), m_d(new Imp(h))
44{
45 if (!h)
46 VP1Msg::message("SimHitHandle_ForwardHit constructor ERROR: Received null hit pointer");
47
48 m_link = HepMcParticleLink(m_d->thehit->trackID(), 0, HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_BARCODE); // FIXME barcode-based
49}
50
51//____________________________________________________________________
56
57//Trk::GlobalMomentum SimHitHandle_ForwardHit::momentumDirection() const
59{
60 return Amg::Hep3VectorToEigen(m_d->thehit->pre().direction);
61}
62
64{
65 return m_d->thehit->pre().momentum.mag();
66}
67//____________________________________________________________________
69{
70 return Amg::Hep3VectorToEigen(m_d->thehit->pre().position);
71}
72
73//____________________________________________________________________
75{
76 return Amg::Hep3VectorToEigen(m_d->thehit->post().position);
77}
78
79//____________________________________________________________________
81{
82 return m_d->thehit->pre().time;
83}
84
85//____________________________________________________________________
90
91//____________________________________________________________________
93{
94 return m_d->thehit->particleEncoding();
95}
96
97//____________________________________________________________________
99{
100
101 // const Trk::StraightLineSurface * surf = new Trk::StraightLineSurface(new HepGeom::Translate3D(0,0,0));
102 Amg::Transform3D transf = Amg::CLHEPTranslate3DToEigen( HepGeom::Translate3D(0,0,0) );
103 const Trk::StraightLineSurface * surf = new Trk::StraightLineSurface( transf );
104
105
106 if (!surf) {
107 VP1Msg::message("SimHitHandle_ForwardHit::createTrackParameters ERROR: could not get Trk::StraightLineSurface");
108 return nullptr;
109 }
110
111 double c;
112 if ( !hasCharge() ) {
113 bool ok;
114 c = VP1ParticleData::particleCharge(m_d->thehit->particleEncoding(),ok);
115 if (!ok) {
116 VP1Msg::message("SimHitHandle_ForwardHit::createTrackParameters ERROR: Could not find particle charge (pdg="
117 +QString::number(m_d->thehit->particleEncoding())+"). Assuming charge=+1.");
118 c = +1.0;
119 } else {
120 if (VP1Msg::verbose())
121 VP1Msg::messageVerbose("Looked up particle charge for trt simhit with pdg code "+VP1Msg::str(m_d->thehit->particleEncoding())+": "+VP1Msg::str(c));
122 }
123 const_cast<SimHitHandle_ForwardHit*>(this)->setCharge(c);
124 } else {
125 c = charge();
126 }
127 return new Trk::AtaStraightLine(posStart(),momentumDirection(),c,*surf);
128 //Fixme: Use constructor with local coords instead?:
129}
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
Header file for AthHistogramAlgorithm.
double charge() const
void setCharge(const double &c)
bool hasCharge() const
SimHitHandle_ForwardHit(const SimulationHit *)
const HepMcParticleLink & particleLink() const
Trk::TrackParameters * createTrackParameters() const
Amg::Vector3D momentumDirection() const
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static bool verbose()
Definition VP1Msg.h:31
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
static double particleCharge(const int &pdgcode, bool &ok)
static QString str(const QString &s)
Definition VP1String.h:49
Amg::Transform3D CLHEPTranslate3DToEigen(const HepGeom::Translate3D &CLHEPtranslate3D)
Converts a CLHEP-based HepGeom::Translate3 into an Eigen-based Amg::Transform3D.
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
ParametersBase< TrackParametersDim, Charged > TrackParameters