1 #include <TEntryList.h>
6 #include "AliRsnCutSet.h"
8 #include "AliRsnPIDManager.h"
10 ClassImp(AliRsnPIDManager)
12 //_____________________________________________________________________________
13 AliRsnPIDManager::AliRsnPIDManager(const char *name, const char *title) : TNamed(name, title)
16 // Default constructor.
18 AliDebug(AliLog::kDebug + 10, "<-");
19 AliDebug(AliLog::kDebug + 10, "->");
22 //_____________________________________________________________________________
23 AliRsnPIDManager::~AliRsnPIDManager()
28 AliDebug(AliLog::kDebug + 10, "<-");
29 for (Int_t iCharge = 0; iCharge < 2; iCharge++) fIdParticles[iCharge].Delete();
30 AliDebug(AliLog::kDebug + 10, "->");
33 void AliRsnPIDManager::Print(Option_t *option) const
35 TNamed::Print(option);
39 for (Int_t iCharge = 0; iCharge < 2; iCharge++) {
40 for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) {
41 cut = (AliRsnCutSet *) fCuts.At(iParticle);
43 el = (TEntryList *)fIdParticles[iCharge].At(iParticle);
44 if (el) AliInfo(Form("%d %d %lld %s", iCharge, iParticle, el->GetN(), cut->GetName()));
49 void AliRsnPIDManager::Init()
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));
60 void AliRsnPIDManager::Reset()
63 for (Int_t iCharge = 0; iCharge < 2; iCharge++) {
64 for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) {
65 el = (TEntryList *)fIdParticles[iCharge].At(iParticle);
72 TEntryList *AliRsnPIDManager::GetParticles(const Int_t &charge, const Int_t &pidId)
74 return (TEntryList *)fIdParticles[charge].At(pidId);
77 void AliRsnPIDManager::SetCut(AliRsnCutSet *cut, const Int_t &pidId)
80 if (!fCuts.GetEntriesFast()) Init();
81 fCuts.AddAt(cut, pidId);
84 void AliRsnPIDManager::ApplyCuts(AliRsnEvent *ev)
87 // Loop over event and add entruies to entry list
88 Int_t numTracks = ev->GetRefESD()->GetNumberOfTracks();
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);
99 void AliRsnPIDManager::CheckTrack(AliRsnDaughter *d, const Int_t &id)
104 for (Int_t iParticle = 0; iParticle < AliPID::kSPECIES; iParticle++) {
106 cut = (AliRsnCutSet *) fCuts.At(iParticle);
108 cutName = cut->GetName();
109 if (!cutName.IsNull()) {
110 if (!cut->IsSelected(d)) continue;
112 el = (TEntryList *)fIdParticles[0].At(iParticle);
114 } else if (d->IsNeg()) {
115 el = (TEntryList *)fIdParticles[1].At(iParticle);