ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TrackHandle_TruthTrack::Imp Class Reference
Collaboration diagram for TrackHandle_TruthTrack::Imp:

Public Member Functions

 Imp (TrackHandle_TruthTrack *tc, const SimBarCode &sbc, const SimHitList &shl, HepMC::ConstGenParticlePtr p)
 
void ensureInitAscObjs ()
 
void ensureInitTrkTracks ()
 
void createTrack (Trk::TrackStates *trackStateOnSurfaces)
 

Static Public Member Functions

static Trk::PerigeecreateTrkPerigeeFromProdVertex (HepMC::ConstGenParticlePtr p, const double &charge)
 
static Trk::TrackParameterscreateTrkParamFromDecayVertex (HepMC::ConstGenParticlePtr p, const double &charge)
 
static Trk::TrackStateOnSurfacecreateTSOS (Trk::TrackParameters *pars)
 
static void addPars (Trk::TrackStates *dv, Trk::TrackParameters *pars)
 

Public Attributes

TrackHandle_TruthTracktheclass
 
SimBarCode simBarCode
 
SimHitList simHitList
 
HepMC::ConstGenParticlePtr genParticle
 
bool ascObjVis
 
std::vector< AscObj_TruthPoint * > * ascObjs
 
const Trk::TracktrkTrack
 

Detailed Description

Definition at line 28 of file TrackHandle_TruthTrack.cxx.

Constructor & Destructor Documentation

◆ Imp()

TrackHandle_TruthTrack::Imp::Imp ( TrackHandle_TruthTrack tc,
const SimBarCode sbc,
const SimHitList shl,
HepMC::ConstGenParticlePtr  p 
)
inline

Definition at line 30 of file TrackHandle_TruthTrack.cxx.

32  : theclass(tc),
33  simBarCode(sbc),
34  simHitList(shl),
35  genParticle(p),
36  ascObjVis(false),
37  ascObjs(nullptr),
38  trkTrack(nullptr) {}

Member Function Documentation

◆ addPars()

static void TrackHandle_TruthTrack::Imp::addPars ( Trk::TrackStates dv,
Trk::TrackParameters pars 
)
inlinestatic

Definition at line 92 of file TrackHandle_TruthTrack.cxx.

93  {
94  if (!pars)
95  return;
97  if (tsos)
98  dv->push_back(tsos);
99  }

◆ createTrack()

void TrackHandle_TruthTrack::Imp::createTrack ( Trk::TrackStates trackStateOnSurfaces)
inline

Definition at line 101 of file TrackHandle_TruthTrack.cxx.

102  {
103  if (!trackStateOnSurfaces) {
104  VP1Msg::messageDebug("TrackHandle_TruthTrack WARNING: Could not create track due to null TSOS vector");
105  return;
106  }
107  if (trackStateOnSurfaces->empty()) {
108  VP1Msg::messageDebug("TrackHandle_TruthTrack WARNING: Could not create track due to empty TSOS vector");
109  delete trackStateOnSurfaces;
110  return;
111  }
112  if (trkTrack) {
113  VP1Msg::messageDebug("TrackHandle_TruthTrack ERROR: Already create trkTrack previously!");
114  delete trackStateOnSurfaces;
115  return;
116  }
117 
119  std::unique_ptr<Trk::TrackStates> sink(trackStateOnSurfaces);
120  trkTrack = new Trk::Track(ti,
121  std::move(sink),
122  nullptr /*fitquality*/);
123 
124  }

◆ createTrkParamFromDecayVertex()

static Trk::TrackParameters* TrackHandle_TruthTrack::Imp::createTrkParamFromDecayVertex ( HepMC::ConstGenParticlePtr  p,
const double &  charge 
)
inlinestatic

Definition at line 65 of file TrackHandle_TruthTrack.cxx.

66  {
67  if (!p)
68  return nullptr;//Fixme: message!
69  HepMC::ConstGenVertexPtr v = p->end_vertex();
70  if (!v)
71  return nullptr;//Fixme: message!
72  Amg::Vector3D mom(p->momentum().px(),p->momentum().py(),p->momentum().pz());
73 // double absmom(mom.mag());
74 // if (absmom<=0)
75 // return 0;//Fixme: message!
76  Amg::Vector3D pos(v->position().x(),v->position().y(),v->position().z());
77 
78  Amg::Translation3D amgtranslation(pos.x(),pos.y(),pos.z());
79  Amg::Transform3D amgTransf(amgtranslation * Amg::RotationMatrix3D::Identity());
80 
81  return new Trk::AtaPlane(pos,mom,charge, *(new Trk::PlaneSurface(amgTransf)));
82  }

◆ createTrkPerigeeFromProdVertex()

static Trk::Perigee* TrackHandle_TruthTrack::Imp::createTrkPerigeeFromProdVertex ( HepMC::ConstGenParticlePtr  p,
const double &  charge 
)
inlinestatic

