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