- if (fNoPID) delete fNoPID;
- if (fPerfectPID) delete fPerfectPID;
- if (fRealisticPID) delete fRealisticPID;
- fNoPID = new AliRsnPIDIndex(arraySizeInit);
- fPerfectPID = new AliRsnPIDIndex(arraySizeInit);
- fRealisticPID = new AliRsnPIDIndex(arraySizeInit);
-
- // set the default type to Realistic
- AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
-
- // loop on tracks and create references
- Double_t prob;
- Int_t i, icharge, type;
- Short_t charge;
- AliRsnMCInfo *mcinfo = 0;
- AliRsnDaughter *track = 0;
- TObjArrayIter iter(fTracks);
- while ((track = (AliRsnDaughter*) iter.Next()))
- {
- charge = track->Charge();
- type = (Int_t) track->PIDType(prob);
- i = fTracks->IndexOf(track);
- mcinfo = track->GetMCInfo();
- if (charge > 0) icharge = 0;
- else if (charge < 0) icharge = 1;
- else
- {
- AliError("Found particle with ZERO charge!!!");
- continue;
- }
- // add to charged array
- fNoPID->AddIndex(i, icharge, (Int_t) AliRsnPID::kUnknown);
- // add to realistic PID array
- fRealisticPID->AddIndex(i, icharge, (Int_t) type);
- // add to perfect PID array (needs MCInfo present)
- if (mcinfo)
- {
- fPerfectPID->AddIndex(i, icharge, (Int_t) AliRsnPID::InternalType(mcinfo->PDG()));
+ Int_t i, nTracks = fRef->GetNumberOfTracks();
+ AliRsnDaughter output;
+
+ for (i = 0; i < nTracks; i++) {
+ AliRsnDaughter track = GetDaughter(i);
+ if (!AcceptTrackPID(&track, type)) continue;
+ if (track.Pt() < ptMin) continue;
+ if (!output.IsOK() || track.Pt() > output.Pt()) {
+ output = track;
+ output.SetGood();