QwAnalysis
QwRootFile Class Reference

A wrapper class for a ROOT file or memory mapped file. More...

#include <QwRootFile.h>

Public Member Functions

 QwRootFile (const TString &run_label)
 Constructor with run label. More...
 
virtual ~QwRootFile ()
 Destructor. More...
 
void ProcessOptions (QwOptions &options)
 Process the configuration options. More...
 
Bool_t IsRootFile () const
 Is the ROOT file active? More...
 
Bool_t IsMapFile () const
 Is the map file active? More...
 
void ConstructIndices (const std::string &from, const std::string &to, bool reverse=true)
 Construct indices from one tree to another tree. More...
 
template<class T >
void ConstructTreeBranches (const std::string &name, const std::string &desc, T &object, const std::string &prefix="")
 Construct the tree branches of a generic object. More...
 
template<class T >
void FillTreeBranches (const std::string &name, const T &object)
 Fill the tree branches of a generic object by tree name. More...
 
template<class T >
void FillTreeBranches (const T &object)
 Fill the tree branches of a generic object by type only. More...
 
template<class T >
Int_t WriteParamFileList (const TString &name, T &object)
 
template<class T >
void ConstructHistograms (const std::string &name, T &object)
 Construct the histograms of a generic object. More...
 
template<class T >
void FillHistograms (T &object)
 Fill histograms of the subsystem array. More...
 
void NewTree (const std::string &name, const std::string &desc)
 Create a new tree with name and description. More...
 
TTree * GetTree (const std::string &name)
 Get the tree with name. More...
 
Int_t FillTree (const std::string &name)
 Fill the tree with name. More...
 
Int_t FillTrees ()
 Fill all registered trees. More...
 
void PrintTrees () const
 Print registered trees. More...
 
void PrintDirs () const
 Print registered histogram directories. More...
 
template<class T >
Int_t WriteObject (const T *obj, const char *name, Option_t *option="", Int_t bufsize=0)
 Write any object to the ROOT file (only valid for TFile) More...
 
void Update ()
 
void Print ()
 
void ls ()
 
void Map ()
 
void Close ()
 
Bool_t cd (const char *path=0)
 
TDirectory * mkdir (const char *name, const char *title="")
 
Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 

Static Public Member Functions

static void DefineOptions (QwOptions &options)
 Define the configuration options. More...
 
static void SetDefaultRootFileStem (const std::string &stem)
 Set default ROOT file stem. More...
 

Private Member Functions

 QwRootFile ()
 Private default constructor. More...
 
Bool_t HasAnyFilled (void)
 Search for non-empty trees or histograms in the file. More...
 
Bool_t HasAnyFilled (TDirectory *d)
 
void DisableTree (const TString &regexp)
 Add regexp to list of disabled trees names. More...
 
bool IsTreeDisabled (const std::string &name)
 Does this tree name match a disabled tree name? More...
 
void DisableHisto (const TString &regexp)
 Add regexp to list of disabled histogram directories. More...
 
bool IsHistoDisabled (const std::string &name)
 Does this histogram directory match a disabled histogram directory? More...
 
bool HasTreeByName (const std::string &name)
 Is a tree registered for this name. More...
 
template<class T >
bool HasTreeByType (const T &object)
 Is a tree registered for this type. More...
 
template<class T >
bool HasTreeByAddr (const T &object)
 Is a tree registered for this object. More...
 
bool HasDirByName (const std::string &name)
 Is a tree registered for this name. More...
 
template<class T >
bool HasDirByType (const T &object)
 Is a directory registered for this type. More...
 

Private Attributes

TFile * fRootFile
 ROOT file. More...
 
TString fRootFileStem
 ROOT file stem. More...
 
TString fPermanentName
 
Bool_t fMakePermanent
 
TMapFile * fMapFile
 Map file. More...
 
Bool_t fEnableMapFile
 
Int_t fUpdateInterval
 
Int_t fCompressionLevel
 
Int_t fBasketSize
 
Int_t fAutoFlush
 
Int_t fAutoSave
 
std::vector< TPRegexp > fDisabledTrees
 List of excluded trees. More...
 
std::vector< TPRegexp > fDisabledHistos
 
std::map< const std::string,
std::vector< QwRootTree * > > 
fTreeByName
 Tree names, addresses, and types. More...
 
std::map< const void
*, std::vector< QwRootTree * > > 
fTreeByAddr
 
std::map< const type_info
*, std::vector< QwRootTree * > > 
fTreeByType
 
std::map< const std::string,
TDirectory * > 
fDirsByName
 Directories. More...
 
std::map< const std::string,
std::vector< std::string > > 
fDirsByType
 
UInt_t fNumMpsEventsToSkip
 Prescaling of events written to tree. More...
 
UInt_t fNumMpsEventsToSave
 
UInt_t fNumHelEventsToSkip
 
UInt_t fNumHelEventsToSave
 
UInt_t fCircularBufferSize
 
UInt_t fCurrentEvent
 

Static Private Attributes

static std::string fDefaultRootFileStem = "Qweak_"
 Default ROOT file stem. More...
 
static const Long64_t kMaxTreeSize = 100000000000LL
 Maximum tree size. More...
 
static const Int_t kMaxMapFileSize = 0x10000000
 

Detailed Description

A wrapper class for a ROOT file or memory mapped file.

This class functions as a wrapper around a ROOT TFile or a TMapFile. The common inheritance of both is only TObject, so there is a lot that we have to wrap (rather than inherit). Theoretically you could have both a TFile and a TMapFile represented by an object of this class at the same time, but that is untested.

The functionality of writing to the file is done by templated functions. The objects that are passed to these functions have to provide the following functions:

  • ConstructHistograms, FillHistograms
  • ConstructBranchAndVector, FillTreeVector

The class keeps track of the registered tree names, and the types of objects that have branches constructed in those trees (via QwRootTree). In most cases it should be possible to just call FillTreeBranches with only the object, although in rare cases this could be ambiguous.

The proper way to register a tree is by either calling ConstructTreeBranches of NewTree first. Then FillTreeBranches will fill the vector, and FillTree will actually fill the tree. FillTree should be called only once.

Definition at line 281 of file QwRootFile.h.

Constructor & Destructor Documentation

QwRootFile::QwRootFile ( const TString &  run_label)

Constructor with run label.

Constructor with relative filename

Definition at line 17 of file QwRootFile.cc.

