CbmRoot
CbmLitQualitySort.cxx
Go to the documentation of this file.
1 /*
2  * \file CbmLitQualitySort.cxx
3  * \author Andrey Lebedev <andrey.lebedev@gsi.de>
4  * \date 2011
5  */
6 
8 #include "data/CbmLitTrack.h"
9 
10 #include <algorithm>
11 
13 
15 
16 //LitStatus CbmLitQualitySort::DoSort(
17 // TrackPtrIterator itBegin,
18 // TrackPtrIterator itEnd)
19 //{
20 // if (itBegin == itEnd) { return kLITSUCCESS; }
21 //
22 // SortNofHits(itBegin, itEnd);
23 // //SortLastPlaneId(itBegin, itEnd);
24 //
25 // return kLITSUCCESS;
26 //}
27 //
28 //LitStatus CbmLitQualitySort::DoSort(
29 // TrackPtrVector& tracks)
30 //{
31 // return DoSort(tracks.begin(), tracks.end());
32 //}
33 
35  TrackPtrIterator itEnd) {
36  std::sort(itBegin, itEnd, CompareTrackPtrNofHitsMore());
37 
38  Int_t maxNofHits = (*itBegin)->GetNofHits();
39  Int_t minNofHits = (*(itEnd - 1))->GetNofHits();
40 
41  for (Int_t iNofHits = minNofHits; iNofHits <= maxNofHits; iNofHits++) {
42  CbmLitTrack value;
43  value.SetNofHits(iNofHits);
44 
45  std::pair<TrackPtrIterator, TrackPtrIterator> bounds;
46  bounds =
47  std::equal_range(itBegin, itEnd, &value, CompareTrackPtrNofHitsMore());
48 
49  if (bounds.first == bounds.second) { continue; }
50 
51  std::sort(bounds.first, bounds.second, CompareTrackPtrChiSqOverNdfLess());
52  }
53  return kLITSUCCESS;
54 }
55 
57  TrackPtrIterator itEnd) {
58  std::sort(itBegin, itEnd, CompareTrackPtrLastStationIdMore());
59 
60  Int_t maxPlaneId = (*itBegin)->GetLastStationId();
61  Int_t minPlaneId = (*(itEnd - 1))->GetLastStationId();
62 
63  for (Int_t iPlaneId = minPlaneId; iPlaneId <= maxPlaneId; iPlaneId++) {
64  CbmLitTrack value;
65  value.SetLastStationId(iPlaneId);
66 
67  std::pair<TrackPtrIterator, TrackPtrIterator> bounds;
68  bounds = std::equal_range(
69  itBegin, itEnd, &value, CompareTrackPtrLastStationIdMore());
70 
71  if (bounds.first == bounds.second) { continue; }
72 
73  std::sort(bounds.first, bounds.second, CompareTrackPtrChiSqOverNdfLess());
74  }
75  return kLITSUCCESS;
76 }
77 
79  TrackPtrIterator itEnd) {
80  std::sort(itBegin, itEnd, CompareTrackPtrChiSqOverNdfLess());
81  return kLITSUCCESS;
82 }
CbmLitQualitySort::DoSortNofHits
static LitStatus DoSortNofHits(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Sort array of tracks by quality using number of hits and chi square.
Definition: CbmLitQualitySort.cxx:34
CbmLitTrack::SetNofHits
void SetNofHits(Int_t nofHits)
Definition: CbmLitTrack.h:84
CompareTrackPtrNofHitsMore
Comparator for STL sorting algorithms.
Definition: CbmLitTrack.h:200
CompareTrackPtrLastStationIdMore
Comparator for STL sorting algorithms.
Definition: CbmLitTrack.h:226
kLITSUCCESS
@ kLITSUCCESS
Definition: CbmLitEnums.h:24
CbmLitQualitySort::DoSortChiSqOverNDF
static LitStatus DoSortChiSqOverNDF(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Sort array of tracks by quality using (chi square / NDF).
Definition: CbmLitQualitySort.cxx:78
CbmLitQualitySort.h
CbmLitTrack::SetLastStationId
void SetLastStationId(Int_t lastPlaneId)
Definition: CbmLitTrack.h:85
TrackPtrIterator
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
Definition: CbmTofTypes.h:21
CompareTrackPtrChiSqOverNdfLess
Comparator for STL sorting algorithms.
Definition: CbmLitTrack.h:173
CbmLitTrack
Base data class for track.
Definition: CbmLitTrack.h:30
CbmLitQualitySort::DoSortLastStation
static LitStatus DoSortLastStation(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Sort array of tracks by quality using last station id and chi square.
Definition: CbmLitQualitySort.cxx:56
CbmLitTrack.h
Base data class for track.
LitStatus
LitStatus
Definition: CbmLitEnums.h:23
CbmLitQualitySort::CbmLitQualitySort
CbmLitQualitySort()
Constructor.
Definition: CbmLitQualitySort.cxx:12
CbmLitQualitySort::~CbmLitQualitySort
virtual ~CbmLitQualitySort()
Destructor.
Definition: CbmLitQualitySort.cxx:14