CbmRoot
LitScalTrack.h
Go to the documentation of this file.
1 
8 #ifndef LITSCALTRACK_H_
9 #define LITSCALTRACK_H_
10 
11 #include "LitScalPixelHit.h"
12 #include "LitTrackParam.h"
13 #include <sstream>
14 #include <string>
15 #include <vector>
16 
17 using std::string;
18 using std::stringstream;
19 using std::vector;
20 
21 namespace lit {
22  namespace parallel {
23 
33  class LitScalTrack {
34  public:
39  : fHits()
40  , fParamFirst()
41  , fParamLast()
42  , fChiSq(0.)
43  , fNDF(1)
44  , fNofMissingHits(0)
45  , fPreviousTrackId(0)
46  , fLastStationId(0)
47  , fIsGood(true) {
48  fHits.reserve(30);
49  }
50 
54  virtual ~LitScalTrack() {}
55 
60  void AddHit(const LitScalPixelHit* hit) { fHits.push_back(hit); }
61 
66  unsigned short GetNofHits() const { return fHits.size(); }
67 
75  void SetNofHits(unsigned short nofHits) { return fHits.resize(nofHits); }
76 
82  const LitScalPixelHit* GetHit(unsigned short index) const {
83  return fHits[index];
84  }
85 
90  const LitTrackParamScal& GetParamFirst() const { return fParamFirst; }
91 
96  void SetParamFirst(const LitTrackParamScal& param) {
97  fParamFirst = param;
98  }
99 
104  const LitTrackParamScal& GetParamLast() const { return fParamLast; }
105 
110  void SetParamLast(const LitTrackParamScal& param) { fParamLast = param; }
111 
116  fscal GetChiSq() const { return fChiSq; }
117 
122  void SetChiSq(fscal chiSq) { fChiSq = chiSq; }
123 
128  void IncChiSq(fscal dChiSq) { fChiSq += dChiSq; }
129 
134  unsigned short GetNDF() const { return fNDF; }
135 
140  void SetNDF(unsigned short NDF) { fNDF = NDF; }
141 
146  unsigned short GetNofMissingHits() const { return fNofMissingHits; }
147 
152  void SetNofMissingHits(unsigned short nofMissingHits) {
153  fNofMissingHits = nofMissingHits;
154  }
155 
160  unsigned short GetLastStationId() const { return fLastStationId; }
161 
166  void SetLastStationId(unsigned short lastStationId) {
167  fLastStationId = lastStationId;
168  }
169 
174  void IncNofMissingHits(unsigned short dNofMissingHits = 1) {
175  fNofMissingHits += dNofMissingHits;
176  }
177 
182  unsigned short GetPreviousTrackId() const { return fPreviousTrackId; }
183 
188  void SetPreviousTrackId(unsigned short previousTrackId) {
189  fPreviousTrackId = previousTrackId;
190  }
191 
196  bool IsGood() const { return fIsGood; }
197 
202  void IsGood(bool isGood) { fIsGood = isGood; }
203 
208  string ToString() const {
209  stringstream ss;
210  ss << "LitTrack: nofHits=" << GetNofHits() << " chiSq=" << GetChiSq()
211  << " NDF=" << GetNDF() << " nofMissingHits=" << GetNofMissingHits()
212  << " previousTrackId=" << GetPreviousTrackId()
213  << " paramFirst=" << GetParamFirst()
214  << " paramLast=" << GetParamLast() << "\n";
215  return ss.str();
216  }
217 
222  friend ostream& operator<<(ostream& strm, const LitScalTrack& track) {
223  strm << track.ToString();
224  return strm;
225  }
226 
227  private:
228  vector<const LitScalPixelHit*> fHits; // Array of hits
229  LitTrackParamScal fParamFirst; // First track parameter
230  LitTrackParamScal fParamLast; // Last track parameter
231  fscal fChiSq; // Chi-square of the track
232  unsigned short fNDF; // Number of degrees of freedom
233  unsigned short fNofMissingHits; // Number of missing hits
234  unsigned short fPreviousTrackId; // Id of the track seed
235  unsigned char fLastStationId; // ID of last station
236  bool fIsGood; // true id track is "good"
237  };
238 
239 
251  public std::
252  binary_function<const LitScalTrack*, const LitScalTrack*, bool> {
253  public:
254  bool operator()(const LitScalTrack* track1,
255  const LitScalTrack* track2) const {
256  return ((track1->GetChiSq() / track1->GetNDF())
257  < (track2->GetChiSq() / track2->GetNDF()));
258  }
259  };
260 
261 
273  public std::
274  binary_function<const LitScalTrack*, const LitScalTrack*, bool> {
275  public:
276  bool operator()(const LitScalTrack* track1,
277  const LitScalTrack* track2) const {
278  return track1->GetNofHits() > track2->GetNofHits();
279  }
280  };
281 
282 
294  public std::
295  binary_function<const LitScalTrack*, const LitScalTrack*, bool> {
296  public:
297  bool operator()(const LitScalTrack* track1,
298  const LitScalTrack* track2) const {
299  return track1->GetLastStationId() > track2->GetLastStationId();
300  }
301  };
302 
303  } // namespace parallel
304 } // namespace lit
305 
306 
307 #endif /* LITSCALTRACK_H_ */
lit::parallel::LitScalTrack::fPreviousTrackId
unsigned short fPreviousTrackId
Definition: LitScalTrack.h:234
lit::parallel::LitScalTrack::~LitScalTrack
virtual ~LitScalTrack()
Destructor.
Definition: LitScalTrack.h:54
fscal
float fscal
Definition: L1/vectors/P4_F32vec4.h:250
lit::parallel::LitScalPixelHit
Base class for scalar pixel hits.
Definition: LitScalPixelHit.h:31
lit::parallel::CompareLitScalTrackChiSqOverNdfLess
Comparator class used in STL algorithms for LitScalTrack class.
Definition: LitScalTrack.h:252
lit::parallel::LitScalTrack::GetNDF
unsigned short GetNDF() const
Returns number of degrees of freedom.
Definition: LitScalTrack.h:134
lit::parallel::LitScalTrack::GetChiSq
fscal GetChiSq() const
Returns chi square of the track.
Definition: LitScalTrack.h:116
lit::parallel::LitScalTrack::GetHit
const LitScalPixelHit * GetHit(unsigned short index) const
Returns pointer to the hit.
Definition: LitScalTrack.h:82
lit::parallel::LitScalTrack::fNofMissingHits
unsigned short fNofMissingHits
Definition: LitScalTrack.h:233
lit::parallel::CompareLitScalTrackNofHitsMore
Comparator class used in STL algorithms for LitScalTrack class.
Definition: LitScalTrack.h:274
LitTrackParam.h
Track parameters data class.
lit::parallel::LitScalTrack::SetLastStationId
void SetLastStationId(unsigned short lastStationId)
Set last station ID.
Definition: LitScalTrack.h:166
lit::parallel::LitScalTrack::LitScalTrack
LitScalTrack()
Constructor.
Definition: LitScalTrack.h:38
lit::parallel::LitScalTrack
Scalar track data class.
Definition: LitScalTrack.h:33
lit::parallel::LitScalTrack::GetNofHits
unsigned short GetNofHits() const
Returns number of hits in track.
Definition: LitScalTrack.h:66
lit::parallel::CompareLitScalTrackNofHitsMore::operator()
bool operator()(const LitScalTrack *track1, const LitScalTrack *track2) const
Definition: LitScalTrack.h:276
lit::parallel::LitScalTrack::SetPreviousTrackId
void SetPreviousTrackId(unsigned short previousTrackId)
Sets previous trackId.
Definition: LitScalTrack.h:188
lit::parallel::LitScalTrack::AddHit
void AddHit(const LitScalPixelHit *hit)
Adds hit to track.
Definition: LitScalTrack.h:60
lit::parallel::LitTrackParam< fscal >
lit::parallel::LitScalTrack::IncChiSq
void IncChiSq(fscal dChiSq)
Increases chi square by dChiSq.
Definition: LitScalTrack.h:128
lit::parallel::LitScalTrack::GetNofMissingHits
unsigned short GetNofMissingHits() const
Returns number of missing hits.
Definition: LitScalTrack.h:146
lit::parallel::LitScalTrack::SetNofHits
void SetNofHits(unsigned short nofHits)
Depricated.
Definition: LitScalTrack.h:75
lit::parallel::LitScalTrack::IsGood
bool IsGood() const
Returns true if track is good.
Definition: LitScalTrack.h:196
lit::parallel::LitScalTrack::SetParamFirst
void SetParamFirst(const LitTrackParamScal &param)
Sets first track parameter.
Definition: LitScalTrack.h:96
lit::parallel::LitScalTrack::operator<<
friend ostream & operator<<(ostream &strm, const LitScalTrack &track)
Operator << for convenient output to ostream.
Definition: LitScalTrack.h:222
lit::parallel::LitScalTrack::ToString
string ToString() const
Returns string representation of the class.
Definition: LitScalTrack.h:208
lit::parallel::LitScalTrack::SetNofMissingHits
void SetNofMissingHits(unsigned short nofMissingHits)
Sets number of missing hits.
Definition: LitScalTrack.h:152
lit::parallel::LitScalTrack::fLastStationId
unsigned char fLastStationId
Definition: LitScalTrack.h:235
LitScalPixelHit.h
Base class for scalar pixel hits.
lit::parallel::LitScalTrack::GetPreviousTrackId
unsigned short GetPreviousTrackId() const
Return Previous track index.
Definition: LitScalTrack.h:182
lit::parallel::LitScalTrack::GetLastStationId
unsigned short GetLastStationId() const
Returns last station ID.
Definition: LitScalTrack.h:160
lit::parallel::LitScalTrack::fNDF
unsigned short fNDF
Definition: LitScalTrack.h:232
lit::parallel::LitScalTrack::fChiSq
fscal fChiSq
Definition: LitScalTrack.h:231
lit::parallel::LitScalTrack::IncNofMissingHits
void IncNofMissingHits(unsigned short dNofMissingHits=1)
Increases number of missing hits by dNofMissingHits.
Definition: LitScalTrack.h:174
lit::parallel::CompareLitScalTrackLastStationIdMore
Comparator class used in STL algorithms for LitScalTrack class.
Definition: LitScalTrack.h:295
lit::parallel::LitScalTrack::fIsGood
bool fIsGood
Definition: LitScalTrack.h:236
lit::parallel::LitScalTrack::GetParamFirst
const LitTrackParamScal & GetParamFirst() const
Returns first parameter of the track.
Definition: LitScalTrack.h:90
lit::parallel::LitScalTrack::fParamFirst
LitTrackParamScal fParamFirst
Definition: LitScalTrack.h:229
lit::parallel::CompareLitScalTrackChiSqOverNdfLess::operator()
bool operator()(const LitScalTrack *track1, const LitScalTrack *track2) const
Definition: LitScalTrack.h:254
lit::parallel::LitScalTrack::SetChiSq
void SetChiSq(fscal chiSq)
Sets chi square.
Definition: LitScalTrack.h:122
lit::parallel::LitScalTrack::SetParamLast
void SetParamLast(const LitTrackParamScal &param)
Sets last track parameter.
Definition: LitScalTrack.h:110
lit::parallel::LitScalTrack::IsGood
void IsGood(bool isGood)
Sets is good track.
Definition: LitScalTrack.h:202
lit::parallel::LitScalTrack::GetParamLast
const LitTrackParamScal & GetParamLast() const
Returns last parameter of the track.
Definition: LitScalTrack.h:104
lit::parallel::LitScalTrack::fHits
vector< const LitScalPixelHit * > fHits
Definition: LitScalTrack.h:228
lit::parallel::NDF
unsigned short NDF(const LitScalTrack &track)
Returns number of degrees of freedom for the track.
Definition: LitMath.h:50
lit::parallel::LitScalTrack::fParamLast
LitTrackParamScal fParamLast
Definition: LitScalTrack.h:230
lit::parallel::CompareLitScalTrackLastStationIdMore::operator()
bool operator()(const LitScalTrack *track1, const LitScalTrack *track2) const
Definition: LitScalTrack.h:297
lit::parallel::LitScalTrack::SetNDF
void SetNDF(unsigned short NDF)
Sets number of degrees of freedom.
Definition: LitScalTrack.h:140
lit
Definition: LitTrackFinderNNVecElectron.h:19