ATLAS Offline Software
Loading...
Searching...
No Matches
TrackHandle_SimulationTrack::Imp Class Reference
Collaboration diagram for TrackHandle_SimulationTrack::Imp:

Public Member Functions

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

Static Public Member Functions

static Trk::TrackStateOnSurfacecreateTSOS (Trk::TrackParameters *pars)
static void addPars (Trk::TrackStates *dv, Trk::TrackParameters *pars)

Public Attributes

TrackHandle_SimulationTracktheclass
SimBarCode simBarCode
SimHitList simHitList
bool ascObjVis
std::vector< AscObj_TruthPoint * > * ascObjs
const Trk::TracktrkTrack

Detailed Description

Definition at line 28 of file TrackHandle_SimulationTrack.cxx.

Constructor & Destructor Documentation

◆ Imp()

TrackHandle_SimulationTrack::Imp::Imp ( TrackHandle_SimulationTrack * tc,
const SimBarCode & sbc,
const SimHitList & shl )
inline

Member Function Documentation

◆ addPars()

void TrackHandle_SimulationTrack::Imp::addPars ( Trk::TrackStates * dv,
Trk::TrackParameters * pars )
inlinestatic

Definition at line 56 of file TrackHandle_SimulationTrack.cxx.

57 {
58 if (!pars)
59 return;
60 Trk::TrackStateOnSurface * tsos = createTSOS(pars);
61 if (tsos)
62 dv->push_back(tsos);
63 }
static Trk::TrackStateOnSurface * createTSOS(Trk::TrackParameters *pars)

◆ createTrack()

void TrackHandle_SimulationTrack::Imp::createTrack ( Trk::TrackStates * trackStateOnSurfaces)
inline

Definition at line 65 of file TrackHandle_SimulationTrack.cxx.

66 {
67 if (!trackStateOnSurfaces) {
68 VP1Msg::messageDebug("TrackHandle_SimulationTrack WARNING: Could not create track due to null TSOS vector");
69 return;
70 }
71 if (trackStateOnSurfaces->empty()) {
72 VP1Msg::messageDebug("TrackHandle_SimulationTrack WARNING: Could not create track due to empty TSOS vector");
73 delete trackStateOnSurfaces;
74 return;
75 }
76 if (trkTrack) {
77 VP1Msg::messageDebug("TrackHandle_SimulationTrack ERROR: Already create trkTrack previously!");
78 delete trackStateOnSurfaces;
79 return;
80 }
81
82 Trk::TrackInfo ti(Trk::TrackInfo::Unknown,
83 theclass->extrapolationParticleHypothesis());
84 /*track assumes ownership*/
85 std::unique_ptr<Trk::TrackStates> sink(trackStateOnSurfaces);
86 trkTrack = new Trk::Track(
87 ti,
88 std::move(sink),
89 nullptr /*fitquality*/);
90
91 // if (VP1Msg::verbose())
92 // VP1Msg::messageVerbose("TrackHandle_SimulationTrack created track
93 // with "
94 // +QString::number(trackStateOnSurfaces->size())+"
95 // parameters");
96 }
bool empty() const noexcept
Returns true if the collection is empty.
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39

◆ createTSOS()

Trk::TrackStateOnSurface * TrackHandle_SimulationTrack::Imp::createTSOS ( Trk::TrackParameters * pars)
inlinestatic

Definition at line 48 of file TrackHandle_SimulationTrack.cxx.

49 {
50 return pars ? new Trk::TrackStateOnSurface(
51 nullptr,
52 std::unique_ptr<Trk::TrackParameters>(pars),
53 nullptr)
54 : nullptr;
55 }

◆ ensureInitAscObjs()

void TrackHandle_SimulationTrack::Imp::ensureInitAscObjs ( )

Definition at line 230 of file TrackHandle_SimulationTrack.cxx.

231{
232 if (ascObjs)
233 return;
234 ascObjs = new std::vector<AscObj_TruthPoint*>;
235 ascObjs->reserve(simHitList.size());
236{
237 SimHitList::const_iterator it, itE(simHitList.end());
238 for ( it = simHitList.begin(); it != itE; ++it )
239 ascObjs->push_back(new AscObj_TruthPoint(theclass,it->second));
240 }
241 {
242 std::vector<AscObj_TruthPoint*>::iterator it, itE(ascObjs->end());
243 for (it=ascObjs->begin();it!=itE;++it)
244 theclass->registerAssocObject(*it);
245 for (it=ascObjs->begin();it!=itE;++it)
246 (*it)->setVisible(ascObjVis);
247 }
248}

◆ ensureInitTrkTracks()

void TrackHandle_SimulationTrack::Imp::ensureInitTrkTracks ( )

Definition at line 128 of file TrackHandle_SimulationTrack.cxx.

129{
130 if (trkTrack)
131 return;
132
133 if (!theclass->hasCharge()) {
134 VP1Msg::message("TrackHandle_SimulationTrack ERROR: Could not determine particle charge (pdg="
135 +QString::number(theclass->pdgCode())+").");//Fixme: I guess we could show non-extrapolated version?
136 return;
137 }
138 //const double charge = theclass->charge(); unused
139
140 Trk::TrackStates* trackStateOnSurfaces = new Trk::TrackStates;
141
142
143 SimHitList::const_iterator it, itE(simHitList.end());
144 for ( it = simHitList.begin(); it != itE; ++it ) {
145 //Fixme: momentum() < 0 (i.e. not present);
146 //Fixme: Possibly add points for both posStart() and posEnd() (and use energy loss information to get different momenta?)
147 addPars(trackStateOnSurfaces,it->second->createTrackParameters());
148 }
149
150
151 createTrack(trackStateOnSurfaces);
152}
void createTrack(Trk::TrackStates *trackStateOnSurfaces)
static void addPars(Trk::TrackStates *dv, Trk::TrackParameters *pars)
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
DataVector< const Trk::TrackStateOnSurface > TrackStates

Member Data Documentation

◆ ascObjs

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

Definition at line 43 of file TrackHandle_SimulationTrack.cxx.

◆ ascObjVis

bool TrackHandle_SimulationTrack::Imp::ascObjVis

Definition at line 42 of file TrackHandle_SimulationTrack.cxx.

◆ simBarCode

SimBarCode TrackHandle_SimulationTrack::Imp::simBarCode

Definition at line 39 of file TrackHandle_SimulationTrack.cxx.

◆ simHitList

SimHitList TrackHandle_SimulationTrack::Imp::simHitList

Definition at line 40 of file TrackHandle_SimulationTrack.cxx.

◆ theclass

TrackHandle_SimulationTrack* TrackHandle_SimulationTrack::Imp::theclass

Definition at line 38 of file TrackHandle_SimulationTrack.cxx.

◆ trkTrack

const Trk::Track* TrackHandle_SimulationTrack::Imp::trkTrack

Definition at line 45 of file TrackHandle_SimulationTrack.cxx.


The documentation for this class was generated from the following file: