Belle II Software  release-05-02-19
RecoTrack.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Heck, Nils Braun, Thomas Hauth *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/RelationsObject.h>
15 #include <framework/core/FrameworkExceptions.h>
16 
17 #include <genfit/Track.h>
18 
19 #include <tracking/dataobjects/RecoHitInformation.h>
20 
21 #include <boost/optional.hpp>
22 
23 #include <string>
24 #include <vector>
25 
26 namespace genfit {
27  class TrackCand;
28  class AbsTrackRep;
29 }
30 
31 namespace Belle2 {
37  class RecoTrackGenfitAccess;
38 
39  BELLE2_DEFINE_EXCEPTION(NoTrackFitResult, "No track fit result available for this hit (e.g. DAF has removed it).")
40 
41 
78  class RecoTrack : public RelationsObject {
80  friend class RecoTrackGenfitAccess;
81 
82  private:
99 
100  public:
105  c_undefined,
106  c_matched,
107  c_clone,
108  c_background,
109  c_ghost
110  };
111 
127  static void registerRequiredRelations(
128  StoreArray<RecoTrack>& recoTracks,
129  std::string const& pxdHitsStoreArrayName = "",
130  std::string const& svdHitsStoreArrayName = "",
131  std::string const& cdcHitsStoreArrayName = "",
132  std::string const& bklmHitsStoreArrayName = "",
133  std::string const& eklmHitsStoreArrayName = "",
134  std::string const& recoHitInformationStoreArrayName = "");
135 
137  RecoTrack() { }
138 
152  RecoTrack(const TVector3& seedPosition, const TVector3& seedMomentum, const short int seedCharge,
153  const std::string& storeArrayNameOfCDCHits = "",
154  const std::string& storeArrayNameOfSVDHits = "",
155  const std::string& storeArrayNameOfPXDHits = "",
156  const std::string& storeArrayNameOfBKLMHits = "",
157  const std::string& storeArrayNameOfEKLMHits = "",
158  const std::string& storeArrayNameOfRecoHitInformation = "");
159 
161  RecoTrack(const RecoTrack&) = delete;
163  RecoTrack& operator=(RecoTrack const&) = delete;
164 
180  static RecoTrack* createFromTrackCand(const genfit::TrackCand& trackCand,
181  const std::string& storeArrayNameOfRecoTracks = "",
182  const std::string& storeArrayNameOfCDCHits = "",
183  const std::string& storeArrayNameOfSVDHits = "",
184  const std::string& storeArrayNameOfPXDHits = "",
185  const std::string& storeArrayNameOfBKLMHits = "",
186  const std::string& storeArrayNameOfEKLMHits = "",
187  const std::string& storeArrayNameOfRecoHitInformation = "",
188  const bool recreateSortingParameters = false
189  );
190 
194  genfit::TrackCand createGenfitTrackCand() const;
195 
200  RecoTrack* copyToStoreArrayUsing(StoreArray<RecoTrack>& storeArray, const TVector3& position,
201  const TVector3& momentum, short charge,
202  const TMatrixDSym& covariance, double timeSeed) const;
203 
208  RecoTrack* copyToStoreArrayUsingSeeds(StoreArray<RecoTrack>& storeArray) const;
209 
215  RecoTrack* copyToStoreArray(StoreArray<RecoTrack>& storeArray) const;
216 
228  size_t addHitsFromRecoTrack(const RecoTrack* recoTrack, unsigned int sortingParameterOffset = 0,
229  bool reversed = false, boost::optional<double> optionalMinimalWeight = boost::none);
230 
240  bool addCDCHit(const UsedCDCHit* cdcHit, const unsigned int sortingParameter,
241  RightLeftInformation rightLeftInformation = RightLeftInformation::c_undefinedRightLeftInformation,
242  OriginTrackFinder foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder)
243  {
244  return addHit(cdcHit, rightLeftInformation, foundByTrackFinder, sortingParameter);
245  }
246 
255  bool addPXDHit(const UsedPXDHit* pxdHit, const unsigned int sortingParameter,
256  OriginTrackFinder foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder)
257  {
258  return addHit(pxdHit, foundByTrackFinder, sortingParameter);
259  }
260 
269  bool addSVDHit(const UsedSVDHit* svdHit, const unsigned int sortingParameter,
270  OriginTrackFinder foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder)
271  {
272  return addHit(svdHit, foundByTrackFinder, sortingParameter);
273  }
274 
283  bool addBKLMHit(const UsedBKLMHit* bklmHit, const unsigned int sortingParameter,
284  OriginTrackFinder foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder)
285  {
286  return addHit(bklmHit, foundByTrackFinder, sortingParameter);
287  }
288 
297  bool addEKLMHit(const UsedEKLMHit* eklmHit, const unsigned int sortingParameter,
298  OriginTrackFinder foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder)
299  {
300  return addHit(eklmHit, foundByTrackFinder, sortingParameter);
301  }
302 
308  template<class HitType>
310  {
311  RelationVector<RecoHitInformation> relatedHitInformationToHit = hit->template getRelationsFrom<RecoHitInformation>
312  (m_storeArrayNameOfRecoHitInformation);
313 
314  for (RecoHitInformation& recoHitInformation : relatedHitInformationToHit) {
315  // cppcheck-suppress useStlAlgorithm
316  if (recoHitInformation.getRelatedFrom<RecoTrack>(this->getArrayName()) == this) {
317  return &recoHitInformation;
318  }
319  }
320 
321  return nullptr;
322  }
323 
324  // Hits Information Questioning
326  template <class HitType>
327  TrackingDetector getTrackingDetector(const HitType* hit) const
328  {
329  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
330  return recoHitInformation->getTrackingDetector();
331  }
332 
334  template <class HitType>
336  {
337  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
338  return recoHitInformation->getRightLeftInformation();
339  }
340 
342  template <class HitType>
343  OriginTrackFinder getFoundByTrackFinder(const HitType* hit) const
344  {
345  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
346  return recoHitInformation->getFoundByTrackFinder();
347  }
348 
350  template <class HitType>
351  unsigned int getSortingParameter(const HitType* hit) const
352  {
353  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
354  return recoHitInformation->getSortingParameter();
355  }
356 
358  template <class HitType>
359  void setRightLeftInformation(const HitType* hit, RightLeftInformation rightLeftInformation)
360  {
361  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
362  recoHitInformation->setRightLeftInformation(rightLeftInformation);
363  setDirtyFlag();
364  }
365 
367  template <class HitType>
368  void setFoundByTrackFinder(const HitType* hit, OriginTrackFinder originTrackFinder)
369  {
370  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
371  recoHitInformation->setFoundByTrackFinder(originTrackFinder);
372  }
373 
375  template <class HitType>
376  void setSortingParameter(const HitType* hit, unsigned int sortingParameter)
377  {
378  RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
379  recoHitInformation->setSortingParameter(sortingParameter);
380  setDirtyFlag();
381  }
382 
387  const genfit::TrackPoint* getCreatedTrackPoint(const RecoHitInformation* recoHitInformation) const;
388 
389  // Hits Added Questioning
391  bool hasCDCHits() const { return getRelatedFrom<UsedCDCHit>(m_storeArrayNameOfCDCHits) != nullptr; }
392 
394  bool hasSVDHits() const { return getRelatedFrom<UsedSVDHit>(m_storeArrayNameOfSVDHits) != nullptr; }
395 
397  bool hasPXDHits() const { return getRelatedFrom<UsedPXDHit>(m_storeArrayNameOfPXDHits) != nullptr; }
398 
400  bool hasBKLMHits() const { return getRelatedFrom<UsedBKLMHit>(m_storeArrayNameOfBKLMHits) != nullptr; }
401 
403  bool hasEKLMHits() const { return getRelatedFrom<UsedEKLMHit>(m_storeArrayNameOfEKLMHits) != nullptr; }
404 
406  template <class HitType>
407  bool hasHit(const HitType* hit) const
408  {
409  const RelationVector<RecoTrack>& relatedTracksToHit = hit->template getRelationsTo<RecoTrack>(getArrayName());
410  return std::find_if(relatedTracksToHit.begin(), relatedTracksToHit.end(), [this](const RecoTrack & recoTrack) {
411  return &recoTrack == this;
412  }) != relatedTracksToHit.end();
413  }
414 
415  // Hits Questioning
417  unsigned int getNumberOfCDCHits() const { return getNumberOfHitsOfGivenType<UsedCDCHit>(m_storeArrayNameOfCDCHits); }
418 
420  unsigned int getNumberOfSVDHits() const { return getNumberOfHitsOfGivenType<UsedSVDHit>(m_storeArrayNameOfSVDHits); }
421 
423  unsigned int getNumberOfPXDHits() const { return getNumberOfHitsOfGivenType<UsedPXDHit>(m_storeArrayNameOfPXDHits); }
424 
426  unsigned int getNumberOfBKLMHits() const { return getNumberOfHitsOfGivenType<UsedBKLMHit>(m_storeArrayNameOfBKLMHits); }
427 
429  unsigned int getNumberOfEKLMHits() const { return getNumberOfHitsOfGivenType<UsedEKLMHit>(m_storeArrayNameOfEKLMHits); }
430 
432  unsigned int getNumberOfTotalHits() const
433  {
434  return getNumberOfCDCHits() + getNumberOfPXDHits() +
435  getNumberOfSVDHits() + getNumberOfBKLMHits() + getNumberOfEKLMHits();
436  }
437 
439  unsigned int getNumberOfTrackingHits() const
440  {
441  return getNumberOfCDCHits() + getNumberOfPXDHits() +
442  getNumberOfSVDHits();
443  }
444 
446  std::vector<Belle2::RecoTrack::UsedCDCHit*> getCDCHitList() const { return getHitList<UsedCDCHit>(m_storeArrayNameOfCDCHits); }
447 
449  std::vector<Belle2::RecoTrack::UsedSVDHit*> getSVDHitList() const { return getHitList<UsedSVDHit>(m_storeArrayNameOfSVDHits); }
450 
452  std::vector<Belle2::RecoTrack::UsedPXDHit*> getPXDHitList() const { return getHitList<UsedPXDHit>(m_storeArrayNameOfPXDHits); }
453 
455  std::vector<Belle2::RecoTrack::UsedBKLMHit*> getBKLMHitList() const { return getHitList<UsedBKLMHit>(m_storeArrayNameOfBKLMHits); }
456 
458  std::vector<Belle2::RecoTrack::UsedEKLMHit*> getEKLMHitList() const { return getHitList<UsedEKLMHit>(m_storeArrayNameOfEKLMHits); }
459 
461  std::vector<Belle2::RecoTrack::UsedCDCHit*> getSortedCDCHitList() const { return getSortedHitList<UsedCDCHit>(m_storeArrayNameOfCDCHits); }
462 
464  std::vector<Belle2::RecoTrack::UsedSVDHit*> getSortedSVDHitList() const { return getSortedHitList<UsedSVDHit>(m_storeArrayNameOfSVDHits); }
465 
467  std::vector<Belle2::RecoTrack::UsedPXDHit*> getSortedPXDHitList() const { return getSortedHitList<UsedPXDHit>(m_storeArrayNameOfPXDHits); }
468 
470  std::vector<Belle2::RecoTrack::UsedBKLMHit*> getSortedBKLMHitList() const { return getSortedHitList<UsedBKLMHit>(m_storeArrayNameOfBKLMHits); }
471 
473  std::vector<Belle2::RecoTrack::UsedEKLMHit*> getSortedEKLMHitList() const { return getSortedHitList<UsedEKLMHit>(m_storeArrayNameOfEKLMHits); }
474 
475  // Seed Helix Functionality
477  TVector3 getPositionSeed() const
478  {
479  const TVectorD& seed = m_genfitTrack.getStateSeed();
480  return TVector3(seed(0), seed(1), seed(2));
481  }
482 
484  TVector3 getMomentumSeed() const
485  {
486  const TVectorD& seed = m_genfitTrack.getStateSeed();
487  return TVector3(seed(3), seed(4), seed(5));
488  }
489 
491  const TVectorD& getStateSeed() const
492  {
493  return m_genfitTrack.getStateSeed();
494  }
495 
497  short int getChargeSeed() const { return m_charge; }
498 
500  double getTimeSeed() const { return m_genfitTrack.getTimeSeed(); }
501 
503  std::tuple<TVector3, TVector3, short> extractTrackState() const;
504 
506  void setPositionAndMomentum(const TVector3& positionSeed, const TVector3& momentumSeed)
507  {
508  m_genfitTrack.setStateSeed(positionSeed, momentumSeed);
509  deleteFittedInformation();
510  }
511 
513  void setChargeSeed(const short int chargeSeed)
514  {
515  m_charge = chargeSeed;
516  deleteFittedInformation();
517  }
518 
520  void setTimeSeed(const double timeSeed)
521  {
522  m_genfitTrack.setTimeSeed(timeSeed);
523  deleteFittedInformation();
524  }
525 
527  const TMatrixDSym& getSeedCovariance() const { return m_genfitTrack.getCovSeed(); }
528 
530  void setSeedCovariance(const TMatrixDSym& seedCovariance) { m_genfitTrack.setCovSeed(seedCovariance); }
531 
532  // Fitting
534  bool wasFitSuccessful(const genfit::AbsTrackRep* representation = nullptr) const;
535 
537  const genfit::FitStatus* getTrackFitStatus(const genfit::AbsTrackRep* representation = nullptr) const
538  {
539  checkDirtyFlag();
540  return m_genfitTrack.getFitStatus(representation);
541  }
542 
544  bool hasTrackFitStatus(const genfit::AbsTrackRep* representation = nullptr) const;
545 
548  {
549  checkDirtyFlag();
550  return m_genfitTrack.getCardinalRep();
551  }
552 
554  const std::vector<genfit::AbsTrackRep*>& getRepresentations() const
555  {
556  checkDirtyFlag();
557  return m_genfitTrack.getTrackReps();
558  }
559 
566  genfit::AbsTrackRep* getTrackRepresentationForPDG(int pdgCode);
567 
574  std::vector<RecoHitInformation*> getRecoHitInformations(bool getSorted = false) const;
575 
580  const genfit::MeasuredStateOnPlane& getMeasuredStateOnPlaneFromFirstHit(const genfit::AbsTrackRep* representation = nullptr) const;
581 
586  const genfit::MeasuredStateOnPlane& getMeasuredStateOnPlaneFromLastHit(const genfit::AbsTrackRep* representation = nullptr) const;
587 
592  const genfit::MeasuredStateOnPlane& getMeasuredStateOnPlaneFromRecoHit(const RecoHitInformation* recoHitInfo,
593  const genfit::AbsTrackRep* representation = nullptr) const;
594 
598  const genfit::MeasuredStateOnPlane& getMeasuredStateOnPlaneClosestTo(const TVector3& closestPoint,
599  const genfit::AbsTrackRep* representation = nullptr);
600 
604  void prune();
605 
607  const std::vector<genfit::TrackPoint*>& getHitPointsWithMeasurement() const
608  {
609  checkDirtyFlag();
610  return m_genfitTrack.getPointsWithMeasurement();
611  }
612 
614  bool getDirtyFlag() const { return m_dirtyFlag; }
615 
617 
621  void setDirtyFlag(const bool& dirtyFlag = true)
622  {
623  m_dirtyFlag = dirtyFlag;
624  if (dirtyFlag) {
625  deleteFittedInformation();
626  }
627  }
628 
629  // Store Array Names
631  const std::string& getStoreArrayNameOfCDCHits() const { return m_storeArrayNameOfCDCHits; }
632 
634  const std::string& getStoreArrayNameOfSVDHits() const { return m_storeArrayNameOfSVDHits; }
635 
637  const std::string& getStoreArrayNameOfPXDHits() const { return m_storeArrayNameOfPXDHits; }
638 
640  const std::string& getStoreArrayNameOfBKLMHits() const { return m_storeArrayNameOfBKLMHits; }
641 
643  const std::string& getStoreArrayNameOfEKLMHits() const { return m_storeArrayNameOfEKLMHits; }
644 
646  const std::string& getStoreArrayNameOfRecoHitInformation() const { return m_storeArrayNameOfRecoHitInformation; }
647 
654  template<class HitType>
655  void mapOnHits(const std::string& storeArrayNameOfHits,
656  std::function<void(RecoHitInformation&, HitType*)> const& mapFunction,
657  std::function<bool(const RecoHitInformation&, const HitType*)> const& pickFunction)
658  {
659  RelationVector<RecoHitInformation> relatedHitInformation = getRelationsTo<RecoHitInformation>
660  (m_storeArrayNameOfRecoHitInformation);
661 
662  for (RecoHitInformation& hitInformation : relatedHitInformation) {
663  HitType* const hit = hitInformation.getRelatedTo<HitType>(storeArrayNameOfHits);
664  if (hit != nullptr && pickFunction(hitInformation, hit)) {
665  mapFunction(hitInformation, hit);
666  }
667  }
668  }
669 
676  template<class HitType>
677  void mapOnHits(const std::string& storeArrayNameOfHits,
678  std::function<void(const RecoHitInformation&, const HitType*)> const& mapFunction,
679  std::function<bool(const RecoHitInformation&, const HitType*)> const& pickFunction) const
680  {
681  RelationVector<RecoHitInformation> relatedHitInformation = getRelationsTo<RecoHitInformation>
682  (m_storeArrayNameOfRecoHitInformation);
683 
684  for (const RecoHitInformation& hitInformation : relatedHitInformation) {
685  const HitType* const hit = hitInformation.getRelatedTo<HitType>(storeArrayNameOfHits);
686  if (hit != nullptr && pickFunction(hitInformation, hit)) {
687  mapFunction(hitInformation, hit);
688  }
689  }
690  }
691 
697  template<class HitType>
698  void mapOnHits(const std::string& storeArrayNameOfHits,
699  std::function<void(RecoHitInformation&, HitType*)> const& mapFunction)
700  {
701  mapOnHits<HitType>(storeArrayNameOfHits, mapFunction, [](const RecoHitInformation&, const HitType*) -> bool { return true; });
702  }
703 
709  template<class HitType>
710  void mapOnHits(const std::string& storeArrayNameOfHits,
711  std::function<void(const RecoHitInformation&, const HitType*)> const& mapFunction) const
712  {
713  mapOnHits<HitType>(storeArrayNameOfHits, mapFunction, [](const RecoHitInformation&, const HitType*) -> bool { return true; });
714  }
715 
716  // Matching status
719  {
720  return m_matchingStatus;
721  }
722 
724  void setMatchingStatus(MatchingStatus matchingStatus)
725  {
726  m_matchingStatus = matchingStatus;
727  }
728 
730  float getQualityIndicator() const
731  {
732  return m_qualityIndicator;
733  }
734 
736  void setQualityIndicator(const float qualityIndicator)
737  {
738  m_qualityIndicator = qualityIndicator;
739  }
740 
748  void deleteFittedInformation();
749 
757  void deleteFittedInformationForRepresentation(const genfit::AbsTrackRep* rep);
758 
760  virtual std::string getInfoHTML() const;
761 
762  private:
766  short int m_charge = 1;
768  std::string m_storeArrayNameOfCDCHits = "";
770  std::string m_storeArrayNameOfSVDHits = "";
772  std::string m_storeArrayNameOfPXDHits = "";
774  std::string m_storeArrayNameOfBKLMHits = "";
776  std::string m_storeArrayNameOfEKLMHits = "";
778  std::string m_storeArrayNameOfRecoHitInformation = "";
781  bool m_dirtyFlag = true;
783  MatchingStatus m_matchingStatus = MatchingStatus::c_undefined;
785  float m_qualityIndicator = NAN;
786 
793  template<class HitType, class ...Args>
794  bool addHit(const HitType* hit, Args&& ... params)
795  {
796  if (hasHit(hit)) {
797  return false;
798  }
799 
800  StoreArray<RecoHitInformation> recoHitInformations(m_storeArrayNameOfRecoHitInformation);
801  RecoHitInformation* newRecoHitInformation = recoHitInformations.appendNew(hit, params...);
802 
803  addHitWithHitInformation(hit, newRecoHitInformation);
804 
805  return true;
806  }
807 
813  template <class HitType>
814  void addHitWithHitInformation(const HitType* hit, RecoHitInformation* recoHitInformation)
815  {
816  hit->addRelationTo(this);
817  addRelationTo(recoHitInformation);
818 
819  setDirtyFlag();
820  }
821 
823  template <class HitType>
825  {
826  RecoHitInformation* recoHitInformation = getRecoHitInformation(hit);
827  if (recoHitInformation == nullptr) {
828  B2FATAL("Queried hit is not in the reco track! Did you prune it?");
829  } else {
830  return recoHitInformation;
831  }
832  }
833 
838  template <class HitType>
839  unsigned int getNumberOfHitsOfGivenType(const std::string& storeArrayNameOfHits) const
840  {
841  return getRelationsFrom<HitType>(storeArrayNameOfHits).size();
842  }
843 
848  template<class HitType>
849  std::vector<HitType*> getSortedHitList(const std::string& storeArrayNameOfHits) const
850  {
851  const RelationVector<RecoHitInformation>& relatedHitInformation = getRelationsTo<RecoHitInformation>
852  (m_storeArrayNameOfRecoHitInformation);
853 
854  std::vector<const RecoHitInformation*> relatedHitInformationAsVector;
855  relatedHitInformationAsVector.reserve(relatedHitInformation.size());
856  for (const RecoHitInformation& hitInformation : relatedHitInformation) {
857  // cppcheck-suppress useStlAlgorithm
858  relatedHitInformationAsVector.push_back(&hitInformation);
859  }
860  std::sort(relatedHitInformationAsVector.begin(), relatedHitInformationAsVector.end(), [](const RecoHitInformation * a,
861  const RecoHitInformation * b) -> bool {
862  return a->getSortingParameter() < b->getSortingParameter();
863  });
864 
865  std::vector<HitType*> hitList;
866  hitList.reserve(relatedHitInformationAsVector.size());
867  for (const RecoHitInformation* hitInformation : relatedHitInformationAsVector) {
868  HitType* relatedHit = hitInformation->getRelatedTo<HitType>(storeArrayNameOfHits);
869  if (relatedHit != nullptr) {
870  hitList.push_back(relatedHit);
871  }
872  }
873 
874  return hitList;
875  }
876 
881  template<class HitType>
882  std::vector<HitType*> getHitList(const std::string& storeArrayNameOfHits) const
883  {
884  RelationVector<HitType> relatedHits = getRelationsFrom<HitType>(storeArrayNameOfHits);
885  std::vector<HitType*> hitList;
886  hitList.reserve(relatedHits.size());
887  for (HitType& hit : relatedHits) {
888  // cppcheck-suppress useStlAlgorithm
889  hitList.push_back(&hit);
890  }
891 
892  return hitList;
893  }
894 
896  void checkDirtyFlag() const
897  {
898  if (m_dirtyFlag) {
899  B2DEBUG(100, "Dirty flag is set. The result may not be in sync with the latest changes. Refit the track to be sure.");
900  }
901  }
902 
904  ClassDef(RecoTrack, 9);
905  };
906 
915  public:
922  static genfit::Track& getGenfitTrack(RecoTrack& recoTrack);
923 
938  static genfit::AbsTrackRep* createOrReturnRKTrackRep(RecoTrack& recoTrack, int PDGcode);
939  };
940 
942 }
Belle2::RecoTrack::getNumberOfPXDHits
unsigned int getNumberOfPXDHits() const
Return the number of pxd hits.
Definition: RecoTrack.h:423
Belle2::RelationVector::size
size_t size() const
Get number of relations.
Definition: RelationVector.h:98
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
genfit::TrackPoint
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition: TrackPoint.h:46
Belle2::RecoTrack::setChargeSeed
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:513
Belle2::RecoTrack::getSortedEKLMHitList
std::vector< Belle2::RecoTrack::UsedEKLMHit * > getSortedEKLMHitList() const
Return a sorted list of eklm hits. Sorted by the sortingParameter.
Definition: RecoTrack.h:473
Belle2::RecoTrack::getTrackFitStatus
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:537
Belle2::RecoTrack::getNumberOfBKLMHits
unsigned int getNumberOfBKLMHits() const
Return the number of bklm hits.
Definition: RecoTrack.h:426
Belle2::RecoTrack::UsedEKLMHit
RecoHitInformation::UsedEKLMHit UsedEKLMHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:98
Belle2::RecoTrack::getQualityIndicator
float getQualityIndicator() const
Get the quality index attached to this RecoTrack given by one of the reconstruction algorithms....
Definition: RecoTrack.h:730
Belle2::RecoTrack::setTimeSeed
void setTimeSeed(const double timeSeed)
Set the time seed. ATTENTION: This is not the fitted time.
Definition: RecoTrack.h:520
Belle2::RecoTrack::getCardinalRepresentation
genfit::AbsTrackRep * getCardinalRepresentation() const
Get a pointer to the cardinal track representation. You are not allowed to modify or delete it!
Definition: RecoTrack.h:547
Belle2::RecoHitInformation::getTrackingDetector
RecoHitDetector getTrackingDetector() const
Get the detector this hit comes from.
Definition: RecoHitInformation.h:248
Belle2::RecoTrack::getSortedPXDHitList
std::vector< Belle2::RecoTrack::UsedPXDHit * > getSortedPXDHitList() const
Return a sorted list of pxd hits. Sorted by the sortingParameter.
Definition: RecoTrack.h:467
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
genfit::TrackCand
Track candidate – seed values and indices.
Definition: TrackCand.h:69
Belle2::RecoTrackGenfitAccess::getGenfitTrack
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Definition: RecoTrack.cc:389
Belle2::RecoTrack::setSeedCovariance
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition: RecoTrack.h:530
Belle2::RecoTrack::getSortedHitList
std::vector< HitType * > getSortedHitList(const std::string &storeArrayNameOfHits) const
Return a sorted list of hits of the given type in the store array that are related to this track.
Definition: RecoTrack.h:849
Belle2::RecoTrack::getSVDHitList
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
Definition: RecoTrack.h:449
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::RecoTrack::getCDCHitList
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
Definition: RecoTrack.h:446
Belle2::RecoTrack::mapOnHits
void mapOnHits(const std::string &storeArrayNameOfHits, std::function< void(const RecoHitInformation &, const HitType *)> const &mapFunction) const
Call a function on all hits of the given type in the store array, that are related to this track.
Definition: RecoTrack.h:710
Belle2::RecoTrack::getNumberOfSVDHits
unsigned int getNumberOfSVDHits() const
Return the number of svd hits.
Definition: RecoTrack.h:420
Belle2::RecoTrack::setDirtyFlag
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:621
Belle2::RecoHitInformation::getRightLeftInformation
RightLeftInformation getRightLeftInformation() const
Get the right-left-information.
Definition: RecoHitInformation.h:236
Belle2::RecoTrack::setFoundByTrackFinder
void setFoundByTrackFinder(const HitType *hit, OriginTrackFinder originTrackFinder)
Set the found by track finder flag or throws an exception of the hit is not related to the track.
Definition: RecoTrack.h:368
genfit
Defines for I/O streams used for error and debug printing.
Definition: AlignablePXDRecoHit.h:19
genfit::Track
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
Belle2::RecoTrack::getSortingParameter
unsigned int getSortingParameter(const HitType *hit) const
Return the sorting parameter for a given hit (every type) or throws an exception of the hit is not re...
Definition: RecoTrack.h:351
Belle2::RecoTrack::getBKLMHitList
std::vector< Belle2::RecoTrack::UsedBKLMHit * > getBKLMHitList() const
Return an unsorted list of bklm hits.
Definition: RecoTrack.h:455
Belle2::RecoTrack::UsedBKLMHit
RecoHitInformation::UsedBKLMHit UsedBKLMHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:96
genfit::AbsTrackRep
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Belle2::RecoTrack::hasSVDHits
bool hasSVDHits() const
Returns true if the track has svd hits.
Definition: RecoTrack.h:394
Belle2::RecoTrack::OriginTrackFinder
RecoHitInformation::OriginTrackFinder OriginTrackFinder
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:88
Belle2::RecoTrack::setQualityIndicator
void setQualityIndicator(const float qualityIndicator)
Set the quality index attached to this RecoTrack. 0 means likely fake.
Definition: RecoTrack.h:736
Belle2::RecoTrack::getStoreArrayNameOfPXDHits
const std::string & getStoreArrayNameOfPXDHits() const
Name of the store array of the pxd hits.
Definition: RecoTrack.h:637
Belle2::RecoTrack::setSortingParameter
void setSortingParameter(const HitType *hit, unsigned int sortingParameter)
Set the sorting parameter or throws an exception of the hit is not related to the track....
Definition: RecoTrack.h:376
Belle2::RecoTrack::getRepresentations
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:554
Belle2::RecoTrack::getNumberOfHitsOfGivenType
unsigned int getNumberOfHitsOfGivenType(const std::string &storeArrayNameOfHits) const
Get the number of hits for the given hit type in the store array that are related to this track.
Definition: RecoTrack.h:839
Belle2::RecoTrack::getMatchingStatus
MatchingStatus getMatchingStatus() const
Return the matching status set by the TrackMatcher module.
Definition: RecoTrack.h:718
Belle2::EKLMAlignmentHit
This dataobject is used only for EKLM alignment.
Definition: EKLMAlignmentHit.h:39
Belle2::RecoTrack::UsedCDCHit
RecoHitInformation::UsedCDCHit UsedCDCHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:90
Belle2::RecoTrack::getNumberOfTrackingHits
unsigned int getNumberOfTrackingHits() const
Return the number of cdc + svd + pxd hits.
Definition: RecoTrack.h:439
Belle2::RecoTrack::UsedPXDHit
RecoHitInformation::UsedPXDHit UsedPXDHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:94
Belle2::RecoTrack::m_genfitTrack
genfit::Track m_genfitTrack
Internal storage for the genfit track.
Definition: RecoTrack.h:764
Belle2::RecoTrack::getSortedBKLMHitList
std::vector< Belle2::RecoTrack::UsedBKLMHit * > getSortedBKLMHitList() const
Return a sorted list of bklm hits. Sorted by the sortingParameter.
Definition: RecoTrack.h:470
Belle2::RecoTrack::RecoTrack
RecoTrack()
Empty constructor for ROOT. Do not use!
Definition: RecoTrack.h:137
Belle2::RecoTrack::addCDCHit
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:240
Belle2::RecoTrack::getHitPointsWithMeasurement
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:607
Belle2::RecoTrack::getTrackingDetector
TrackingDetector getTrackingDetector(const HitType *hit) const
Return the tracking detector of a given hit (every type) or throws an exception of the hit is not rel...
Definition: RecoTrack.h:327
Belle2::RecoTrack::UsedSVDHit
RecoHitInformation::UsedSVDHit UsedSVDHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:92
Belle2::RecoHitInformation::OriginTrackFinder
OriginTrackFinder
The TrackFinder which has added the hit to the track.
Definition: RecoHitInformation.h:80
Belle2::RecoTrack::addEKLMHit
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:297
Belle2::RecoTrack::hasHit
bool hasHit(const HitType *hit) const
Returns true if the given hit is in the track.
Definition: RecoTrack.h:407
Belle2::RecoTrack::getTimeSeed
double getTimeSeed() const
Return the time seed stored in the reco track. ATTENTION: This is not the fitted time.
Definition: RecoTrack.h:500
Belle2::RecoHitInformation::RecoHitDetector
RecoHitDetector
The detector this hit comes from (which is of course also visible in the hit type)
Definition: RecoHitInformation.h:118
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::RecoHitInformation::setSortingParameter
void setSortingParameter(unsigned int sortingParameter)
Set the sorting parameter.
Definition: RecoHitInformation.h:230
Belle2::RecoTrackGenfitAccess
This class allows access to the genfit::Track of the RecoTrack.
Definition: RecoTrack.h:914
Belle2::RecoTrack::getPositionSeed
TVector3 getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
Definition: RecoTrack.h:477
Belle2::RelationVector
Class for type safe access to objects that are referred to in relations.
Definition: DataStore.h:38
Belle2::RecoTrack::getStoreArrayNameOfCDCHits
const std::string & getStoreArrayNameOfCDCHits() const
Name of the store array of the cdc hits.
Definition: RecoTrack.h:631
Belle2::RecoTrack::hasEKLMHits
bool hasEKLMHits() const
Returns true if the track has eklm hits.
Definition: RecoTrack.h:403
Belle2::RelationVector::begin
iterator begin()
Return iterator to first entry.
Definition: RelationVector.h:151
Belle2::RecoTrack::mapOnHits
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:655
Belle2::RecoTrack::mapOnHits
void mapOnHits(const std::string &storeArrayNameOfHits, std::function< void(RecoHitInformation &, HitType *)> const &mapFunction)
Call a function on all hits of the given type in the store array, that are related to this track.
Definition: RecoTrack.h:698
Belle2::RecoTrack::getRecoHitInformation
RecoHitInformation * getRecoHitInformation(HitType *hit) const
Return the reco hit information for a generic hit from the storeArray.
Definition: RecoTrack.h:309
Belle2::RecoTrack::addSVDHit
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:269
Belle2::RecoTrack::getSortedSVDHitList
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSortedSVDHitList() const
Return a sorted list of svd hits. Sorted by the sortingParameter.
Definition: RecoTrack.h:464
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RecoHitInformation::setFoundByTrackFinder
void setFoundByTrackFinder(OriginTrackFinder foundByTrackFinder)
Set which track finder has found the track.
Definition: RecoHitInformation.h:218
Belle2::RecoHitInformation::setRightLeftInformation
void setRightLeftInformation(RightLeftInformation rightLeftInformation)
Set the right-left-information.
Definition: RecoHitInformation.h:242
Belle2::RecoTrack::setMatchingStatus
void setMatchingStatus(MatchingStatus matchingStatus)
Set the matching status (used by the TrackMatcher module)
Definition: RecoTrack.h:724
Belle2::RecoTrack::addBKLMHit
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:283
Belle2::RecoTrack::addHit
bool addHit(const HitType *hit, Args &&... params)
Add a generic hit with the given parameters for the reco hit information.
Definition: RecoTrack.h:794
Belle2::RecoTrack::getSortedCDCHitList
std::vector< Belle2::RecoTrack::UsedCDCHit * > getSortedCDCHitList() const
Return a sorted list of cdc hits. Sorted by the sortingParameter.
Definition: RecoTrack.h:461
Belle2::RecoTrack::hasCDCHits
bool hasCDCHits() const
Returns true if the track has cdc hits.
Definition: RecoTrack.h:391
Belle2::RecoTrack::addHitWithHitInformation
void addHitWithHitInformation(const HitType *hit, RecoHitInformation *recoHitInformation)
Add the needed relations for adding a generic hit with the given hit information.
Definition: RecoTrack.h:814
Belle2::RecoTrack::TrackingDetector
RecoHitInformation::RecoHitDetector TrackingDetector
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:86
Belle2::RecoHitInformation
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
Definition: RecoHitInformation.h:48
Belle2::PXDCluster
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:41
Belle2::RecoTrackGenfitAccess::createOrReturnRKTrackRep
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:394
Belle2::RecoTrack::getNumberOfCDCHits
unsigned int getNumberOfCDCHits() const
Return the number of cdc hits.
Definition: RecoTrack.h:417
Belle2::SVDCluster
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:38
Belle2::RecoTrack::getMomentumSeed
TVector3 getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition: RecoTrack.h:484
Belle2::RecoTrack::getEKLMHitList
std::vector< Belle2::RecoTrack::UsedEKLMHit * > getEKLMHitList() const
Return an unsorted list of eklm hits.
Definition: RecoTrack.h:458
Belle2::RecoTrack::RightLeftInformation
RecoHitInformation::RightLeftInformation RightLeftInformation
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:84
Belle2::RecoTrack::getNumberOfTotalHits
unsigned int getNumberOfTotalHits() const
Return the number of cdc + svd + pxd + bklm + eklm hits.
Definition: RecoTrack.h:432
Belle2::RecoHitInformation::getSortingParameter
unsigned int getSortingParameter() const
Get the sorting parameter.
Definition: RecoHitInformation.h:224
Belle2::RecoTrack::getHitList
std::vector< HitType * > getHitList(const std::string &storeArrayNameOfHits) const
Return an unsorted list of hits of the given type in the store array that are related to this track.
Definition: RecoTrack.h:882
Belle2::RecoTrack::getDirtyFlag
bool getDirtyFlag() const
This returns true, if a hit was added after the last fit and measurement creation and a refit should ...
Definition: RecoTrack.h:614
Belle2::RecoTrack::getRecoHitInformationSafely
RecoHitInformation * getRecoHitInformationSafely(HitType *hit) const
Returns the reco hit information for a given hit or throws an exception if the hit is not related to ...
Definition: RecoTrack.h:824
Belle2::RelationVector::end
iterator end()
Return iterator to last entry +1.
Definition: RelationVector.h:153
Belle2::RecoTrack::getChargeSeed
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition: RecoTrack.h:497
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::RecoTrack::hasPXDHits
bool hasPXDHits() const
Returns true if the track has pxd hits.
Definition: RecoTrack.h:397
BELLE2_DEFINE_EXCEPTION
#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
Macro that defines an exception with the given message template.
Definition: FrameworkExceptions.h:46
Belle2::RecoTrack::getStoreArrayNameOfRecoHitInformation
const std::string & getStoreArrayNameOfRecoHitInformation() const
Name of the store array of the reco hit informations.
Definition: RecoTrack.h:646
Belle2::RecoTrack::getNumberOfEKLMHits
unsigned int getNumberOfEKLMHits() const
Return the number of eklm hits.
Definition: RecoTrack.h:429
Belle2::RecoTrack::getStoreArrayNameOfEKLMHits
const std::string & getStoreArrayNameOfEKLMHits() const
Name of the store array of the eklm hits.
Definition: RecoTrack.h:643
Belle2::RecoTrack::setPositionAndMomentum
void setPositionAndMomentum(const TVector3 &positionSeed, const TVector3 &momentumSeed)
Set the position and momentum seed of the reco track. ATTENTION: This is not the fitted position or m...
Definition: RecoTrack.h:506
Belle2::RecoHitInformation::RightLeftInformation
RightLeftInformation
The RightLeft information of the hit which is only valid for CDC hits.
Definition: RecoHitInformation.h:72
genfit::FitStatus
Class where important numbers and properties of a fit can be stored.
Definition: FitStatus.h:80
Belle2::RecoTrack::mapOnHits
void mapOnHits(const std::string &storeArrayNameOfHits, std::function< void(const RecoHitInformation &, const HitType *)> const &mapFunction, std::function< bool(const RecoHitInformation &, const HitType *)> const &pickFunction) const
Call a function on all hits of the given type in the store array, that are related to this track.
Definition: RecoTrack.h:677
Belle2::RecoHitInformation::getFoundByTrackFinder
OriginTrackFinder getFoundByTrackFinder() const
Get which track finder has found the track.
Definition: RecoHitInformation.h:212
Belle2::RecoTrack::MatchingStatus
MatchingStatus
Enum for the matching status of this reco track (set by the matching modules in the tracking package)...
Definition: RecoTrack.h:104
Belle2::RelationsInterface
Defines interface for accessing relations of objects in StoreArray.
Definition: RelationsObject.h:102
Belle2::BKLMHit2d
Store one BKLM strip hit as a ROOT object.
Definition: BKLMHit2d.h:42
Belle2::RecoTrack::addPXDHit
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:255
Belle2::RecoTrack::checkDirtyFlag
void checkDirtyFlag() const
Helper: Check the dirty flag and produce a warning, whenever a fit result is accessed.
Definition: RecoTrack.h:896
Belle2::RecoTrack::getStoreArrayNameOfBKLMHits
const std::string & getStoreArrayNameOfBKLMHits() const
Name of the store array of the bklm hits.
Definition: RecoTrack.h:640
Belle2::RecoTrack::getStateSeed
const TVectorD & getStateSeed() const
Return the state seed in the form posX, posY, posZ, momX, momY, momZ. ATTENTION: This is not the fitt...
Definition: RecoTrack.h:491
Belle2::RecoTrack::setRightLeftInformation
void setRightLeftInformation(const HitType *hit, RightLeftInformation rightLeftInformation)
Set the right left information or throws an exception of the hit is not related to the track....
Definition: RecoTrack.h:359
Belle2::RecoTrack::hasBKLMHits
bool hasBKLMHits() const
Returns true if the track has bklm hits.
Definition: RecoTrack.h:400
Belle2::RecoTrack::getSeedCovariance
const TMatrixDSym & getSeedCovariance() const
Return the covariance matrix of the seed. ATTENTION: This is not the fitted covariance.
Definition: RecoTrack.h:527
Belle2::RecoTrack::getRightLeftInformation
RightLeftInformation getRightLeftInformation(const HitType *hit) const
Return the right left information of a given hit (every type) or throws an exception of the hit is no...
Definition: RecoTrack.h:335
Belle2::RecoTrack::getFoundByTrackFinder
OriginTrackFinder getFoundByTrackFinder(const HitType *hit) const
Return the found by track finder flag for the given hit (every type) or throws an exception of the hi...
Definition: RecoTrack.h:343
Belle2::RecoTrack::getStoreArrayNameOfSVDHits
const std::string & getStoreArrayNameOfSVDHits() const
Name of the store array of the svd hits.
Definition: RecoTrack.h:634
Belle2::RecoTrack::getPXDHitList
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList() const
Return an unsorted list of pxd hits.
Definition: RecoTrack.h:452