Belle II Software prerelease-10-00-00a
RecoTrack.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/dataobjects/RecoTrack.h>
9#include <mdst/dataobjects/MCParticle.h>
10
11#include <genfit/TrackCand.h>
12#include <genfit/AbsTrackRep.h>
13#include <genfit/KalmanFitterInfo.h>
14#include <genfit/KalmanFitStatus.h>
15#include <genfit/WireTrackCandHit.h>
16#include <genfit/RKTrackRep.h>
17#include <genfit/MplTrackRep.h>
18#include <simulation/monopoles/MonopoleConstants.h>
19#include <svd/dataobjects/SVDCluster.h>
20
21#include <cmath>
22
23using namespace Belle2;
24
25RecoTrack::RecoTrack(const ROOT::Math::XYZVector& seedPosition, const ROOT::Math::XYZVector& seedMomentum,
26 const short int seedCharge,
27 const std::string& storeArrayNameOfPXDHits,
28 const std::string& storeArrayNameOfSVDHits,
29 const std::string& storeArrayNameOfCDCHits,
30 const std::string& storeArrayNameOfBKLMHits,
31 const std::string& storeArrayNameOfEKLMHits,
32 const std::string& storeArrayNameOfRecoHitInformation) :
33 m_charge(seedCharge),
34 m_storeArrayNameOfPXDHits(storeArrayNameOfPXDHits),
35 m_storeArrayNameOfSVDHits(storeArrayNameOfSVDHits),
36 m_storeArrayNameOfCDCHits(storeArrayNameOfCDCHits),
37 m_storeArrayNameOfBKLMHits(storeArrayNameOfBKLMHits),
38 m_storeArrayNameOfEKLMHits(storeArrayNameOfEKLMHits),
39 m_storeArrayNameOfRecoHitInformation(storeArrayNameOfRecoHitInformation)
40{
41 m_genfitTrack.setStateSeed(XYZToTVector(seedPosition), XYZToTVector(seedMomentum));
42 // TODO Set the covariance seed (that should be done by the tracking package)
43 TMatrixDSym covSeed(6);
44 covSeed(0, 0) = 1e-3;
45 covSeed(1, 1) = 1e-3;
46 covSeed(2, 2) = 4e-3;
47 covSeed(3, 3) = 0.01e-3;
48 covSeed(4, 4) = 0.01e-3;
49 covSeed(5, 5) = 0.04e-3;
50 m_genfitTrack.setCovSeed(covSeed);
51}
52
54 StoreArray<RecoTrack>& recoTracks,
55 std::string const& pxdHitsStoreArrayName,
56 std::string const& svdHitsStoreArrayName,
57 std::string const& cdcHitsStoreArrayName,
58 std::string const& bklmHitsStoreArrayName,
59 std::string const& eklmHitsStoreArrayName,
60 std::string const& recoHitInformationStoreArrayName)
61{
62 StoreArray<RecoHitInformation> recoHitInformations(recoHitInformationStoreArrayName);
63 recoHitInformations.registerInDataStore();
64 recoTracks.registerRelationTo(recoHitInformations);
65
66 StoreArray<RecoHitInformation::UsedPXDHit> pxdHits(pxdHitsStoreArrayName);
67 if (pxdHits.isOptional()) {
68 pxdHits.registerRelationTo(recoTracks);
69 recoHitInformations.registerRelationTo(pxdHits);
70 }
71
72 StoreArray<RecoHitInformation::UsedSVDHit> svdHits(svdHitsStoreArrayName);
73 if (svdHits.isOptional()) {
74 svdHits.registerRelationTo(recoTracks);
75 recoHitInformations.registerRelationTo(svdHits);
76 }
77
78 StoreArray<RecoHitInformation::UsedCDCHit> cdcHits(cdcHitsStoreArrayName);
79 if (cdcHits.isOptional()) {
80 cdcHits.registerRelationTo(recoTracks);
81 recoHitInformations.registerRelationTo(cdcHits);
82 }
83
84 StoreArray<RecoHitInformation::UsedBKLMHit> bklmHits(bklmHitsStoreArrayName);
85 if (bklmHits.isOptional()) {
86 bklmHits.registerRelationTo(recoTracks);
87 recoHitInformations.registerRelationTo(bklmHits);
88 }
89
90 StoreArray<RecoHitInformation::UsedEKLMHit> eklmHits(eklmHitsStoreArrayName);
91 if (eklmHits.isOptional()) {
92 eklmHits.registerRelationTo(recoTracks);
93 recoHitInformations.registerRelationTo(eklmHits);
94 }
95}
96
97RecoTrack* RecoTrack::createFromTrackCand(const genfit::TrackCand& trackCand,
98 const std::string& storeArrayNameOfRecoTracks,
99 const std::string& storeArrayNameOfPXDHits,
100 const std::string& storeArrayNameOfSVDHits,
101 const std::string& storeArrayNameOfCDCHits,
102 const std::string& storeArrayNameOfBKLMHits,
103 const std::string& storeArrayNameOfEKLMHits,
104 const std::string& storeArrayNameOfRecoHitInformation,
105 const bool recreateSortingParameters
106 )
107{
108
109 StoreArray<RecoTrack> recoTracks(storeArrayNameOfRecoTracks);
110 StoreArray<RecoHitInformation> recoHitInformations(storeArrayNameOfRecoHitInformation);
111 StoreArray<UsedPXDHit> pxdHits(storeArrayNameOfPXDHits);
112 StoreArray<UsedSVDHit> svdHits(storeArrayNameOfSVDHits);
113 StoreArray<UsedCDCHit> cdcHits(storeArrayNameOfCDCHits);
114 StoreArray<UsedBKLMHit> bklmHits(storeArrayNameOfBKLMHits);
115 StoreArray<UsedEKLMHit> eklmHits(storeArrayNameOfEKLMHits);
116
117 // Set the tracking parameters
118 const ROOT::Math::XYZVector& position = ROOT::Math::XYZVector(trackCand.getPosSeed());
119 const ROOT::Math::XYZVector& momentum = ROOT::Math::XYZVector(trackCand.getMomSeed());
120 const short int charge = trackCand.getChargeSeed();
121 const double time = trackCand.getTimeSeed();
122
123 RecoTrack* newRecoTrack = recoTracks.appendNew(position, momentum, charge,
124 pxdHits.getName(), svdHits.getName(), cdcHits.getName(),
125 bklmHits.getName(), eklmHits.getName(),
126 recoHitInformations.getName());
127 newRecoTrack->setTimeSeed(time);
128
129 // TODO Set the covariance seed (that should be done by the tracking package)
130 TMatrixDSym covSeed(6);
131 covSeed(0, 0) = 1e-3;
132 covSeed(1, 1) = 1e-3;
133 covSeed(2, 2) = 4e-3;
134 covSeed(3, 3) = 0.01e-3;
135 covSeed(4, 4) = 0.01e-3;
136 covSeed(5, 5) = 0.04e-3;
137 newRecoTrack->m_genfitTrack.setCovSeed(covSeed);
138
139 for (unsigned int hitIndex = 0; hitIndex < trackCand.getNHits(); hitIndex++) {
140 genfit::TrackCandHit* trackCandHit = trackCand.getHit(hitIndex);
141 const int detID = trackCandHit->getDetId();
142 const int hitID = trackCandHit->getHitId();
143 const unsigned int sortingParameter = recreateSortingParameters ? hitIndex : static_cast<unsigned int>
144 (trackCandHit->getSortingParameter());
145 if (detID == Const::CDC) {
146 UsedCDCHit* cdcHit = cdcHits[hitID];
147 // Special case for CDC hits, we add a right-left information
148 const genfit::WireTrackCandHit* wireHit = dynamic_cast<const genfit::WireTrackCandHit*>(trackCandHit);
149 if (not wireHit) {
150 B2FATAL("CDC hit is not a wire hit. The RecoTrack can not handle such a case.");
151 }
152 if (wireHit->getLeftRightResolution() > 0) {
153 newRecoTrack->addCDCHit(cdcHit, sortingParameter, RecoHitInformation::RightLeftInformation::c_right);
154 } else if (wireHit->getLeftRightResolution() < 0) {
155 newRecoTrack->addCDCHit(cdcHit, sortingParameter, RecoHitInformation::RightLeftInformation::c_left);
156 } else {
157 newRecoTrack->addCDCHit(cdcHit, sortingParameter, RecoHitInformation::RightLeftInformation::c_undefinedRightLeftInformation);
158 }
159
160 } else if (detID == Const::SVD) {
161 UsedSVDHit* svdHit = svdHits[hitID];
162 newRecoTrack->addSVDHit(svdHit, sortingParameter);
163 } else if (detID == Const::PXD) {
164 UsedPXDHit* pxdHit = pxdHits[hitID];
165 newRecoTrack->addPXDHit(pxdHit, sortingParameter);
166 } else if (detID == Const::BKLM) {
167 UsedBKLMHit* bklmHit = bklmHits[hitID];
168 newRecoTrack->addBKLMHit(bklmHit, sortingParameter);
169 } else if (detID == Const::EKLM) {
170 UsedEKLMHit* eklmHit = eklmHits[hitID];
171 newRecoTrack->addEKLMHit(eklmHit, sortingParameter);
172 }
173 }
174
175 return newRecoTrack;
176}
177
178genfit::TrackCand RecoTrack::createGenfitTrackCand() const
179{
180 genfit::TrackCand createdTrackCand;
181
182 // Set the trajectory parameters
183 createdTrackCand.setPosMomSeed(XYZToTVector(getPositionSeed()), XYZToTVector(getMomentumSeed()), getChargeSeed());
184 createdTrackCand.setCovSeed(getSeedCovariance());
185 createdTrackCand.setTimeSeed(getTimeSeed());
186
187 // Add the hits
188 mapOnHits<UsedPXDHit>(m_storeArrayNameOfPXDHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
189 const UsedPXDHit * const hit) {
190 createdTrackCand.addHit(Const::PXD, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
191 });
192 mapOnHits<UsedSVDHit>(m_storeArrayNameOfSVDHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
193 const UsedSVDHit * const hit) {
194 createdTrackCand.addHit(Const::SVD, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
195 });
196 mapOnHits<UsedCDCHit>(m_storeArrayNameOfCDCHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
197 const UsedCDCHit * const hit) {
198 if (hitInformation.getRightLeftInformation() == RecoHitInformation::c_left) {
199 createdTrackCand.addHit(new genfit::WireTrackCandHit(Const::CDC, hit->getArrayIndex(), -1,
200 hitInformation.getSortingParameter(), -1));
201 } else if (hitInformation.getRightLeftInformation() == RecoHitInformation::c_right) {
202 createdTrackCand.addHit(new genfit::WireTrackCandHit(Const::CDC, hit->getArrayIndex(), -1,
203 hitInformation.getSortingParameter(), 1));
204 } else {
205 createdTrackCand.addHit(new genfit::WireTrackCandHit(Const::CDC, hit->getArrayIndex(), -1,
206 hitInformation.getSortingParameter(), 0));
207 }
208 });
209 mapOnHits<UsedBKLMHit>(m_storeArrayNameOfBKLMHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
210 const UsedBKLMHit * const hit) {
211 createdTrackCand.addHit(Const::BKLM, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
212 });
213 mapOnHits<UsedEKLMHit>(m_storeArrayNameOfEKLMHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
214 const UsedEKLMHit * const hit) {
215 createdTrackCand.addHit(Const::EKLM, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
216 });
217
218 createdTrackCand.sortHits();
219
220 // Set the MC Particle
221 const MCParticle* relatedMCParticle = getRelatedTo<MCParticle>();
222 if (relatedMCParticle) {
223 createdTrackCand.setMcTrackId(relatedMCParticle->getArrayIndex());
224 }
225
226 // Add the hits
227 return createdTrackCand;
228}
229
230const genfit::TrackPoint* RecoTrack::getCreatedTrackPoint(const RecoHitInformation* recoHitInformation) const
231{
232 int createdTrackPointID = recoHitInformation->getCreatedTrackPointID();
233 if (createdTrackPointID == -1) {
234 return nullptr;
235 }
236
237 return m_genfitTrack.getPoint(createdTrackPointID);
238}
239
240size_t RecoTrack::addHitsFromRecoTrack(const RecoTrack* recoTrack, unsigned int sortingParameterOffset, bool reversed,
241 std::optional<double> optionalMinimalWeight)
242{
243 size_t hitsCopied = 0;
244
245 unsigned int maximalSortingParameter = 0;
246
247 if (reversed) {
248 const auto& recoHitInformations = recoTrack->getRecoHitInformations();
249 const auto sortBySP = [](const RecoHitInformation * lhs, const RecoHitInformation * rhs) {
250 return lhs->getSortingParameter() < rhs->getSortingParameter();
251 };
252 const auto& maximalElement = std::max_element(recoHitInformations.begin(), recoHitInformations.end(), sortBySP);
253 if (maximalElement != recoHitInformations.end()) {
254 maximalSortingParameter = (*maximalElement)->getSortingParameter();
255 }
256 }
257
258 // Helper function to add the sorting parameter offset (or reverse the sign of the sorting parameter)
259 const auto calculateSortingParameter = [maximalSortingParameter, sortingParameterOffset](unsigned int sortingParameters) {
260 if (maximalSortingParameter > 0) {
261 return maximalSortingParameter - sortingParameters + sortingParameterOffset;
262 }
263 return sortingParameters + sortingParameterOffset;
264 };
265
266 const auto testHitWeight = [recoTrack, optionalMinimalWeight](const RecoHitInformation * recoHitInformation) {
267 if (not optionalMinimalWeight) {
268 return true;
269 }
270 double minimalWeight = *optionalMinimalWeight;
271 const genfit::TrackPoint* trackPoint = recoTrack->getCreatedTrackPoint(recoHitInformation);
272 if (trackPoint) {
273 genfit::KalmanFitterInfo* kalmanFitterInfo = trackPoint->getKalmanFitterInfo();
274 if (not kalmanFitterInfo) {
275 return false;
276 }
277 const std::vector<double>& weights = kalmanFitterInfo->getWeights();
278 const auto checkWeight = [minimalWeight](const double weight) {
279 return weight >= minimalWeight;
280 };
281 return std::any_of(weights.begin(), weights.end(), checkWeight);
282 }
283 return true;
284 };
285
286 for (auto* pxdHit : recoTrack->getPXDHitList()) {
287 auto recoHitInfo = recoTrack->getRecoHitInformation(pxdHit);
288 assert(recoHitInfo);
289 if (testHitWeight(recoHitInfo)) {
290 hitsCopied += addPXDHit(pxdHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
291 recoHitInfo->getFoundByTrackFinder());
292 }
293 }
294
295 for (auto* svdHit : recoTrack->getSVDHitList()) {
296 auto recoHitInfo = recoTrack->getRecoHitInformation(svdHit);
297 assert(recoHitInfo);
298 if (testHitWeight(recoHitInfo)) {
299 hitsCopied += addSVDHit(svdHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
300 recoHitInfo->getFoundByTrackFinder());
301 }
302 }
303
304 for (auto* cdcHit : recoTrack->getCDCHitList()) {
305 auto recoHitInfo = recoTrack->getRecoHitInformation(cdcHit);
306 assert(recoHitInfo);
307 if (testHitWeight(recoHitInfo)) {
308 hitsCopied += addCDCHit(cdcHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
309 recoHitInfo->getRightLeftInformation(),
310 recoHitInfo->getFoundByTrackFinder());
311 }
312 }
313
314 for (auto* bklmHit : recoTrack->getBKLMHitList()) {
315 auto recoHitInfo = recoTrack->getRecoHitInformation(bklmHit);
316 assert(recoHitInfo);
317 if (testHitWeight(recoHitInfo)) {
318 hitsCopied += addBKLMHit(bklmHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
319 recoHitInfo->getFoundByTrackFinder());
320 }
321 }
322
323 for (auto* eklmHit : recoTrack->getEKLMHitList()) {
324 auto recoHitInfo = recoTrack->getRecoHitInformation(eklmHit);
325 assert(recoHitInfo);
326 if (testHitWeight(recoHitInfo)) {
327 hitsCopied += addEKLMHit(eklmHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
328 recoHitInfo->getFoundByTrackFinder());
329 }
330 }
331
332 return hitsCopied;
333}
334
335
336bool RecoTrack::wasFitSuccessful(const genfit::AbsTrackRep* representation) const
337{
339
340 if (getRepresentations().empty()) {
341 return false;
342 }
343
344 if (not hasTrackFitStatus(representation)) {
345 return false;
346 }
347
348 const genfit::FitStatus* fs = getTrackFitStatus(representation);
349 if (not fs) {
350 return false;
351 }
352 if (not fs->isFitConverged()) {
353 return false;
354 }
355
356 // make sure we only consider fitted if the Kalman method was used
357 if (not dynamic_cast<const genfit::KalmanFitStatus*>(fs)) {
358 return false;
359 }
360
361 // make sure there is at least one hit with a valid mSoP
362 const unsigned int trackSize = m_genfitTrack.getNumPoints();
363 for (unsigned int i = 0; i < trackSize; i++) {
364 try {
365 m_genfitTrack.getFittedState(i, representation);
366 return true;
367 } catch (const genfit::Exception& exception) {
368 B2DEBUG(29, "Can not get mSoP because of: " << exception.what());
369 }
370 }
371
372 return false;
373}
374
376{
377 // "Delete" all RecoHitInfromation but the first and the last.
378 // Copy is intended!
379 std::vector<RelationEntry> relatedRecoHitInformations = getRelationsWith<RecoHitInformation>
381 std::sort(relatedRecoHitInformations.begin(), relatedRecoHitInformations.end(), [](const RelationEntry & lhs,
382 const RelationEntry & rhs) {
383 return dynamic_cast<RecoHitInformation*>(lhs.object)->getSortingParameter() > dynamic_cast<RecoHitInformation*>
384 (rhs.object)->getSortingParameter();
385 });
386
387 // "Prune" all RecoHitInformation but the first and the last.
388 for (unsigned int i = 1; i < relatedRecoHitInformations.size() - 1; ++i) {
389 dynamic_cast<RecoHitInformation*>(relatedRecoHitInformations[i].object)->setFlag(RecoHitInformation::RecoHitFlag::c_pruned);
390 dynamic_cast<RecoHitInformation*>(relatedRecoHitInformations[i].object)->setCreatedTrackPointID(-1);
391 }
392
393 // Genfits prune method fails, if the number of hits is too small.
394 if (getHitPointsWithMeasurement().size() >= 2) {
395 m_genfitTrack.prune("FL");
396 }
397}
398
399void RecoTrackGenfitAccess::swapGenfitTrack(RecoTrack& recoTrack, const genfit::Track* track)
400{
401 recoTrack.m_genfitTrack = *track;
402}
403
405{
406 return recoTrack.m_genfitTrack;
407}
408
409genfit::AbsTrackRep* RecoTrackGenfitAccess::createOrReturnRKTrackRep(RecoTrack& recoTrack, int PDGcode)
410{
411 // try to get the trackRep, if it has already been added
412 genfit::AbsTrackRep* trackRepresentation = recoTrack.getTrackRepresentationForPDG(std::abs(PDGcode));
413
414 // not available? create one
415 if (trackRepresentation == nullptr) {
416 if (PDGcode == Monopoles::c_monopolePDGCode) {
417 trackRepresentation = new genfit::MplTrackRep(PDGcode, Monopoles::monopoleMagCharge);
418 } else {
419 trackRepresentation = new genfit::RKTrackRep(PDGcode);
420 }
421 RecoTrackGenfitAccess::getGenfitTrack(recoTrack).addTrackRep(trackRepresentation);
422 }
423 return trackRepresentation;
424}
425
426const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneClosestTo(const ROOT::Math::XYZVector& closestPoint,
427 const genfit::AbsTrackRep* representation)
428{
430 const unsigned int numberOfPoints = m_genfitTrack.getNumPointsWithMeasurement();
431
432 assert(numberOfPoints > 0);
433
434 const genfit::MeasuredStateOnPlane* nearestStateOnPlane = nullptr;
435 double minimalDistance2 = 0;
436 for (unsigned int hitIndex = 0; hitIndex < numberOfPoints; hitIndex++) {
437 try {
438 const genfit::MeasuredStateOnPlane& measuredStateOnPlane = m_genfitTrack.getFittedState(hitIndex, representation);
439
440 const double currentDistance2 = (ROOT::Math::XYZVector(measuredStateOnPlane.getPos()) - closestPoint).Mag2();
441
442 if (not nearestStateOnPlane or currentDistance2 < minimalDistance2) {
443 nearestStateOnPlane = &measuredStateOnPlane;
444 minimalDistance2 = currentDistance2;
445 }
446 } catch (const genfit::Exception& exception) {
447 B2DEBUG(50, "Can not get mSoP because of: " << exception.what());
448 continue;
449 }
450 }
451
452 // catch case no hit has measured state on plane (not sure how likely that is) which would lead to undefined behavior
453 if (not nearestStateOnPlane) {
454 B2WARNING("Non of the track hits had a MeasuredStateOnPlane! Exception thrown.");
455 throw NoStateOnPlaneFound();
456 }
457
458 return *nearestStateOnPlane;
459}
460
461
463{
464 // Delete all fitted information for all representations
465 for (const genfit::AbsTrackRep* rep : getRepresentations()) {
467 }
468}
469
470void RecoTrack::deleteFittedInformationForRepresentation(const genfit::AbsTrackRep* rep)
471{
472 m_genfitTrack.deleteFittedState(rep);
473}
474
475genfit::AbsTrackRep* RecoTrack::getTrackRepresentationForPDG(int pdgCode) const
476{
477 if (pdgCode < 0) {
478 B2FATAL("Only positive pdgCode is possible when calling getTrackRepresentationForPDG, got " << pdgCode);
479 }
480
481 const std::vector<genfit::AbsTrackRep*>& trackRepresentations = getRepresentations();
482
483 for (genfit::AbsTrackRep* trackRepresentation : trackRepresentations) {
484 // Check if the track representation is a RKTrackRep.
485 const genfit::RKTrackRep* rkTrackRepresenation = dynamic_cast<const genfit::RKTrackRep*>(trackRepresentation);
486 if (rkTrackRepresenation != nullptr) {
487 // take the absolute value of the PDG code as the TrackRep holds the PDG code including the charge (so -13 or 13)
488 if (std::abs(rkTrackRepresenation->getPDG()) == pdgCode) {
489 return trackRepresentation;
490 }
491 }
492 }
493
494 return nullptr;
495}
496
497
499std::tuple<ROOT::Math::XYZVector, ROOT::Math::XYZVector, short> RecoTrack::extractTrackState() const
500{
501 if (not wasFitSuccessful()) {
502 return std::make_tuple(getPositionSeed(), getMomentumSeed(), getChargeSeed());
503 } else {
504 const auto& measuredStateOnPlane = getMeasuredStateOnPlaneFromFirstHit();
505 return std::make_tuple(ROOT::Math::XYZVector(measuredStateOnPlane.getPos()), ROOT::Math::XYZVector(measuredStateOnPlane.getMom()),
506 measuredStateOnPlane.getCharge());
507 }
508}
509
511 const ROOT::Math::XYZVector& position, const ROOT::Math::XYZVector& momentum, short charge,
512 const TMatrixDSym& covariance, double timeSeed) const
513{
514 RecoTrack* newRecoTrack = storeArray.appendNew(position, momentum, charge,
517
518 newRecoTrack->setTimeSeed(timeSeed);
519 newRecoTrack->setSeedCovariance(covariance);
520
521 return newRecoTrack;
522}
523
528
530{
531 if (wasFitSuccessful()) {
532 const auto& mSoP = getMeasuredStateOnPlaneFromFirstHit();
533 return copyToStoreArrayUsing(storeArray,
534 ROOT::Math::XYZVector(mSoP.getPos()),
535 ROOT::Math::XYZVector(mSoP.getMom()),
536 static_cast<short>(mSoP.getCharge()),
537 mSoP.get6DCov(), mSoP.getTime());
538 } else {
539 return copyToStoreArrayUsingSeeds(storeArray);
540 }
541}
542
543bool RecoTrack::hasTrackFitStatus(const genfit::AbsTrackRep* representation) const
544{
546
547 // there might be the case, where the genfit track has no trackreps, even not the cardinal
548 // one because no fit attempt was performed. In this case, the "hasFitStatus" call to genfit
549 // will fail with an access violation. To prevent that, check for the number of reps here before
550 // actually calling genfit's hasFitStatus(...)
551 if (m_genfitTrack.getNumReps() == 0)
552 return false;
553
554 return m_genfitTrack.hasFitStatus(representation);
555}
556
557std::vector<RecoHitInformation*> RecoTrack::getRecoHitInformations(bool getSorted) const
558{
559 std::vector<RecoHitInformation*> hitList;
562
563 hitList.reserve(recoHitInformations.size());
564 for (auto& recoHit : recoHitInformations) {
565 hitList.push_back(&recoHit);
566 }
567
568 // sort the returned vector if requested
569 if (getSorted) {
570 std::sort(hitList.begin(), hitList.end(), [](const RecoHitInformation * a,
571 const RecoHitInformation * b) -> bool {
572 return a->getSortingParameter() < b->getSortingParameter();
573 });
574 }
575
576 return hitList;
577}
578
579const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneFromRecoHit(const RecoHitInformation* recoHitInfo,
580 const genfit::AbsTrackRep* representation) const
581{
583
584 if (!hasTrackFitStatus(representation)) {
585 B2FATAL("MeasuredStateOnPlane can not be retrieved for RecoTracks where no fit has been attempted.");
586 }
587
588 if (!recoHitInfo->useInFit()) {
589 B2FATAL("MeasuredStateOnPlane cannot be provided for RecoHit which was not used in the fit.");
590 }
591
592 const auto* hitTrackPoint = getCreatedTrackPoint(recoHitInfo);
593 if (not hitTrackPoint) {
594 B2FATAL("TrackPoint was requested which has not been created");
595 }
596
597 const auto* fittedResult = hitTrackPoint->getFitterInfo(representation);
598 if (not fittedResult) {
599 throw NoTrackFitResult();
600 }
601
602 return fittedResult->getFittedState();
603}
604
605const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneFromFirstHit(const genfit::AbsTrackRep* representation) const
606{
607 const unsigned int trackSize = m_genfitTrack.getNumPoints();
608 for (unsigned int i = 0; i < trackSize; i++) {
609 try {
610 return m_genfitTrack.getFittedState(i, representation);
611 } catch (const genfit::Exception& exception) {
612 B2DEBUG(28, "Can not get mSoP because of: " << exception.what());
613 }
614 }
615
616 B2FATAL("There is no single hit with a valid mSoP in this track! Check if the fit failed with wasFitSuccessful before");
617}
618
619const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneFromLastHit(const genfit::AbsTrackRep* representation) const
620{
621 int trackSize = m_genfitTrack.getNumPoints();
622 for (int i = -1; i >= -trackSize; i--) {
623 try {
624 return m_genfitTrack.getFittedState(i, representation);
625 } catch (const genfit::Exception& exception) {
626 B2DEBUG(28, "Can not get mSoP because of: " << exception.what());
627 }
628 }
629
630 B2FATAL("There is no single hit with a valid mSoP in this track!");
631}
632
634{
635 m_isArmTimeComputed = true;
636 const std::vector<RecoHitInformation*>& recoHits = getRecoHitInformations(true);
637 bool svdDone = false;
638 int nSVDHits = 0;
639 static RecoHitInformation::RecoHitDetector und = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector;
640 RecoHitInformation::RecoHitDetector SVD = RecoHitInformation::RecoHitDetector::c_SVD;
643 float clusterTimeSum = 0;
644 float clusterTimeSigma2Sum = 0;
645 bool trackArmTimeDone = false;
646
647 // loop over the recoHits of the RecoTrack
648 for (const auto& recoHit : recoHits) {
649 RecoHitInformation::RecoHitDetector foundin = recoHit->getTrackingDetector();
650 if (!svdDone && foundin != SVD) {
651 detIDpre = foundin;
652 trackArmTimeDone = false;
653 }
654 if (foundin == SVD) {
655 RelationVector<SVDCluster> svdClusters = recoHit->getRelationsTo<SVDCluster>(m_storeArrayNameOfSVDHits);
656 clusterTimeSum += svdClusters[0]->getClsTime();
657 clusterTimeSigma2Sum += svdClusters[0]->getClsTimeSigma() * svdClusters[0]->getClsTimeSigma();
658 nSVDHits += 1;
659 svdDone = true;
660 } else {
661 // Compute the track arm times using SVD cluster times
662 if (svdDone && nSVDHits > 1) {
663 detIDpost = foundin;
664 if (!isOutgoingArm(detIDpre, detIDpost)) {
665 m_ingoingArmTime = clusterTimeSum / nSVDHits;
666 m_ingoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
667 m_hasIngoingArmTime = true;
668 m_nSVDHitsOfIngoingArm = nSVDHits;
669 } else {
670 m_outgoingArmTime = clusterTimeSum / nSVDHits;
671 m_outgoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
673 m_nSVDHitsOfOutgoingArm = nSVDHits;
674 }
675 svdDone = false;
676 detIDpre = detIDpost;
677 detIDpost = und;
678 clusterTimeSum = 0;
679 nSVDHits = 0;
680 trackArmTimeDone = true;
681 }
682 }
683
684 // When the last recoHit is SVD, it does not enter in the else{} of if (detID == SVD) {...} else {...}
685 // where the track arm times are calculated, so they are calculated here.
686 // It will not reset all variables because it is run only at the last recoHit
687 if (!trackArmTimeDone && (recoHit == recoHits.back()) && nSVDHits > 1) {
688 if (!isOutgoingArm(detIDpre, detIDpost)) {
689 m_ingoingArmTime = clusterTimeSum / nSVDHits;
690 m_ingoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
691 m_hasIngoingArmTime = true;
692 m_nSVDHitsOfIngoingArm = nSVDHits;
693 } else {
694 m_outgoingArmTime = clusterTimeSum / nSVDHits;
695 m_outgoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
697 m_nSVDHitsOfOutgoingArm = nSVDHits;
698 }
699 }
700 }
701}
702
704{
705 static RecoHitInformation::RecoHitDetector und = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector;
706 RecoHitInformation::RecoHitDetector PXD = RecoHitInformation::RecoHitDetector::c_PXD;
707 RecoHitInformation::RecoHitDetector CDC = RecoHitInformation::RecoHitDetector::c_CDC;
708 bool isOutgoing = true;
709 if (pre == PXD && post == CDC) isOutgoing = true;
710 else if (pre == und && post == CDC) isOutgoing = true;
711 else if (pre == PXD && post == und) isOutgoing = true;
712 else if (pre == CDC && post == PXD) isOutgoing = false;
713 else if (pre == und && post == PXD) isOutgoing = false;
714 else if (pre == CDC && post == und) isOutgoing = false;
715 else {
716 //TO DO
717 B2DEBUG(29,
718 "SVD-only? PXD-SVD-PXD??? --- use layer information to determine if the track arm is outgoing or ingoing! Considered --> 'OUT'");
719 isOutgoing = true;
720 }
721 return isOutgoing;
722}
723
724void RecoTrack::flipTrackDirectionAndCharge(const genfit::AbsTrackRep* representation)
725{
726 const genfit::MeasuredStateOnPlane& measuredStateOnPlane = getMeasuredStateOnPlaneFromLastHit(representation);
727 const ROOT::Math::XYZVector& fittedPosition = ROOT::Math::XYZVector(measuredStateOnPlane.getPos());
728 const ROOT::Math::XYZVector& fittedMomentum = ROOT::Math::XYZVector(measuredStateOnPlane.getMom());
729 const double& fittedCharge = measuredStateOnPlane.getCharge();
730
731 // revert the charge and momentum
732 setChargeSeed(-fittedCharge);
733 setPositionAndMomentum(fittedPosition, -fittedMomentum);
735 swapArmTimes();
736 setDirtyFlag();
737}
738
739std::string RecoTrack::getInfoHTML() const
740{
741 std::stringstream out;
742
743 out << "<b>Charge seed</b>=" << getChargeSeed();
744
745 out << "<b>pT seed</b>=" << getMomentumSeed().Rho();
746 out << ", <b>pZ seed</b>=" << getMomentumSeed().Z();
747 out << "<br>";
748 out << "<b>position seed</b>=" << getMomentumSeed().X() << ", " << getMomentumSeed().Y() << ", " << getMomentumSeed().Z();
749 out << "<br>";
750
751 for (const genfit::AbsTrackRep* rep : getRepresentations()) {
752 out << "<b>was fitted with " << rep->getPDG() << "</b>=" << wasFitSuccessful() << ", ";
753 }
754 out << "<br>";
755
756 return out.str();
757}
A Class to store the Monte Carlo particle information.
Definition MCParticle.h:32
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
Definition MCParticle.h:233
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
RightLeftInformation getRightLeftInformation() const
Get the right-left-information.
RecoHitDetector
The detector this hit comes from (which is of course also visible in the hit type)
bool useInFit() const
Get the flag, whether this his should be used in a fit or not.
int getCreatedTrackPointID() const
Get the id of the TrackPoint related to this reco hit information in the genfit::Track.
unsigned int getSortingParameter() const
Get the sorting parameter.
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Definition RecoTrack.cc:404
static void swapGenfitTrack(RecoTrack &recoTrack, const genfit::Track *track)
Set the genfit track of a Recotrack copying the information from another genfit track.
Definition RecoTrack.cc:399
static genfit::AbsTrackRep * createOrReturnRKTrackRep(RecoTrack &recoTrack, int PDGcode)
Checks if a TrackRap for the PDG id of the RecoTrack (and its charge conjugate) does already exit and...
Definition RecoTrack.cc:409
This is the Reconstruction Event-Data Model Track.
Definition RecoTrack.h:79
size_t addHitsFromRecoTrack(const RecoTrack *recoTrack, unsigned int sortingParameterOffset=0, bool reversed=false, std::optional< double > optionalMinimalWeight=std::nullopt)
Add all hits from another RecoTrack to this RecoTrack.
Definition RecoTrack.cc:240
void setChargeSeed(const short int chargeSeed)
Set the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition RecoTrack.h:597
RecoHitInformation::UsedCDCHit UsedCDCHit
Copy the definitions from the RecoHitInformation to this class.
Definition RecoTrack.h:91
void mapOnHits(const std::string &storeArrayNameOfHits, std::function< void(RecoHitInformation &, HitType *)> const &mapFunction, std::function< bool(const RecoHitInformation &, const HitType *)> const &pickFunction)
Call a function on all hits of the given type in the store array, that are related to this track.
Definition RecoTrack.h:766
const std::vector< genfit::AbsTrackRep * > & getRepresentations() const
Return a list of track representations. You are not allowed to modify or delete them!
Definition RecoTrack.h:638
const TMatrixDSym & getSeedCovariance() const
Return the covariance matrix of the seed. ATTENTION: This is not the fitted covariance.
Definition RecoTrack.h:611
bool addBKLMHit(const UsedBKLMHit *bklmHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a bklm hit with the given information to the reco track.
Definition RecoTrack.h:286
bool addCDCHit(const UsedCDCHit *cdcHit, const unsigned int sortingParameter, RightLeftInformation rightLeftInformation=RightLeftInformation::c_undefinedRightLeftInformation, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a cdc hit with the given information to the reco track.
Definition RecoTrack.h:243
void deleteFittedInformation()
Delete all fitted information for all representations.
Definition RecoTrack.cc:462
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList() const
Return an unsorted list of pxd hits.
Definition RecoTrack.h:449
float m_ingoingArmTimeError
Error of the track time of the ingoing arm.
Definition RecoTrack.h:925
const std::string & getStoreArrayNameOfEKLMHits() const
Name of the store array of the eklm hits.
Definition RecoTrack.h:744
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
Definition RecoTrack.cc:336
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
Definition RecoTrack.h:452
static RecoTrack * createFromTrackCand(const genfit::TrackCand &trackCand, const std::string &storeArrayNameOfRecoTracks="", const std::string &storeArrayNameOfPXDHits="", const std::string &storeArrayNameOfSVDHits="", const std::string &storeArrayNameOfCDCHits="", const std::string &storeArrayNameOfBKLMHits="", const std::string &storeArrayNameOfEKLMHits="", const std::string &storeArrayNameOfRecoHitInformation="", const bool recreateSortingParameters=false)
Create a reco track from a genfit::TrackCand and save it to the given store array.
Definition RecoTrack.cc:97
void setPositionAndMomentum(const ROOT::Math::XYZVector &positionSeed, const ROOT::Math::XYZVector &momentumSeed)
Set the position and momentum seed of the reco track. ATTENTION: This is not the fitted position or m...
Definition RecoTrack.h:590
std::string m_storeArrayNameOfCDCHits
Store array name of added CDC hits.
Definition RecoTrack.h:905
bool addEKLMHit(const UsedEKLMHit *eklmHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds an eklm hit with the given information to the reco track.
Definition RecoTrack.h:300
bool addPXDHit(const UsedPXDHit *pxdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a pxd hit with the given information to the reco track.
Definition RecoTrack.h:258
std::vector< Belle2::RecoTrack::UsedBKLMHit * > getBKLMHitList() const
Return an unsorted list of bklm hits.
Definition RecoTrack.h:458
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
Definition RecoTrack.h:455
const std::string & getStoreArrayNameOfSVDHits() const
Name of the store array of the svd hits.
Definition RecoTrack.h:735
void estimateArmTime()
This function calculates the track time of the ingoing and outgoing arms and their difference.
Definition RecoTrack.cc:633
ROOT::Math::XYZVector getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
Definition RecoTrack.h:480
bool m_hasIngoingArmTime
Internal storage of the final ingoing arm time is set.
Definition RecoTrack.h:938
std::tuple< ROOT::Math::XYZVector, ROOT::Math::XYZVector, short > extractTrackState() const
Return the position, the momentum and the charge of the first measured state on plane or - if unfitte...
Definition RecoTrack.cc:499
RecoHitInformation::UsedEKLMHit UsedEKLMHit
Copy the definitions from the RecoHitInformation to this class.
Definition RecoTrack.h:99
int m_nSVDHitsOfOutgoingArm
Number of SVD clusters of the outgoing arm.
Definition RecoTrack.h:929
bool m_hasOutgoingArmTime
Internal storage of the final outgoing arm time is set.
Definition RecoTrack.h:940
const std::string & getStoreArrayNameOfPXDHits() const
Name of the store array of the pxd hits.
Definition RecoTrack.h:732
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneClosestTo(const ROOT::Math::XYZVector &closestPoint, const genfit::AbsTrackRep *representation=nullptr)
Return genfit's MasuredStateOnPlane, that is closest to the given point useful for extrapolation of m...
Definition RecoTrack.cc:426
float m_outgoingArmTime
Track time of the outgoing arm.
Definition RecoTrack.h:919
void setDirtyFlag(const bool &dirtyFlag=true)
Set to true, if you want to rebuild the measurements and do the fit independent on changes of the hit...
Definition RecoTrack.h:722
std::string m_storeArrayNameOfBKLMHits
Store array name of added BKLM hits.
Definition RecoTrack.h:907
std::string getInfoHTML() const override
Get useful information on EventDisplay.
Definition RecoTrack.cc:739
void prune()
Prune the genfit track, e.g.
Definition RecoTrack.cc:375
short int m_charge
Storage for the charge. All other helix parameters are saved in the genfit::Track.
Definition RecoTrack.h:899
RecoHitInformation::UsedBKLMHit UsedBKLMHit
Copy the definitions from the RecoHitInformation to this class.
Definition RecoTrack.h:97
std::vector< Belle2::RecoTrack::UsedEKLMHit * > getEKLMHitList() const
Return an unsorted list of eklm hits.
Definition RecoTrack.h:461
RecoTrack * copyToStoreArrayUsingSeeds(StoreArray< RecoTrack > &storeArray) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition RecoTrack.cc:524
const std::string & getStoreArrayNameOfBKLMHits() const
Name of the store array of the bklm hits.
Definition RecoTrack.h:741
void setTimeSeed(const double timeSeed)
Set the time seed. ATTENTION: This is not the fitted time.
Definition RecoTrack.h:604
genfit::TrackCand createGenfitTrackCand() const
Create a genfit::TrackCand out of this reco track and copy all information to the track candidate.
Definition RecoTrack.cc:178
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromLastHit(const genfit::AbsTrackRep *representation=nullptr) const
Return genfit's MeasuredStateOnPlane for the last hit in a fit useful for extrapolation of measuremen...
Definition RecoTrack.cc:619
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition RecoTrack.h:614
const std::string & getStoreArrayNameOfRecoHitInformation() const
Name of the store array of the reco hit information.
Definition RecoTrack.h:747
bool hasTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Check, if there is a fit status for the given representation or for the cardinal one.
Definition RecoTrack.cc:543
int m_nSVDHitsOfIngoingArm
Number of SVD clusters of the ingoing arm.
Definition RecoTrack.h:931
RecoHitInformation * getRecoHitInformation(HitType *hit) const
Return the reco hit information for a generic hit from the storeArray.
Definition RecoTrack.h:312
RecoTrack * copyToStoreArray(StoreArray< RecoTrack > &storeArray) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition RecoTrack.cc:529
RecoTrack * copyToStoreArrayUsing(StoreArray< RecoTrack > &storeArray, const ROOT::Math::XYZVector &position, const ROOT::Math::XYZVector &momentum, short charge, const TMatrixDSym &covariance, double timeSeed) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition RecoTrack.cc:510
const genfit::TrackPoint * getCreatedTrackPoint(const RecoHitInformation *recoHitInformation) const
Get a pointer to the TrackPoint that was created from this hit.
Definition RecoTrack.cc:230
std::vector< RecoHitInformation * > getRecoHitInformations(bool getSorted=false) const
Return a list of all RecoHitInformations associated with the RecoTrack.
Definition RecoTrack.cc:557
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
Definition RecoTrack.cc:53
bool m_isArmTimeComputed
true if the arms times are already computed, false otherwise
Definition RecoTrack.h:936
std::string m_storeArrayNameOfSVDHits
Store array name of added SVD hits.
Definition RecoTrack.h:903
const std::string & getStoreArrayNameOfCDCHits() const
Name of the store array of the cdc hits.
Definition RecoTrack.h:738
float m_ingoingArmTime
Track time of the ingoing arm.
Definition RecoTrack.h:923
void flipTrackDirectionAndCharge(const genfit::AbsTrackRep *representation=nullptr)
Flip the direction of the RecoTrack by inverting the momentum vector and the charge.
Definition RecoTrack.cc:724
void revertRecoHitInformationSorting()
Revert the sorting order of the RecoHitInformation.
Definition RecoTrack.h:750
void deleteFittedInformationForRepresentation(const genfit::AbsTrackRep *rep)
Delete all fitted information for the given representations.
Definition RecoTrack.cc:470
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition RecoTrack.h:508
float m_outgoingArmTimeError
Error of the track time of the outgoing arm.
Definition RecoTrack.h:921
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromFirstHit(const genfit::AbsTrackRep *representation=nullptr) const
Return genfit's MeasuredStateOnPlane for the first hit in a fit useful for extrapolation of measureme...
Definition RecoTrack.cc:605
ROOT::Math::XYZVector getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition RecoTrack.h:487
genfit::AbsTrackRep * getTrackRepresentationForPDG(int pdgCode) const
Return an already created track representation of the given reco track for the PDG.
Definition RecoTrack.cc:475
genfit::Track m_genfitTrack
Internal storage for the genfit track.
Definition RecoTrack.h:897
RecoHitInformation::UsedSVDHit UsedSVDHit
Copy the definitions from the RecoHitInformation to this class.
Definition RecoTrack.h:93
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromRecoHit(const RecoHitInformation *recoHitInfo, const genfit::AbsTrackRep *representation=nullptr) const
Return genfit's MeasuredStateOnPlane on plane for associated with one RecoHitInformation.
Definition RecoTrack.cc:579
std::string m_storeArrayNameOfEKLMHits
Store array name of added EKLM hits.
Definition RecoTrack.h:909
RecoTrack()
Empty constructor for ROOT. Do not use!
Definition RecoTrack.h:140
std::string m_storeArrayNameOfPXDHits
Store array name of added PXD hits.
Definition RecoTrack.h:901
bool addSVDHit(const UsedSVDHit *svdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a svd hit with the given information to the reco track.
Definition RecoTrack.h:272
void checkDirtyFlag() const
Helper: Check the dirty flag and produce a warning, whenever a fit result is accessed.
Definition RecoTrack.h:1066
bool isOutgoingArm(RecoHitInformation::RecoHitDetector pre=RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector, RecoHitInformation::RecoHitDetector post=RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector)
This function returns true if the arm direction is Outgoing and false if the arm direction is Ingoing...
Definition RecoTrack.cc:703
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
Definition RecoTrack.h:621
RecoHitInformation::UsedPXDHit UsedPXDHit
Copy the definitions from the RecoHitInformation to this class.
Definition RecoTrack.h:95
double getTimeSeed() const
Return the time seed stored in the reco track. ATTENTION: This is not the fitted time.
Definition RecoTrack.h:511
const std::vector< genfit::TrackPoint * > & getHitPointsWithMeasurement() const
Return a list of measurements and track points, which can be used e.g. to extrapolate....
Definition RecoTrack.h:708
std::string m_storeArrayNameOfRecoHitInformation
Store array of added RecoHitInformation.
Definition RecoTrack.h:911
void swapArmTimes()
Swap arm times, booleans and nSVDHits.
Definition RecoTrack.h:1058
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition SVDCluster.h:29
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition StoreArray.h:246
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition StoreArray.h:140
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
Definition VectorUtil.h:24
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.
Abstract base class for different kinds of events.
Struct for relations.