CbmRoot
CbmLitTrackSelectionSharedHits.cxx
Go to the documentation of this file.
1 /* CbmLitTrackSelectionSharedHits.h
2  * @author Andrey Lebedev <andrey.lebedev@gsi.de>
3  * @since 2008
4  * @version 1.0
5  */
6 
8 
9 #include "data/CbmLitTrack.h"
11 
12 #include <algorithm>
13 #include <set>
14 
16  : fNofSharedHits(0) {}
17 
19 
21  TrackPtrIterator itEnd) {
22  if (itBegin == itEnd) { return kLITSUCCESS; }
23 
24  CbmLitQualitySort::DoSortNofHits(itBegin, itEnd);
25  CheckSharedHits(itBegin, itEnd);
26 
27  return kLITSUCCESS;
28 }
29 
31  return DoSelect(tracks.begin(), tracks.end());
32 }
33 
35  TrackPtrIterator itEnd) {
36  std::set<int> hitsId;
37  const int STRIPSTART = 100000;
38  const int TRDSTART = 1000000;
39 
40  for (TrackPtrIterator iTrack = itBegin; iTrack != itEnd; iTrack++) {
41  CbmLitTrack* track = *iTrack;
42 
43  if (track->GetQuality() == kLITBAD) { continue; }
44 
45  int nofSharedHits = 0;
46  int nofHits = track->GetNofHits();
47 
48  for (int iHit = 0; iHit < nofHits; iHit++) {
49  int hitId = track->GetHit(iHit)->GetRefId();
50  LitHitType type = track->GetHit(iHit)->GetType();
51  LitSystemId sysId = track->GetHit(iHit)->GetSystem();
52  if (type == kLITSTRIPHIT) { hitId += STRIPSTART; }
53  if (sysId == kLITTRD) { hitId += TRDSTART; }
54  if (hitsId.find(hitId) != hitsId.end()) {
55  nofSharedHits++;
56  if (nofSharedHits > fNofSharedHits) {
57  track->SetQuality(kLITBAD);
58  break;
59  }
60  }
61  }
62 
63  if (track->GetQuality() == kLITBAD) { continue; }
64 
65  for (int iHit = 0; iHit < nofHits; iHit++) {
66  int hitId = track->GetHit(iHit)->GetRefId();
67  LitHitType type = track->GetHit(iHit)->GetType();
68  LitSystemId detId = track->GetHit(iHit)->GetSystem();
69  if (type == kLITSTRIPHIT) { hitId += STRIPSTART; }
70  if (detId == kLITTRD) { hitId += TRDSTART; }
71  hitsId.insert(hitId);
72  }
73  }
74  hitsId.clear();
75 }
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
CbmLitTrackSelectionSharedHits::CbmLitTrackSelectionSharedHits
CbmLitTrackSelectionSharedHits()
Definition: CbmLitTrackSelectionSharedHits.cxx:15
CbmLitTrackSelectionSharedHits::CheckSharedHits
void CheckSharedHits(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Definition: CbmLitTrackSelectionSharedHits.cxx:34
CbmLitHit::GetRefId
Int_t GetRefId() const
Definition: CbmLitHit.h:46
CbmLitTrackSelectionSharedHits.h
CbmLitTrackSelectionSharedHits::DoSelect
virtual LitStatus DoSelect(TrackPtrVector &tracks)
Main function to be implemented for concrete track selection algorithm.
Definition: CbmLitTrackSelectionSharedHits.cxx:30
kLITSUCCESS
@ kLITSUCCESS
Definition: CbmLitEnums.h:24
TrackPtrIterator
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
Definition: CbmTofTypes.h:21
TrackPtrVector
std::vector< CbmTofTrack * > TrackPtrVector
Definition: CbmTofTypes.h:22
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
CbmLitTrackSelectionSharedHits::~CbmLitTrackSelectionSharedHits
virtual ~CbmLitTrackSelectionSharedHits()
Definition: CbmLitTrackSelectionSharedHits.cxx:18
kLITSTRIPHIT
@ kLITSTRIPHIT
Definition: CbmLitEnums.h:15
CbmLitTrackSelectionSharedHits::fNofSharedHits
int fNofSharedHits
Definition: CbmLitTrackSelectionSharedHits.h:41
CbmLitTrack
Base data class for track.
Definition: CbmLitTrack.h:30
kLITBAD
@ kLITBAD
Definition: CbmLitEnums.h:33
CbmLitTrack::SetQuality
void SetQuality(LitTrackQa quality)
Definition: CbmLitTrack.h:76
LitHitType
LitHitType
Definition: CbmLitEnums.h:14
CbmLitTrackSelectionSharedHits::DoSelect
virtual LitStatus DoSelect(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Main function to be implemented for concrete track selection algorithm.
Definition: CbmLitTrackSelectionSharedHits.cxx:20
LitSystemId
LitSystemId
Definition: CbmLitEnums.h:40
CbmLitTrack.h
Base data class for track.
kLITTRD
@ kLITTRD
Definition: CbmLitEnums.h:42
CbmLitHit::GetSystem
LitSystemId GetSystem() const
Definition: CbmLitHit.h:52
CbmLitComparators.h
LitStatus
LitStatus
Definition: CbmLitEnums.h:23
CbmLitTrack::GetQuality
LitTrackQa GetQuality() const
Definition: CbmLitTrack.h:57
CbmLitTrack::GetHit
const CbmLitHit * GetHit(Int_t index) const
Definition: CbmLitTrack.h:65
CbmLitHit::GetType
LitHitType GetType() const
Definition: CbmLitHit.h:47
CbmLitTrack::GetNofHits
Int_t GetNofHits() const
Definition: CbmLitTrack.h:56