ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SimHitHandle_TRTHit Class Reference

#include <SimHitHandle_TRTHit.h>

Inheritance diagram for SimHitHandle_TRTHit:
Collaboration diagram for SimHitHandle_TRTHit:

Classes

class  Imp
 

Public Member Functions

 SimHitHandle_TRTHit (const TRTUncompressedHit *)
 
virtual ~SimHitHandle_TRTHit ()
 
QString type () const
 
Amg::Vector3D momentumDirection () const
 
double actualMomentum () const
 
Amg::Vector3D posStart () const
 
Amg::Vector3D posEnd () const
 
double hitTime () const
 
int actualPDGCodeFromSimHit () const
 
const HepMcParticleLinkparticleLink () const
 
Trk::TrackParameterscreateTrackParameters () const
 
double momentum () const
 
int pdg () const
 
SimBarCode simBarCode () const
 
bool hasCharge () const
 
double charge () const
 
void setFakeMomentum (const double &m)
 
void setCharge (const double &c)
 
void cacheMomentum ()
 

Private Member Functions

void setPDG (int)
 

Private Attributes

Impm_d
 
Trk::TrackParametersm_trackPars
 
int m_pdgId
 
double m_fakemom
 
double m_charge
 

Detailed Description

Definition at line 23 of file SimHitHandle_TRTHit.h.

Constructor & Destructor Documentation

◆ SimHitHandle_TRTHit()

SimHitHandle_TRTHit::SimHitHandle_TRTHit ( const TRTUncompressedHit h)

Definition at line 42 of file SimHitHandle_TRTHit.cxx.

43  : SimHitHandleBase(), m_d(new Imp(h))
44 {
45  if (!h)
46  VP1Msg::message("SimHitHandle_TRTHit constructor ERROR: Received null hit pointer");
47 }

◆ ~SimHitHandle_TRTHit()

SimHitHandle_TRTHit::~SimHitHandle_TRTHit ( )
virtual

Definition at line 50 of file SimHitHandle_TRTHit.cxx.

51 {
52  delete m_d;
53 }

Member Function Documentation

◆ actualMomentum()

double SimHitHandle_TRTHit::actualMomentum ( ) const
virtual

Reimplemented from SimHitHandleBase.

Definition at line 68 of file SimHitHandle_TRTHit.cxx.

69 {
70  bool ok;
72  if (!ok) {
73  VP1Msg::message("SimHitHandle_TRTHit constructor WARNING: Could not determine mass for pdg code "
74  +QString::number(pdg())+". Assuming charged pion mass.");
75  mass = 139.57019*CLHEP::MeV;//Charged pion mass
76  }
77  const double ekin = m_d->thehit->GetKineticEnergy()*CLHEP::MeV;
78  const double gamma = 1.0 + ekin/mass;
79  double betasq = 1.0-1.0/(gamma*gamma);
80  if (betasq<=0.0)
81  return 0.0;
82  return sqrt(betasq)*(mass+ekin);
83 }

◆ actualPDGCodeFromSimHit()

int SimHitHandle_TRTHit::actualPDGCodeFromSimHit ( ) const
virtual

Reimplemented from SimHitHandleBase.

Definition at line 161 of file SimHitHandle_TRTHit.cxx.

162 {
163  return m_d->thehit->GetParticleEncoding();
164 }

◆ cacheMomentum()

void SimHitHandleBase::cacheMomentum ( )
inlineinherited

Definition at line 58 of file SimHitHandleBase.h.

58 { if (m_fakemom==-2) m_fakemom = actualMomentum(); }

◆ charge()

double SimHitHandleBase::charge ( ) const
inlineinherited

Definition at line 51 of file SimHitHandleBase.h.

51 { return m_charge; }

◆ createTrackParameters()

Trk::TrackParameters * SimHitHandle_TRTHit::createTrackParameters ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 167 of file SimHitHandle_TRTHit.cxx.

168 {
169  if (!m_d->ensureDetElemInit())
170  return nullptr;
171  const Trk::StraightLineSurface * surf
172  = dynamic_cast<const Trk::StraightLineSurface *>( &(m_d->detelem->strawSurface(m_d->strawID)));
173  if (!surf) {
174  VP1Msg::message("SimHitHandle_TRTHit::createTrackParameters ERROR: could not get Trk::StraightLineSurface");
175  return nullptr;
176  }
177 
178  double c;
179  if ( !hasCharge() ) {
180  bool ok;
182  if (!ok) {
183  VP1Msg::message("SimHitHandle_TRTHit::createTrackParameters ERROR: Could not find particle charge (pdg="
184  +QString::number(m_d->thehit->GetParticleEncoding())+"). Assuming charge=+1.");
185  c = +1.0;
186  } else {
187  if (VP1Msg::verbose())
188  VP1Msg::messageVerbose("Looked up particle charge for trt simhit with pdg code "+VP1Msg::str(m_d->thehit->GetParticleEncoding())+": "+VP1Msg::str(c));
189  }
190  const_cast<SimHitHandle_TRTHit*>(this)->setCharge(c);
191  } else {
192  c = charge();
193  }
194  return new Trk::AtaStraightLine(0.5*(posStart()+posEnd()),momentum()*momentumDirection(),c,*surf);
195  //Fixme: Use constructor with local coords instead?:
196 }

