Belle II Software  release-08-01-10
TrackBase.h
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 
9 //-----------------------------------------------------------------------------
10 // Description : A class to represent a track object in TRGCDC.
11 //-----------------------------------------------------------------------------
12 
13 #ifndef TRGCDCTrackBase_FLAG_
14 #define TRGCDCTrackBase_FLAG_
15 
16 #include <vector>
17 #include "CLHEP/Vector/LorentzVector.h"
18 
19 #ifdef TRGCDC_SHORT_NAMES
20 #define TCTBase TRGCDCTrackBase
21 #endif
22 
23 #define TRGCDCTrackBaseType 1
24 #define TRGCDCCircleType 2
25 #define TRGCDCLineType 4
26 #define TRGCDCTrackType 8
27 #define TRGCDCSegmentType 16
28 
29 namespace Belle2 {
35  class TRGCDCLink;
36  class TRGCDCFitter;
37  class TRGCDCRelation;
38 
41 
42  public:
43 
46 
48  TRGCDCTrackBase(const std::string& name, double charge);
49 
51  virtual ~TRGCDCTrackBase();
52 
55 
56  public:
57 
59  std::string name(void) const;
60 
62  int status(void) const;
63 
65  double charge(void) const;
66 
68  virtual const CLHEP::Hep3Vector& p(void) const;
69 
71  virtual double pt(void) const;
72 
74  virtual const CLHEP::Hep3Vector& x(void) const;
75 
77  virtual void dump(const std::string& message = std::string(""),
78  const std::string& prefix = std::string("")) const;
79 
81  const std::vector<TRGCDCLink*>& links(void) const;
82 
84  const std::vector<TRGCDCLink*>& links(unsigned layerId) const;
85 
87  bool fitted(void) const;
88 
90  void setFitted(bool fitted);
91 
93  void setTrackID(int trackID);
94 
96  int getTrackID();
97 
99  virtual unsigned objectType(void) const;
100 
102  const TRGCDCFitter* fitter(void) const;
103 
106  const TRGCDCRelation relation(void) const;
107 
109  const TRGCDCRelation relation2D(void) const;
110 
112  const TRGCDCRelation relation3D(void) const;
113 
114  public: // Modifiers
115 
117  std::string name(const std::string& newName);
118 
120  void append(TRGCDCLink*);
121 
123  void append(const std::vector<TRGCDCLink*>& links);
124 
126  double charge(double c);
127 
129  virtual int fit(void);
130 
132  const TRGCDCFitter* fitter(const TRGCDCFitter*);
133 
134  public: // Utility functions
135 
137  virtual int approach2D(TRGCDCLink&) const;
138 
139  private:
140 
142  std::string _name;
143 
145  int _status;
146 
148  double _charge;
149 
151  CLHEP::Hep3Vector _p;
152 
154  CLHEP::Hep3Vector _x;
155 
157  std::vector<TRGCDCLink*>* _ts;
158 
160  std::vector<TRGCDCLink*> _tsAll;
161 
163  const unsigned _nTs;
164 
167 
169  mutable bool _fitted;
170 
173 
174  friend class TRGCDCFitter;
175  friend class TRGCDCCircleFitter;
176  friend class TRGCDCHelixFitter;
177  friend class TRGCDCCircle;
178  friend class TRGCDCTrack;
179  };
180 
181 //-----------------------------------------------------------------------------
182 
183  inline
184  std::string
186  {
187  return _name;
188  }
189 
190  inline
191  std::string
192  TRGCDCTrackBase::name(const std::string& a)
193  {
194  return _name = a;
195  }
196 
197  inline
198  int
200  {
201  return _status;
202  }
203 
204  inline
205  const CLHEP::Hep3Vector&
206  TRGCDCTrackBase::p(void) const
207  {
208  return _p;
209  }
210 
211  inline
212  const CLHEP::Hep3Vector&
213  TRGCDCTrackBase::x(void) const
214  {
215  return _x;
216  }
217 
218  inline
219  double
221  {
222  return _p.perp();
223  }
224 
225  inline
226  bool
228  {
229  return _fitted;
230  }
231 
232  inline
233  void
235  {
236  _fitted = fitted;
237  }
238 
239  inline
240  unsigned
242  {
243  return TRGCDCTrackBaseType;
244  }
245 
246  inline
247  double
249  {
250  return _charge;
251  }
252 
253  inline
254  double
256  {
257  return _charge = a;
258  }
259 
260  inline
261  const TRGCDCFitter*
263  {
264  return _fitter;
265  }
266 
267  inline
268  const TRGCDCFitter*
270  {
271  _fitted = false;
272  return _fitter = a;
273  }
274 
275  inline
276  void
278  {
279  m_trackID = trackID;
280  }
281 
282  inline
283  int
285  {
286  return m_trackID;
287  }
288 
290 } // namespace Belle2
291 
292 #endif /* TRGCDCTrackBase_FLAG_ */
A class to fit a TTrackBase object to a circle.
Definition: CircleFitter.h:31
A class to represent a circle.
Definition: Circle.h:33
A class to fit a TRGCDCTrackBase object.
Definition: Fitter.h:40
A class to represent a wire in CDC.
Definition: Relation.h:35
A class to represent a track object in TRGCDC.
Definition: TrackBase.h:40
int m_trackID
ID of tracks.
Definition: TrackBase.h:172
std::vector< TRGCDCLink * > _tsAll
Links for all super layers.
Definition: TrackBase.h:160
const unsigned _nTs
Size of _ts.
Definition: TrackBase.h:163
double _charge
Charge.
Definition: TrackBase.h:148
std::vector< TRGCDCLink * > * _ts
Links for each super layer.
Definition: TrackBase.h:157
CLHEP::Hep3Vector _p
Momentum.
Definition: TrackBase.h:151
CLHEP::Hep3Vector _x
Position.
Definition: TrackBase.h:154
const TRGCDCFitter * _fitter
Fitter.
Definition: TrackBase.h:166
TRGCDCTrackBase & operator=(TRGCDCTrackBase &)=delete
Assignment operator, deleted.
std::string _name
Name.
Definition: TrackBase.h:142
bool _fitted
Fitting status.
Definition: TrackBase.h:169
A class to represent a reconstructed charged track in TRGCDC.
Definition: TRGCDCTrack.h:38
const TRGCDCRelation relation(void) const
returns MC information.
Definition: TrackBase.cc:142
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TrackBase.cc:65
double charge(void) const
returns charge.
Definition: TrackBase.h:248
const TRGCDCRelation relation3D(void) const
returns MC information for only stereo layers.
Definition: TrackBase.cc:232
virtual double pt(void) const
returns Pt.
Definition: TrackBase.h:220
int getTrackID()
get track ID.
Definition: TrackBase.h:284
int status(void) const
returns status.
Definition: TrackBase.h:199
void setTrackID(int trackID)
set track ID.
Definition: TrackBase.h:277
const TRGCDCRelation relation2D(void) const
returns MC information for only axial layers.
Definition: TrackBase.cc:182
const TRGCDCFitter * fitter(void) const
returns a pointer to a default fitter.
Definition: TrackBase.h:262
virtual int fit(void)
fits itself by a default fitter. Error was happened if return value is not zero.
Definition: TrackBase.cc:97
TRGCDCTrackBase(const TRGCDCTrackBase &)
Copy constructor.
Definition: TrackBase.cc:31
std::string name(void) const
returns name.
Definition: TrackBase.h:185
bool fitted(void) const
returns true if fitted.
Definition: TrackBase.h:227
virtual int approach2D(TRGCDCLink &) const
calculate closest approach. Error was happened if return value is not zero.
Definition: TrackBase.cc:135
virtual unsigned objectType(void) const
returns object type.
Definition: TrackBase.h:241
virtual const CLHEP::Hep3Vector & p(void) const
returns momentum vector.
Definition: TrackBase.h:206
const std::vector< TRGCDCLink * > & links(void) const
returns a vector to track segments.
Definition: TrackBase.cc:123
virtual const CLHEP::Hep3Vector & x(void) const
returns position vector.
Definition: TrackBase.h:213
virtual ~TRGCDCTrackBase()
Destructor.
Definition: TrackBase.cc:60
void append(TRGCDCLink *)
appends a link.
Definition: TrackBase.cc:108
void setFitted(bool fitted)
set fit status
Definition: TrackBase.h:234
Abstract base class for different kinds of events.