- }
- Info("Read"," Read: %d particles.",counter);
- }
- else Info("Read"," Read: 0 particles.");
-
- if (trackbranch)
- {
- for(i = 0; i < tbuffer->GetEntries(); i++)
- {
- tpart = dynamic_cast<AliHBTParticle*>(tbuffer->At(i));
- if(tpart == 0x0) continue; //if returned pointer is NULL
- for (Int_t s = 0; s < tpart->GetNumberOfPids(); s++)
+ fParticlesEvent->AddParticle(part);
+ counter++;
+ }
+ }
+ Info("ReadNext"," Read: %d particles.",counter);
+ }
+ else Info("ReadNext"," Read: 0 particles.");
+
+ if (fTrackBranch)
+ {
+ Info("ReadNext","Found %d tracks in total.",fTrackBuffer->GetEntries());
+ for(i = 0; i < fTrackBuffer->GetEntries(); i++)
+ {
+ ttrack = dynamic_cast<AliHBTParticle*>(fTrackBuffer->At(i));
+ if( ttrack == 0x0 ) continue; //if returned pointer is NULL
+
+ for (Int_t s = 0; s < ttrack->GetNumberOfPids(); s++)
+ {
+ if( Pass(ttrack->GetNthPid(s)) ) continue; //check if we are intersted with particles of this type
+ //if not take next partilce
+ TParticlePDG* pdgp = pdgdb->GetParticle(ttrack->GetNthPid(s));
+ if (pdgp == 0x0)//PDG part corresponding to new incarnation
+ {
+ Error("ReadNext","Particle code unknown to PDG DB.");
+ continue;
+ }
+ AliHBTParticle* track = new AliHBTParticle(*ttrack);
+
+ //apart of setting PDG code of an incarnation
+ //it is necessary tu recalculate energy on the basis of
+ //new PDG code (mass) hypothesis
+ Double_t mass = pdgp->Mass();//mass of new incarnation
+ Double_t tEtot = TMath::Sqrt( ttrack->Px()*ttrack->Px() +
+ ttrack->Py()*ttrack->Py() +
+ ttrack->Pz()*ttrack->Pz() +
+ mass*mass);//total energy of the new incarnation
+ //update Energy and Calc Mass
+ track->SetMomentum(ttrack->Px(),ttrack->Py(),ttrack->Pz(),tEtot);
+ track->SetCalcMass(mass);
+ track->SetPdgCode(ttrack->GetNthPid(s),ttrack->GetNthPidProb(s));
+
+ if( Pass(track) )