◆ hasCharge()

bool SimHitHandleBase::hasCharge ( ) const
inlineinherited

Definition at line 50 of file SimHitHandleBase.h.

50 { return m_charge!=-99999.0; }

◆ hitTime()

double SimHitHandle_TRTHit::hitTime ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 149 of file SimHitHandle_TRTHit.cxx.

150 {
151  return m_d->thehit->GetGlobalTime();
152 }

◆ momentum()

double SimHitHandleBase::momentum ( ) const
inlineinherited

Definition at line 41 of file SimHitHandleBase.h.

41 { return m_fakemom == -2 ? actualMomentum() : m_fakemom; }

◆ momentumDirection()

Amg::Vector3D SimHitHandle_TRTHit::momentumDirection ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 58 of file SimHitHandle_TRTHit.cxx.

59 {
60  if (VP1Msg::verbose()&&posStart()==posEnd())
61  VP1Msg::messageVerbose("SimHitHandle_SiHit::momentumDirection() ERROR: posStart()==posEnd()");
63 // return Trk::GlobalMomentum(u.x(),u.y(),u.z());
64  return Amg::Vector3D(u.x(),u.y(),u.z());
65 }

◆ particleLink()

const HepMcParticleLink & SimHitHandle_TRTHit::particleLink ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 155 of file SimHitHandle_TRTHit.cxx.

156 {
157  return m_d->thehit->particleLink();
158 }

◆ pdg()

int SimHitHandleBase::pdg ( ) const
inlineinherited

Definition at line 82 of file SimHitHandleBase.h.

83 {
84  return m_pdgId;
85 }

◆ posEnd()

Amg::Vector3D SimHitHandle_TRTHit::posEnd ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 141 of file SimHitHandle_TRTHit.cxx.

◆ posStart()

Amg::Vector3D SimHitHandle_TRTHit::posStart ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 133 of file SimHitHandle_TRTHit.cxx.

◆ setCharge()

void SimHitHandleBase::setCharge ( const double &  c)
inlineinherited

Definition at line 57 of file SimHitHandleBase.h.

57 { m_charge = c; }

◆ setFakeMomentum()

void SimHitHandleBase::setFakeMomentum ( const double &  m)
inlineinherited

Definition at line 56 of file SimHitHandleBase.h.

56 { m_fakemom = m; }

◆ setPDG()

void SimHitHandleBase::setPDG ( int  pdg)
inlineprivateinherited

Definition at line 87 of file SimHitHandleBase.h.

88 {
89  m_pdgId = pdg;
90 }

◆ simBarCode()

SimBarCode SimHitHandleBase::simBarCode ( ) const
inlineinherited

Definition at line 48 of file SimHitHandleBase.h.

48 { return SimBarCode(particleLink(),pdg()); }

◆ type()

QString SimHitHandle_TRTHit::type ( ) const
inlinevirtual

Implements SimHitHandleBase.

Definition at line 29 of file SimHitHandle_TRTHit.h.

29 { return "TRTUncompressedHit"; };

Member Data Documentation

◆ m_charge

double SimHitHandleBase::m_charge
privateinherited

Definition at line 71 of file SimHitHandleBase.h.

◆ m_d

Imp* SimHitHandle_TRTHit::m_d
private

Definition at line 44 of file SimHitHandle_TRTHit.h.

◆ m_fakemom

double SimHitHandleBase::m_fakemom
privateinherited

Definition at line 70 of file SimHitHandleBase.h.

◆ m_pdgId

int SimHitHandleBase::m_pdgId
privateinherited

Definition at line 68 of file SimHitHandleBase.h.

◆ m_trackPars

Trk::TrackParameters* SimHitHandleBase::m_trackPars
mutableprivateinherited

Definition at line 67 of file SimHitHandleBase.h.


