]>
Commit | Line | Data |
---|---|---|
c865cb1d | 1 | #include <TEntryList.h> |
2 | ||
3 | #include "AliLog.h" | |
4 | #include "AliPID.h" | |
5 | ||
6 | #include "AliRsnCutSet.h" | |
7 | ||
8 | #include "AliRsnPIDManager.h" | |
9 | ||
10 | ClassImp(AliRsnPIDManager) | |
11 | ||
12 | //_____________________________________________________________________________ | |
13 | AliRsnPIDManager::AliRsnPIDManager(const char *name, const char *title) : TNamed(name, title) | |
14 | { | |
15 | // | |
16 | // Default constructor. | |
17 | // | |
18 | AliDebug(AliLog::kDebug + 10, "<-"); | |
19 | AliDebug(AliLog::kDebug + 10, "->"); | |
20 | } | |
21 | ||
22 | //_____________________________________________________________________________ | |
23 | AliRsnPIDManager::~AliRsnPIDManager() | |
24 | { | |
25 | // | |
26 | // Destructor | |
27 | // | |
28 | AliDebug(AliLog::kDebug + 10, "<-"); | |
29 | for (Int_t iCharge = 0; iCharge < 2; iCharge++) fIdParticles[iCharge].Delete(); | |
30 | AliDebug(AliLog::kDebug + 10, "->"); | |
31 | } | |
32 | ||
547e2d97 | 33 | void AliRsnPIDManager::Print(Option_t *option) const |
c865cb1d | 34 | { |
35 | TNamed::Print(option); | |
36 | ||
37 | TEntryList *el; | |
38 | AliRsnCutSet *cut; | |
39 | for (Int_t iCharge = 0; iCharge < 2; iCharge++) { | |
40 | for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) { | |
547e2d97 | 41 | cut = (AliRsnCutSet *) fCuts.At(iParticle); |
c865cb1d | 42 | if (!cut) continue; |
547e2d97 | 43 | el = (TEntryList *)fIdParticles[iCharge].At(iParticle); |
c865cb1d | 44 | if (el) AliInfo(Form("%d %d %lld %s", iCharge, iParticle, el->GetN(), cut->GetName())); |
45 | } | |
46 | } | |
47 | } | |
48 | ||
49 | void AliRsnPIDManager::Init() | |
50 | { | |
51 | for (Int_t iCharge = 0; iCharge < 2; iCharge++) { | |
52 | for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) { | |
53 | fIdParticles[iCharge].Add(new TEntryList()); | |
54 | // fCuts.Add(new AliRsnCutSet("", AliRsnTarget::kDaughter)); | |
55 | } | |
56 | } | |
57 | } | |
58 | ||
59 | ||
60 | void AliRsnPIDManager::Reset() | |
61 | { | |
62 | TEntryList *el; | |
63 | for (Int_t iCharge = 0; iCharge < 2; iCharge++) { | |
64 | for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) { | |
547e2d97 | 65 | el = (TEntryList *)fIdParticles[iCharge].At(iParticle); |
c865cb1d | 66 | el->Reset(); |
67 | } | |
68 | } | |
69 | } | |
70 | ||
71 | ||
547e2d97 | 72 | TEntryList *AliRsnPIDManager::GetParticles(const Int_t &charge, const Int_t &pidId) |
c865cb1d | 73 | { |
547e2d97 | 74 | return (TEntryList *)fIdParticles[charge].At(pidId); |
c865cb1d | 75 | } |
76 | ||
547e2d97 | 77 | void AliRsnPIDManager::SetCut(AliRsnCutSet *cut, const Int_t &pidId) |
c865cb1d | 78 | { |
79 | if (!cut) return; | |
80 | if (!fCuts.GetEntriesFast()) Init(); | |
81 | fCuts.AddAt(cut, pidId); | |
82 | } | |
83 | ||
547e2d97 | 84 | void AliRsnPIDManager::ApplyCuts(AliRsnEvent *ev) |
c865cb1d | 85 | { |
86 | ||
87 | // Loop over event and add entruies to entry list | |
88 | Int_t numTracks = ev->GetRefESD()->GetNumberOfTracks(); | |
89 | Int_t iTrack; | |
90 | AliRsnDaughter daughter; | |
91 | for (iTrack = 0; iTrack < numTracks; iTrack++) { | |
92 | ev->SetDaughter(daughter, iTrack, AliRsnDaughter::kTrack); | |
93 | daughter.SetRsnID(iTrack); | |
94 | CheckTrack(&daughter, iTrack); | |
95 | } | |
96 | ||
97 | } | |
98 | ||
547e2d97 | 99 | void AliRsnPIDManager::CheckTrack(AliRsnDaughter *d, const Int_t &id) |
c865cb1d | 100 | { |
101 | TEntryList *el; | |
102 | AliRsnCutSet *cut; | |
103 | TString cutName; | |
104 | for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) { | |
105 | ||
547e2d97 | 106 | cut = (AliRsnCutSet *) fCuts.At(iParticle); |
c865cb1d | 107 | if (!cut) continue; |
108 | cutName = cut->GetName(); | |
109 | if (!cutName.IsNull()) { | |
110 | if (!cut->IsSelected(d)) continue; | |
111 | if (d->IsPos()) { | |
547e2d97 | 112 | el = (TEntryList *)fIdParticles[0].At(iParticle); |
c865cb1d | 113 | el->Enter(id); |
114 | } else if (d->IsNeg()) { | |
547e2d97 | 115 | el = (TEntryList *)fIdParticles[1].At(iParticle); |
c865cb1d | 116 | el->Enter(id); |
117 | } | |
118 | } | |
119 | } | |
120 | } |