ATLAS Offline Software
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 
23 #include "InDetIdentifier/SCT_ID.h"
25 #include "TrkSurfaces/Surface.h"
26 
28 
31 
32 
33 //____________________________________________________________________
35 public:
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 
49 }
50 
51 //____________________________________________________________________
53 {
54  delete m_d;
55 }
56 
57 //Trk::GlobalMomentum SimHitHandle_ForwardHit::momentumDirection() const
59 {
61 }
62 
64 {
65  return m_d->thehit->pre().momentum.mag();
66 }
67 //____________________________________________________________________
69 {
71 }
72 
73 //____________________________________________________________________
75 {
77 }
78 
79 //____________________________________________________________________
81 {
82  return m_d->thehit->pre().time;
83 }
84 
85 //____________________________________________________________________
87 {
88  return m_link;
89 }
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;
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 }
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
SimHitHandle_ForwardHit::actualPDGCodeFromSimHit
int actualPDGCodeFromSimHit() const
Definition: SimHitHandle_ForwardHit.cxx:92
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
StraightLineSurface.h
SimHitHandle_ForwardHit::m_link
HepMcParticleLink m_link
Definition: SimHitHandle_ForwardHit.h:45
TrackParameters.h
Surface.h
SimHitHandle_ForwardHit::particleLink
const HepMcParticleLink & particleLink() const
Definition: SimHitHandle_ForwardHit.cxx:86
VP1Msg.h
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
SimHitHandle_ForwardHit::actualMomentum
double actualMomentum() const
Definition: SimHitHandle_ForwardHit.cxx:63
VP1ParticleData.h
SimHitHandle_ForwardHit.h
SimHitHandle_ForwardHit::posStart
Amg::Vector3D posStart() const
Definition: SimHitHandle_ForwardHit.cxx:68
SimulationHit::StepPoint::time
double time
Definition: SimulationHit.h:23
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
SimulationHit
Definition: SimulationHit.h:11
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
VP1TrackSanity.h
SimulationHit::pre
const StepPoint & pre() const
Definition: SimulationHit.h:30
Trk::AtaStraightLine
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:35
VP1DetInfo.h
GeoPrimitives.h
SimHitHandleBase::setCharge
void setCharge(const double &c)
Definition: SimHitHandleBase.h:57
SimHitHandle_ForwardHit::hitTime
double hitTime() const
Definition: SimHitHandle_ForwardHit.cxx:80
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
SimHitHandle_ForwardHit::Imp::thehit
const SimulationHit * thehit
Definition: SimHitHandle_ForwardHit.cxx:37
VP1ParticleData::particleCharge
static double particleCharge(const int &pdgcode, bool &ok)
Definition: VP1ParticleData.cxx:103
SimulationHit::StepPoint::position
CLHEP::Hep3Vector position
Definition: SimulationHit.h:24
Trk::ParametersBase
Definition: ParametersBase.h:55
SimHitHandle_ForwardHit::~SimHitHandle_ForwardHit
virtual ~SimHitHandle_ForwardHit()
Definition: SimHitHandle_ForwardHit.cxx:52
SimHitHandle_ForwardHit::momentumDirection
Amg::Vector3D momentumDirection() const
Definition: SimHitHandle_ForwardHit.cxx:58
SimHitHandle_ForwardHit::Imp
Definition: SimHitHandle_ForwardHit.cxx:34
CLHEPtoEigenConverter.h
SimulationHit::trackID
int trackID() const
Definition: SimulationHit.h:34
SimHitHandle_ForwardHit
Definition: SimHitHandle_ForwardHit.h:23
python.selection.number
number
Definition: selection.py:20
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
SimulationHit::particleEncoding
int particleEncoding() const
Definition: SimulationHit.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
SimulationHit::post
const StepPoint & post() const
Definition: SimulationHit.h:31
SimHitHandle_ForwardHit::Imp::Imp
Imp(const SimulationHit *h)
Definition: SimHitHandle_ForwardHit.cxx:36
SimHitHandle_ForwardHit::m_d
Imp * m_d
Definition: SimHitHandle_ForwardHit.h:43
SimHitHandle_ForwardHit::posEnd
Amg::Vector3D posEnd() const
Definition: SimHitHandle_ForwardHit.cxx:74
Amg::CLHEPTranslate3DToEigen
Amg::Transform3D CLHEPTranslate3DToEigen(const HepGeom::Translate3D &CLHEPtranslate3D)
Converts a CLHEP-based HepGeom::Translate3 into an Eigen-based Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:99
SimHitHandle_ForwardHit::createTrackParameters
Trk::TrackParameters * createTrackParameters() const
Definition: SimHitHandle_ForwardHit.cxx:98
h
SimHitHandle_ForwardHit::SimHitHandle_ForwardHit
SimHitHandle_ForwardHit(const SimulationHit *)
Definition: SimHitHandle_ForwardHit.cxx:42
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
SimHitHandleBase::hasCharge
bool hasCharge() const
Definition: SimHitHandleBase.h:50
SimHitHandleBase
Definition: SimHitHandleBase.h:32
SimHitHandleBase::charge
double charge() const
Definition: SimHitHandleBase.h:51
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
SimulationHit.h
python.compressB64.c
def c
Definition: compressB64.py:93
SimulationHit::StepPoint::direction
CLHEP::Hep3Vector direction
Definition: SimulationHit.h:26
SimulationHit::StepPoint::momentum
CLHEP::Hep3Vector momentum
Definition: SimulationHit.h:27
Trk::StraightLineSurface
Definition: StraightLineSurface.h:51