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

#include <SimHitHandle_SiHit.h>

Inheritance diagram for SimHitHandle_SiHit:
Collaboration diagram for SimHitHandle_SiHit:

Classes

class  Imp
 

Public Member Functions

 SimHitHandle_SiHit (const SiHit *)
 
virtual ~SimHitHandle_SiHit ()
 
QString type () const
 
Amg::Vector3D momentumDirection () const
 
Amg::Vector3D posStart () const
 
Amg::Vector3D posEnd () const
 
double hitTime () const
 
const HepMcParticleLinkparticleLink () const
 
Trk::TrackParameterscreateTrackParameters () const
 
virtual double actualMomentum () 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 ()
 

Protected Member Functions

virtual int actualPDGCodeFromSimHit () const
 

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 26 of file SimHitHandle_SiHit.h.

Constructor & Destructor Documentation

◆ SimHitHandle_SiHit()

SimHitHandle_SiHit::SimHitHandle_SiHit ( const SiHit h)

Definition at line 40 of file SimHitHandle_SiHit.cxx.

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

◆ ~SimHitHandle_SiHit()

SimHitHandle_SiHit::~SimHitHandle_SiHit ( )
virtual

Definition at line 48 of file SimHitHandle_SiHit.cxx.

49 {
50  delete m_d;
51 }

Member Function Documentation

◆ actualMomentum()

virtual double SimHitHandleBase::actualMomentum ( ) const
inlinevirtualinherited

Reimplemented in SimHitHandle_TrackRecord, SimHitHandle_ForwardHit, and SimHitHandle_TRTHit.

Definition at line 40 of file SimHitHandleBase.h.

40 { return -1; }

◆ actualPDGCodeFromSimHit()

virtual int SimHitHandleBase::actualPDGCodeFromSimHit ( ) const
inlineprotectedvirtualinherited

Reimplemented in SimHitHandle_TrackRecord, SimHitHandle_ForwardHit, and SimHitHandle_TRTHit.

Definition at line 61 of file SimHitHandleBase.h.

61 { return SimBarCode::unknownPDG; };

◆ 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_SiHit::createTrackParameters ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 125 of file SimHitHandle_SiHit.cxx.

126 {
127  //Find charge and magnitude of momentum:
128  double c;
129  if ( !hasCharge() ) {
130  bool ok;
132  if (!ok) {
133  VP1Msg::message("SimHitHandle_SiHit::createTrackParameters ERROR: Could not find particle charge (pdg="
134  +QString::number(pdg())+"). Assuming charge=+1.");
135  c = +1.0;
136  } else {
137  if (VP1Msg::verbose())
138  VP1Msg::messageVerbose("Looked up particle charge for silicon simhit with pdg code "+VP1Msg::str(pdg())+": "+VP1Msg::str(c));
139  }
140  const_cast<SimHitHandle_SiHit*>(this)->setCharge(c);
141  } else {
142  c = charge();
143  }
144 
145  double mom = momentum();
146  if (mom<=0) {
147  VP1Msg::message("SimHitHandle_SiHit::createTrackParameters ERROR: Unknown momentum. Using 1 GeV");
148  mom = 1*CLHEP::GeV;
149  }
150 
152  // if (!m_d->ensureDetElemInit()) {
153  // VP1Msg::messageDebug("SimHitHandle_SiHit WARNING: Could not get detector element!");
154  // return 0;
155  // }
156  // const Trk::PlaneSurface * surf
157  // = dynamic_cast<const Trk::PlaneSurface *>( &(m_d->detelem->surface()));
158  // if (!surf) {
159  // VP1Msg::message("SimHitHandle_SiHit::createTrackParameters ERROR: could not get Trk::PlaneSurface");
160  // return 0;
161  // }
165 
166  const Amg::Vector3D globpos = posStart();
167 
168 // const Trk::GlobalMomentum u(momentumDirection());
170 
171  return new Trk::Perigee(0, 0, u.phi(), u.theta(), c/mom, globpos);
172 }

◆ hasCharge()

bool SimHitHandleBase::hasCharge ( ) const
inlineinherited

Definition at line 50 of file SimHitHandleBase.h.

50 { return m_charge!=-99999.0; }

◆ hitTime()

double SimHitHandle_SiHit::hitTime ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 113 of file SimHitHandle_SiHit.cxx.

114 {
115  return m_d->thehit->meanTime();
116 }

