Updating Event Randomizer to new reader schema
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Aug 2003 07:33:03 +0000 (07:33 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Aug 2003 07:33:03 +0000 (07:33 +0000)
HBTAN/AliHBTEvent.cxx
HBTAN/AliHBTPositionRandomizer.cxx
HBTAN/AliHBTPositionRandomizer.h
HBTAN/AliHBTReader.h

index fd2e0937575dab478bee650cf57092e31950ec4c..c43bdea9c0f81106b73440666e0587373fec9c7a 100644 (file)
@@ -96,6 +96,7 @@ void  AliHBTEvent::Reset()
        }
     }
    fNParticles = 0;
+   fRandomized = kFALSE;
 } 
 /**************************************************************************/ 
 
index a76923ff0dbd0b5074919a640851e6543444399a..7fa85b490dcc5e9954e4a6899c890ecefb10cb06 100644 (file)
@@ -37,8 +37,29 @@ AliHBTPositionRandomizer::AliHBTPositionRandomizer(AliHBTReader* reader):
 } 
 /*********************************************************************/
 
+AliHBTEvent* AliHBTPositionRandomizer::GetParticleEvent() 
+{
+ // gets from fReader and randomizes current particle event
+ if (fReader == 0x0) return 0x0;
+ AliHBTEvent *e =  fReader->GetParticleEvent();
+ if (e->IsRandomized() == kFALSE) Randomize(e);
+ return e;
+}
+/*********************************************************************/
+
+AliHBTEvent* AliHBTPositionRandomizer::GetTrackEvent() 
+{
+ // gets from fReader and randomizes current track event
+ if (fReader == 0x0) return 0x0;
+ AliHBTEvent *e =  fReader->GetTrackEvent();
+ if (e->IsRandomized() == kFALSE) Randomize(e);
+ return e;
+}
+/*********************************************************************/
+
 Int_t AliHBTPositionRandomizer::Read(AliHBTRun* particles, AliHBTRun *tracks)
 {
+  //Reads all available events and randomizes them
   if (fReader == 0x0) return 1;
   Info("Randomize(AliHBTRun*)","");
   Int_t err = fReader->Read(particles,tracks);
index 16cbb9037e957c6369193148d9dfa8f58b92c1f7..a8a062b23ef28fde9e7fd7d4568170378c0b720a 100644 (file)
@@ -15,7 +15,16 @@ class AliHBTPositionRandomizer: public AliHBTReader
    AliHBTPositionRandomizer();
    AliHBTPositionRandomizer(AliHBTReader* reader);
    
-   Int_t Read(AliHBTRun* particles, AliHBTRun *tracks);
+   Int_t  Next(){return (fReader)?fReader->Next():1;}
+   void   Rewind(){if(fReader) fReader->Rewind();}
+   
+   Bool_t ReadsTracks() const {return (fReader)?fReader->ReadsTracks():kFALSE;}
+   Bool_t ReadsParticles() const {return (fReader)?fReader->ReadsParticles():kFALSE;}
+   
+   Int_t  Read(AliHBTRun* particles, AliHBTRun *tracks);
+   
+   AliHBTEvent* GetParticleEvent() ;
+   AliHBTEvent* GetTrackEvent() ;
 
    AliHBTEvent* GetParticleEvent(Int_t n);
    AliHBTEvent* GetTrackEvent(Int_t n){return (fReader)?fReader->GetTrackEvent(n):0x0;}
@@ -32,6 +41,7 @@ class AliHBTPositionRandomizer: public AliHBTReader
    
  protected:
    void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p);
+   Int_t ReadNext(){return (fReader)?fReader->Next():1;}
  private:
    AliHBTReader* fReader;
    AliHBTRndm*   fRandomizer;
index a121fe2ba3357a142b9d749dd0885226a7eb7ef0..e7a1cfaf5b7beb9d0b22dae5a35a7c26a417f16f 100644 (file)
@@ -31,8 +31,8 @@ class AliHBTReader: public TNamed
     
     virtual Int_t        Read(AliHBTRun* particles, AliHBTRun *tracks);
     
-    virtual AliHBTEvent* GetParticleEvent() const {return fParticlesEvent;}
-    virtual AliHBTEvent* GetTrackEvent() const {return fTracksEvent;}
+    virtual AliHBTEvent* GetParticleEvent() {return fParticlesEvent;}//can not be const because position randomizer overloads it
+    virtual AliHBTEvent* GetTrackEvent() {return fTracksEvent;}//
     
     virtual AliHBTEvent* GetParticleEvent(Int_t);
     virtual AliHBTEvent* GetTrackEvent(Int_t);