]>
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 | ||
024a7e64 | 25 | class TFile; |
88cb7938 | 26 | class TString; |
27 | class TFolder; | |
28 | class TObjArray; | |
29 | class TTree; | |
88cb7938 | 30 | class TParticle; |
31 | ||
32 | class AliRun; | |
33 | class AliLoader; | |
34 | class AliDetector; | |
35 | class AliHeader; | |
36 | class AliStack; | |
9e1ceb13 | 37 | class AliCDBEntry; |
bacbe0fd | 38 | class AliCentralTrigger; |
88cb7938 | 39 | |
c93255fe | 40 | #include <TNamed.h> |
41 | ||
42 | #include "AliConfig.h" | |
43 | #include "AliDataLoader.h" | |
44 | ||
88cb7938 | 45 | class AliRunLoader: public TNamed |
46 | { | |
47 | public: | |
48 | ||
49 | AliRunLoader(); | |
50 | AliRunLoader(const char* topfoldername); | |
51 | AliRunLoader(TFolder* topfolder); | |
52 | ||
53 | virtual ~AliRunLoader(); | |
54 | ||
55 | static AliRunLoader* Open(const char* filename = "galice.root", | |
e191bb57 | 56 | const char* eventfoldername = AliConfig::GetDefaultEventFolderName(), |
88cb7938 | 57 | Option_t* option = "READ"); |
58 | ||
59 | Int_t GetEventNumber() const {return fCurrentEvent;} | |
60 | ||
61 | Int_t GetEvent(Int_t evno);//sets the event number and reloads data in folders properly | |
62 | Int_t GetNextEvent(){return GetEvent(fCurrentEvent+1);}//gets next event | |
63 | Int_t SetEventNumber(Int_t evno); //cleans folders and sets the root dirs in files (do not reload data) | |
64 | Int_t SetNextEvent(){return SetEventNumber(fCurrentEvent+1);} | |
65 | ||
66 | Int_t GetNumberOfEvents(); | |
67 | ||
9e1ceb13 | 68 | AliCDBEntry* GetCDBEntry(const char* name) const; |
2c8628dd | 69 | |
88cb7938 | 70 | void MakeTree(Option_t *option); |
71 | void MakeHeader(); | |
bacbe0fd | 72 | void MakeTrigger(); |
88cb7938 | 73 | void MakeStack(); |
74 | ||
75 | Int_t LoadgAlice(); | |
76 | Int_t LoadHeader(); | |
77 | Int_t LoadKinematics(Option_t* option = "READ"); | |
bacbe0fd | 78 | Int_t LoadTrigger(Option_t* option = "READ"); |
88cb7938 | 79 | Int_t LoadTrackRefs(Option_t* option = "READ"); |
80 | ||
81 | void UnloadHeader(); | |
bacbe0fd | 82 | void UnloadTrigger(); |
88cb7938 | 83 | void UnloadKinematics(); |
84 | void UnloadgAlice(); | |
85 | void UnloadTrackRefs(); | |
86 | ||
87 | void SetKineFileName(const TString& fname){fKineDataLoader->SetFileName(fname);} | |
88 | void SetTrackRefsFileName(const TString& fname){fTrackRefsDataLoader->SetFileName(fname);} | |
89 | ||
90 | TTree* TreeE() const; //returns the tree from folder; shortcut method | |
bacbe0fd | 91 | TTree* TreeCT() const; //returns the tree from folder; shortcut method |
88cb7938 | 92 | AliHeader* GetHeader() const; |
bacbe0fd | 93 | AliCentralTrigger* GetTrigger() const; |
88cb7938 | 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; | |
33c3c91a | 101 | Int_t GetRunNumber() const {return fRun;} |
102 | void SetRunNumber(Int_t run) {fRun=run;} | |
88cb7938 | 103 | |
88cb7938 | 104 | Int_t WriteHeader(Option_t* opt=""); |
bacbe0fd | 105 | Int_t WriteTrigger(Option_t* opt=""); |
88cb7938 | 106 | Int_t WriteAliRun(Option_t* opt=""); |
107 | Int_t WriteKinematics(Option_t* opt=""); | |
108 | Int_t WriteTrackRefs(Option_t* opt=""); | |
109 | Int_t WriteRunLoader(Option_t* opt=""); | |
110 | ||
111 | Int_t WriteHits(Option_t* opt=""); | |
112 | Int_t WriteSDigits(Option_t* opt=""); | |
113 | Int_t WriteDigits(Option_t* opt=""); | |
114 | Int_t WriteRecPoints(Option_t* opt=""); | |
115 | Int_t WriteTracks(Option_t* opt=""); | |
116 | ||
f49dcb04 | 117 | Int_t LoadHits(Option_t* detectors = "all",Option_t* opt = "READ"); |
118 | Int_t LoadSDigits(Option_t* detectors = "all",Option_t* opt = "READ"); | |
119 | Int_t LoadDigits(Option_t* detectors = "all",Option_t* opt = "READ"); | |
120 | Int_t LoadRecPoints(Option_t* detectors = "all",Option_t* opt = "READ"); | |
121 | Int_t LoadTracks(Option_t* detectors = "all",Option_t* opt = "READ"); | |
122 | Int_t LoadRecParticles(Option_t* detectors = "all",Option_t* opt = "READ"); | |
88cb7938 | 123 | |
1bb20a37 | 124 | void UnloadHits(Option_t* detectors = "all"); |
125 | void UnloadSDigits(Option_t* detectors = "all"); | |
126 | void UnloadDigits(Option_t* detectors = "all"); | |
127 | void UnloadRecPoints(Option_t* detectors = "all"); | |
128 | void UnloadTracks(Option_t* detectors = "all"); | |
129 | void UnloadRecParticles(Option_t* detectors = "all"); | |
130 | void UnloadAll(Option_t* detectors = "all"); | |
88cb7938 | 131 | |
132 | void AddLoader(AliLoader* loader); | |
133 | void AddLoader(AliDetector* det); | |
134 | AliLoader* GetLoader(const char* detname) const; | |
135 | AliLoader* GetLoader(AliDetector* det) const; | |
e191bb57 | 136 | Int_t SetEventFolderName(const TString& name = AliConfig::GetDefaultEventFolderName());//sets top folder name for this run; of alread |
88cb7938 | 137 | void CleanFolders();//removes all abjects from folder structure |
138 | void CleanDetectors(); | |
139 | void CleanKinematics(){Clean(fgkKineContainerName);} | |
140 | void CleanTrackRefs(){Clean(fgkTrackRefsContainerName);} | |
141 | ||
142 | void RemoveEventFolder(); //remove folder structure from top folder | |
143 | void SetCompressionLevel(Int_t cl); | |
144 | void SetKineComprLevel(Int_t cl); | |
145 | void SetTrackRefsComprLevel(Int_t cl); | |
146 | ||
147 | TFolder* GetEventFolder() const {return fEventFolder;} | |
148 | void CdGAFile(); | |
149 | ||
150 | void MakeTrackRefsContainer(); | |
151 | void SetDirName(TString& dirname); | |
152 | Int_t GetFileOffset() const; | |
153 | void SetNumberOfEventsPerFile(Int_t nevpf){fNEventsPerFile = nevpf;} | |
c516e34c | 154 | void SetNumberOfEventsPerRun(Int_t nevpr) {fNEventsPerRun = nevpr;} |
155 | Int_t GetNumberOfEventsPerRun() {return fNEventsPerRun;} | |
88cb7938 | 156 | void SetDigitsFileNameSuffix(const TString& suffix);//adds the suffix before ".root", |
157 | //e.g. TPC.Digits.root -> TPC.DigitsMerged.root | |
158 | //made on Jiri Chudoba demand | |
159 | TString GetFileName() const;//returns name of galice file | |
160 | const TObjArray* GetArrayOfLoaders() const {return fLoaders;} | |
024a7e64 | 161 | void Cd(){fgRunLoader = this;} |
f0f6f856 | 162 | void Synchronize(); |
163 | ||
1bb20a37 | 164 | AliLoader* GetDetectorLoader(const char* detname); |
165 | TTree* GetTreeH(const char* detname, Bool_t maketree); | |
166 | TTree* GetTreeS(const char* detname, Bool_t maketree); | |
167 | TTree* GetTreeD(const char* detname, Bool_t maketree); | |
168 | TTree* GetTreeR(const char* detname, Bool_t maketree); | |
169 | TTree* GetTreeT(const char* detname, Bool_t maketree); | |
170 | TTree* GetTreeP(const char* detname, Bool_t maketree); | |
d0d4a6b3 | 171 | |
172 | /******************************************/ | |
173 | /***** Public S T A T I C Stuff *******/ | |
174 | /******************************************/ | |
175 | static AliRunLoader* GetRunLoader(const char* eventfoldername); | |
33c3c91a | 176 | static AliRunLoader* Instance(){return fgRunLoader;} |
d0d4a6b3 | 177 | static AliLoader* GetDetectorLoader(const char* detname, const char* eventfoldername); |
178 | static TTree* GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername); | |
179 | static TTree* GetTreeS(const char* detname, Bool_t maketree, const char* eventfoldername); | |
180 | static TTree* GetTreeD(const char* detname, Bool_t maketree, const char* eventfoldername); | |
181 | static TTree* GetTreeR(const char* detname, Bool_t maketree, const char* eventfoldername); | |
182 | static TTree* GetTreeT(const char* detname, Bool_t maketree, const char* eventfoldername); | |
183 | static TTree* GetTreeP(const char* detname, Bool_t maketree, const char* eventfoldername); | |
184 | ||
024a7e64 | 185 | static TString GetRunLoaderName () {return fgkRunLoaderName;} |
186 | static TString GetHeaderContainerName () {return fgkHeaderContainerName;} | |
bacbe0fd | 187 | static TString GetTriggerContainerName () {return fgkTriggerContainerName;} |
024a7e64 | 188 | static TString GetKineContainerName () {return fgkKineContainerName;} |
189 | static TString GetTrackRefsContainerName () {return fgkTrackRefsContainerName;} | |
190 | static TString GetHeaderBranchName () {return fgkHeaderBranchName;} | |
bacbe0fd | 191 | static TString GetTriggerBranchName () {return fgkTriggerBranchName;} |
024a7e64 | 192 | static TString GetKineBranchName () {return fgkKineBranchName;} |
bacbe0fd | 193 | static TString GetTriggerFileName() { return fgkDefaultTriggerFileName; } |
024a7e64 | 194 | static TString GetGAliceName () {return fgkGAliceName;} |
d0d4a6b3 | 195 | |
024a7e64 | 196 | protected: |
33c3c91a | 197 | void SetGAliceFile(TFile* gafile);//sets the pointer to gAlice file |
198 | Int_t OpenKineFile(Option_t* opt); | |
199 | Int_t OpenTrackRefsFile(Option_t* opt); | |
88cb7938 | 200 | |
33c3c91a | 201 | Int_t OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl); |
202 | void SetUnixDir(const TString& udirname); | |
203 | const TString SetFileOffset(const TString& fname);//adds the proper number before .root | |
204 | void SetDetectorAddresses(); | |
205 | ||
206 | TObjArray *fLoaders; // List of Detectors | |
207 | TFolder *fEventFolder; //!top folder for this run | |
88cb7938 | 208 | |
33c3c91a | 209 | Int_t fRun; //! Current run number |
210 | Int_t fCurrentEvent;//!Number of current event | |
88cb7938 | 211 | |
bacbe0fd | 212 | TFile *fGAFile;//! pointer to main file with AliRun and Run Loader -> galice.root |
213 | AliHeader *fHeader;//! pointer to header | |
214 | AliStack *fStack; //! pointer to stack | |
215 | AliCentralTrigger *fCTrigger; //! pointer to CEntral Trigger Processor | |
88cb7938 | 216 | |
33c3c91a | 217 | AliDataLoader *fKineDataLoader;// kinematics data loader |
218 | AliDataLoader *fTrackRefsDataLoader;//track reference data loader | |
88cb7938 | 219 | |
33c3c91a | 220 | Int_t fNEventsPerFile; //defines number of events stored per one file |
c516e34c | 221 | Int_t fNEventsPerRun; //defines number of event per run |
222 | TString fUnixDirName; //! name of unix path to directory that contains event | |
88cb7938 | 223 | static const TString fgkDefaultKineFileName;//default file name with kinamatics |
224 | static const TString fgkDefaultTrackRefsFileName;//default file name with kinamatics | |
bacbe0fd | 225 | static const TString fgkDefaultTriggerFileName;//default file name with trigger |
88cb7938 | 226 | |
88cb7938 | 227 | |
228 | private: | |
dc86eb51 | 229 | AliRunLoader(const AliRunLoader &r); //Not implemented |
230 | AliRunLoader & operator = (const AliRunLoader &); //Not implemented | |
88cb7938 | 231 | void GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const; |
88cb7938 | 232 | void CleanHeader(){Clean(fgkHeaderContainerName);} |
bacbe0fd | 233 | void CleanTrigger(){Clean(fgkTriggerContainerName);} |
88cb7938 | 234 | void Clean(const TString& name); |
88cb7938 | 235 | Int_t SetEvent(); |
236 | ||
33c3c91a | 237 | static AliRunLoader* fgRunLoader; //pointer to the AliRunLoader instance |
024a7e64 | 238 | |
239 | static const TString fgkRunLoaderName; //default name of the run loader | |
240 | static const TString fgkHeaderContainerName; //default name of the kinematics container (TREE) name - TreeE | |
bacbe0fd | 241 | static const TString fgkTriggerContainerName; //default name of the trigger container (TREE) name - TreeCT |
024a7e64 | 242 | static const TString fgkKineContainerName; //default name of the kinematics container (TREE) name - TreeK |
243 | static const TString fgkTrackRefsContainerName; //default name of the track references container (TREE) name - TreeTR | |
244 | static const TString fgkHeaderBranchName; //default name of the branch containing the header | |
bacbe0fd | 245 | static const TString fgkTriggerBranchName; //default name of the branch containing the trigger |
024a7e64 | 246 | static const TString fgkKineBranchName; //default name of the branch with kinematics |
247 | static const TString fgkGAliceName; //default name for gAlice file | |
88cb7938 | 248 | |
8bcc8b54 | 249 | ClassDef(AliRunLoader,3) |
88cb7938 | 250 | }; |
251 | ||
252 | #endif |