/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/io/include/RAT/DSWriter.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/io/include/RAT/DSWriter.hh Source File
Ratpac-two
DSWriter.hh
1 #ifndef __RAT_DSWriter___
2 #define __RAT_DSWriter___
3 
4 #include <TFile.h>
5 #include <TObject.h>
6 #include <TTree.h>
7 
8 #include <RAT/DS/Root.hh>
9 #include <RAT/DS/Run.hh>
10 #include <string>
11 
12 namespace RAT {
13 
14 // Convenience class for ROOT scripts
15 class DSWriter : public TObject {
16  public:
17  // Write event tree to `filename`, flushing to disk every `autosave` kB.
18  // If update is true, append to file if it exists
19  DSWriter(const char *filename, bool update = false, int autosave = 1024);
20  virtual ~DSWriter();
21 
22  // Write an event to tree. Returns error code from TTree::Fill()
23  int Fill(DS::Root *ds);
24  TTree *GetTree() { return fTree; };
25  TTree *GetRunTree() { return fRunTree; };
26  void WriteLog();
27  void WriteStatus(int status);
28  void Close();
29 
30  ClassDef(DSWriter, 0);
31 
32  protected:
33  std::string fFilename;
34  TFile *fFile;
35  TTree *fTree;
36  TTree *fRunTree;
37  DS::Root *fBranchDS;
38  DS::Run *fBranchRun;
39 };
40 
41 } // namespace RAT
42 #endif
Definition: DSWriter.hh:15
Definition: Root.hh:39
Definition: Run.hh:22
Definition: CCCrossSecMessenger.hh:29