]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliReaderAOD.h
PAR: pass proper defines for certain ROOT features
[u/mrichter/AliRoot.git] / ANALYSIS / AliReaderAOD.h
1 #ifndef ALIREADERAOD_H
2 #define ALIREADERAOD_H
3 //______________________________________________________________________________
4 ////////////////////////////////////////////////////////////////////////////////
5 //                                                                            //
6 // class AliReaderAOD                                                         //
7 //                                                                            //
8 // Reader and Writer for AOD format.                                          //
9 // AODs are stored in a tree named by the variable fgkTreeName.               //
10 // There is stored 1 or 2 branches. Each of them stores AOD objects           //
11 // First branch is named by the variable fgkReconstructedDataBranchName       //
12 // ("reconstructed.") and keeps reconstructed data.                           //
13 // Second branch is called by the variable fgkSimulatedDataBranchName         //
14 // ("simulated.") and stores Monte carlo truth. If both branches are present  //
15 // AODs are parallel, i.e. nth particle in one branch corresponds to the nth  //
16 // particle in the other one.                                                 //
17 //                                                                            //
18 // Since we accept different formats of particles that are stored in AODs     //
19 // reader must take care of that fact: clean buffer if the next file contains //
20 // different particle type.                                                   //
21 //                                                                            //
22 // If no cuts are specified in a reader, it reuturns pointer to the           //
23 // buffers. In the other case data are copied to the onother AOD (filtering   //
24 // out particles that do not pass a cut), thus reading is slower.             //
25 //                                                                            //
26 // Piotr.Skowronski@cern.ch                                                   //
27 //                                                                            //
28 ////////////////////////////////////////////////////////////////////////////////
29
30
31
32 #include "AliReader.h"
33
34 class TTree;
35 class TFile;
36
37 class AliReaderAOD: public AliReader
38 {
39   public:
40     AliReaderAOD(const Char_t* aodfilename = "AOD.root");
41     virtual ~AliReaderAOD();
42
43     void          ReadSimulatedData(Bool_t flag){fReadSim = flag;}//switches reading MC data
44     void          ReadReconsructedData(Bool_t flag){fReadRec = flag;}//switches reading MC data
45     Bool_t        ReadsRec() const {return fReadRec;}
46     Bool_t        ReadsSim() const {return fReadSim;}
47
48     void          Rewind();
49
50
51     static Int_t WriteAOD(AliReader* reader, const char* outfilename = "AliAOD.root", //reads tracks from runs and writes them to file
52                           const char* pclassname = "AliAODParticle", Bool_t multcheck = kFALSE);
53     
54   protected:
55     virtual Int_t         ReadNext();
56     virtual Int_t         OpenFile(Int_t evno);//opens files to be read for given event
57     
58     virtual Int_t         ReadRecAndSim();
59     virtual Int_t         ReadRec();
60     virtual Int_t         ReadSim();
61     
62     static const TString  fgkTreeName;//name of branch holding simulated data
63     static const TString  fgkReconstructedDataBranchName;//name of branch holding reconstructed data
64     static const TString  fgkSimulatedDataBranchName;//name of branch holding simulated data
65     
66   
67   private:
68     TString fFileName;//File name
69     
70     Bool_t  fReadSim;//indicates if to read simulated data
71     Bool_t  fReadRec;//indicates if to read simulated data
72
73     TTree*        fTree;//!tree
74     TFile*        fFile;//!file
75     AliAOD*       fSimBuffer;//!buffer array that tree is read to
76     AliAOD*       fRecBuffer;//!
77     
78     AliReaderAOD(const AliReaderAOD&); // Not implemented
79     AliReaderAOD& operator=(const AliReaderAOD&); // Not implemented
80     
81     ClassDef(AliReaderAOD,1)
82 };
83
84 #endif