+/********************************************************************/
+
+AliHBTEvent* AliHBTReader::GetParticleEvent(Int_t n)
+ {
+ //returns Nth event with simulated particles
+ if (ReadsParticles() == kFALSE)
+ {
+ Error("GetParticleEvent","This reader is not able to provide simulated particles.");
+ return 0;
+ }
+
+ if (!fIsRead)
+ {
+ if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+ if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+
+ if (Read(fParticles,fTracks))
+ {
+ Error("GetParticleEvent","Error in reading");
+ return 0x0;
+ }
+ else fIsRead = kTRUE;
+ }
+ return fParticles->GetEvent(n);
+ }
+/********************************************************************/
+
+AliHBTEvent* AliHBTReader::GetTrackEvent(Int_t n)
+ {
+ //returns Nth event with reconstructed tracks
+ if (ReadsTracks() == kFALSE)
+ {
+ Error("GetTrackEvent","This reader is not able to provide recosntructed tracks.");
+ return 0;
+ }
+ if (!fIsRead)
+ {
+ if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+ if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+
+ if(Read(fParticles,fTracks))
+ {
+ Error("GetTrackEvent","Error in reading");
+ return 0x0;
+ }
+ else fIsRead = kTRUE;
+ }
+ return fTracks->GetEvent(n);
+ }
+/********************************************************************/
+
+Int_t AliHBTReader::GetNumberOfPartEvents()
+ {
+ //returns number of events of particles
+ if (ReadsParticles() == kFALSE)
+ {
+ Error("GetNumberOfPartEvents","This reader is not able to provide simulated particles.");
+ return 0;
+ }
+
+ if (!fIsRead)
+ {
+ if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+ if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+
+ if (Read(fParticles,fTracks))
+ {
+ Error("GetNumberOfPartEvents","Error in reading");
+ return 0;
+ }
+ else fIsRead = kTRUE;
+ }
+ return fParticles->GetNumberOfEvents();
+ }
+/********************************************************************/
+
+Int_t AliHBTReader::GetNumberOfTrackEvents()
+ {
+ //returns number of events of tracks
+ if (ReadsTracks() == kFALSE)
+ {
+ Error("GetNumberOfTrackEvents","This reader is not able to provide recosntructed tracks.");
+ return 0;
+ }
+ if (!fIsRead)
+ {
+ if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+ if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+
+ if(Read(fParticles,fTracks))
+ {
+ Error("GetNumberOfTrackEvents","Error in reading");
+ return 0;
+ }
+ else fIsRead = kTRUE;
+ }
+ return fTracks->GetNumberOfEvents();
+ }
+/********************************************************************/