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