EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairParRootFileIo.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairParRootFileIo.h
1 #ifndef FAIRPARROOTFILEIO_H
2 #define FAIRPARROOTFILEIO_H
3 
4 #include "FairParIo.h"
5 
6 #include "TNamed.h"
7 #include "TFile.h"
8 #include "TList.h"
9 
10 class FairRtdbRun;
11 
12 class FairParRootFile : public TNamed
13 {
14  public:
16  FairParRootFile(const Text_t* fname, Option_t* option="READ",
17  const Text_t* ftitle="",Int_t compress=1);
18  FairParRootFile(TFile* f);
20  FairRtdbRun* getRun() {return run;}
22 
23  Bool_t IsOpen() {return RootFile->IsOpen();}
24  void cd() {RootFile->cd();}
25  Bool_t IsWritable() {return RootFile->IsWritable();}
26 
27  TKey* GetKey(Text_t* t) { return RootFile->GetKey(t);}
28  TList* GetListOfKeys() { return RootFile->GetListOfKeys();}
29  void Close() {RootFile->Close();}
30 
31  protected:
32  TFile* RootFile;
33 
34  private:
37 
38  ClassDef(FairParRootFile,0) // ROOT file for Parameter I/O
39 
40 };
41 
42 
44 {
45  protected:
46  FairParRootFile* file; // pointer to ROOT file
47  Bool_t fMerging;
48  public:
50  FairParRootFileIo(Bool_t merged);
52  Bool_t open(const Text_t* fname, Option_t* option="READ",
53  const Text_t* ftitle="",Int_t compress=1);
54  Bool_t open(const TList* fnamelist, Option_t* option="READ",
55  const Text_t* ftitle="",Int_t compress=1);
56  void close();
57  void print();
60  TList* getKeys();
61  Bool_t check() {
62  // returns kTRUE if file is open
63  if (file) { return file->IsOpen(); }
64  else { return kFALSE; }
65  }
66  void cd() {
67  // sets the global ROOT file pointer gFile
68  if (file) { file->cd(); }
69  }
73  Bool_t open(TFile* f);
74  void setMerging( Bool_t io ) { fMerging=io;}
75 
76  private:
79 
80  ClassDef(FairParRootFileIo,0) // Parameter I/O from ROOT files
81 };
82 
83 #endif /* !FAIRPARROOTFILEIO_H */
84