3 //_________________________________________________________________________
4 ///////////////////////////////////////////////////////////////////////////
9 // Reads particles and tracks and
10 // puts them to the AliAOD objects and eventually, if needed, buffers AliAODs in AliAODRun(s)
12 // User loops over events calling method Next. In case of success this method returns 0.
13 // In case of error or if there is no more events to read, non-0 value is returned
15 // Reading can be rewound to the beginning using method Rewind.
17 // Tracks are read to the fEventRec (contains reconstructed tracks)
18 // and fEventSim (corresponding MC simulated data) data members,
19 // that are of the type AliAOD.
21 // If a given reader has ability of reading both, reconstructed and simulated data,
22 // these are structured in AODs so a "n'th" simulated particle
23 // (the one stored in the fEventSim at slot n)
24 // corresponds to the n'th reconstructed track (the one stored in the fEventRec at slot n).
26 // The same reconstructed track can be present more than ones in the AOD,
27 // but with a different PID. In this case
28 // pointer to the corresponding MC simulated particles is also present more than ones.
29 // This situation happens if you want to read all particles
30 // with PID probability of being , e.g., pion higher than 60%
31 // and being kaon higher than 40%. Than, if a given track has probability Ppid(pi)=52% and Ppid(K)=48%
32 // than it is read twise.
34 // Provides functionality for both buffering and non-buffering reading
35 // This can be switched on/off via method SetEventBuffering(bool)
36 // The main method that inheriting classes need to implement is ReadNext()
37 // that read next event in queue.
40 // Bool_t ReadsSim() const; specifies if reader is able to read simulated particles
41 // Bool_t ReadsRec() const; specifies if reader is able to read reconstructed tracks
42 // void Rewind(); rewind reading to the beginning
44 // This class provides full functionality for reading from many sources
45 // User can provide TObjArray of TObjStrings (SetDirs method or via parameter
46 // in the constructor) which desribes paths of directories to search data in.
47 // If none specified current directory is searched.
49 // Piotr.Skowronski@cern.ch
51 ///////////////////////////////////////////////////////////////////////////
54 #include <TObjArray.h>
56 class TGliteXmlEventlist;
60 class AliAODParticleCut;
61 class AliVAODParticle;
65 class AliReader: public TNamed
69 AliReader(TObjArray*);
70 AliReader(const AliReader& in);
73 AliReader& operator=(const AliReader& in);
76 virtual void Rewind() = 0; //
78 virtual Bool_t ReadsSim() const = 0; //specifies if reader is able to read simulated particles
79 virtual Bool_t ReadsRec() const = 0;//specifies if reader is able to read reconstructed tracks
81 void AddParticleCut(AliAODParticleCut* cut);//adds a particle cut to the list of cuts
83 virtual AliAOD* GetEventRec() const {return fEventRec;}//returns current event with reconstructed tracks
84 virtual AliAOD* GetEventSim() const {return fEventSim;}//returns current event with simulated particles
86 virtual AliAOD* GetEventRec(Int_t n);//returns event number n
87 virtual AliAOD* GetEventSim(Int_t n);
89 virtual Int_t Read(const char * name) {return TObject::Read(name);}
90 virtual Int_t Read(AliAODRun* particles, AliAODRun *tracks);//Reads all available evenets and stores them in 'particles' and 'tracks'
92 virtual Int_t GetNumberOfRecEvents();//Returns number of available events -> usually conncected with reading all events
93 //may be time consuming
94 virtual Int_t GetNumberOfSimEvents();//
96 void SetEventList(TGliteXmlEventlist* evl){fEventList = evl;}
98 void SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names
99 void SetEventBuffering(Bool_t flag){fBufferEvents = flag;}//switches on/off buffering - read data are kept in local buffer
100 void SetBlend(Bool_t flag = kTRUE){fBlend=flag;} //set blending - randomizing particle order
101 virtual Int_t GetNumberOfDirs() const {return (fDirs)?fDirs->GetEntries():0;}
102 void ReadEventsFromTo(Int_t first,Int_t last){fFirst = first; fLast = last;}
103 virtual TH1I* GetTrackCounter() const {return fTrackCounter;}
104 virtual void WriteTrackCounter() const;//Writes the track counting histigram
108 TGliteXmlEventlist* fEventList;//Event list delivered by GLite/AliEn
110 TObjArray* fCuts;//array with particle cuts
111 TObjArray* fDirs;//arry with directories to read data from
113 Int_t fCurrentEvent;//! number of current event in current directory
114 Int_t fCurrentDir;//! number of current directory
116 Int_t fNEventsRead;//!total
118 AliAOD* fEventRec; //! tracks read from current event
119 AliAOD* fEventSim; //! particles read from current event
121 AliAODRun* fRunSim; //!simulated particles
122 AliAODRun* fRunRec; //!reconstructed tracks
124 Bool_t fIsRead;//!flag indicating if the data are already read
125 Bool_t fBufferEvents;//flag indicating if the data should be bufferred
127 Bool_t fBlend;// flag indicating if randomly change positions of the particles after reading
129 Int_t fFirst;//first event to return (all before are skipped)
130 Int_t fLast;//the last one
132 TH1I* fTrackCounter; //histogram with number of tracks read
134 virtual Int_t ReadNext() = 0; //this methods reads next event and put result in fTracksEvent and/or fParticlesEvent
135 Bool_t Rejected(AliVAODParticle* p);//Checks if a given particle agains cuts
136 Bool_t Rejected(Int_t pid);//Checks if a given pid passes cuts
137 void Blend();//Mixes current events in a symmetric way so after mixing thy are consistent
139 TString GetDirName(Int_t entry);
143 ClassDef(AliReader,1)//