Belle II Software development
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 const 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 const 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 const 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 const UsedSVDHit* svdHit = svdHits[hitID];
162 newRecoTrack->addSVDHit(svdHit, sortingParameter);
163 } else if (detID == Const::PXD) {
164 const UsedPXDHit* pxdHit = pxdHits[hitID];
165 newRecoTrack->addPXDHit(pxdHit, sortingParameter);
166 } else if (detID == Const::BKLM) {
167 const UsedBKLMHit* bklmHit = bklmHits[hitID];
168 newRecoTrack->addBKLMHit(bklmHit, sortingParameter);
169 } else if (detID == Const::EKLM) {
170 const 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 // cppcheck-suppress variableScope ; declaration kept at this scope for readability
271 double minimalWeight = *optionalMinimalWeight;
272 const genfit::TrackPoint* trackPoint = recoTrack->getCreatedTrackPoint(recoHitInformation);
273 if (trackPoint) {
274 const genfit::KalmanFitterInfo* kalmanFitterInfo = trackPoint->getKalmanFitterInfo();
275 if (not kalmanFitterInfo) {
276 return false;
277 }
278 const std::vector<double>& weights = kalmanFitterInfo->getWeights();
279 const auto checkWeight = [minimalWeight](const double weight) {
280 return weight >= minimalWeight;
281 };
282 return std::any_of(weights.begin(), weights.end(), checkWeight);
283 }
284 return true;
285 };
286
287 for (auto* pxdHit : recoTrack->getPXDHitList()) {
288 auto recoHitInfo = recoTrack->getRecoHitInformation(pxdHit);
289 assert(recoHitInfo);
290 if (testHitWeight(recoHitInfo)) {
291 hitsCopied += addPXDHit(pxdHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
292 recoHitInfo->getFoundByTrackFinder());
293 }
294 }
295
296 for (auto* svdHit : recoTrack->getSVDHitList()) {
297 auto recoHitInfo = recoTrack->getRecoHitInformation(svdHit);
298 assert(recoHitInfo);
299 if (testHitWeight(recoHitInfo)) {
300 hitsCopied += addSVDHit(svdHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
301 recoHitInfo->getFoundByTrackFinder());
302 }
303 }
304
305 for (auto* cdcHit : recoTrack->getCDCHitList()) {
306 auto recoHitInfo = recoTrack->getRecoHitInformation(cdcHit);
307 assert(recoHitInfo);
308 if (testHitWeight(recoHitInfo)) {
309 hitsCopied += addCDCHit(cdcHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
310 recoHitInfo->getRightLeftInformation(),
311 recoHitInfo->getFoundByTrackFinder());
312 }
313 }
314
315 for (auto* bklmHit : recoTrack->getBKLMHitList()) {
316 auto recoHitInfo = recoTrack->getRecoHitInformation(bklmHit);
317 assert(recoHitInfo);
318 if (testHitWeight(recoHitInfo)) {
319 hitsCopied += addBKLMHit(bklmHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
320 recoHitInfo->getFoundByTrackFinder());
321 }
322 }
323
324 for (auto* eklmHit : recoTrack->getEKLMHitList()) {
325 auto recoHitInfo = recoTrack->getRecoHitInformation(eklmHit);
326 assert(recoHitInfo);
327 if (testHitWeight(recoHitInfo)) {
328 hitsCopied += addEKLMHit(eklmHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
329 recoHitInfo->getFoundByTrackFinder());
330 }
331 }
332
333 return hitsCopied;
334}
335
336
337bool RecoTrack::wasFitSuccessful(const genfit::AbsTrackRep* representation) const
338{
340
341 if (getRepresentations().empty()) {
342 return false;
343 }
344
345 if (not hasTrackFitStatus(representation)) {
346 return false;
347 }
348
349 const genfit::FitStatus* fs = getTrackFitStatus(representation);
350 if (not fs) {
351 return false;
352 }
353 if (not fs->isFitConverged()) {
354 return false;
355 }
356
357 // make sure we only consider fitted if the Kalman method was used
358 if (not dynamic_cast<const genfit::KalmanFitStatus*>(fs)) {
359 return false;
360 }
361
362 // make sure there is at least one hit with a valid mSoP
363 const unsigned int trackSize = m_genfitTrack.getNumPoints();
364 for (unsigned int i = 0; i < trackSize; i++) {
365 try {
366 m_genfitTrack.getFittedState(i, representation);
367 return true;
368 } catch (const genfit::Exception& exception) {
369 B2DEBUG(29, "Can not get mSoP because of: " << exception.what());
370 }
371 }
372
373 return false;
374}
375
377{
378 // "Delete" all RecoHitInfromation but the first and the last.
379 // Copy is intended!
380 std::vector<RelationEntry> relatedRecoHitInformations = getRelationsWith<RecoHitInformation>
382 std::sort(relatedRecoHitInformations.begin(), relatedRecoHitInformations.end(), [](const RelationEntry & lhs,
383 const RelationEntry & rhs) {
384 return dynamic_cast<RecoHitInformation*>(lhs.object)->getSortingParameter() > dynamic_cast<RecoHitInformation*>
385 (rhs.object)->getSortingParameter();
386 });
387
388 // "Prune" all RecoHitInformation but the first and the last.
389 for (unsigned int i = 1; i < relatedRecoHitInformations.size() - 1; ++i) {
390 dynamic_cast<RecoHitInformation*>(relatedRecoHitInformations[i].object)->setFlag(RecoHitInformation::RecoHitFlag::c_pruned);
391 dynamic_cast<RecoHitInformation*>(relatedRecoHitInformations[i].object)->setCreatedTrackPointID(-1);
392 }
393
394 // Genfits prune method fails, if the number of hits is too small.
395 if (getHitPointsWithMeasurement().size() >= 2) {
396 m_genfitTrack.prune("FL");
397 }
398}
399
400void RecoTrackGenfitAccess::swapGenfitTrack(RecoTrack& recoTrack, const genfit::Track* track)
401{
402 recoTrack.m_genfitTrack = *track;
403}
404
406{
407 return recoTrack.m_genfitTrack;
408}
409
410genfit::AbsTrackRep* RecoTrackGenfitAccess::createOrReturnRKTrackRep(RecoTrack& recoTrack, int PDGcode)
411{
412 // try to get the trackRep, if it has already been added
413 genfit::AbsTrackRep* trackRepresentation = recoTrack.getTrackRepresentationForPDG(std::abs(PDGcode));
414
415 // not available? create one
416 if (trackRepresentation == nullptr) {
417 if (PDGcode == Monopoles::c_monopolePDGCode) {
418 trackRepresentation = new genfit::MplTrackRep(PDGcode, Monopoles::monopoleMagCharge);
419 } else {
420 trackRepresentation = new genfit::RKTrackRep(PDGcode);
421 }
422 RecoTrackGenfitAccess::getGenfitTrack(recoTrack).addTrackRep(trackRepresentation);
423 }
424 return trackRepresentation;
425}
426
427const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneClosestTo(const ROOT::Math::XYZVector& closestPoint,
428 const genfit::AbsTrackRep* representation)
429{
431 const unsigned int numberOfPoints = m_genfitTrack.getNumPointsWithMeasurement();
432
433 assert(numberOfPoints > 0);
434
435 const genfit::MeasuredStateOnPlane* nearestStateOnPlane = nullptr;
436 double minimalDistance2 = 0;
437 for (unsigned int hitIndex = 0; hitIndex < numberOfPoints; hitIndex++) {
438 try {
439 const genfit::MeasuredStateOnPlane& measuredStateOnPlane = m_genfitTrack.getFittedState(hitIndex, representation);
440
441 const double currentDistance2 = (ROOT::Math::XYZVector(measuredStateOnPlane.getPos()) - closestPoint).Mag2();
442
443 if (not nearestStateOnPlane or currentDistance2 < minimalDistance2) {
444 nearestStateOnPlane = &measuredStateOnPlane;
445 minimalDistance2 = currentDistance2;
446 }
447 } catch (const genfit::Exception& exception) {
448 B2DEBUG(50, "Can not get mSoP because of: " << exception.what());
449 continue;
450 }
451 }
452
453 // catch case no hit has measured state on plane (not sure how likely that is) which would lead to undefined behavior
454 if (not nearestStateOnPlane) {
455 B2WARNING("Non of the track hits had a MeasuredStateOnPlane! Exception thrown.");
456 throw NoStateOnPlaneFound();
457 }
458
459 return *nearestStateOnPlane;
460}
461
462
464{
465 // Delete all fitted information for all representations
466 for (const genfit::AbsTrackRep* rep : getRepresentations()) {
468 }
469}
470
471void RecoTrack::deleteFittedInformationForRepresentation(const genfit::AbsTrackRep* rep)
472{
473 m_genfitTrack.deleteFittedState(rep);
474}
475
476genfit::AbsTrackRep* RecoTrack::getTrackRepresentationForPDG(int pdgCode) const
477{
478 if (pdgCode < 0) {
479 B2FATAL("Only positive pdgCode is possible when calling getTrackRepresentationForPDG, got " << pdgCode);
480 }
481
482 const std::vector<genfit::AbsTrackRep*>& trackRepresentations = getRepresentations();
483
484 for (genfit::AbsTrackRep* trackRepresentation : trackRepresentations) {
485 // Check if the track representation is a RKTrackRep.
486 const genfit::RKTrackRep* rkTrackRepresenation = dynamic_cast<const genfit::RKTrackRep*>(trackRepresentation);
487 if (rkTrackRepresenation != nullptr) {
488 // take the absolute value of the PDG code as the TrackRep holds the PDG code including the charge (so -13 or 13)
489 if (std::abs(rkTrackRepresenation->getPDG()) == pdgCode) {
490 return trackRepresentation;
491 }
492 }
493 }
494
495 return nullptr;
496}
497
498
500std::tuple<ROOT::Math::XYZVector, ROOT::Math::XYZVector, short> RecoTrack::extractTrackState() const
501{
502 if (not wasFitSuccessful()) {
503 return std::make_tuple(getPositionSeed(), getMomentumSeed(), getChargeSeed());
504 } else {
505 const auto& measuredStateOnPlane = getMeasuredStateOnPlaneFromFirstHit();
506 return std::make_tuple(ROOT::Math::XYZVector(measuredStateOnPlane.getPos()), ROOT::Math::XYZVector(measuredStateOnPlane.getMom()),
507 measuredStateOnPlane.getCharge());
508 }
509}
510
512 const ROOT::Math::XYZVector& position, const ROOT::Math::XYZVector& momentum, short charge,
513 const TMatrixDSym& covariance, double timeSeed) const
514{
515 RecoTrack* newRecoTrack = storeArray.appendNew(position, momentum, charge,
518
519 newRecoTrack->setTimeSeed(timeSeed);
520 newRecoTrack->setSeedCovariance(covariance);
521
522 return newRecoTrack;
523}
524
529
531{
532 if (wasFitSuccessful()) {
533 const auto& mSoP = getMeasuredStateOnPlaneFromFirstHit();
534 return copyToStoreArrayUsing(storeArray,
535 ROOT::Math::XYZVector(mSoP.getPos()),
536 ROOT::Math::XYZVector(mSoP.getMom()),
537 static_cast<short>(mSoP.getCharge()),
538 mSoP.get6DCov(), mSoP.getTime());
539 } else {
540 return copyToStoreArrayUsingSeeds(storeArray);
541 }
542}
543
544bool RecoTrack::hasTrackFitStatus(const genfit::AbsTrackRep* representation) const
545{
547
548 // there might be the case, where the genfit track has no trackreps, even not the cardinal
549 // one because no fit attempt was performed. In this case, the "hasFitStatus" call to genfit
550 // will fail with an access violation. To prevent that, check for the number of reps here before
551 // actually calling genfit's hasFitStatus(...)
552 if (m_genfitTrack.getNumReps() == 0)
553 return false;
554
555 return m_genfitTrack.hasFitStatus(representation);
556}
557
558std::vector<RecoHitInformation*> RecoTrack::getRecoHitInformations(bool getSorted) const
559{
560 std::vector<RecoHitInformation*> hitList;
563
564 hitList.reserve(recoHitInformations.size());
565 for (auto& recoHit : recoHitInformations) {
566 hitList.push_back(&recoHit);
567 }
568
569 // sort the returned vector if requested
570 if (getSorted) {
571 std::sort(hitList.begin(), hitList.end(), [](const RecoHitInformation * a,
572 const RecoHitInformation * b) -> bool {
573 return a->getSortingParameter() < b->getSortingParameter();
574 });
575 }
576
577 return hitList;
578}
579
580const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneFromRecoHit(const RecoHitInformation* recoHitInfo,
581 const genfit::AbsTrackRep* representation) const
582{
584
585 if (!hasTrackFitStatus(representation)) {
586 B2FATAL("MeasuredStateOnPlane can not be retrieved for RecoTracks where no fit has been attempted.");
587 }
588
589 if (!recoHitInfo->useInFit()) {
590 B2FATAL("MeasuredStateOnPlane cannot be provided for RecoHit which was not used in the fit.");
591 }
592
593 const auto* hitTrackPoint = getCreatedTrackPoint(recoHitInfo);
594 if (not hitTrackPoint) {
595 B2FATAL("TrackPoint was requested which has not been created");
596 }
597
598 const auto* fittedResult = hitTrackPoint->getFitterInfo(representation);
599 if (not fittedResult) {
600 throw NoTrackFitResult();
601 }
602
603 return fittedResult->getFittedState();
604}
605
606const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneFromFirstHit(const genfit::AbsTrackRep* representation) const
607{
608 const unsigned int trackSize = m_genfitTrack.getNumPoints();
609 for (unsigned int i = 0; i < trackSize; i++) {
610 try {
611 return m_genfitTrack.getFittedState(i, representation);
612 } catch (const genfit::Exception& exception) {
613 B2DEBUG(28, "Can not get mSoP because of: " << exception.what());
614 }
615 }
616
617 B2FATAL("There is no single hit with a valid mSoP in this track! Check if the fit failed with wasFitSuccessful before");
618}
619
620const genfit::MeasuredStateOnPlane& RecoTrack::getMeasuredStateOnPlaneFromLastHit(const genfit::AbsTrackRep* representation) const
621{
622 int trackSize = m_genfitTrack.getNumPoints();
623 for (int i = -1; i >= -trackSize; i--) {
624 try {
625 return m_genfitTrack.getFittedState(i, representation);
626 } catch (const genfit::Exception& exception) {
627 B2DEBUG(28, "Can not get mSoP because of: " << exception.what());
628 }
629 }
630
631 B2FATAL("There is no single hit with a valid mSoP in this track!");
632}
633
635{
636 m_isArmTimeComputed = true;
637 const std::vector<RecoHitInformation*>& recoHits = getRecoHitInformations(true);
638 bool svdDone = false;
639 int nSVDHits = 0;
640 static RecoHitInformation::RecoHitDetector und = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector;
641 RecoHitInformation::RecoHitDetector SVD = RecoHitInformation::RecoHitDetector::c_SVD;
644 float clusterTimeSum = 0;
645 float clusterTimeSigma2Sum = 0;
646 bool trackArmTimeDone = false;
647
648 // loop over the recoHits of the RecoTrack
649 for (const auto& recoHit : recoHits) {
650 RecoHitInformation::RecoHitDetector foundin = recoHit->getTrackingDetector();
651 if (!svdDone && foundin != SVD) {
652 detIDpre = foundin;
653 trackArmTimeDone = false;
654 }
655 if (foundin == SVD) {
656 RelationVector<SVDCluster> svdClusters = recoHit->getRelationsTo<SVDCluster>(m_storeArrayNameOfSVDHits);
657 clusterTimeSum += svdClusters[0]->getClsTime();
658 clusterTimeSigma2Sum += svdClusters[0]->getClsTimeSigma() * svdClusters[0]->getClsTimeSigma();
659 nSVDHits += 1;
660 svdDone = true;
661 } else {
662 // Compute the track arm times using SVD cluster times
663 if (svdDone && nSVDHits > 1) {
664 detIDpost = foundin;
665 if (!isOutgoingArm(detIDpre, detIDpost)) {
666 m_ingoingArmTime = clusterTimeSum / nSVDHits;
667 m_ingoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
668 m_hasIngoingArmTime = true;
669 m_nSVDHitsOfIngoingArm = nSVDHits;
670 } else {
671 m_outgoingArmTime = clusterTimeSum / nSVDHits;
672 m_outgoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
674 m_nSVDHitsOfOutgoingArm = nSVDHits;
675 }
676 svdDone = false;
677 detIDpre = detIDpost;
678 detIDpost = und;
679 clusterTimeSum = 0;
680 nSVDHits = 0;
681 trackArmTimeDone = true;
682 }
683 }
684
685 // When the last recoHit is SVD, it does not enter in the else{} of if (detID == SVD) {...} else {...}
686 // where the track arm times are calculated, so they are calculated here.
687 // It will not reset all variables because it is run only at the last recoHit
688 if (!trackArmTimeDone && (recoHit == recoHits.back()) && nSVDHits > 1) {
689 if (!isOutgoingArm(detIDpre, detIDpost)) {
690 m_ingoingArmTime = clusterTimeSum / nSVDHits;
691 m_ingoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
692 m_hasIngoingArmTime = true;
693 m_nSVDHitsOfIngoingArm = nSVDHits;
694 } else {
695 m_outgoingArmTime = clusterTimeSum / nSVDHits;
696 m_outgoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
698 m_nSVDHitsOfOutgoingArm = nSVDHits;
699 }
700 }
701 }
702}
703
705{
706 static RecoHitInformation::RecoHitDetector und = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector;
707 RecoHitInformation::RecoHitDetector PXD = RecoHitInformation::RecoHitDetector::c_PXD;
708 RecoHitInformation::RecoHitDetector CDC = RecoHitInformation::RecoHitDetector::c_CDC;
709 bool isOutgoing = true;
710 if (pre == PXD && post == CDC) isOutgoing = true;
711 else if (pre == und && post == CDC) isOutgoing = true;
712 else if (pre == PXD && post == und) isOutgoing = true;
713 else if (pre == CDC && post == PXD) isOutgoing = false;
714 else if (pre == und && post == PXD) isOutgoing = false;
715 else if (pre == CDC && post == und) isOutgoing = false;
716 else {
717 //TO DO
718 B2DEBUG(29,
719 "SVD-only? PXD-SVD-PXD??? --- use layer information to determine if the track arm is outgoing or ingoing! Considered --> 'OUT'");
720 isOutgoing = true;
721 }
722 return isOutgoing;
723}
724
725void RecoTrack::flipTrackDirectionAndCharge(const genfit::AbsTrackRep* representation)
726{
727 const genfit::MeasuredStateOnPlane& measuredStateOnPlane = getMeasuredStateOnPlaneFromLastHit(representation);
728 const ROOT::Math::XYZVector& fittedPosition = ROOT::Math::XYZVector(measuredStateOnPlane.getPos());
729 const ROOT::Math::XYZVector& fittedMomentum = ROOT::Math::XYZVector(measuredStateOnPlane.getMom());
730 const double& fittedCharge = measuredStateOnPlane.getCharge();
731
732 // revert the charge and momentum
733 setChargeSeed(-fittedCharge);
734 setPositionAndMomentum(fittedPosition, -fittedMomentum);
736 swapArmTimes();
737 setDirtyFlag();
738}
739
740std::string RecoTrack::getInfoHTML() const
741{
742 std::stringstream out;
743
744 out << "<b>Charge seed</b>=" << getChargeSeed();
745
746 out << "<b>pT seed</b>=" << getMomentumSeed().Rho();
747 out << ", <b>pZ seed</b>=" << getMomentumSeed().Z();
748 out << "<br>";
749 out << "<b>position seed</b>=" << getMomentumSeed().X() << ", " << getMomentumSeed().Y() << ", " << getMomentumSeed().Z();
750 out << "<br>";
751
752 for (const genfit::AbsTrackRep* rep : getRepresentations()) {
753 out << "<b>was fitted with " << rep->getPDG() << "</b>=" << wasFitSuccessful() << ", ";
754 }
755 out << "<br>";
756
757 return out.str();
758}
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:234
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:405
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:400
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:410
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:595
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:764
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:636
const TMatrixDSym & getSeedCovariance() const
Return the covariance matrix of the seed. ATTENTION: This is not the fitted covariance.
Definition RecoTrack.h:609
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:463
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList() const
Return an unsorted list of pxd hits.
Definition RecoTrack.h:447
float m_ingoingArmTimeError
Error of the track time of the ingoing arm.
Definition RecoTrack.h:923
const std::string & getStoreArrayNameOfEKLMHits() const
Name of the store array of the eklm hits.
Definition RecoTrack.h:742
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
Definition RecoTrack.cc:337
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
Definition RecoTrack.h:450
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:588
std::string m_storeArrayNameOfCDCHits
Store array name of added CDC hits.
Definition RecoTrack.h:903
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:456
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
Definition RecoTrack.h:453
const std::string & getStoreArrayNameOfSVDHits() const
Name of the store array of the svd hits.
Definition RecoTrack.h:733
void estimateArmTime()
This function calculates the track time of the ingoing and outgoing arms and their difference.
Definition RecoTrack.cc:634
ROOT::Math::XYZVector getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
Definition RecoTrack.h:478
bool m_hasIngoingArmTime
Internal storage of the final ingoing arm time is set.
Definition RecoTrack.h:936
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:500
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:927
bool m_hasOutgoingArmTime
Internal storage of the final outgoing arm time is set.
Definition RecoTrack.h:938
const std::string & getStoreArrayNameOfPXDHits() const
Name of the store array of the pxd hits.
Definition RecoTrack.h:730
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:427
float m_outgoingArmTime
Track time of the outgoing arm.
Definition RecoTrack.h:917
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:720
std::string m_storeArrayNameOfBKLMHits
Store array name of added BKLM hits.
Definition RecoTrack.h:905
std::string getInfoHTML() const override
Get useful information on EventDisplay.
Definition RecoTrack.cc:740
void prune()
Prune the genfit track, e.g.
Definition RecoTrack.cc:376
short int m_charge
Storage for the charge. All other helix parameters are saved in the genfit::Track.
Definition RecoTrack.h:897
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:459
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:525
const std::string & getStoreArrayNameOfBKLMHits() const
Name of the store array of the bklm hits.
Definition RecoTrack.h:739
void setTimeSeed(const double timeSeed)
Set the time seed. ATTENTION: This is not the fitted time.
Definition RecoTrack.h:602
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:620
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition RecoTrack.h:612
const std::string & getStoreArrayNameOfRecoHitInformation() const
Name of the store array of the reco hit information.
Definition RecoTrack.h:745
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:544
int m_nSVDHitsOfIngoingArm
Number of SVD clusters of the ingoing arm.
Definition RecoTrack.h:929
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:530
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:511
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:558
bool m_isArmTimeComputed
true if the arms times are already computed, false otherwise
Definition RecoTrack.h:934
std::string m_storeArrayNameOfSVDHits
Store array name of added SVD hits.
Definition RecoTrack.h:901
const std::string & getStoreArrayNameOfCDCHits() const
Name of the store array of the cdc hits.
Definition RecoTrack.h:736
float m_ingoingArmTime
Track time of the ingoing arm.
Definition RecoTrack.h:921
static void registerRequiredRelations(const 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
void flipTrackDirectionAndCharge(const genfit::AbsTrackRep *representation=nullptr)
Flip the direction of the RecoTrack by inverting the momentum vector and the charge.
Definition RecoTrack.cc:725
void revertRecoHitInformationSorting()
Revert the sorting order of the RecoHitInformation.
Definition RecoTrack.h:748
void deleteFittedInformationForRepresentation(const genfit::AbsTrackRep *rep)
Delete all fitted information for the given representations.
Definition RecoTrack.cc:471
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition RecoTrack.h:506
float m_outgoingArmTimeError
Error of the track time of the outgoing arm.
Definition RecoTrack.h:919
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:606
ROOT::Math::XYZVector getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition RecoTrack.h:485
genfit::AbsTrackRep * getTrackRepresentationForPDG(int pdgCode) const
Return an already created track representation of the given reco track for the PDG.
Definition RecoTrack.cc:476
genfit::Track m_genfitTrack
Internal storage for the genfit track.
Definition RecoTrack.h:895
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:580
std::string m_storeArrayNameOfEKLMHits
Store array name of added EKLM hits.
Definition RecoTrack.h:907
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:899
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:1063
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:704
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:619
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:509
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:706
std::string m_storeArrayNameOfRecoHitInformation
Store array of added RecoHitInformation.
Definition RecoTrack.h:909
void swapArmTimes()
Swap arm times, booleans and nSVDHits.
Definition RecoTrack.h:1055
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
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:247
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:26
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.