The documentation for this class was generated from the following files:
SimHitHandle_TRTHit::m_d
Imp * m_d
Definition: SimHitHandle_TRTHit.h:43
SimHitHandleBase::particleLink
virtual const HepMcParticleLink & particleLink() const =0
SimHitHandle_TRTHit
Definition: SimHitHandle_TRTHit.h:23
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TRTUncompressedHit::GetPreStepY
float GetPreStepY() const
Definition: TRTUncompressedHit.h:67
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
TRTUncompressedHit::GetParticleEncoding
int GetParticleEncoding() const
Definition: TRTUncompressedHit.h:55
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
SimHitHandle_TRTHit::momentumDirection
Amg::Vector3D momentumDirection() const
Definition: SimHitHandle_TRTHit.cxx:58
TRTUncompressedHit::GetPostStepY
float GetPostStepY() const
Definition: TRTUncompressedHit.h:76
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
TRTUncompressedHit::GetPreStepZ
float GetPreStepZ() const
Definition: TRTUncompressedHit.h:70
TRTUncompressedHit::GetGlobalTime
float GetGlobalTime() const
Definition: TRTUncompressedHit.h:82
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
SimBarCode
Definition: SimBarCode.h:22
Trk::AtaStraightLine
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:35
SimHitHandleBase::setCharge
void setCharge(const double &c)
Definition: SimHitHandleBase.h:57
TrigVtx::gamma
@ gamma
Definition: TrigParticleTable.h:26
SimHitHandleBase::SimHitHandleBase
SimHitHandleBase()
Definition: SimHitHandleBase.h:34
TRTUncompressedHit::GetKineticEnergy
float GetKineticEnergy() const
Definition: TRTUncompressedHit.h:58
SimHitHandle_TRTHit::Imp::ensureDetElemInit
bool ensureDetElemInit() const
Definition: SimHitHandle_TRTHit.cxx:86
VP1ParticleData::particleCharge
static double particleCharge(const int &pdgcode, bool &ok)
Definition: VP1ParticleData.cxx:103
InDetDD::TRT_BaseElement::getAbsoluteTransform
const HepGeom::Transform3D getAbsoluteTransform(int straw) const
This is an alias to strawTransform(int straw)
Definition: TRT_BaseElement.cxx:42
SimHitHandleBase::momentum
double momentum() const
Definition: SimHitHandleBase.h:41
python.selection.number
number
Definition: selection.py:20
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
SimHitHandleBase::m_fakemom
double m_fakemom
Definition: SimHitHandleBase.h:70
SimHitHandleBase::m_charge
double m_charge
Definition: SimHitHandleBase.h:71
SimHitHandle_TRTHit::posEnd
Amg::Vector3D posEnd() const
Definition: SimHitHandle_TRTHit.cxx:141
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
SimHitHandleBase::pdg
int pdg() const
Definition: SimHitHandleBase.h:82
TRTUncompressedHit::GetPreStepX
float GetPreStepX() const
Definition: TRTUncompressedHit.h:64
h
SimHitHandleBase::m_pdgId
int m_pdgId
Definition: SimHitHandleBase.h:68
SimHitHandle_TRTHit::Imp::thehit
const TRTUncompressedHit * thehit
Definition: SimHitHandle_TRTHit.cxx:34
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
Amg::CLHEPTransformToEigen
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:38
SimHitHandleBase::hasCharge
bool hasCharge() const
Definition: SimHitHandleBase.h:50
SimHitHandleBase::actualMomentum
virtual double actualMomentum() const
Definition: SimHitHandleBase.h:40
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
VP1ParticleData::particleMass
static double particleMass(const int &pdgcode, bool &ok)
Definition: VP1ParticleData.cxx:83
TRTUncompressedHit::GetPostStepX
float GetPostStepX() const
Definition: TRTUncompressedHit.h:73
InDetDD::TRT_BaseElement::strawSurface
const Trk::StraightLineSurface & strawSurface(int straw) const
Straw Surface: access to the surface via integer.
Definition: TRT_BaseElement.cxx:121
SimHitHandleBase::charge
double charge() const
Definition: SimHitHandleBase.h:51
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
SimHitHandle_TRTHit::Imp::strawID
size_t strawID
Definition: SimHitHandle_TRTHit.cxx:36
SimHitHandle_TRTHit::posStart
Amg::Vector3D posStart() const
Definition: SimHitHandle_TRTHit.cxx:133
TRTUncompressedHit::particleLink
const HepMcParticleLink & particleLink() const
Definition: TRTUncompressedHit.h:109
python.compressB64.c
def c
Definition: compressB64.py:93
SimHitHandle_TRTHit::Imp::detelem
const InDetDD::TRT_BaseElement * detelem
Definition: SimHitHandle_TRTHit.cxx:35
Trk::StraightLineSurface
Definition: StraightLineSurface.h:51
TRTUncompressedHit::GetPostStepZ
float GetPostStepZ() const
Definition: TRTUncompressedHit.h:79