Implemented restricting event subrange to read
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 6 Sep 2003 15:03:27 +0000 (15:03 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 6 Sep 2003 15:03:27 +0000 (15:03 +0000)
HBTAN/AliHBTReader.cxx
HBTAN/AliHBTReader.h

index fd4d25d..b6edaa3 100644 (file)
@@ -26,7 +26,10 @@ AliHBTReader::AliHBTReader():
  fParticles(0x0),
  fTracks(0x0),
  fIsRead(kFALSE),
- fBufferEvents(kFALSE)
+ fBufferEvents(kFALSE),
+ fBlend(kFALSE),
+ fFirst(0),
+ fLast(0)
 {
 //constructor
 }
@@ -43,7 +46,10 @@ AliHBTReader::AliHBTReader(TObjArray* dirs):
  fParticles(0x0),
  fTracks(0x0),
  fIsRead(kFALSE),
- fBufferEvents(kFALSE)
+ fBufferEvents(kFALSE),
+ fBlend(kFALSE),
+ fFirst(0),
+ fLast(0)
 {
 //ctor with array of directories to read as parameter
 }
@@ -65,17 +71,22 @@ AliHBTReader::~AliHBTReader()
 Int_t AliHBTReader::Next()
 {
 //moves to next event
-  if ( ReadNext() == kTRUE)
-     return kTRUE;
+  if ((fNEventsRead > fLast) && (fLast > 0) )
+   
+  do
+   {
+    if ( ReadNext() == kTRUE)
+      return kTRUE;
+   }while (fNEventsRead < fFirst);
   
   if (fBlend) Blend();
   
   if (fBufferEvents)
    {
      if ( ReadsTracks() && fTracksEvent) 
-       fTracks->SetEvent(fNEventsRead-1,fTracksEvent);
+       fTracks->SetEvent(fNEventsRead-1-fFirst,fTracksEvent);
      if ( ReadsParticles() && fParticlesEvent)
-       fParticles->SetEvent(fNEventsRead-1,fParticlesEvent);
+       fParticles->SetEvent(fNEventsRead-1-fFirst,fParticlesEvent);
    }
   return kFALSE;
 }
index e986b8d..f9c250d 100644 (file)
@@ -44,6 +44,7 @@ class AliHBTReader: public TNamed
     void                 SetEventBuffering(Bool_t flag){fBufferEvents = flag;}
     void          SetBlend(Bool_t flag = kTRUE){fBlend=flag;}
     virtual Int_t GetNumberOfDirs() const {return (fDirs)?fDirs->GetEntries():0;}
+    void          ReadEventsFromTo(Int_t first,Int_t last){fFirst = first; fLast = last;}
   protected:
     
     TObjArray*    fCuts;//array with particle cuts
@@ -64,6 +65,10 @@ class AliHBTReader: public TNamed
     Bool_t        fBufferEvents;//flag indicating if the data should be bufferred
     
     Bool_t        fBlend;// flag indicating if randomly change positions of the particles after reading
+    
+    Int_t         fFirst;//first event to return (all are before are skipped)
+    Int_t         fLast;//last
+    
     virtual Int_t ReadNext() = 0; //this methods reads next event and put result in fTracksEvent and/or fParticlesEvent
     Bool_t Pass(AliHBTParticle*);
     Bool_t Pass(Int_t pid);