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