]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliDataLoader.h
Added methods to set/get centrailty from clusters in outer layer, which is less noisy...
[u/mrichter/AliRoot.git] / STEER / AliDataLoader.h
1 #ifndef ALIDATALOADER_H
2 #define ALIDATALOADER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //__________________________________________
9 ////////////////////////////////////////////
10 //                                        //
11 //  class AliDataLoader                   //
12 //                                        //
13 //  Loader responsible for one data type  //
14 //  i.e. Hits, Kine, etc.                 //
15 //  many objects type can be assciated    //
16 //  with one data type: storing object    //
17 //  (usually tree), task producing it,    //
18 //  Quality Assurance(QA), QA Task, and   //
19 //  others.                               //
20 //                                        //
21 //                                        //
22 ////////////////////////////////////////////
23
24 #include <TDirectory.h>
25 #include <TNamed.h>
26 #include <TString.h>
27 class TTask;
28 class TTree;
29 class TFile;
30 class TFolder;
31
32 class AliBaseLoader;
33 class AliLoader;
34 class AliObjectLoader;
35 class AliRunLoader;
36 class AliTaskLoader;
37 class AliTreeLoader;
38
39 class AliDataLoader: public TNamed
40  {
41   public:
42    AliDataLoader();
43    AliDataLoader(const char* filename, const char* contname, const char* name, Option_t* opt = "t");
44    virtual ~AliDataLoader();
45
46    virtual Int_t      SetEvent();
47    virtual Int_t      GetEvent();
48
49    //shrtcuts method to basic data base loader 0  
50    virtual Int_t      Load(Option_t* opt="");
51    virtual void       Unload();
52    virtual Int_t      Reload(); 
53    virtual Int_t      WriteData(Option_t* opt="");
54    virtual TTree*     Tree() const;
55    virtual void       Clean();
56    virtual void       MakeTree();
57    virtual Int_t      OpenFile(Option_t* opt);
58
59    virtual void       CloseFile();
60    void               UnloadAll();
61    void               CleanAll();
62    const TString&     GetFileName() const {return fFileName;}
63    TFile*             GetFile() const {return fFile;}
64    TDirectory*        GetDirectory() const {return fDirectory;}
65    const TString&     GetFileOption() const {return fFileOption;}
66    const Int_t&       GetCompressionLevel() const {return fCompressionLevel;}
67    
68    Bool_t             Cd(){return (fDirectory)?fDirectory->cd():kFALSE;}
69    
70    virtual void       SetFileName(const TString& filename){fFileName = filename;}
71    virtual void       SetFileOption(const Option_t* fileopt);
72    virtual void       SetCompressionLevel(Int_t cl);
73
74    Int_t              SetEventFolder(TFolder* eventfolder);//sets the event folder
75    Int_t              SetFolder(TFolder* folder);//sets the data folder ??????
76    TFolder*           GetEventFolder();
77    TFolder*           GetFolder() const {return fFolder;}
78    
79 //   TObject*           GetFromDirectory(const char *name){return (fDirectory)?fDirectory->Get(name):0x0;}
80    void               SetFileNameSuffix(const TString& suffix);//adds the suffix before ".root", 
81                                                                //e.g. TPC.Digits.root -> TPC.DigitsMerged.root
82                                                                //made on Jiri Chudoba demand
83    void               SetNumberOfEventsPerFile(Int_t nevpf) 
84      {fNEventsPerFile = nevpf;}
85    const TString      SetFileOffset(const TString& fname);//adds the proper number before .root extension suffix
86    void               SetDirName(TString& dirname);
87
88    void               AddBaseLoader(AliBaseLoader* bl);
89    enum EStdBasicLoaders {kData = 0,kTask,kQA,kQATask};//standard basic loaders identifiers
90
91    AliBaseLoader*     GetBaseLoader(const TString& name) const;
92    AliBaseLoader*     GetBaseLoader(Int_t n) const;
93    AliObjectLoader*   GetBaseDataLoader();
94    AliTaskLoader*     GetBaseTaskLoader();
95    AliBaseLoader*     GetBaseQALoader();
96    AliTaskLoader*     GetBaseQATaskLoader();
97    
98    void               SetBaseDataLoader(AliBaseLoader* bl);
99    void               SetBaseTaskLoader(AliTaskLoader* bl);
100    void               SetBaseQALoader(AliBaseLoader* bl);
101    void               SetBaseQATaskLoader(AliTaskLoader* bl);
102    
103    Bool_t             CheckReload();//checks if we have to reload given file
104    Bool_t             IsFileWritable() const;
105    Bool_t             IsFileOpen() const;
106    Bool_t             IsOptionContrary(const TString& option) const;
107    
108    void Synchronize();
109
110   protected:
111    AliRunLoader*      GetRunLoader();//gets the run-loader from event folder
112
113   private:
114    AliDataLoader(const AliDataLoader&); //Not implemented
115    AliDataLoader& operator=(const AliDataLoader&); //Not implemented
116       
117    TString      fFileName; //name of the file 
118    TFile*       fFile; //! pointer to file 
119    TDirectory*  fDirectory; //!pointer to TDirectory
120    TString      fFileOption; //!file option while opened 
121    Int_t        fCompressionLevel; //Compression Level of File
122    Int_t        fNEventsPerFile;  //defines number of events stored per one file
123    
124    TObjArray*   fBaseLoaders;//base loaders
125    Bool_t       fHasTask;// flag if has a task
126    TString      fTaskName;// name of the task
127    TTask*       fParentalTask;//Parental task
128
129    TFolder*     fEventFolder;//!event folder
130    TFolder*     fFolder;//! folder with data
131    
132    ClassDef(AliDataLoader,2)
133  };
134
135 #endif
136
137