References QwLog::endl(), fCompressionLevel, fEnableMapFile, fMapFile, fPermanentName, fRootFile, fRootFileStem, QwOptions::GetArgc(), QwOptions::GetArgv(), getenv_safe_TString(), gQwOptions, kMaxMapFileSize, ProcessOptions(), QwError, QwMessage, and WriteObject().

18  : fRootFile(0), fMakePermanent(0),
19  fMapFile(0), fEnableMapFile(kFALSE),
20  fUpdateInterval(400)
21 {
22  // Process the configuration options
24 
25  // Check for the memory-mapped file flag
26  if (fEnableMapFile) {
27 
28  TString mapfilename = "/dev/shm/";
29 
30  // if( host_name.Contains("cdaql4") and (not user_name.CompareTo("cdaq", TString::kExact)) ) {
31  // mapfilename = "/local/scratch/qweak/";
32  // }
33  // else {
34  // mapfilename = getenv_safe_TString("QW_ROOTFILES");
35  // }
36 
37  mapfilename += "/QwMemMapFile.map";
38 
39  fMapFile = TMapFile::Create(mapfilename,"RECREATE", kMaxMapFileSize, "RealTime Producer File");
40 
41  if (not fMapFile) {
42  QwError << "Memory-mapped file " << mapfilename
43  << " could not be opened!" << QwLog::endl;
44  return;
45  }
46 
47  QwMessage << "================== RealTime Producer Memory Map File =================" << QwLog::endl;
48  fMapFile->Print();
49  QwMessage << "======================================================================" << QwLog::endl;
50 
51  } else {
52 
53  //TString rootfilename = getenv_safe_TString("QW_ROOTFILES");
54  TString hostname = gSystem -> HostName();
55  TString rootfilename;
56  TString localRootFileName = gSystem->Getenv("QW_ROOTFILES_LOCAL");
57 
58 // std::cout << "---------------------------------------------------------------------------------" << std::endl;
59 // printf("\n\n\n\n\n\n");
60 // printf("%s %s \n", hostname.Data(), localRootFileName.Data());
61 // printf("\n\n\n\n\n\n");
62 // std::cout << "---------------------------------------------------------------------------------" << std::endl;
63 // // if( localRootFileName.CompareTo("") == 0 ) {
64  if (localRootFileName.IsNull()) {
65  rootfilename = getenv_safe_TString("QW_ROOTFILES");
66  } else {
67  rootfilename = localRootFileName;
68  }
69 // std::cout << "---------------------------------------------------------------------------------" << std::endl;
70 // printf("\n\n\n\n\n\n");
71 // printf("%s %s \n", hostname.Data(), localRootFileName.Data());
72 // printf("\n\n\n\n\n\n");
73 // std::cout << "---------------------------------------------------------------------------------" << std::endl;
74 
75 
76  // Use a probably-unique temporary file name.
77  pid_t pid = getpid();
78 
79  fPermanentName = rootfilename
80  + Form("/%s%s.root", fRootFileStem.Data(), run_label.Data());
81  rootfilename += Form("/%s%s.%s.%d.root",
82  fRootFileStem.Data(), run_label.Data(),
83  hostname.Data(), pid);
84  fRootFile = new TFile(rootfilename, "RECREATE", "QWeak ROOT file");
85  if (! fRootFile) {
86  QwError << "ROOT file " << rootfilename
87  << " could not be opened!" << QwLog::endl;
88  return;
89  }
90 
91  TString run_condition_name = Form("%s_condition", run_label.Data());
92  TList *run_cond_list = (TList*) fRootFile -> FindObjectAny(run_condition_name);
93  if (not run_cond_list) {
94  QwRunCondition run_condition(
97  run_condition_name
98  );
99 
100  fRootFile -> WriteObject(
101  run_condition.Get(),
102  run_condition.GetName()
103  );
104  }
105 
106  fRootFile->SetCompressionLevel(fCompressionLevel);
107  }
108 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
Bool_t fEnableMapFile
Definition: QwRootFile.h:470
const TString getenv_safe_TString(const char *name)
Definition: QwOptions.h:40
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
Int_t fUpdateInterval
Definition: QwRootFile.h:471
QwOptions gQwOptions
Definition: QwOptions.cc:27
char ** GetArgv()
Get the vector of command line arguments.
Definition: QwOptions.h:278
TString fPermanentName
Definition: QwRootFile.h:461
TString fRootFileStem
ROOT file stem.
Definition: QwRootFile.h:455
Int_t WriteObject(const T *obj, const char *name, Option_t *option="", Int_t bufsize=0)
Write any object to the ROOT file (only valid for TFile)
Definition: QwRootFile.h:403
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
int GetArgc()
Get the number of command line arguments.
Definition: QwOptions.h:276
Int_t fCompressionLevel
Definition: QwRootFile.h:472
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
static const Int_t kMaxMapFileSize
Definition: QwRootFile.h:565
void ProcessOptions(QwOptions &options)
Process the configuration options.
Definition: QwRootFile.cc:243
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
Bool_t fMakePermanent
Definition: QwRootFile.h:462

+ Here is the call graph for this function:

QwRootFile::~QwRootFile ( )
virtual

Destructor.

Destructor

Definition at line 114 of file QwRootFile.cc.

References QwLog::endl(), fMakePermanent, fMapFile, fPermanentName, fRootFile, fTreeByName, HasAnyFilled(), QwMessage, and QwWarning.

115 {
116  // Keep the file on disk if any trees or histograms have been filled.
117  // Also respect any other requests to keep the file around.
119 
120  // Close the map file
121  if (fMapFile) {
122  fMapFile->Close();
123  // TMapFiles may not be deleted
124  fMapFile = 0;
125  }
126 
127  // Close the ROOT file.
128  // Rename if permanence is requested, remove otherwise
129  if (fRootFile) {
130  TString rootfilename = fRootFile->GetName();
131 
132  fRootFile->Close();
133  delete fRootFile;
134  fRootFile = 0;
135 
136  int err;
137  const char* action;
138  if (fMakePermanent) {
139  action = " rename ";
140  err = rename( rootfilename.Data(), fPermanentName.Data() );
141  } else {
142  action = " remove ";
143  err = remove( rootfilename.Data() );
144  }
145  // It'd be proper to "extern int errno" and strerror() here,
146  // but that doesn't seem very C++-ish.
147  if (err) {
148  QwWarning << "Couldn't" << action << rootfilename << QwLog::endl;
149  } else {
150  QwMessage << "Was able to" << action << rootfilename << QwLog::endl;
151  QwMessage << "Root file is " << fPermanentName << QwLog::endl;
152  }
153  }
154 
155  // Delete Qweak ROOT trees
156  std::map< const std::string, std::vector<QwRootTree*> >::iterator map_iter;
157  std::vector<QwRootTree*>::iterator vec_iter;
158  for (map_iter = fTreeByName.begin(); map_iter != fTreeByName.end(); map_iter++) {
159  for (vec_iter = map_iter->second.begin(); vec_iter != map_iter->second.end(); vec_iter++) {
160  delete *vec_iter;
161  }
162  }
163 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
TString fPermanentName
Definition: QwRootFile.h:461
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
Bool_t HasAnyFilled(void)
Search for non-empty trees or histograms in the file.
Definition: QwRootFile.cc:293
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
Bool_t fMakePermanent
Definition: QwRootFile.h:462

+ Here is the call graph for this function:

QwRootFile::QwRootFile ( )
private

Private default constructor.

Member Function Documentation

Bool_t QwRootFile::cd ( const char *  path = 0)
inline

Definition at line 422 of file QwRootFile.h.

References fMapFile, and fRootFile.

Referenced by ConstructTreeBranches(), and NewTree().

422  {
423  Bool_t status = kTRUE;
424  if (fMapFile) status &= fMapFile->cd(path);
425  if (fRootFile) status &= fRootFile->cd(path);
426  return status;
427  }
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452

+ Here is the caller graph for this function:

void QwRootFile::Close ( )
inline

Definition at line 416 of file QwRootFile.h.

References fMakePermanent, fMapFile, fRootFile, and HasAnyFilled().

Referenced by main().

416  {
418  if (fMapFile) fMapFile->Close(); if (fRootFile) fRootFile->Close();
419  }
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
Bool_t HasAnyFilled(void)
Search for non-empty trees or histograms in the file.
Definition: QwRootFile.cc:293
Bool_t fMakePermanent
Definition: QwRootFile.h:462

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
void QwRootFile::ConstructHistograms ( const std::string &  name,
T &  object 
)

Construct the histograms of a generic object.

Construct the histogram of a generic object

Parameters
nameName for histogram directory
objectSubsystem array

Definition at line 706 of file QwRootFile.h.

References QwLog::endl(), fDirsByName, fDirsByType, fMapFile, fRootFile, IsHistoDisabled(), and QwMessage.

Referenced by main().

707 {
708  // Return if we do not want this histogram information
709  if (IsHistoDisabled(name)) return;
710 
711  // Create the histograms in a directory
712  if (fRootFile) {
713  std::string type = typeid(object).name();
714  fDirsByName[name] = fRootFile->GetDirectory("/")->mkdir(name.c_str());
715  fDirsByType[type].push_back(name);
716  object.ConstructHistograms(fDirsByName[name]);
717  }
718 
719  // No support for directories in a map file
720  if (fMapFile) {
721  QwMessage << "QwRootFile::ConstructHistograms::detectors address "
722  << &object
723  << " and its name " << name
724  << QwLog::endl;
725 
726  std::string type = typeid(object).name();
727  fDirsByName[name] = fMapFile->GetDirectory()->mkdir(name.c_str());
728  fDirsByType[type].push_back(name);
729  //object.ConstructHistograms(fDirsByName[name]);
730  object.ConstructHistograms();
731  }
732 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
std::map< const std::string, TDirectory * > fDirsByName
Directories.
Definition: QwRootFile.h:536
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
std::map< const std::string, std::vector< std::string > > fDirsByType
Definition: QwRootFile.h:537
bool IsHistoDisabled(const std::string &name)
Does this histogram directory match a disabled histogram directory?
Definition: QwRootFile.h:500

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRootFile::ConstructIndices ( const std::string &  from,
const std::string &  to,
bool  reverse = true 
)
inline

Construct indices from one tree to another tree.

Construct the indices from one tree to another tree, and optionally in reverse as well.

Parameters
fromName of tree where index will be created
toName of tree to which index will point
reverseFlag to create indices in both direction

Definition at line 574 of file QwRootFile.h.

References fTreeByName, and IsTreeDisabled().

Referenced by main().

575 {
576  // Return if we do not want this tree information
577  if (IsTreeDisabled(from)) return;
578  if (IsTreeDisabled(to)) return;
579 
580  // If the trees are defined
581  if (fTreeByName.count(from) > 0 && fTreeByName.count(to) > 0) {
582 
583  // Construct index from the first tree to the second tree
584  fTreeByName[from].front()->ConstructIndexTo(fTreeByName[to].front());
585 
586  // Construct index from the second tree back to the first tree
587  if (reverse)
588  fTreeByName[to].front()->ConstructIndexTo(fTreeByName[from].front());
589  }
590 }
bool IsTreeDisabled(const std::string &name)
Does this tree name match a disabled tree name?
Definition: QwRootFile.h:490
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
void QwRootFile::ConstructTreeBranches ( const std::string &  name,
const std::string &  desc,
T &  object,
const std::string &  prefix = "" 
)

Construct the tree branches of a generic object.

Construct the tree branches of a generic object

Parameters
nameName for tree
descDescription for tree
objectSubsystem array
prefixPrefix for the tree

Definition at line 600 of file QwRootFile.h.

References cd(), fAutoFlush, fAutoSave, fBasketSize, fCircularBufferSize, fEnableMapFile, fNumHelEventsToSave, fNumHelEventsToSkip, fNumMpsEventsToSave, fNumMpsEventsToSkip, fTreeByAddr, fTreeByName, fTreeByType, IsTreeDisabled(), kMaxTreeSize, QwRootTree::SetAutoFlush(), QwRootTree::SetAutoSave(), QwRootTree::SetBasketSize(), QwRootTree::SetCircular(), QwRootTree::SetMaxTreeSize(), and QwRootTree::SetPrescaling().

Referenced by main().

605 {
606  // Return if we do not want this tree information
607  if (IsTreeDisabled(name)) return;
608 
609  // Pointer to new tree
610  QwRootTree* tree = 0;
611 
612  // If the tree does not exist yet, create it
613  if (fTreeByName.count(name) == 0) {
614 
615  // Go to top level directory
616  this->cd();
617 
618  // New tree with name, description, object, prefix
619  tree = new QwRootTree(name, desc, object, prefix);
620 
621  // Settings only relevant for new trees
622  if (name == "Mps_Tree")
624  else if (name == "Hel_Tree")
626 
627  #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,00)
628  tree->SetAutoFlush(fAutoFlush);
629  #endif
630  tree->SetAutoSave(fAutoSave);
631  tree->SetBasketSize(fBasketSize);
633 
636 
637  } else {
638 
639  // New tree based on existing tree
640  tree = new QwRootTree(fTreeByName[name].front(), object, prefix);
641  }
642 
643  // Add the branches to the list of trees by name, object, type
644  const void* addr = static_cast<const void*>(&object);
645  const type_info* type = &typeid(object);
646  fTreeByName[name].push_back(tree);
647  fTreeByAddr[addr].push_back(tree);
648  fTreeByType[type].push_back(tree);
649 }
Int_t fBasketSize
Definition: QwRootFile.h:473
UInt_t fNumMpsEventsToSave
Definition: QwRootFile.h:557
Int_t fAutoSave
Definition: QwRootFile.h:475
Int_t fAutoFlush
Definition: QwRootFile.h:474
A wrapper class for a ROOT tree.
Definition: QwRootFile.h:36
Bool_t fEnableMapFile
Definition: QwRootFile.h:470
void SetMaxTreeSize(Long64_t maxsize=1900000000)
Set maximum tree size.
Definition: QwRootFile.h:220
UInt_t fNumHelEventsToSkip
Definition: QwRootFile.h:558
void SetAutoSave(Long64_t autosave=300000000)
Set autosave size.
Definition: QwRootFile.h:234
void SetAutoFlush(Long64_t autoflush=30000000)
Set autoflush size.
Definition: QwRootFile.h:226
std::map< const void *, std::vector< QwRootTree * > > fTreeByAddr
Definition: QwRootFile.h:511
UInt_t fNumMpsEventsToSkip
Prescaling of events written to tree.
Definition: QwRootFile.h:556
UInt_t fNumHelEventsToSave
Definition: QwRootFile.h:559
void SetBasketSize(Int_t basketsize=16000)
Set basket size.
Definition: QwRootFile.h:240
void SetPrescaling(UInt_t num_to_save, UInt_t num_to_skip)
Set tree prescaling parameters.
Definition: QwRootFile.h:206
Bool_t cd(const char *path=0)
Definition: QwRootFile.h:422
bool IsTreeDisabled(const std::string &name)
Does this tree name match a disabled tree name?
Definition: QwRootFile.h:490
UInt_t fCircularBufferSize
Definition: QwRootFile.h:560
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510
static const Long64_t kMaxTreeSize
Maximum tree size.
Definition: QwRootFile.h:564
void SetCircular(Long64_t buff=100000)
Definition: QwRootFile.h:246
std::map< const type_info *, std::vector< QwRootTree * > > fTreeByType
Definition: QwRootFile.h:512

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRootFile::DefineOptions ( QwOptions options)
static

Define the configuration options.

Defines configuration options using QwOptions functionality.

Parameters
optionsOptions object

Definition at line 169 of file QwRootFile.cc.

References QwOptions::AddOptions(), default_bool_value, and fDefaultRootFileStem.

Referenced by QwOptions::DefineOptions().

170 {
171  // Define the ROOT filename stem
172  options.AddOptions("Default options")
173  ("rootfile-stem", po::value<std::string>()->default_value(fDefaultRootFileStem),
174  "stem of the output ROOT filename");
175 
176  // Define the memory map option
177  options.AddOptions()
178  ("enable-mapfile", po::value<bool>()->default_bool_value(false),
179  "enable output to memory-mapped file");
180 
181  // Define the histogram and tree options
182  options.AddOptions("ROOT output options")
183  ("disable-trees", po::value<bool>()->default_bool_value(false),
184  "disable output to all trees");
185  options.AddOptions("ROOT output options")
186  ("disable-histos", po::value<bool>()->default_bool_value(false),
187  "disable output to all histograms");
188 
189  // Define the helicity window versus helicity pattern options
190  options.AddOptions("ROOT output options")
191  ("disable-mps-tree", po::value<bool>()->default_bool_value(false),
192  "disable helicity window output");
193  options.AddOptions("ROOT output options")
194  ("disable-hel-tree", po::value<bool>()->default_bool_value(false),
195  "disable helicity pattern output");
196  options.AddOptions("ROOT output options")
197  ("disable-burst-tree", po::value<bool>()->default_bool_value(false),
198  "disable burst tree");
199  options.AddOptions("ROOT output options")
200  ("disable-slow-tree", po::value<bool>()->default_bool_value(false),
201  "disable slow control tree");
202 
203  // Define the tree output prescaling options
204  options.AddOptions("ROOT output options")
205  ("num-mps-accepted-events", po::value<int>()->default_value(0),
206  "number of accepted consecutive MPS events");
207  options.AddOptions("ROOT output options")
208  ("num-mps-discarded-events", po::value<int>()->default_value(0),
209  "number of discarded consecutive MPS events");
210  options.AddOptions("ROOT output options")
211  ("num-hel-accepted-events", po::value<int>()->default_value(0),
212  "number of accepted consecutive pattern events");
213  options.AddOptions("ROOT output options")
214  ("num-hel-discarded-events", po::value<int>()->default_value(0),
215  "number of discarded consecutive pattern events");
216  options.AddOptions("ROOT output options")
217  ("mapfile-update-interval", po::value<int>()->default_value(400),
218  "Events between a map file update");
219 
220  // Define the autoflush and autosave option (default values by ROOT)
221  options.AddOptions("ROOT performance options")
222  ("autoflush", po::value<int>()->default_value(0),
223  "TTree autoflush");
224  options.AddOptions("ROOT performance options")
225  ("autosave", po::value<int>()->default_value(300000000),
226  "TTree autosave");
227  options.AddOptions("ROOT performance options")
228  ("basket-size", po::value<int>()->default_value(16000),
229  "TTree basket size");
230  options.AddOptions("ROOT performance options")
231  ("circular-buffer", po::value<int>()->default_value(0),
232  "TTree circular buffer");
233  options.AddOptions("ROOT performance options")
234  ("compression-level", po::value<int>()->default_value(1),
235  "TFile compression level");
236 }
#define default_bool_value(b)
Definition: QwOptions.h:51
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Definition: QwOptions.h:164
static std::string fDefaultRootFileStem
Default ROOT file stem.
Definition: QwRootFile.h:457

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRootFile::DisableHisto ( const TString &  regexp)
inlineprivate

Add regexp to list of disabled histogram directories.

Definition at line 496 of file QwRootFile.h.

References fDisabledHistos.

Referenced by ProcessOptions().

496  {
497  fDisabledHistos.push_back(regexp);
498  }
std::vector< TPRegexp > fDisabledHistos
Definition: QwRootFile.h:483

+ Here is the caller graph for this function:

void QwRootFile::DisableTree ( const TString &  regexp)
inlineprivate

Add regexp to list of disabled trees names.

Definition at line 486 of file QwRootFile.h.

References fDisabledTrees.

Referenced by ProcessOptions().

486  {
487  fDisabledTrees.push_back(regexp);
488  }
std::vector< TPRegexp > fDisabledTrees
List of excluded trees.
Definition: QwRootFile.h:482

+ Here is the caller graph for this function:

template<class T >
void QwRootFile::FillHistograms ( T &  object)
inline

Fill histograms of the subsystem array.

Definition at line 329 of file QwRootFile.h.

References fUpdateInterval, HasDirByType(), and Update().

Referenced by main().

329  {
330  // Update regularly
331  static Int_t update_count = 0;
332  update_count++;
333  if (update_count % fUpdateInterval == 0) Update();
334  if (! HasDirByType(object)) return;
335  // Fill histograms
336  object.FillHistograms();
337  }
Int_t fUpdateInterval
Definition: QwRootFile.h:471
void Update()
Definition: QwRootFile.h:412
bool HasDirByType(const T &object)
Is a directory registered for this type.
Definition: QwRootFile.h:546

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Int_t QwRootFile::FillTree ( const std::string &  name)
inline

Fill the tree with name.

Definition at line 359 of file QwRootFile.h.

References fTreeByName, and HasTreeByName().

Referenced by main().

359  {
360  if (! HasTreeByName(name)) return 0;
361  else return fTreeByName[name].front()->Fill();
362  }
bool HasTreeByName(const std::string &name)
Is a tree registered for this name.
Definition: QwRootFile.h:516
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
void QwRootFile::FillTreeBranches ( const std::string &  name,
const T &  object 
)

Fill the tree branches of a generic object by tree name.

Fill the tree branches of a generic object by name

Parameters
nameName for tree
objectSubsystem array

Definition at line 658 of file QwRootFile.h.

References fTreeByAddr, HasTreeByName(), and HasTreeByType().

Referenced by main().

661 {
662  // If this name has no registered trees
663  if (! HasTreeByName(name)) return;
664  // If this type has no registered trees
665  if (! HasTreeByType(object)) return;
666 
667  // Get the address of the object
668  const void* addr = static_cast<const void*>(&object);
669 
670  // Fill the trees with the correct address
671  for (size_t tree = 0; tree < fTreeByAddr[addr].size(); tree++) {
672  if (fTreeByAddr[addr].at(tree)->GetName() == name) {
673  fTreeByAddr[addr].at(tree)->FillTreeBranches(object);
674  }
675  }
676 }
bool HasTreeByName(const std::string &name)
Is a tree registered for this name.
Definition: QwRootFile.h:516
std::map< const void *, std::vector< QwRootTree * > > fTreeByAddr
Definition: QwRootFile.h:511
bool HasTreeByType(const T &object)
Is a tree registered for this type.
Definition: QwRootFile.h:522

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
void QwRootFile::FillTreeBranches ( const T &  object)

Fill the tree branches of a generic object by type only.

Fill the tree branches of a generic object by type only

Parameters
objectSubsystem array

Definition at line 684 of file QwRootFile.h.

References fTreeByAddr, and HasTreeByAddr().

686 {
687  // If this address has no registered trees
688  if (! HasTreeByAddr(object)) return;
689 
690  // Get the address of the object
691  const void* addr = static_cast<const void*>(&object);
692 
693  // Fill the trees with the correct address
694  for (size_t tree = 0; tree < fTreeByAddr[addr].size(); tree++) {
695  fTreeByAddr[addr].at(tree)->FillTreeBranches(object);
696  }
697 }
std::map< const void *, std::vector< QwRootTree * > > fTreeByAddr
Definition: QwRootFile.h:511
bool HasTreeByAddr(const T &object)
Is a tree registered for this object.
Definition: QwRootFile.h:529

+ Here is the call graph for this function:

Int_t QwRootFile::FillTrees ( )
inline

Fill all registered trees.

Definition at line 365 of file QwRootFile.h.

References fTreeByName.

365  {
366  // Loop over all registered tree names
367  Int_t retval = 0;
368  std::map< const std::string, std::vector<QwRootTree*> >::iterator iter;
369  for (iter = fTreeByName.begin(); iter != fTreeByName.end(); iter++) {
370  retval += iter->second.front()->Fill();
371  }
372  return retval;
373  }
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510
TTree* QwRootFile::GetTree ( const std::string &  name)
inline

Get the tree with name.

Definition at line 353 of file QwRootFile.h.

References fTreeByName, and HasTreeByName().

Referenced by main().

353  {
354  if (! HasTreeByName(name)) return 0;
355  else return fTreeByName[name].front()->GetTree();
356  }
bool HasTreeByName(const std::string &name)
Is a tree registered for this name.
Definition: QwRootFile.h:516
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwRootFile::HasAnyFilled ( void  )
private

Search for non-empty trees or histograms in the file.

Determine whether the rootfile object has any non-empty trees or histograms.

Definition at line 293 of file QwRootFile.cc.

References fRootFile.

Referenced by Close(), HasAnyFilled(), and ~QwRootFile().

293  {
294  return this->HasAnyFilled(fRootFile);
295 }
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
Bool_t HasAnyFilled(void)
Search for non-empty trees or histograms in the file.
Definition: QwRootFile.cc:293

+ Here is the caller graph for this function:

Bool_t QwRootFile::HasAnyFilled ( TDirectory *  d)
private

Definition at line 296 of file QwRootFile.cc.

References HasAnyFilled().

296  {
297  if (!d) return false;
298  TList* l = d->GetListOfKeys();
299 
300  for( int i=0; i < l->GetEntries(); ++i) {
301  const char* name = l->At(i)->GetName();
302  TObject* obj = d->FindObjectAny(name);
303 
304  // Objects which can't be found don't count.
305  if (!obj) continue;
306 
307  // Lists of parameter files, map files, and job conditions don't count.
308  if ( TString(name).Contains("parameter_file") ) continue;
309  if ( TString(name).Contains("mapfile") ) continue;
310  if ( TString(name).Contains("_condition") ) continue;
311  // The EPICS tree doesn't count
312  if ( TString(name).Contains("Slow_Tree") ) continue;
313 
314  // Recursively check subdirectories.
315  if (obj->IsA()->InheritsFrom( "TDirectory" ))
316  if (this->HasAnyFilled( (TDirectory*)obj )) return true;
317 
318  if (obj->IsA()->InheritsFrom( "TTree" ))
319  if ( ((TTree*) obj)->GetEntries() ) return true;
320 
321  if (obj->IsA()->InheritsFrom( "TH1" ))
322  if ( ((TH1*) obj)->GetEntries() ) return true;
323  }
324 
325  return false;
326 }
Bool_t HasAnyFilled(void)
Search for non-empty trees or histograms in the file.
Definition: QwRootFile.cc:293

+ Here is the call graph for this function:

bool QwRootFile::HasDirByName ( const std::string &  name)
inlineprivate

Is a tree registered for this name.

Definition at line 540 of file QwRootFile.h.

References fDirsByName.

540  {
541  if (fDirsByName.count(name) == 0) return false;
542  else return true;
543  }
std::map< const std::string, TDirectory * > fDirsByName
Directories.
Definition: QwRootFile.h:536
template<class T >
bool QwRootFile::HasDirByType ( const T &  object)
inlineprivate

Is a directory registered for this type.

Definition at line 546 of file QwRootFile.h.

References fDirsByType.

Referenced by FillHistograms().

546  {
547  std::string type = typeid(object).name();
548  if (fDirsByType.count(type) == 0) return false;
549  else return true;
550  }
std::map< const std::string, std::vector< std::string > > fDirsByType
Definition: QwRootFile.h:537

+ Here is the caller graph for this function:

template<class T >
bool QwRootFile::HasTreeByAddr ( const T &  object)
inlineprivate

Is a tree registered for this object.

Definition at line 529 of file QwRootFile.h.

References fTreeByAddr.

Referenced by FillTreeBranches().

529  {
530  const void* addr = static_cast<const void*>(&object);
531  if (fTreeByAddr.count(addr) == 0) return false;
532  else return true;
533  }
std::map< const void *, std::vector< QwRootTree * > > fTreeByAddr
Definition: QwRootFile.h:511

+ Here is the caller graph for this function:

bool QwRootFile::HasTreeByName ( const std::string &  name)
inlineprivate

Is a tree registered for this name.

Definition at line 516 of file QwRootFile.h.

References fTreeByName.

Referenced by FillTree(), FillTreeBranches(), GetTree(), and NewTree().

516  {
517  if (fTreeByName.count(name) == 0) return false;
518  else return true;
519  }
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510

+ Here is the caller graph for this function:

template<class T >
bool QwRootFile::HasTreeByType ( const T &  object)
inlineprivate

Is a tree registered for this type.

Definition at line 522 of file QwRootFile.h.

References fTreeByType.

Referenced by FillTreeBranches().

522  {
523  const type_info* type = &typeid(object);
524  if (fTreeByType.count(type) == 0) return false;
525  else return true;
526  }
std::map< const type_info *, std::vector< QwRootTree * > > fTreeByType
Definition: QwRootFile.h:512

+ Here is the caller graph for this function:

bool QwRootFile::IsHistoDisabled ( const std::string &  name)
inlineprivate

Does this histogram directory match a disabled histogram directory?

Definition at line 500 of file QwRootFile.h.

References fDisabledHistos.

Referenced by ConstructHistograms().

500  {
501  for (size_t i = 0; i < fDisabledHistos.size(); i++)
502  if (fDisabledHistos.at(i).Match(name)) return true;
503  return false;
504  }
std::vector< TPRegexp > fDisabledHistos
Definition: QwRootFile.h:483

+ Here is the caller graph for this function:

Bool_t QwRootFile::IsMapFile ( ) const
inline

Is the map file active?

Definition at line 304 of file QwRootFile.h.

References fMapFile.

304 { return (fMapFile); };
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
Bool_t QwRootFile::IsRootFile ( ) const
inline

Is the ROOT file active?

Definition at line 302 of file QwRootFile.h.

References fRootFile.

302 { return (fRootFile); };
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
bool QwRootFile::IsTreeDisabled ( const std::string &  name)
inlineprivate

Does this tree name match a disabled tree name?

Definition at line 490 of file QwRootFile.h.

References fDisabledTrees.

Referenced by ConstructIndices(), and ConstructTreeBranches().

490  {
491  for (size_t i = 0; i < fDisabledTrees.size(); i++)
492  if (fDisabledTrees.at(i).Match(name)) return true;
493  return false;
494  }
std::vector< TPRegexp > fDisabledTrees
List of excluded trees.
Definition: QwRootFile.h:482

+ Here is the caller graph for this function:

void QwRootFile::ls ( )
inline

Definition at line 414 of file QwRootFile.h.

References fMapFile, and fRootFile.

414 { if (fMapFile) fMapFile->ls(); if (fRootFile) fRootFile->ls(); }
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
void QwRootFile::Map ( )
inline

Definition at line 415 of file QwRootFile.h.

References fRootFile.

415 { if (fRootFile) fRootFile->Map(); }
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
TDirectory* QwRootFile::mkdir ( const char *  name,
const char *  title = "" 
)
inline

Definition at line 430 of file QwRootFile.h.

References fRootFile.

430  {
431  // TMapFile has no suport for mkdir
432  if (fRootFile) return fRootFile->mkdir(name, title);
433  else return 0;
434  }
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
void QwRootFile::NewTree ( const std::string &  name,
const std::string &  desc 
)
inline

Create a new tree with name and description.

Definition at line 341 of file QwRootFile.h.

References cd(), fTreeByName, and HasTreeByName().

Referenced by main().

341  {
342  this->cd();
343  QwRootTree *tree = 0;
344  if (! HasTreeByName(name)) {
345  tree = new QwRootTree(name,desc);
346  } else {
347  tree = new QwRootTree(fTreeByName[name].front());
348  }
349  fTreeByName[name].push_back(tree);
350  }
A wrapper class for a ROOT tree.
Definition: QwRootFile.h:36
bool HasTreeByName(const std::string &name)
Is a tree registered for this name.
Definition: QwRootFile.h:516
Bool_t cd(const char *path=0)
Definition: QwRootFile.h:422
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRootFile::Print ( )
inline

Definition at line 413 of file QwRootFile.h.

References fMapFile, and fRootFile.

413 { if (fMapFile) fMapFile->Print(); if (fRootFile) fRootFile->Print(); }
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452
void QwRootFile::PrintDirs ( ) const
inline

Print registered histogram directories.

Definition at line 391 of file QwRootFile.h.

References QwLog::endl(), fDirsByName, and QwMessage.

Referenced by main().

391  {
392  QwMessage << "Dirs: " << QwLog::endl;
393  // Loop ove rall registered directories
394  std::map< const std::string, TDirectory* >::const_iterator iter;
395  for (iter = fDirsByName.begin(); iter != fDirsByName.end(); iter++) {
396  QwMessage << iter->first << QwLog::endl;
397  }
398  }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< const std::string, TDirectory * > fDirsByName
Directories.
Definition: QwRootFile.h:536
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRootFile::PrintTrees ( ) const
inline

Print registered trees.

Definition at line 376 of file QwRootFile.h.

References QwLog::endl(), fTreeByName, and QwMessage.

Referenced by main().

376  {
377  QwMessage << "Trees: " << QwLog::endl;
378  // Loop over all registered tree names
379  std::map< const std::string, std::vector<QwRootTree*> >::const_iterator iter;
380  for (iter = fTreeByName.begin(); iter != fTreeByName.end(); iter++) {
381  QwMessage << iter->first << ": " << iter->second.size()
382  << " objects registered" << QwLog::endl;
383  // Loop over all registered objects for this tree
384  std::vector<QwRootTree*>::const_iterator tree;
385  for (tree = iter->second.begin(); tree != iter->second.end(); tree++) {
386  (*tree)->Print();
387  }
388  }
389  }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< const std::string, std::vector< QwRootTree * > > fTreeByName
Tree names, addresses, and types.
Definition: QwRootFile.h:510
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRootFile::ProcessOptions ( QwOptions options)

Process the configuration options.

Parse the configuration options and store in class fields

Parameters
optionsOptions object

Definition at line 243 of file QwRootFile.cc.

References DisableHisto(), DisableTree(), QwLog::endl(), fAutoFlush, fAutoSave, fBasketSize, fCircularBufferSize, fCompressionLevel, fEnableMapFile, fNumHelEventsToSave, fNumHelEventsToSkip, fNumMpsEventsToSave, fNumMpsEventsToSkip, fRootFileStem, fUpdateInterval, QwOptions::GetValue(), QwMessage, and QwWarning.

Referenced by QwRootFile().

244 {
245  // Option 'root-stem' to specify ROOT file stem
246  fRootFileStem = TString(options.GetValue<std::string>("rootfile-stem"));
247 
248  // Option 'mapfile' to enable memory-mapped ROOT file
249  fEnableMapFile = options.GetValue<bool>("enable-mapfile");
250 
251  // Options 'disable-trees' and 'disable-histos' for disabling
252  // tree and histogram output
253  if (options.GetValue<bool>("disable-trees")) DisableTree(".*");
254  if (options.GetValue<bool>("disable-histos")) DisableHisto(".*");
255 
256  // Options 'disable-mps' and 'disable-hel' for disabling
257  // helicity window and helicity pattern output
258  if (options.GetValue<bool>("disable-mps-tree")) DisableTree("Mps_Tree");
259  if (options.GetValue<bool>("disable-hel-tree")) DisableTree("Hel_Tree");
260  if (options.GetValue<bool>("disable-burst-tree")) DisableTree("Burst_Tree");
261  if (options.GetValue<bool>("disable-slow-tree")) DisableTree("Slow_Tree");
262 
263  // Options 'num-accepted-events' and 'num-discarded-events' for
264  // prescaling of the tree output
265  fNumMpsEventsToSave = options.GetValue<int>("num-mps-accepted-events");
266  fNumMpsEventsToSkip = options.GetValue<int>("num-mps-discarded-events");
267  fNumHelEventsToSave = options.GetValue<int>("num-mps-accepted-events");
268  fNumHelEventsToSkip = options.GetValue<int>("num-mps-discarded-events");
269 
270  // Update interval for the map file
271  fCircularBufferSize = options.GetValue<int>("circular-buffer");
272  fUpdateInterval = options.GetValue<int>("mapfile-update-interval");
273  fCompressionLevel = options.GetValue<int>("compression-level");
274  fBasketSize = options.GetValue<int>("basket-size");
275 
276  // Autoflush and autosave
277  fAutoFlush = options.GetValue<int>("autoflush");
278  if ((ROOT_VERSION_CODE < ROOT_VERSION(5,26,00)) && fAutoFlush != -30000000){
280  QwWarning << "QwRootFile::ProcessOptions: "
281  << "The 'autoflush' flag is not supported by ROOT version "
282  << ROOT_RELEASE
283  << QwLog::endl;
284  }
285  fAutoSave = options.GetValue<int>("autosave");
286  return;
287 }
Int_t fBasketSize
Definition: QwRootFile.h:473
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
UInt_t fNumMpsEventsToSave
Definition: QwRootFile.h:557
Int_t fAutoSave
Definition: QwRootFile.h:475
Int_t fAutoFlush
Definition: QwRootFile.h:474
Bool_t fEnableMapFile
Definition: QwRootFile.h:470
UInt_t fNumHelEventsToSkip
Definition: QwRootFile.h:558
void DisableHisto(const TString &regexp)
Add regexp to list of disabled histogram directories.
Definition: QwRootFile.h:496
UInt_t fNumMpsEventsToSkip
Prescaling of events written to tree.
Definition: QwRootFile.h:556
Int_t fUpdateInterval
Definition: QwRootFile.h:471
UInt_t fNumHelEventsToSave
Definition: QwRootFile.h:559
TString fRootFileStem
ROOT file stem.
Definition: QwRootFile.h:455
T GetValue(const std::string &key)
Get a templated value.
Definition: QwOptions.h:240
UInt_t fCircularBufferSize
Definition: QwRootFile.h:560
Int_t fCompressionLevel
Definition: QwRootFile.h:472
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
void DisableTree(const TString &regexp)
Add regexp to list of disabled trees names.
Definition: QwRootFile.h:486
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void QwRootFile::SetDefaultRootFileStem ( const std::string &  stem)
inlinestatic

Set default ROOT file stem.

Definition at line 296 of file QwRootFile.h.

References fDefaultRootFileStem.

Referenced by main().

296  {
297  fDefaultRootFileStem = stem;
298  }
static std::string fDefaultRootFileStem
Default ROOT file stem.
Definition: QwRootFile.h:457

+ Here is the caller graph for this function:

void QwRootFile::Update ( )
inline

Definition at line 412 of file QwRootFile.h.

References fMapFile.

Referenced by FillHistograms().

412 { if (fMapFile) fMapFile->Update(); } // not for TFile
TMapFile * fMapFile
Map file.
Definition: QwRootFile.h:469

+ Here is the caller graph for this function:

Int_t QwRootFile::Write ( const char *  name = 0,
Int_t  option = 0,
Int_t  bufsize = 0 
)
inline

Definition at line 437 of file QwRootFile.h.

References fRootFile.

Referenced by main().

437  {
438  Int_t retval = 0;
439  // TMapFile has no suport for Write
440  if (fRootFile) retval = fRootFile->Write(name, option, bufsize);
441  return retval;
442  }
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452

+ Here is the caller graph for this function:

template<class T >
Int_t QwRootFile::WriteObject ( const T *  obj,
const char *  name,
Option_t *  option = "",
Int_t  bufsize = 0 
)
inline

Write any object to the ROOT file (only valid for TFile)

Definition at line 403 of file QwRootFile.h.

References fRootFile.

Referenced by QwRootFile().

403  {
404  Int_t retval = 0;
405  // TMapFile has no suport for WriteObject
406  if (fRootFile) retval = fRootFile->WriteObject(obj,name,option,bufsize);
407  return retval;
408  }
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452

+ Here is the caller graph for this function:

template<class T >
Int_t QwRootFile::WriteParamFileList ( const TString &  name,
T &  object 
)

Definition at line 736 of file QwRootFile.h.

References fRootFile.

Referenced by main().

737 {
738  Int_t retval = 0;
739  if (fRootFile) {
740  TList *param_list = (TList*) fRootFile->FindObjectAny(name);
741  if (not param_list) {
742  retval = fRootFile->WriteObject(object.GetParamFileNameList(name), name);
743  }
744  }
745  return retval;
746 }
TFile * fRootFile
ROOT file.
Definition: QwRootFile.h:452

+ Here is the caller graph for this function:

Field Documentation

Int_t QwRootFile::fAutoFlush
private

Definition at line 474 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

Int_t QwRootFile::fAutoSave
private

Definition at line 475 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

Int_t QwRootFile::fBasketSize
private

Definition at line 473 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

UInt_t QwRootFile::fCircularBufferSize
private

Definition at line 560 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

Int_t QwRootFile::fCompressionLevel
private

Definition at line 472 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

UInt_t QwRootFile::fCurrentEvent
private

Definition at line 561 of file QwRootFile.h.

std::string QwRootFile::fDefaultRootFileStem = "Qweak_"
staticprivate

Default ROOT file stem.

Definition at line 457 of file QwRootFile.h.

Referenced by DefineOptions(), and SetDefaultRootFileStem().

std::map< const std::string, TDirectory* > QwRootFile::fDirsByName
private

Directories.

Definition at line 536 of file QwRootFile.h.

Referenced by ConstructHistograms(), HasDirByName(), and PrintDirs().

std::map< const std::string, std::vector<std::string> > QwRootFile::fDirsByType
private

Definition at line 537 of file QwRootFile.h.

Referenced by ConstructHistograms(), and HasDirByType().

std::vector< TPRegexp > QwRootFile::fDisabledHistos
private

Definition at line 483 of file QwRootFile.h.

Referenced by DisableHisto(), and IsHistoDisabled().

std::vector< TPRegexp > QwRootFile::fDisabledTrees
private

List of excluded trees.

Definition at line 482 of file QwRootFile.h.

Referenced by DisableTree(), and IsTreeDisabled().

Bool_t QwRootFile::fEnableMapFile
private

Definition at line 470 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), ProcessOptions(), and QwRootFile().

Bool_t QwRootFile::fMakePermanent
private

Definition at line 462 of file QwRootFile.h.

Referenced by Close(), and ~QwRootFile().

TMapFile* QwRootFile::fMapFile
private

Map file.

Definition at line 469 of file QwRootFile.h.

Referenced by cd(), Close(), ConstructHistograms(), IsMapFile(), ls(), Print(), QwRootFile(), Update(), and ~QwRootFile().

UInt_t QwRootFile::fNumHelEventsToSave
private

Definition at line 559 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

UInt_t QwRootFile::fNumHelEventsToSkip
private

Definition at line 558 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

UInt_t QwRootFile::fNumMpsEventsToSave
private

Definition at line 557 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

UInt_t QwRootFile::fNumMpsEventsToSkip
private

Prescaling of events written to tree.

Definition at line 556 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

TString QwRootFile::fPermanentName
private

While the file is open, give it a temporary filename. Perhaps change to a permanent name when closing the file.

Definition at line 461 of file QwRootFile.h.

Referenced by QwRootFile(), and ~QwRootFile().

TFile* QwRootFile::fRootFile
private
TString QwRootFile::fRootFileStem
private

ROOT file stem.

Definition at line 455 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

std::map< const void* , std::vector<QwRootTree*> > QwRootFile::fTreeByAddr
private

Definition at line 511 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), FillTreeBranches(), and HasTreeByAddr().

std::map< const std::string, std::vector<QwRootTree*> > QwRootFile::fTreeByName
private

Tree names, addresses, and types.

Definition at line 510 of file QwRootFile.h.

Referenced by ConstructIndices(), ConstructTreeBranches(), FillTree(), FillTrees(), GetTree(), HasTreeByName(), NewTree(), PrintTrees(), and ~QwRootFile().

std::map< const type_info* , std::vector<QwRootTree*> > QwRootFile::fTreeByType
private

Definition at line 512 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and HasTreeByType().

Int_t QwRootFile::fUpdateInterval
private

Definition at line 471 of file QwRootFile.h.

Referenced by FillHistograms(), and ProcessOptions().

const Int_t QwRootFile::kMaxMapFileSize = 0x10000000
staticprivate

Definition at line 565 of file QwRootFile.h.

Referenced by QwRootFile().

const Long64_t QwRootFile::kMaxTreeSize = 100000000000LL
staticprivate

Maximum tree size.

Definition at line 564 of file QwRootFile.h.

Referenced by ConstructTreeBranches().


The documentation for this class was generated from the following files: