4 //___________________________________________________________________
5 /////////////////////////////////////////////////////////////////////
7 // class AliRunLoader //
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 //
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. //
23 /////////////////////////////////////////////////////////////////////
27 #include "AliConfig.h"
28 #include "AliLoader.h"
29 #include "AliDataLoader.h"
43 class AliRunDigitizer;
46 class AliRunLoader: public TNamed
51 AliRunLoader(const char* topfoldername);
52 AliRunLoader(TFolder* topfolder);
54 virtual ~AliRunLoader();
56 static AliRunLoader* Open(const char* filename = "galice.root",
57 const char* eventfoldername = AliConfig::fgkDefaultEventFolderName,
58 Option_t* option = "READ");
60 Int_t GetEventNumber() const {return fCurrentEvent;}
62 Int_t GetEvent(Int_t evno);//sets the event number and reloads data in folders properly
63 Int_t GetNextEvent(){return GetEvent(fCurrentEvent+1);}//gets next event
64 Int_t SetEventNumber(Int_t evno); //cleans folders and sets the root dirs in files (do not reload data)
65 Int_t SetNextEvent(){return SetEventNumber(fCurrentEvent+1);}
67 Int_t GetNumberOfEvents();
69 void MakeTree(Option_t *option);
75 Int_t LoadKinematics(Option_t* option = "READ");
76 Int_t LoadTrackRefs(Option_t* option = "READ");
79 void UnloadKinematics();
81 void UnloadTrackRefs();
83 void SetKineFileName(const TString& fname){fKineDataLoader->SetFileName(fname);}
84 void SetTrackRefsFileName(const TString& fname){fTrackRefsDataLoader->SetFileName(fname);}
86 TTree* TreeE() const; //returns the tree from folder; shortcut method
87 AliHeader* GetHeader() const;
89 AliStack* Stack() const {return fStack;}
91 TTree* TreeK() const; //returns the tree from folder; shortcut method
92 TTree* TreeTR() const; //returns the tree from folder; shortcut method
94 AliRun* GetAliRun()const;
96 Int_t WriteGeometry(Option_t* opt="");
97 Int_t WriteHeader(Option_t* opt="");
98 Int_t WriteAliRun(Option_t* opt="");
99 Int_t WriteKinematics(Option_t* opt="");
100 Int_t WriteTrackRefs(Option_t* opt="");
101 Int_t WriteRunLoader(Option_t* opt="");
103 Int_t WriteHits(Option_t* opt="");
104 Int_t WriteSDigits(Option_t* opt="");
105 Int_t WriteDigits(Option_t* opt="");
106 Int_t WriteRecPoints(Option_t* opt="");
107 Int_t WriteTracks(Option_t* opt="");
109 Int_t LoadHits(Option_t* detectors = "all",Option_t* opt = "RAED");
110 Int_t LoadSDigits(Option_t* detectors = "all",Option_t* opt = "RAED");
111 Int_t LoadDigits(Option_t* detectors = "all",Option_t* opt = "RAED");
112 Int_t LoadRecPoints(Option_t* detectors = "all",Option_t* opt = "RAED");
113 Int_t LoadTracks(Option_t* detectors = "all",Option_t* opt = "RAED");
114 Int_t LoadRecParticles(Option_t* detectors = "all",Option_t* opt = "RAED");
116 void UnloadHits(Option_t* detectors = "all");
117 void UnloadSDigits(Option_t* detectors = "all");
118 void UnloadDigits(Option_t* detectors = "all");
119 void UnloadRecPoints(Option_t* detectors = "all");
120 void UnloadTracks(Option_t* detectors = "all");
121 void UnloadRecParticles(Option_t* detectors = "all");
122 void UnloadAll(Option_t* detectors = "all");
124 void AddLoader(AliLoader* loader);
125 void AddLoader(AliDetector* det);
126 AliLoader* GetLoader(const char* detname) const;
127 AliLoader* GetLoader(AliDetector* det) const;
128 Int_t SetEventFolderName(const TString& name = AliConfig::fgkDefaultEventFolderName);//sets top folder name for this run; of alread
129 void CleanFolders();//removes all abjects from folder structure
130 void CleanDetectors();
131 void CleanKinematics(){Clean(fgkKineContainerName);}
132 void CleanTrackRefs(){Clean(fgkTrackRefsContainerName);}
134 void RemoveEventFolder(); //remove folder structure from top folder
135 void SetCompressionLevel(Int_t cl);
136 void SetKineComprLevel(Int_t cl);
137 void SetTrackRefsComprLevel(Int_t cl);
139 TFolder* GetEventFolder() const {return fEventFolder;}
142 void MakeTrackRefsContainer();
143 void SetDirName(TString& dirname);
144 Int_t GetFileOffset() const;
145 void SetNumberOfEventsPerFile(Int_t nevpf){fNEventsPerFile = nevpf;}
147 void SetDigitsFileNameSuffix(const TString& suffix);//adds the suffix before ".root",
148 //e.g. TPC.Digits.root -> TPC.DigitsMerged.root
149 //made on Jiri Chudoba demand
150 TString GetFileName() const;//returns name of galice file
151 const TObjArray* GetArrayOfLoaders() const {return fLoaders;}
152 Int_t GetDebug() const {return AliLoader::GetDebug();}
153 void cd(){fgRunLoader = this;}
156 AliLoader* GetDetectorLoader(const char* detname);
157 TTree* GetTreeH(const char* detname, Bool_t maketree);
158 TTree* GetTreeS(const char* detname, Bool_t maketree);
159 TTree* GetTreeD(const char* detname, Bool_t maketree);
160 TTree* GetTreeR(const char* detname, Bool_t maketree);
161 TTree* GetTreeT(const char* detname, Bool_t maketree);
162 TTree* GetTreeP(const char* detname, Bool_t maketree);
165 /**********************************************/
166 /************ PROTECTED ***************/
167 /********* D A T A ************/
168 /**********************************************/
170 TObjArray *fLoaders; // List of Detectors
171 TFolder *fEventFolder; //!top folder for this run
173 Int_t fCurrentEvent;//!Number of current event
175 TFile *fGAFile;//! pointer to main file with AliRun and Run Loader -> galice.root
176 AliHeader *fHeader;//! pointer to header
177 AliStack *fStack; //! pointer to stack
179 AliDataLoader *fKineDataLoader;// kinematics data loader
180 AliDataLoader *fTrackRefsDataLoader;//track reference data loader
182 Int_t fNEventsPerFile; //defines number of events stored per one file
183 TString fUnixDirName; //! name of unix path to directory that contains event
184 static const TString fgkDefaultKineFileName;//default file name with kinamatics
185 static const TString fgkDefaultTrackRefsFileName;//default file name with kinamatics
188 /*********************************************/
189 /************ PROTECTED **************/
190 /********* M E T H O D S ***********/
191 /*********************************************/
193 void SetGAliceFile(TFile* gafile);//sets the pointer to gAlice file
194 Int_t OpenKineFile(Option_t* opt);
195 Int_t OpenTrackRefsFile(Option_t* opt);
197 Int_t OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl);
198 void SetUnixDir(const TString& udirname);
199 const TString SetFileOffset(const TString& fname);//adds the proper number before .root
200 void SetDetectorAddresses();
203 void GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const;
205 void CleanHeader(){Clean(fgkHeaderContainerName);}
206 void Clean(const TString& name);
210 static AliRunLoader* fgRunLoader;
213 /******************************************/
214 /***** Public S T A T I C Stuff *******/
215 /******************************************/
216 static AliRunLoader* GetRunLoader(const char* eventfoldername);
217 static AliRunLoader* GetRunLoader(){return fgRunLoader;}
218 static AliLoader* GetDetectorLoader(const char* detname, const char* eventfoldername);
219 static TTree* GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername);
220 static TTree* GetTreeS(const char* detname, Bool_t maketree, const char* eventfoldername);
221 static TTree* GetTreeD(const char* detname, Bool_t maketree, const char* eventfoldername);
222 static TTree* GetTreeR(const char* detname, Bool_t maketree, const char* eventfoldername);
223 static TTree* GetTreeT(const char* detname, Bool_t maketree, const char* eventfoldername);
224 static TTree* GetTreeP(const char* detname, Bool_t maketree, const char* eventfoldername);
226 // static AliRunDigitizer* GetRunDigitizer();
227 // Tasks are supposed to be singletons, that is why following methods are static
228 static TTask* GetRunDigitizer(); //
229 static TTask* GetRunSDigitizer(); //
230 static TTask* GetRunReconstructioner(); //
231 static TTask* GetRunTracker(); //
232 static TTask* GetRunPIDTask(); //
233 static TTask* GetRunQATask(); //
235 static const TString fgkRunLoaderName;
236 static const TString fgkHeaderContainerName; //default name of the kinematics container (TREE) name - TreeE
237 static const TString fgkKineContainerName; //default name of the kinematics container (TREE) name - TreeK
238 static const TString fgkTrackRefsContainerName; //default name of the track references container (TREE) name - TreeTR
239 static const TString fgkHeaderBranchName;
240 static const TString fgkKineBranchName;
241 static const TString fgkGAliceName;
243 ClassDef(AliRunLoader,1)