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 ReadsRec() const; specifies if reader is able to read simulated particles
41 // Bool_t ReadsSim() 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>
58 class AliAODParticleCut;
59 class AliVAODParticle;
63 class AliReader: public TNamed
67 AliReader(TObjArray*);
68 AliReader(const AliReader& in);
71 AliReader& operator=(const AliReader& in);
74 virtual void Rewind() = 0; //
76 virtual Bool_t ReadsSim() const = 0; //specifies if reader is able to read simulated particles
77 virtual Bool_t ReadsRec() const = 0;//specifies if reader is able to read reconstructed tracks
79 void AddParticleCut(AliAODParticleCut* cut);//adds a particle cut to the list of cuts
81 virtual AliAOD* GetEventRec() const {return fEventRec;}//returns current event with reconstructed tracks
82 virtual AliAOD* GetEventSim() const {return fEventSim;}//returns current event with simulated particles
84 virtual AliAOD* GetEventRec(Int_t n);//returns event number n
85 virtual AliAOD* GetEventSim(Int_t n);
87 virtual Int_t Read(AliAODRun* particles, AliAODRun *tracks);//Reads all available evenets and stores them in 'particles' and 'tracks'
89 virtual Int_t GetNumberOfRecEvents();//Returns number of available events -> usually conncected with reading all events
90 //may be time consuming
91 virtual Int_t GetNumberOfSimEvents();//
93 void SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names
94 void SetEventBuffering(Bool_t flag){fBufferEvents = flag;}//switches on/off buffering - read data are kept in local buffer
95 void SetBlend(Bool_t flag = kTRUE){fBlend=flag;} //set blending - randomizing particle order
96 virtual Int_t GetNumberOfDirs() const {return (fDirs)?fDirs->GetEntries():0;}
97 void ReadEventsFromTo(Int_t first,Int_t last){fFirst = first; fLast = last;}
98 virtual TH1I* GetTrackCounter() const {return fTrackCounter;}
99 virtual void WriteTrackCounter() const;//Writes the track counting histigram
103 TObjArray* fCuts;//array with particle cuts
104 TObjArray* fDirs;//arry with directories to read data from
106 Int_t fCurrentEvent;//! number of current event in current directory
107 Int_t fCurrentDir;//! number of current directory
109 Int_t fNEventsRead;//!total
111 AliAOD* fEventRec; //! tracks read from current event
112 AliAOD* fEventSim; //! particles read from current event
114 AliAODRun* fRunSim; //!simulated particles
115 AliAODRun* fRunRec; //!reconstructed tracks
117 Bool_t fIsRead;//!flag indicating if the data are already read
118 Bool_t fBufferEvents;//flag indicating if the data should be bufferred
120 Bool_t fBlend;// flag indicating if randomly change positions of the particles after reading
122 Int_t fFirst;//first event to return (all before are skipped)
123 Int_t fLast;//the last one
125 TH1I* fTrackCounter; //histogram with number of tracks read
127 virtual Int_t ReadNext() = 0; //this methods reads next event and put result in fTracksEvent and/or fParticlesEvent
128 Bool_t Rejected(AliVAODParticle* p);//Checks if a given particle agains cuts
129 Bool_t Rejected(Int_t pid);//Checks if a given pid passes cuts
130 void Blend();//Mixes current events in a symmetric way so after mixing thy are consistent
132 TString GetDirName(Int_t entry);
136 ClassDef(AliReader,1)//