]>
Commit | Line | Data |
---|---|---|
88cb7938 | 1 | #ifndef ALIRUNLoader_H |
2 | #define ALIRUNLoader_H | |
3 | ||
4 | //___________________________________________________________________ | |
5 | ///////////////////////////////////////////////////////////////////// | |
6 | // // | |
7 | // class AliRunLoader // | |
8 | // // | |
9 | // This class aims to be the only one interface for manging data // | |
10 | // It stores Loaders for all modules which knows the filenames // | |
11 | // of the data files to be stored. // | |
12 | // It aims to substitude AliRun in automatic managing of data // | |
13 | // positioning thus there won't be necessity of loading gAlice // | |
14 | // from file in order to get fast access to the data // | |
15 | // // | |
16 | // Logical place to put the specific Loader to the given // | |
17 | // detector is detector itself (i.e ITSLoader in ITS). // | |
18 | // But, to load detector object one need to load gAlice, and // | |
19 | // by the way all other detectors with their geometrieces and // | |
20 | // so on. So, if one need to open TPC clusters there is no // | |
21 | // principal nedd to read everything. // | |
22 | // // | |
23 | ///////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include <TNamed.h> | |
024a7e64 | 26 | |
88cb7938 | 27 | #include "AliConfig.h" |
28 | #include "AliLoader.h" | |
29 | #include "AliDataLoader.h" | |
30 | ||
024a7e64 | 31 | class TFile; |
88cb7938 | 32 | class TString; |
33 | class TFolder; | |
34 | class TObjArray; | |
35 | class TTree; | |
36 | class TTask; | |
37 | class TParticle; | |
38 | ||
39 | class AliRun; | |
40 | class AliLoader; | |
41 | class AliDetector; | |
42 | class AliHeader; | |
43 | class AliStack; | |
44 | class AliRunDigitizer; | |
45 | ||
46 | ||
47 | class AliRunLoader: public TNamed | |
48 | { | |
49 | public: | |
50 | ||
51 | AliRunLoader(); | |
52 | AliRunLoader(const char* topfoldername); | |
53 | AliRunLoader(TFolder* topfolder); | |
024a7e64 | 54 | AliRunLoader(const AliRunLoader &rl); |
55 | AliRunLoader & operator = (const AliRunLoader &rl) | |
56 | {rl.Copy(*this); return *this;} | |
88cb7938 | 57 | |
58 | virtual ~AliRunLoader(); | |
59 | ||
60 | static AliRunLoader* Open(const char* filename = "galice.root", | |
e191bb57 | 61 | const char* eventfoldername = AliConfig::GetDefaultEventFolderName(), |
88cb7938 | 62 | Option_t* option = "READ"); |
63 | ||
64 | Int_t GetEventNumber() const {return fCurrentEvent;} | |
65 | ||
66 | Int_t GetEvent(Int_t evno);//sets the event number and reloads data in folders properly | |
67 | Int_t GetNextEvent(){return GetEvent(fCurrentEvent+1);}//gets next event | |
68 | Int_t SetEventNumber(Int_t evno); //cleans folders and sets the root dirs in files (do not reload data) | |
69 | Int_t SetNextEvent(){return SetEventNumber(fCurrentEvent+1);} | |
70 | ||
71 | Int_t GetNumberOfEvents(); | |
72 | ||
2c8628dd | 73 | const TObject* GetRunObject(const char* name) const; |
74 | ||
88cb7938 | 75 | void MakeTree(Option_t *option); |
76 | void MakeHeader(); | |
77 | void MakeStack(); | |
78 | ||
79 | Int_t LoadgAlice(); | |
80 | Int_t LoadHeader(); | |
81 | Int_t LoadKinematics(Option_t* option = "READ"); | |
82 | Int_t LoadTrackRefs(Option_t* option = "READ"); | |
83 | ||
84 | void UnloadHeader(); | |
85 | void UnloadKinematics(); | |
86 | void UnloadgAlice(); | |
87 | void UnloadTrackRefs(); | |
88 | ||
89 | void SetKineFileName(const TString& fname){fKineDataLoader->SetFileName(fname);} | |
90 | void SetTrackRefsFileName(const TString& fname){fTrackRefsDataLoader->SetFileName(fname);} | |
91 | ||
92 | TTree* TreeE() const; //returns the tree from folder; shortcut method | |
93 | AliHeader* GetHeader() const; | |
94 | ||
95 | AliStack* Stack() const {return fStack;} | |
96 | ||
97 | TTree* TreeK() const; //returns the tree from folder; shortcut method | |
98 | TTree* TreeTR() const; //returns the tree from folder; shortcut method | |
99 | ||
100 | AliRun* GetAliRun()const; | |
101 | ||
102 | Int_t WriteGeometry(Option_t* opt=""); | |
103 | Int_t WriteHeader(Option_t* opt=""); | |
104 | Int_t WriteAliRun(Option_t* opt=""); | |
105 | Int_t WriteKinematics(Option_t* opt=""); | |
106 | Int_t WriteTrackRefs(Option_t* opt=""); | |
107 | Int_t WriteRunLoader(Option_t* opt=""); | |
108 | ||
109 | Int_t WriteHits(Option_t* opt=""); | |
110 | Int_t WriteSDigits(Option_t* opt=""); | |
111 | Int_t WriteDigits(Option_t* opt=""); | |
112 | Int_t WriteRecPoints(Option_t* opt=""); | |
113 | Int_t WriteTracks(Option_t* opt=""); | |
114 | ||
115 | Int_t LoadHits(Option_t* detectors = "all",Option_t* opt = "RAED"); | |
116 | Int_t LoadSDigits(Option_t* detectors = "all",Option_t* opt = "RAED"); | |
117 | Int_t LoadDigits(Option_t* detectors = "all",Option_t* opt = "RAED"); | |
118 | Int_t LoadRecPoints(Option_t* detectors = "all",Option_t* opt = "RAED"); | |
119 | Int_t LoadTracks(Option_t* detectors = "all",Option_t* opt = "RAED"); | |
1bb20a37 | 120 | Int_t LoadRecParticles(Option_t* detectors = "all",Option_t* opt = "RAED"); |
88cb7938 | 121 | |
1bb20a37 | 122 | void UnloadHits(Option_t* detectors = "all"); |
123 | void UnloadSDigits(Option_t* detectors = "all"); | |
124 | void UnloadDigits(Option_t* detectors = "all"); | |
125 | void UnloadRecPoints(Option_t* detectors = "all"); | |
126 | void UnloadTracks(Option_t* detectors = "all"); | |
127 | void UnloadRecParticles(Option_t* detectors = "all"); | |
128 | void UnloadAll(Option_t* detectors = "all"); | |
88cb7938 | 129 | |
130 | void AddLoader(AliLoader* loader); | |
131 | void AddLoader(AliDetector* det); | |
132 | AliLoader* GetLoader(const char* detname) const; | |
133 | AliLoader* GetLoader(AliDetector* det) const; | |
e191bb57 | 134 | Int_t SetEventFolderName(const TString& name = AliConfig::GetDefaultEventFolderName());//sets top folder name for this run; of alread |
88cb7938 | 135 | void CleanFolders();//removes all abjects from folder structure |
136 | void CleanDetectors(); | |
137 | void CleanKinematics(){Clean(fgkKineContainerName);} | |
138 | void CleanTrackRefs(){Clean(fgkTrackRefsContainerName);} | |
139 | ||
140 | void RemoveEventFolder(); //remove folder structure from top folder | |
141 | void SetCompressionLevel(Int_t cl); | |
142 | void SetKineComprLevel(Int_t cl); | |
143 | void SetTrackRefsComprLevel(Int_t cl); | |
144 | ||
145 | TFolder* GetEventFolder() const {return fEventFolder;} | |
146 | void CdGAFile(); | |
147 | ||
148 | void MakeTrackRefsContainer(); | |
149 | void SetDirName(TString& dirname); | |
150 | Int_t GetFileOffset() const; | |
151 | void SetNumberOfEventsPerFile(Int_t nevpf){fNEventsPerFile = nevpf;} | |
152 | ||
153 | void SetDigitsFileNameSuffix(const TString& suffix);//adds the suffix before ".root", | |
154 | //e.g. TPC.Digits.root -> TPC.DigitsMerged.root | |
155 | //made on Jiri Chudoba demand | |
156 | TString GetFileName() const;//returns name of galice file | |
157 | const TObjArray* GetArrayOfLoaders() const {return fLoaders;} | |
158 | Int_t GetDebug() const {return AliLoader::GetDebug();} | |
024a7e64 | 159 | void Cd(){fgRunLoader = this;} |
f0f6f856 | 160 | void Synchronize(); |
161 | ||
1bb20a37 | 162 | AliLoader* GetDetectorLoader(const char* detname); |
163 | TTree* GetTreeH(const char* detname, Bool_t maketree); | |
164 | TTree* GetTreeS(const char* detname, Bool_t maketree); | |
165 | TTree* GetTreeD(const char* detname, Bool_t maketree); | |
166 | TTree* GetTreeR(const char* detname, Bool_t maketree); | |
167 | TTree* GetTreeT(const char* detname, Bool_t maketree); | |
168 | TTree* GetTreeP(const char* detname, Bool_t maketree); | |
d0d4a6b3 | 169 | |
170 | /******************************************/ | |
171 | /***** Public S T A T I C Stuff *******/ | |
172 | /******************************************/ | |
173 | static AliRunLoader* GetRunLoader(const char* eventfoldername); | |
174 | static AliRunLoader* GetRunLoader(){return fgRunLoader;} | |
175 | static AliLoader* GetDetectorLoader(const char* detname, const char* eventfoldername); | |
176 | static TTree* GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername); | |
177 | static TTree* GetTreeS(const char* detname, Bool_t maketree, const char* eventfoldername); | |
178 | static TTree* GetTreeD(const char* detname, Bool_t maketree, const char* eventfoldername); | |
179 | static TTree* GetTreeR(const char* detname, Bool_t maketree, const char* eventfoldername); | |
180 | static TTree* GetTreeT(const char* detname, Bool_t maketree, const char* eventfoldername); | |
181 | static TTree* GetTreeP(const char* detname, Bool_t maketree, const char* eventfoldername); | |
182 | ||
183 | // static AliRunDigitizer* GetRunDigitizer(); | |
184 | // Tasks are supposed to be singletons, that is why following methods are static | |
185 | static TTask* GetRunDigitizer(); // | |
186 | static TTask* GetRunSDigitizer(); // | |
187 | static TTask* GetRunReconstructioner(); // | |
188 | static TTask* GetRunTracker(); // | |
189 | static TTask* GetRunPIDTask(); // | |
190 | static TTask* GetRunQATask(); // | |
024a7e64 | 191 | |
192 | static TString GetRunLoaderName () {return fgkRunLoaderName;} | |
193 | static TString GetHeaderContainerName () {return fgkHeaderContainerName;} | |
194 | static TString GetKineContainerName () {return fgkKineContainerName;} | |
195 | static TString GetTrackRefsContainerName () {return fgkTrackRefsContainerName;} | |
196 | static TString GetHeaderBranchName () {return fgkHeaderBranchName;} | |
197 | static TString GetKineBranchName () {return fgkKineBranchName;} | |
198 | static TString GetGAliceName () {return fgkGAliceName;} | |
d0d4a6b3 | 199 | |
024a7e64 | 200 | protected: |
88cb7938 | 201 | /**********************************************/ |
202 | /************ PROTECTED ***************/ | |
203 | /********* D A T A ************/ | |
204 | /**********************************************/ | |
205 | ||
206 | TObjArray *fLoaders; // List of Detectors | |
207 | TFolder *fEventFolder; //!top folder for this run | |
208 | ||
209 | Int_t fCurrentEvent;//!Number of current event | |
210 | ||
211 | TFile *fGAFile;//! pointer to main file with AliRun and Run Loader -> galice.root | |
212 | AliHeader *fHeader;//! pointer to header | |
213 | AliStack *fStack; //! pointer to stack | |
214 | ||
215 | AliDataLoader *fKineDataLoader;// kinematics data loader | |
216 | AliDataLoader *fTrackRefsDataLoader;//track reference data loader | |
217 | ||
218 | Int_t fNEventsPerFile; //defines number of events stored per one file | |
219 | TString fUnixDirName; //! name of unix path to directory that contains event | |
220 | static const TString fgkDefaultKineFileName;//default file name with kinamatics | |
221 | static const TString fgkDefaultTrackRefsFileName;//default file name with kinamatics | |
222 | ||
223 | ||
224 | /*********************************************/ | |
225 | /************ PROTECTED **************/ | |
226 | /********* M E T H O D S ***********/ | |
227 | /*********************************************/ | |
228 | ||
229 | void SetGAliceFile(TFile* gafile);//sets the pointer to gAlice file | |
230 | Int_t OpenKineFile(Option_t* opt); | |
231 | Int_t OpenTrackRefsFile(Option_t* opt); | |
232 | ||
233 | Int_t OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl); | |
234 | void SetUnixDir(const TString& udirname); | |
235 | const TString SetFileOffset(const TString& fname);//adds the proper number before .root | |
236 | void SetDetectorAddresses(); | |
237 | ||
238 | private: | |
239 | void GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const; | |
240 | ||
241 | void CleanHeader(){Clean(fgkHeaderContainerName);} | |
242 | void Clean(const TString& name); | |
243 | ||
244 | Int_t SetEvent(); | |
245 | ||
d0d4a6b3 | 246 | static AliRunLoader* fgRunLoader; //pointer to the AliRunLoader instance |
88cb7938 | 247 | |
024a7e64 | 248 | private: |
249 | void Copy(TObject &arun) const; | |
250 | ||
251 | static const TString fgkRunLoaderName; //default name of the run loader | |
252 | static const TString fgkHeaderContainerName; //default name of the kinematics container (TREE) name - TreeE | |
253 | static const TString fgkKineContainerName; //default name of the kinematics container (TREE) name - TreeK | |
254 | static const TString fgkTrackRefsContainerName; //default name of the track references container (TREE) name - TreeTR | |
255 | static const TString fgkHeaderBranchName; //default name of the branch containing the header | |
256 | static const TString fgkKineBranchName; //default name of the branch with kinematics | |
257 | static const TString fgkGAliceName; //default name for gAlice file | |
88cb7938 | 258 | |
259 | ClassDef(AliRunLoader,1) | |
260 | }; | |
261 | ||
262 | #endif |