]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTReader.h
Coding violations corrected
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReader.h
1 #ifndef ALIHBTREADER_H
2 #define ALIHBTREADER_H
3 //_________________________________________________________________________
4 ///////////////////////////////////////////////////////////////////////////
5 //
6 // class AliHBTReader
7 //
8 // Reader Base class (reads particles and tracks and
9 // puts it to the AliHBTRun objects
10 //
11 // Piotr.Skowronski@cern.ch
12 ///////////////////////////////////////////////////////////////////////////
13
14 #include <TNamed.h>
15 #include <TObjArray.h>
16
17 class AliHBTRun;
18 class AliHBTEvent;
19 class AliHBTParticleCut;
20 class AliHBTParticle;
21 class TString;
22 class TH1I;
23  
24 class AliHBTReader: public TNamed
25 {
26   public:
27     AliHBTReader();
28     AliHBTReader(TObjArray*);
29     AliHBTReader(const AliHBTReader& in);
30     virtual ~AliHBTReader();
31     
32     AliHBTReader& operator=(const AliHBTReader& in);
33         
34     virtual Int_t        Next();
35     virtual void         Rewind() = 0; //
36     
37     virtual Bool_t       ReadsTracks() const = 0; //specifies if reader is able to read simulated particles
38     virtual Bool_t       ReadsParticles() const = 0;//specifies if reader is able to read reconstructed tracks
39     
40     void                 AddParticleCut(AliHBTParticleCut* cut);
41     
42     virtual Int_t        Read(AliHBTRun* particles, AliHBTRun *tracks);
43     
44     virtual AliHBTEvent* GetParticleEvent() {return fParticlesEvent;}//can not be const because position randomizer overloads it
45     virtual AliHBTEvent* GetTrackEvent() {return fTracksEvent;}//
46     
47     virtual AliHBTEvent* GetParticleEvent(Int_t n);
48     virtual AliHBTEvent* GetTrackEvent(Int_t n);
49     
50     virtual Int_t        GetNumberOfPartEvents();
51     virtual Int_t        GetNumberOfTrackEvents();
52     
53     void                 SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names
54     void                 SetEventBuffering(Bool_t flag){fBufferEvents = flag;}//switches on/off buffering - read data are kept in local buffer
55     void          SetBlend(Bool_t flag = kTRUE){fBlend=flag;} //set blending - randomizing particle order
56     virtual Int_t GetNumberOfDirs() const {return (fDirs)?fDirs->GetEntries():0;}
57     void          ReadEventsFromTo(Int_t first,Int_t last){fFirst = first; fLast = last;}
58     virtual TH1I* GetTrackCounter() const {return fTrackCounter;}
59     virtual void  WriteTrackCounter() const;
60     
61   protected:
62     
63     TObjArray*    fCuts;//array with particle cuts
64     TObjArray*    fDirs;//arry with directories to read data from
65     
66     Int_t         fCurrentEvent;//!  number of current event in current directory
67     Int_t         fCurrentDir;//! number of current directory
68     
69     Int_t         fNEventsRead;//!total 
70         
71     AliHBTEvent*  fTracksEvent;    //! tracks read from current event
72     AliHBTEvent*  fParticlesEvent; //! particles read from current event
73     
74     AliHBTRun*    fParticles; //!simulated particles
75     AliHBTRun*    fTracks; //!reconstructed tracks (particles)
76     
77     Bool_t        fIsRead;//!flag indicating if the data are already read
78     Bool_t        fBufferEvents;//flag indicating if the data should be bufferred
79     
80     Bool_t        fBlend;// flag indicating if randomly change positions of the particles after reading
81     
82     Int_t         fFirst;//first event to return (all are before are skipped)
83     Int_t         fLast;//last
84
85     TH1I*         fTrackCounter; //histogram with number of tracks read
86     
87     virtual Int_t ReadNext() = 0; //this methods reads next event and put result in fTracksEvent and/or fParticlesEvent
88     Bool_t Rejected(AliHBTParticle* p);
89     Bool_t Rejected(Int_t pid);
90     void Blend();
91     
92     TString& GetDirName(Int_t entry);
93     
94   private:
95   
96     ClassDef(AliHBTReader,4)//version 2 - TNamed as parental class
97                             //version 3 - Blending added
98 };
99
100 #endif