Definition at line 50 of file TrackHandle_TruthTrack.cxx.

51  {
52  if (!p)
53  return nullptr;//Fixme: message!
54  HepMC::ConstGenVertexPtr v = p->production_vertex();
55  if (!v)
56  return nullptr;//Fixme: message!
57  Amg::Vector3D mom(p->momentum().px(),p->momentum().py(),p->momentum().pz());
58  double absmom(mom.mag());
59  if (absmom<=0)
60  return nullptr;//Fixme: message!
61  Amg::Vector3D pos(v->position().x(),v->position().y(),v->position().z());
62  return new Trk::Perigee(0.,0.,mom.phi(), mom.theta(), charge/absmom, pos);
63  }

◆ createTSOS()

static Trk::TrackStateOnSurface* TrackHandle_TruthTrack::Imp::createTSOS ( Trk::TrackParameters pars)
inlinestatic

Definition at line 84 of file TrackHandle_TruthTrack.cxx.

85  {
86  return pars ? new Trk::TrackStateOnSurface(
87  nullptr,
88  std::unique_ptr<Trk::TrackParameters>(pars),
89  nullptr)
90  : nullptr;
91  }

◆ ensureInitAscObjs()

void TrackHandle_TruthTrack::Imp::ensureInitAscObjs ( )

Definition at line 307 of file TrackHandle_TruthTrack.cxx.

308 {
309  if (ascObjs)
310  return;
311  ascObjs = new std::vector<AscObj_TruthPoint*>;
312  HepMC::ConstGenVertexPtr vprod{nullptr};
313  HepMC::ConstGenVertexPtr vend{nullptr};
314  if (genParticle) {
315  vprod=genParticle->production_vertex();
316  vend=genParticle->end_vertex();
317  }
318  ascObjs->reserve((vprod?1:0)+(vend?1:simHitList.size()));
319  if (vprod)
320  ascObjs->push_back(new AscObj_TruthPoint(theclass,vprod,genParticle));
321 
322  if (vend) {
323  ascObjs->push_back(new AscObj_TruthPoint(theclass,vend,genParticle));
324  } else {
325  SimHitList::const_iterator it, itE(simHitList.end());
326  for ( it = simHitList.begin(); it != itE; ++it )
327  ascObjs->push_back(new AscObj_TruthPoint(theclass,it->second));
328  }
330  for (it=ascObjs->begin();it!=itE;++it)
332  for (it=ascObjs->begin();it!=itE;++it)
333  (*it)->setVisible(ascObjVis);
334 }

◆ ensureInitTrkTracks()

void TrackHandle_TruthTrack::Imp::ensureInitTrkTracks ( )

Definition at line 157 of file TrackHandle_TruthTrack.cxx.

158 {
159  if (trkTrack)
160  return;
161 
162  //The GenParticle part is used if it is available with a production
163  //vertex. The sim. hits are used if present and the genparticle does
164  //not have an end vertex:
165  bool useGenParticle = genParticle && genParticle->production_vertex();
166  bool decayedGenParticle = useGenParticle && genParticle->end_vertex();
167  bool useSimHits = !decayedGenParticle && !simHitList.empty();
168 
169  if (!useGenParticle&&!useSimHits) {
170  VP1Msg::message("TrackHandle_TruthTrack ERROR: Track has neither a genparticle or sim. hits!!");
171  return;
172  }
173 
174  if (!theclass->hasCharge()) {
175  VP1Msg::message("TrackHandle_TruthTrack ERROR: Could not determine particle charge (pdg="
176  +QString::number(theclass->pdgCode())+").");//Fixme: I guess we could show non-extrapolated version?
177  return;
178  }
179  const double charge = theclass->charge();
180 
181  Trk::TrackStates* trackStateOnSurfaces = new Trk::TrackStates;
182 
183  if (useGenParticle) {
185 
186  if (decayedGenParticle) {
188  createTrack(trackStateOnSurfaces);
189  return;
190  }
191  }
192 
193  if (useSimHits) {
194  //Add parameters from simhits (yes, if !useGenParticle, we get no perigee).
195  SimHitList::const_iterator it, itE(simHitList.end());
196  for ( it = simHitList.begin(); it != itE; ++it ) {
197  //Fixme: momentum() < 0 (i.e. not present);
198  //Fixme: Possibly add points for both posStart() and posEnd() (and use energy loss information to get different momenta?)
199  addPars(trackStateOnSurfaces,it->second->createTrackParameters());
200  }
201 
202  }
203 
204  createTrack(trackStateOnSurfaces);
205 }

Member Data Documentation

◆ ascObjs

std::vector<AscObj_TruthPoint*>* TrackHandle_TruthTrack::Imp::ascObjs

Definition at line 45 of file TrackHandle_TruthTrack.cxx.

◆ ascObjVis

bool TrackHandle_TruthTrack::Imp::ascObjVis

