]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliDataLoader.h
Adding support for CINT7, CMSH7, CMUL7, CMUU7, CEMC7 triggers
[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 class TTask;
25 class TTree;
26 class TFile;
27 class TFolder;
28
29 class AliBaseLoader;
30 class AliLoader;
31 class AliObjectLoader;
32 class AliRunLoader;
33 class AliTaskLoader;
34 class AliTreeLoader;
35
36 #include <TDirectory.h>
37 #include <TNamed.h>
38 #include <TString.h>
39
40 class AliDataLoader: public TNamed
41  {
42   public:
43    AliDataLoader();
44    AliDataLoader(const char* filename, const char* contname, const char* name, Option_t* opt = "t");
45    virtual ~AliDataLoader();
46
47    virtual Int_t      SetEvent();
48    virtual Int_t      GetEvent();
49
50    //shrtcuts method to basic data base loader 0  
51    virtual Int_t      Load(Option_t* opt="");
52    virtual void       Unload();
53    virtual Int_t      Reload(); 
54    virtual Int_t      WriteData(Option_t* opt="");
55    virtual TTree*     Tree() const;
56    virtual void       Clean();
57    virtual void       MakeTree();
58    virtual Int_t      OpenFile(Option_t* opt);
59
60    virtual void       CloseFile();
61    void               UnloadAll();
62    void               CleanAll();
63    const TString&     GetFileName() const {return fFileName;}
64    TFile*             GetFile() const {return fFile;}
65    TDirectory*        GetDirectory() const {return fDirectory;}
66    const TString&     GetFileOption() const {return fFileOption;}
67    const Int_t&       GetCompressionLevel() const {return fCompressionLevel;}
68    
69    Bool_t             Cd(){return (fDirectory)?fDirectory->cd():kFALSE;}
70    
71    virtual void       SetFileName(const TString& filename){fFileName = filename;}
72    virtual void       SetFileOption(const Option_t* fileopt);
73    virtual void       SetCompressionLevel(Int_t cl);
74
75    Int_t              SetEventFolder(TFolder* eventfolder);//sets the event folder
76    Int_t              SetFolder(TFolder* folder);//sets the data folder ??????
77    TFolder*           GetEventFolder();
78    TFolder*           GetFolder() const {return fFolder;}
79    
80 //   TObject*           GetFromDirectory(const char *name){return (fDirectory)?fDirectory->Get(name):0x0;}
81    void               SetFileNameSuffix(const TString& suffix);//adds the suffix before ".root", 
82                                                                //e.g. TPC.Digits.root -> TPC.DigitsMerged.root
83                                                                //made on Jiri Chudoba demand
84    void               SetNumberOfEventsPerFile(Int_t nevpf) 
85      {fNEventsPerFile = nevpf;}
86    const TString      SetFileOffset(const TString& fname);//adds the proper number before .root extension suffix
87    void               SetDirName(TString& dirname);
88
89    void               AddBaseLoader(AliBaseLoader* bl);
90    enum EStdBasicLoaders {kData = 0,kTask,kQA,kQATask};//standard basic loaders identifiers
91
92    AliBaseLoader*     GetBaseLoader(const TString& name) const;
93    AliBaseLoader*     GetBaseLoader(Int_t n) const;
94    AliObjectLoader*   GetBaseDataLoader();
95    AliTaskLoader*     GetBaseTaskLoader();
96    AliBaseLoader*     GetBaseQALoader();
97    AliTaskLoader*     GetBaseQATaskLoader();
98    
99    void               SetBaseDataLoader(AliBaseLoader* bl);
100    void               SetBaseTaskLoader(AliTaskLoader* bl);
101    void               SetBaseQALoader(AliBaseLoader* bl);
102    void               SetBaseQATaskLoader(AliTaskLoader* bl);
103    
104    Bool_t             CheckReload();//checks if we have to reload given file
105    Bool_t             IsFileWritable() const;
106    Bool_t             IsFileOpen() const;
107    Bool_t             IsOptionContrary(const TString& option) const;
108    
109    void Synchronize();
110
111   protected:
112    AliRunLoader*      GetRunLoader();//gets the run-loader from event folder
113
114   private:
115    AliDataLoader(const AliDataLoader&); //Not implemented
116    AliDataLoader& operator=(const AliDataLoader&); //Not implemented
117       
118    TString      fFileName; //name of the file 
119    TFile*       fFile; //! pointer to file 
120    TDirectory*  fDirectory; //!pointer to TDirectory
121    TString      fFileOption; //!file option while opened 
122    Int_t        fCompressionLevel; //Compression Level of File
123    Int_t        fNEventsPerFile;  //defines number of events stored per one file
124    
125    TObjArray*   fBaseLoaders;//base loaders
126    Bool_t       fHasTask;// flag if has a task
127    TString      fTaskName;// name of the task
128    TTask*       fParentalTask;//Parental task
129
130    TFolder*     fEventFolder;//!event folder
131    TFolder*     fFolder;//! folder with data
132    
133    ClassDef(AliDataLoader,2)
134  };
135
136 #endif
137
138