Belle II Software  release-08-01-10
TrackPoint.h
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
23 #ifndef genfit_TrackPoint_h
24 #define genfit_TrackPoint_h
25 
26 #include "AbsMeasurement.h"
27 #include "AbsFitterInfo.h"
28 #include "ThinScatterer.h"
29 
30 #include <TObject.h>
31 
32 #include <map>
33 #include <vector>
34 #include <memory>
35 
36 
37 namespace genfit {
38 
39 class Track;
40 class KalmanFitterInfo;
41 
46 class TrackPoint : public TObject {
47 
48  public:
49 
50  TrackPoint();
51  explicit TrackPoint(Track* track);
52 
59  TrackPoint(const std::vector< genfit::AbsMeasurement* >& rawMeasurements, Track* track);
60 
67  TrackPoint(genfit::AbsMeasurement* rawMeasurement, Track* track);
68 
69  TrackPoint(const TrackPoint&); // copy constructor
70  TrackPoint& operator=(TrackPoint); // assignment operator
71  void swap(TrackPoint& other);
72 
77  TrackPoint(const TrackPoint& rhs,
78  const std::map<const genfit::AbsTrackRep*, genfit::AbsTrackRep*>& map,
79  const std::vector<const genfit::AbsTrackRep*> * repsToIgnore = nullptr);
80 
81  virtual ~TrackPoint();
82 
83 
84  double getSortingParameter() const {return sortingParameter_;}
85 
86  Track* getTrack() const {return track_;}
87  void setTrack(Track* track) {track_ = track;}
88 
89  const std::vector< genfit::AbsMeasurement* >& getRawMeasurements() const {return rawMeasurements_;}
90  AbsMeasurement* getRawMeasurement(int i = 0) const;
91  unsigned int getNumRawMeasurements() const {return rawMeasurements_.size();}
92  bool hasRawMeasurements() const {return (rawMeasurements_.size() != 0);}
94  std::vector< genfit::AbsFitterInfo* > getFitterInfos() const;
96  AbsFitterInfo* getFitterInfo(const AbsTrackRep* rep = nullptr) const;
98  KalmanFitterInfo* getKalmanFitterInfo(const AbsTrackRep* rep = nullptr) const;
99  bool hasFitterInfo(const AbsTrackRep* rep) const {
100  return (fitterInfos_.find(rep) != fitterInfos_.end());
101  }
102 
103  ThinScatterer* getMaterialInfo() const {return thinScatterer_.get();}
104  bool hasThinScatterer() const {return thinScatterer_.get() != nullptr;}
105 
106 
107  void setSortingParameter(double sortingParameter) {sortingParameter_ = sortingParameter;}
109  void addRawMeasurement(genfit::AbsMeasurement* rawMeasurement) {assert(rawMeasurement!=nullptr); rawMeasurement->setTrackPoint(this); rawMeasurements_.push_back(rawMeasurement);}
110  void deleteRawMeasurements();
112  void setFitterInfo(genfit::AbsFitterInfo* fitterInfo);
113  void deleteFitterInfo(const AbsTrackRep* rep) {delete fitterInfos_[rep]; fitterInfos_.erase(rep);}
114 
115  void setScatterer(ThinScatterer* scatterer) {thinScatterer_.reset(scatterer);}
116 
117  void Print(const Option_t* = "") const;
118 
126  void fixupRepsForReading();
127 
128  private:
129  double sortingParameter_;
130 
133 
135  std::vector<AbsMeasurement*> rawMeasurements_; // Ownership
136 
137  std::map< const AbsTrackRep*, AbsFitterInfo* > fitterInfos_;
138 
145  std::map<unsigned int, AbsFitterInfo*> vFitterInfos_;
146 
147  std::unique_ptr<ThinScatterer> thinScatterer_; // Ownership
148 
149  public:
150 
151  ClassDef(TrackPoint,1)
152 
153 };
154 
155 } /* End of namespace genfit */
158 #endif // genfit_TrackPoint_h
This class collects all information needed and produced by a specific AbsFitter and is specific to on...
Definition: AbsFitterInfo.h:42
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
Thin or thick scatterer.
Definition: ThinScatterer.h:38
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition: TrackPoint.h:46
AbsFitterInfo * getFitterInfo(const AbsTrackRep *rep=nullptr) const
Get fitterInfo for rep. Per default, use cardinal rep.
Definition: TrackPoint.cc:170
std::map< unsigned int, AbsFitterInfo * > vFitterInfos_
Ownership over FitterInfos.
Definition: TrackPoint.h:145
void fixupRepsForReading()
This function is used when reading the TrackPoint and is called by the owner in order to build fitter...
Definition: TrackPoint.cc:319
void addRawMeasurement(genfit::AbsMeasurement *rawMeasurement)
Takes ownership and sets this as measurement's trackPoint.
Definition: TrackPoint.h:109
std::vector< genfit::AbsFitterInfo * > getFitterInfos() const
Get list of all fitterInfos.
Definition: TrackPoint.cc:156
std::vector< AbsMeasurement * > rawMeasurements_
No ownership.
Definition: TrackPoint.h:135
void setFitterInfo(genfit::AbsFitterInfo *fitterInfo)
Takes Ownership.
Definition: TrackPoint.cc:194
KalmanFitterInfo * getKalmanFitterInfo(const AbsTrackRep *rep=nullptr) const
Helper to avoid casting.
Definition: TrackPoint.cc:180
Track * track_
Pointer to Track where TrackPoint belongs to.
Definition: TrackPoint.h:132
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
Defines for I/O streams used for error and debug printing.