Definition at line 44 of file TrackHandle_TruthTrack.cxx.

◆ genParticle

HepMC::ConstGenParticlePtr TrackHandle_TruthTrack::Imp::genParticle

Definition at line 42 of file TrackHandle_TruthTrack.cxx.

◆ simBarCode

SimBarCode TrackHandle_TruthTrack::Imp::simBarCode

Definition at line 40 of file TrackHandle_TruthTrack.cxx.

◆ simHitList

SimHitList TrackHandle_TruthTrack::Imp::simHitList

Definition at line 41 of file TrackHandle_TruthTrack.cxx.

◆ theclass

TrackHandle_TruthTrack* TrackHandle_TruthTrack::Imp::theclass

Definition at line 39 of file TrackHandle_TruthTrack.cxx.

◆ trkTrack

const Trk::Track* TrackHandle_TruthTrack::Imp::trkTrack

Definition at line 47 of file TrackHandle_TruthTrack.cxx.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
TrackHandle_TruthTrack::Imp::simBarCode
SimBarCode simBarCode
Definition: TrackHandle_TruthTrack.cxx:40
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
TrackHandle_TruthTrack::Imp::simHitList
SimHitList simHitList
Definition: TrackHandle_TruthTrack.cxx:41
PlotCalibFromCool.dv
dv
Definition: PlotCalibFromCool.py:762
TrackHandleBase::charge
double charge() const
Definition: TrackHandleBase.cxx:1491
xAOD::JetInput::Track
@ Track
Definition: JetContainerInfo.h:61
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Trk::Perigee
ParametersT< 5, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:29
TrackHandle_TruthTrack::Imp::theclass
TrackHandle_TruthTrack * theclass
Definition: TrackHandle_TruthTrack.cxx:39
TrackHandle_TruthTrack::Imp::createTrack
void createTrack(Trk::TrackStates *trackStateOnSurfaces)
Definition: TrackHandle_TruthTrack.cxx:101
TrackHandle_TruthTrack::Imp::createTrkParamFromDecayVertex
static Trk::TrackParameters * createTrkParamFromDecayVertex(HepMC::ConstGenParticlePtr p, const double &charge)
Definition: TrackHandle_TruthTrack.cxx:65
TruthTest.itE
itE
Definition: TruthTest.py:25
TrackHandle_TruthTrack::Imp::addPars
static void addPars(Trk::TrackStates *dv, Trk::TrackParameters *pars)
Definition: TrackHandle_TruthTrack.cxx:92
TrackHandleBase::registerAssocObject
void registerAssocObject(AssociatedObjectHandleBase *)
Trackhandle assumes ownership.
Definition: TrackHandleBase.cxx:1432
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::TrackStates
DataVector< const Trk::TrackStateOnSurface > TrackStates
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:30
TrackHandle_TruthTrack::Imp::ascObjs
std::vector< AscObj_TruthPoint * > * ascObjs
Definition: TrackHandle_TruthTrack.cxx:45
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
TrackHandle_TruthTrack::Imp::genParticle
HepMC::ConstGenParticlePtr genParticle
Definition: TrackHandle_TruthTrack.cxx:42
TrackHandle_TruthTrack::Imp::createTrkPerigeeFromProdVertex
static Trk::Perigee * createTrkPerigeeFromProdVertex(HepMC::ConstGenParticlePtr p, const double &charge)
Definition: TrackHandle_TruthTrack.cxx:50
DataVector< const Trk::TrackStateOnSurface >
TrackHandleBase::extrapolationParticleHypothesis
virtual Trk::ParticleHypothesis extrapolationParticleHypothesis() const
Default implementation of this next method bases hypothesis on pdgCode() and charge():
Definition: TrackHandleBase.cxx:1517
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
python.selection.number
number
Definition: selection.py:20
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TrackHandle_TruthTrack::Imp::ascObjVis
bool ascObjVis
Definition: TrackHandle_TruthTrack.cxx:44
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:157
Trk::AtaPlane
ParametersT< 5, Charged, PlaneSurface > AtaPlane
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:30
TrackHandle_TruthTrack::pdgCode
virtual int pdgCode() const
0 means unknown
Definition: TrackHandle_TruthTrack.cxx:234
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
Trk::PlaneSurface
Definition: PlaneSurface.h:64
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
AscObj_TruthPoint
Definition: AscObj_TruthPoint.h:27
TrackHandleBase::hasCharge
bool hasCharge() const
Definition: TrackHandleBase.h:99
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
TrackHandle_TruthTrack::Imp::createTSOS
static Trk::TrackStateOnSurface * createTSOS(Trk::TrackParameters *pars)
Definition: TrackHandle_TruthTrack.cxx:84
TrackHandle_TruthTrack::Imp::trkTrack
const Trk::Track * trkTrack
Definition: TrackHandle_TruthTrack.cxx:47
Trk::TrackInfo::Unknown
@ Unknown
Track fitter not defined.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:41