CbmRoot
Loading...
Searching...
No Matches
CbmLitTrackSelectionSharedHits.cxx
Go to the documentation of this file.
1/* Copyright (C) 2008-2013 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
6
7#include "data/CbmLitTrack.h"
9
10#include <algorithm>
11#include <set>
12
14
16
18{
19 if (itBegin == itEnd) {
20 return kLITSUCCESS;
21 }
22
24 CheckSharedHits(itBegin, itEnd);
25
26 return kLITSUCCESS;
27}
28
33
35{
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) {
44 continue;
45 }
46
47 int nofSharedHits = 0;
48 int nofHits = track->GetNofHits();
49
50 for (int iHit = 0; iHit < nofHits; iHit++) {
51 int hitId = track->GetHit(iHit)->GetRefId();
52 LitHitType type = track->GetHit(iHit)->GetType();
53 LitSystemId sysId = track->GetHit(iHit)->GetSystem();
54 if (type == kLITSTRIPHIT) {
55 hitId += STRIPSTART;
56 }
57 if (sysId == kLITTRD) {
58 hitId += TRDSTART;
59 }
60 if (hitsId.find(hitId) != hitsId.end()) {
61 nofSharedHits++;
62 if (nofSharedHits > fNofSharedHits) {
63 track->SetQuality(kLITBAD);
64 break;
65 }
66 }
67 }
68
69 if (track->GetQuality() == kLITBAD) {
70 continue;
71 }
72
73 for (int iHit = 0; iHit < nofHits; iHit++) {
74 int hitId = track->GetHit(iHit)->GetRefId();
75 LitHitType type = track->GetHit(iHit)->GetType();
76 LitSystemId detId = track->GetHit(iHit)->GetSystem();
77 if (type == kLITSTRIPHIT) {
78 hitId += STRIPSTART;
79 }
80 if (detId == kLITTRD) {
81 hitId += TRDSTART;
82 }
83 hitsId.insert(hitId);
84 }
85 }
86 hitsId.clear();
87}
TClonesArray * tracks
@ kLITBAD
Definition CbmLitEnums.h:40
LitHitType
Definition CbmLitEnums.h:19
@ kLITSTRIPHIT
Definition CbmLitEnums.h:20
LitStatus
Definition CbmLitEnums.h:29
@ kLITSUCCESS
Definition CbmLitEnums.h:30
LitSystemId
Definition CbmLitEnums.h:48
@ kLITTRD
Definition CbmLitEnums.h:50
Base data class for track.
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
Definition CbmTofTypes.h:25
std::vector< CbmTofTrack * > TrackPtrVector
Definition CbmTofTypes.h:26
LitSystemId GetSystem() const
Definition CbmLitHit.h:48
LitHitType GetType() const
Definition CbmLitHit.h:43
Int_t GetRefId() const
Definition CbmLitHit.h:42
static LitStatus DoSortNofHits(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Sort array of tracks by quality.
void CheckSharedHits(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
virtual LitStatus DoSelect(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Main function to be implemented for concrete track selection algorithm.
Base data class for track.
Definition CbmLitTrack.h:34
const CbmLitHit * GetHit(Int_t index) const
Definition CbmLitTrack.h:71
Int_t GetNofHits() const
Definition CbmLitTrack.h:62
LitTrackQa GetQuality() const
Definition CbmLitTrack.h:63
void SetQuality(LitTrackQa quality)
Definition CbmLitTrack.h:80