AliRoot Core  edcc906 (edcc906)
Go to the documentation of this file.
1 #ifndef ALIRUNLoader_H
2 #define ALIRUNLoader_H
4 //___________________________________________________________________
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 // //
25 class TFile;
26 class TString;
27 class TFolder;
28 class TObjArray;
29 class TTree;
30 class TParticle;
32 class AliRun;
33 class AliLoader;
34 class AliDetector;
35 class AliHeader;
36 class AliStack;
37 class AliCDBEntry;
38 class AliCentralTrigger;
40 #include <TNamed.h>
42 #include "AliConfig.h"
43 #include "AliDataLoader.h"
45 class AliRunLoader: public TNamed
46 {
47  public:
49  AliRunLoader();
50  AliRunLoader(const char* topfoldername);
51  AliRunLoader(TFolder* topfolder);
53  virtual ~AliRunLoader();
55  static AliRunLoader* Open(const char* filename = "galice.root",
56  const char* eventfoldername = AliConfig::GetDefaultEventFolderName(),
57  Option_t* option = "READ");
59  Int_t GetEventNumber() const {return fCurrentEvent;}
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)
66  Int_t GetNumberOfEvents();
68  AliCDBEntry* GetCDBEntry(const char* name) const;
70  void MakeTree(Option_t *option);
71  void MakeHeader();
72  void MakeTrigger();
73  void MakeStack();
75  Int_t LoadgAlice();
76  Int_t LoadHeader();
77  Int_t LoadKinematics(Option_t* option = "READ");
78  Int_t LoadTrigger(Option_t* option = "READ");
79  Int_t LoadTrackRefs(Option_t* option = "READ");
81  void UnloadHeader();
82  void UnloadTrigger();
83  void UnloadKinematics();
84  void UnloadgAlice();
85  void UnloadTrackRefs();
87  void SetKineFileName(const TString& fname){fKineDataLoader->SetFileName(fname);}
90  TTree* TreeE() const; //returns the tree from folder; shortcut method
91  TTree* TreeCT() const; //returns the tree from folder; shortcut method
92  AliHeader* GetHeader() const;
95  AliStack* Stack() const {return fStack;}
97  TTree* TreeK() const; //returns the tree from folder; shortcut method
98  TTree* TreeTR() const; //returns the tree from folder; shortcut method
100  AliRun* GetAliRun()const;
101  Int_t GetRunNumber() const {return fRun;}
102  void SetRunNumber(Int_t run) {fRun=run;}
104  Int_t WriteHeader(Option_t* opt="");
105  Int_t WriteTrigger(Option_t* opt="");
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="");
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="");
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");
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");
132  void AddLoader(AliLoader* loader);
133  void AddLoader(AliDetector* det);
134  AliLoader* GetLoader(const char* detname) const;
135  AliLoader* GetLoader(AliDetector* det) const;
136  Int_t SetEventFolderName(const TString& name = AliConfig::GetDefaultEventFolderName());//sets top folder name for this run; of alread
137  void CleanFolders();//removes all abjects from folder structure
138  void CleanDetectors();
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);
147  TFolder* GetEventFolder() const {return fEventFolder;}
148  void CdGAFile();
150  void MakeTrackRefsContainer();
151  void SetDirName(TString& dirname);
152  Int_t GetFileOffset() const;
153  void SetNumberOfEventsPerFile(Int_t nevpf){fNEventsPerFile = nevpf;}
154  void SetNumberOfEventsPerRun(Int_t nevpr) {fNEventsPerRun = nevpr;}
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;}
161  void Cd(){fgRunLoader = this;}
162  void Synchronize();
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);
172  /******************************************/
173  /***** Public S T A T I C Stuff *******/
174  /******************************************/
175  static AliRunLoader* GetRunLoader(const char* eventfoldername);
176  static AliRunLoader* Instance(){return fgRunLoader;}
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);
185  static TString GetRunLoaderName () {return fgkRunLoaderName;}
186  static TString GetHeaderContainerName () {return fgkHeaderContainerName;}
188  static TString GetKineContainerName () {return fgkKineContainerName;}
190  static TString GetHeaderBranchName () {return fgkHeaderBranchName;}
191  static TString GetTriggerBranchName () {return fgkTriggerBranchName;}
192  static TString GetKineBranchName () {return fgkKineBranchName;}
193  static TString GetTriggerFileName() { return fgkDefaultTriggerFileName; }
194  static TString GetGAliceName () {return fgkGAliceName;}
196 protected:
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);
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();
206  TObjArray *fLoaders; // List of Detectors
207  TFolder *fEventFolder;
209  Int_t fRun;
212  TFile *fGAFile;
217  AliDataLoader *fKineDataLoader;// kinematics data loader
218  AliDataLoader *fTrackRefsDataLoader;//track reference data loader
220  Int_t fNEventsPerFile; //defines number of events stored per one file
221  Int_t fNEventsPerRun; //defines number of event per run
222  TString fUnixDirName;
223  static const TString fgkDefaultKineFileName;//default file name with kinamatics
224  static const TString fgkDefaultTrackRefsFileName;//default file name with kinamatics
225  static const TString fgkDefaultTriggerFileName;//default file name with trigger
228  private:
229  AliRunLoader(const AliRunLoader &r); //Not implemented
230  AliRunLoader & operator = (const AliRunLoader &); //Not implemented
231  void GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const;
234  void Clean(const TString& name);
235  Int_t SetEvent();
237  static AliRunLoader* fgRunLoader; //pointer to the AliRunLoader instance
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
241  static const TString fgkTriggerContainerName; //default name of the trigger container (TREE) name - TreeCT
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
245  static const TString fgkTriggerBranchName; //default name of the branch containing the trigger
246  static const TString fgkKineBranchName; //default name of the branch with kinematics
247  static const TString fgkGAliceName; //default name for gAlice file
249  ClassDef(AliRunLoader,3)
250 };
252 #endif
void RemoveEventFolder()
static AliRunLoader * Instance()
Definition: AliRunLoader.h:176
Int_t LoadgAlice()
void SetKineFileName(const TString &fname)
Definition: AliRunLoader.h:87
Int_t GetEventNumber() const
Definition: AliRunLoader.h:59
void GetListOfDetectors(const char *namelist, TObjArray &pointerarray) const
static const TString & GetDefaultEventFolderName()
Definition: AliConfig.h:58
void UnloadAll(Option_t *detectors="all")
Int_t WriteRecPoints(Option_t *opt="")
void SetTrackRefsComprLevel(Int_t cl)
AliCentralTrigger * GetTrigger() const
Int_t fNEventsPerFile
Definition: AliRunLoader.h:220
static TString GetTriggerFileName()
Definition: AliRunLoader.h:193
void MakeTrackRefsContainer()
void AddLoader(AliLoader *loader)
TFile * fGAFile
Number of current event.
Definition: AliRunLoader.h:212
static const TString fgkDefaultTriggerFileName
Definition: AliRunLoader.h:225
Int_t WriteRunLoader(Option_t *opt="")
static TString GetKineContainerName()
Definition: AliRunLoader.h:188
void CleanKinematics()
Definition: AliRunLoader.h:139
Definition: AliRun.h:27
void SetKineComprLevel(Int_t cl)
#define TObjArray
void UnloadRecParticles(Option_t *detectors="all")
static const TString fgkRunLoaderName
Definition: AliRunLoader.h:239
Int_t GetNextEvent()
Definition: AliRunLoader.h:62
static const TString fgkKineContainerName
Definition: AliRunLoader.h:242
TTree * GetTreeT(const char *detname, Bool_t maketree)
void SetDirName(TString &dirname)
Int_t GetRunNumber() const
Definition: AliRunLoader.h:101
Int_t LoadSDigits(Option_t *detectors="all", Option_t *opt="READ")
Int_t WriteTrigger(Option_t *opt="")
Int_t LoadDigits(Option_t *detectors="all", Option_t *opt="READ")
void UnloadDigits(Option_t *detectors="all")
AliLoader * GetLoader(const char *detname) const
Int_t fRun
top folder for this run
Definition: AliRunLoader.h:209
AliLoader * GetDetectorLoader(const char *detname)
void UnloadTrackRefs()
void CleanHeader()
Definition: AliRunLoader.h:232
Int_t WriteKinematics(Option_t *opt="")
TTree * GetTreeH(const char *detname, Bool_t maketree)
static const TString fgkKineBranchName
Definition: AliRunLoader.h:246
static TString GetRunLoaderName()
Definition: AliRunLoader.h:185
Int_t WriteTrackRefs(Option_t *opt="")
Int_t WriteAliRun(Option_t *opt="")
void UnloadSDigits(Option_t *detectors="all")
void UnloadTrigger()
void SetUnixDir(const TString &udirname)
TTree * GetTreeS(const char *detname, Bool_t maketree)
AliCentralTrigger * fCTrigger
pointer to stack
Definition: AliRunLoader.h:215
void SetGAliceFile(TFile *gafile)
void UnloadTracks(Option_t *detectors="all")
static AliRunLoader * Open(const char *filename="galice.root", const char *eventfoldername=AliConfig::GetDefaultEventFolderName(), Option_t *option="READ")
Int_t SetEventNumber(Int_t evno)
void MakeTrigger()
void SetTrackRefsFileName(const TString &fname)
Definition: AliRunLoader.h:88
static TString GetKineBranchName()
Definition: AliRunLoader.h:192
void SetDigitsFileNameSuffix(const TString &suffix)
static const TString fgkDefaultTrackRefsFileName
Definition: AliRunLoader.h:224
TString GetFileName() const
static const TString fgkGAliceName
Definition: AliRunLoader.h:247
void CleanTrigger()
Definition: AliRunLoader.h:233
static AliRunLoader * fgRunLoader
Definition: AliRunLoader.h:237
const TString SetFileOffset(const TString &fname)
static const TString fgkTriggerContainerName
Definition: AliRunLoader.h:241
Int_t fNEventsPerRun
Definition: AliRunLoader.h:221
void MakeTree(Option_t *option)
TObjArray * fLoaders
Definition: AliRunLoader.h:206
TFolder * fEventFolder
Definition: AliRunLoader.h:207
AliHeader * GetHeader() const
static const TString fgkTriggerBranchName
Definition: AliRunLoader.h:245
Int_t LoadRecPoints(Option_t *detectors="all", Option_t *opt="READ")
static TString GetTriggerContainerName()
Definition: AliRunLoader.h:187
void SetCompressionLevel(Int_t cl)
void CleanDetectors()
AliRunLoader & operator=(const AliRunLoader &)
Int_t OpenKineFile(Option_t *opt)
void UnloadKinematics()
Int_t WriteHeader(Option_t *opt="")
Int_t LoadRecParticles(Option_t *detectors="all", Option_t *opt="READ")
Int_t LoadHeader()
static TString GetTriggerBranchName()
Definition: AliRunLoader.h:191
virtual ~AliRunLoader()
static TString GetGAliceName()
Definition: AliRunLoader.h:194
Int_t GetNumberOfEvents()
Definition: AliCDBEntry.h:18
virtual void SetFileName(const TString &filename)
Definition: AliDataLoader.h:64
Int_t LoadTrigger(Option_t *option="READ")
TTree * TreeTR() const
TTree * TreeE() const
Int_t GetEvent(Int_t evno)
static TString GetTrackRefsContainerName()
Definition: AliRunLoader.h:189
AliCDBEntry * GetCDBEntry(const char *name) const
Int_t fCurrentEvent
Current run number.
Definition: AliRunLoader.h:210
TTree * TreeCT() const
TFolder * GetEventFolder() const
Definition: AliRunLoader.h:147
Int_t SetNextEvent()
Definition: AliRunLoader.h:64
static const TString fgkHeaderContainerName
Definition: AliRunLoader.h:240
Int_t SetEventFolderName(const TString &name=AliConfig::GetDefaultEventFolderName())
AliStack * fStack
pointer to header
Definition: AliRunLoader.h:214
Int_t GetNumberOfEventsPerRun()
Definition: AliRunLoader.h:155
Int_t GetFileOffset() const
Int_t WriteTracks(Option_t *opt="")
void UnloadHits(Option_t *detectors="all")
Int_t LoadHits(Option_t *detectors="all", Option_t *opt="READ")
void Clean(const TString &name)
Int_t LoadTrackRefs(Option_t *option="READ")
TTree * GetTreeD(const char *detname, Bool_t maketree)
void SetNumberOfEventsPerFile(Int_t nevpf)
Definition: AliRunLoader.h:153
static const TString fgkDefaultKineFileName
name of unix path to directory that contains event
Definition: AliRunLoader.h:223
Int_t OpenDataFile(const TString &filename, TFile *&file, TDirectory *&dir, Option_t *opt, Int_t cl)
Int_t WriteHits(Option_t *opt="")
TTree * GetTreeR(const char *detname, Bool_t maketree)
TString fUnixDirName
Definition: AliRunLoader.h:222
static const TString fgkTrackRefsContainerName
Definition: AliRunLoader.h:243
static TString GetHeaderContainerName()
Definition: AliRunLoader.h:186
static const TString fgkHeaderBranchName
Definition: AliRunLoader.h:244
AliDataLoader * fKineDataLoader
pointer to CEntral Trigger Processor
Definition: AliRunLoader.h:217
Int_t OpenTrackRefsFile(Option_t *opt)
Int_t WriteDigits(Option_t *opt="")
static TString GetHeaderBranchName()
Definition: AliRunLoader.h:190
void UnloadRecPoints(Option_t *detectors="all")
Int_t LoadTracks(Option_t *detectors="all", Option_t *opt="READ")
Int_t WriteSDigits(Option_t *opt="")
static AliRunLoader * GetRunLoader(const char *eventfoldername)
void SetDetectorAddresses()
char * fname
const TObjArray * GetArrayOfLoaders() const
Definition: AliRunLoader.h:160
TTree * GetTreeP(const char *detname, Bool_t maketree)
void SetRunNumber(Int_t run)
Definition: AliRunLoader.h:102
AliHeader * fHeader
pointer to main file with AliRun and Run Loader -> galice.root
Definition: AliRunLoader.h:213
Int_t SetEvent()
void SetNumberOfEventsPerRun(Int_t nevpr)
Definition: AliRunLoader.h:154
AliDataLoader * fTrackRefsDataLoader
Definition: AliRunLoader.h:218
TTree * TreeK() const
Int_t LoadKinematics(Option_t *option="READ")
AliRun * GetAliRun() const
AliStack * Stack() const
Definition: AliRunLoader.h:95
void CleanTrackRefs()
Definition: AliRunLoader.h:140