◆ 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_SiHit::momentumDirection ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 85 of file SimHitHandle_SiHit.cxx.

86 {
88  VP1Msg::messageVerbose("SimHitHandle_SiHit::momentumDirection() ERROR: posStart()==posEnd()");
89  return (posEnd()-posStart()).unit();
90 }

◆ particleLink()

const HepMcParticleLink & SimHitHandle_SiHit::particleLink ( ) const
virtual

Implements SimHitHandleBase.

Definition at line 119 of file SimHitHandle_SiHit.cxx.

120 {
121  return m_d->thehit->particleLink();
122 }

◆ pdg()

int SimHitHandleBase::pdg ( ) const
inlineinherited

Definition at line 82 of file SimHitHandleBase.h.

83 {
84  return m_pdgId;
85 }

◆ posEnd()

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

Implements SimHitHandleBase.

Definition at line 107 of file SimHitHandle_SiHit.cxx.

108 {
110 }

◆ posStart()

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

Implements SimHitHandleBase.

Definition at line 101 of file SimHitHandle_SiHit.cxx.

102 {
104 }

◆ 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_SiHit::type ( ) const
inlinevirtual

Implements SimHitHandleBase.

Definition at line 32 of file SimHitHandle_SiHit.h.

32 { return "SiHit"; };

Member Data Documentation

◆ m_charge

double SimHitHandleBase::m_charge
privateinherited

Definition at line 71 of file SimHitHandleBase.h.

◆ m_d

Imp* SimHitHandle_SiHit::m_d
private

Definition at line 46 of file SimHitHandle_SiHit.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:
SimHitHandleBase::particleLink
virtual const HepMcParticleLink & particleLink() const =0
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
SiHit::localEndPosition
HepGeom::Point3D< double > localEndPosition() const
Definition: SiHit.cxx:153
SimHitHandle_SiHit::m_d
Imp * m_d
Definition: SimHitHandle_SiHit.h:45
Trk::Perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:33
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
SimBarCode
Definition: SimBarCode.h:22
SiHit::meanTime
double meanTime() const
Definition: SiHit.h:180
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
SimHitHandleBase::setCharge
void setCharge(const double &c)
Definition: SimHitHandleBase.h:57
SimHitHandle_SiHit::momentumDirection
Amg::Vector3D momentumDirection() const
Definition: SimHitHandle_SiHit.cxx:85
SimHitHandle_SiHit::Imp::thehit
const SiHit * thehit
Definition: SimHitHandle_SiHit.cxx:32
SimHitHandleBase::SimHitHandleBase
SimHitHandleBase()
Definition: SimHitHandleBase.h:34
SimBarCode::unknownPDG
static const int unknownPDG
Definition: SimBarCode.h:25
VP1ParticleData::particleCharge
static double particleCharge(const int &pdgcode, bool &ok)
Definition: VP1ParticleData.cxx:103
SiHit::particleLink
const HepMcParticleLink & particleLink() const
Definition: SiHit.h:190
SimHitHandleBase::momentum
double momentum() const
Definition: SimHitHandleBase.h:41
SimHitHandle_SiHit
Definition: SimHitHandle_SiHit.h:26
python.selection.number
number
Definition: selection.py:20
SimHitHandle_SiHit::Imp::localToGlobal
Amg::Vector3D localToGlobal(const HepGeom::Point3D< double > &) const
Definition: SimHitHandle_SiHit.cxx:93
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_SiHit::posStart
Amg::Vector3D posStart() const
Definition: SimHitHandle_SiHit.cxx:101
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
SimHitHandleBase::pdg
int pdg() const
Definition: SimHitHandleBase.h:82
h
SimHitHandleBase::m_pdgId
int m_pdgId
Definition: SimHitHandleBase.h:68
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
SimHitHandleBase::hasCharge
bool hasCharge() const
Definition: SimHitHandleBase.h:50
SimHitHandleBase::actualMomentum
virtual double actualMomentum() const
Definition: SimHitHandleBase.h:40
SimHitHandle_SiHit::posEnd
Amg::Vector3D posEnd() const
Definition: SimHitHandle_SiHit.cxx:107
SimHitHandleBase::charge
double charge() const
Definition: SimHitHandleBase.h:51
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
python.compressB64.c
def c
Definition: compressB64.py:93
SiHit::localStartPosition
HepGeom::Point3D< double > localStartPosition() const
Definition: SiHit.cxx:146