JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwRootFile Class Reference

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

#include <QwRootFile.h>

+ Collaboration diagram for QwRootFile:

Public Member Functions

 QwRootFile (const TString &run_label)
 Constructor with run label.
 
virtual ~QwRootFile ()
 Destructor.
 
void ProcessOptions (QwOptions &options)
 Process the configuration options.
 
Bool_t IsRootFile () const
 Is the ROOT file active?
 
Bool_t IsMapFile () const
 Is the map file active?
 
void ConstructIndices (const std::string &from, const std::string &to, bool reverse=true)
 Construct indices from one tree to another tree.
 
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.
 
template<class T>
void FillTreeBranches (const std::string &name, const T &object)
 Fill the tree branches of a generic object by tree name.
 
template<class T>
void FillTreeBranches (const T &object)
 Fill the tree branches of a generic object by type only.
 
template<class T>
Int_t WriteParamFileList (const TString &name, T &object)
 
template<class T>
void ConstructObjects (const std::string &name, T &object)
 Construct the histograms of a generic object.
 
template<class T>
void ConstructHistograms (const std::string &name, T &object)
 Construct the histograms of a generic object.
 
template<class T>
void FillHistograms (T &object)
 Fill histograms of the subsystem array.
 
void NewTree (const std::string &name, const std::string &desc)
 Create a new tree with name and description.
 
TTree * GetTree (const std::string &name)
 Get the tree with name.
 
Int_t FillTree (const std::string &name)
 Fill the tree with name.
 
Int_t FillTrees ()
 Fill all registered trees.
 
void PrintTrees () const
 Print registered trees.
 
void PrintDirs () const
 Print registered histogram directories.
 
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)
 
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.
 
static void SetDefaultRootFileDir (const std::string &dir)
 Set default ROOT files dir.
 
static void SetDefaultRootFileStem (const std::string &stem)
 Set default ROOT file stem.
 

Private Member Functions

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

Private Attributes

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

Static Private Attributes

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

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 827 of file QwRootFile.h.

Constructor & Destructor Documentation

◆ QwRootFile() [1/2]

QwRootFile::QwRootFile ( const TString & run_label)

Constructor with run label.

Constructor with relative filename

Definition at line 25 of file QwRootFile.cc.

27 fMapFile(0), fEnableMapFile(kFALSE),
29#ifdef HAS_RNTUPLE_SUPPORT
30 , fEnableRNTuples(kFALSE)
31#endif // HAS_RNTUPLE_SUPPORT
32{
33 // Process the configuration options
35
36#ifdef QW_ENABLE_MAPFILE
37 // Check for the memory-mapped file flag
38 if (fEnableMapFile) {
39
40 TString mapfilename = "/dev/shm/";
41
42 mapfilename += "/QwMemMapFile.map";
43
44 fMapFile = TMapFile::Create(mapfilename,"UPDATE", kMaxMapFileSize, "RealTime Producer File");
45
46 if (not fMapFile) {
47 QwError << "Memory-mapped file " << mapfilename
48 << " could not be opened!" << QwLog::endl;
49 return;
50 }
51
52 QwMessage << "================== RealTime Producer Memory Map File =================" << QwLog::endl;
53 fMapFile->Print();
54 QwMessage << "======================================================================" << QwLog::endl;
55 } else
56#endif
57 {
58
59 TString rootfilename = fRootFileDir;
60 TString hostname = gSystem -> HostName();
61
62 // Use a probably-unique temporary file name.
63 pid_t pid = getpid();
64
65 fPermanentName = rootfilename
66 + Form("/%s%s.root", fRootFileStem.Data(), run_label.Data());
68 rootfilename += Form("/%s%s.%s.%d.root",
69 fRootFileStem.Data(), run_label.Data(),
70 hostname.Data(), pid);
71 } else {
72 rootfilename = fPermanentName;
73 }
74 fRootFile = new TFile(rootfilename.Data(), "RECREATE", "myfile1");
75 if (! fRootFile) {
76 QwError << "ROOT file " << rootfilename
77 << " could not be opened!" << QwLog::endl;
78 return;
79 } else {
80 QwMessage << "Opened "<< (fUseTemporaryFile?"temporary ":"")
81 <<"rootfile " << rootfilename << QwLog::endl;
82 }
83
84 TString run_condition_name = Form("condition_%s", run_label.Data());
85 TList *run_cond_list = (TList*) fRootFile -> FindObjectAny(run_condition_name);
86 if (not run_cond_list) {
87 QwRunCondition run_condition(
88 gQwOptions.GetArgc(),
89 gQwOptions.GetArgv(),
90 run_condition_name
91 );
92
94 run_condition.Get(),
95 run_condition.GetName()
96 );
97 }
98
99 fRootFile->SetCompressionAlgorithm(fCompressionAlgorithm);
100 fRootFile->SetCompressionLevel(fCompressionLevel);
101 }
102}
#define gQwOptions
Definition QwOptions.h:31
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
TString fRootFileStem
ROOT file stem.
TFile * fRootFile
ROOT file.
TString fRootFileDir
ROOT files dir.
Int_t fCompressionAlgorithm
static const Int_t kMaxMapFileSize
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)
void ProcessOptions(QwOptions &options)
Process the configuration options.
Int_t fCompressionLevel
Bool_t fUseTemporaryFile
TString fPermanentName
TMapFile * fMapFile
Map file.
Int_t fUpdateInterval
Bool_t fMakePermanent
Bool_t fEnableMapFile

References QwLog::endl(), fCompressionAlgorithm, fCompressionLevel, fEnableMapFile, fMakePermanent, fMapFile, fPermanentName, fRootFile, fRootFileDir, fRootFileStem, fUpdateInterval, fUseTemporaryFile, QwRunCondition::Get(), QwRunCondition::GetName(), gQwOptions, kMaxMapFileSize, ProcessOptions(), QwError, QwMessage, and WriteObject().

+ Here is the call graph for this function:

◆ ~QwRootFile()

QwRootFile::~QwRootFile ( )
virtual

Destructor.

Destructor

Definition at line 108 of file QwRootFile.cc.

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

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

+ Here is the call graph for this function:

◆ QwRootFile() [2/2]

QwRootFile::QwRootFile ( )
private

Private default constructor.

Member Function Documentation

◆ cd()

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

Definition at line 1086 of file QwRootFile.h.

1086 {
1087 Bool_t status = kTRUE;
1088 if (fMapFile) status &= fMapFile->cd(path);
1089 if (fRootFile) status &= fRootFile->cd(path);
1090 return status;
1091 }

References fMapFile, and fRootFile.

Referenced by ConstructTreeBranches(), and NewTree().

+ Here is the caller graph for this function:

◆ Close()

void QwRootFile::Close ( )
inline

Definition at line 1043 of file QwRootFile.h.

1043 {
1044
1045 // Check if we should make the file permanent - restore original logic
1047
1048
1049#ifdef HAS_RNTUPLE_SUPPORT
1050 // Close all RNTuples before closing the file
1051 for (auto& pair : fNTupleByName) {
1052 for (auto& ntuple : pair.second) {
1053 if (ntuple) ntuple->Close();
1054 }
1055 }
1056#endif // HAS_RNTUPLE_SUPPORT
1057
1058 // CRITICAL FIX: Explicitly write all trees before closing!
1059 if (fRootFile) {
1060
1061 for (auto iter = fTreeByName.begin(); iter != fTreeByName.end(); iter++) {
1062 if (!iter->second.empty() && iter->second.front()) {
1063 TTree* tree = iter->second.front()->GetTree();
1064 if (tree && tree->GetEntries() > 0) {
1065
1066 tree->Write();
1067 }
1068 }
1069 }
1070 }
1071
1072 // Close the file and handle renaming
1073 if (fRootFile) {
1074 TString rootfilename = fRootFile->GetName();
1075
1076 fRootFile->Close();
1077
1078 }
1079
1080 if (fMapFile) fMapFile->Close();
1081
1082
1083 }

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

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructHistograms()

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 1545 of file QwRootFile.h.

1546{
1547 // Return if we do not want this histogram information
1548 if (IsHistoDisabled(name)) return;
1549
1550 // Create the histograms in a directory
1551 if (fRootFile) {
1552 std::string type = typeid(object).name();
1553 fDirsByName[name] =
1554 fRootFile->GetDirectory(("/" + name).c_str()) ?
1555 fRootFile->GetDirectory(("/" + name).c_str()) :
1556 fRootFile->GetDirectory("/")->mkdir(name.c_str());
1557 fDirsByType[type].push_back(name);
1558
1559 object.ConstructHistograms(fDirsByName[name]);
1560 }
1561
1562 // No support for directories in a map file
1563 if (fMapFile) {
1564 QwMessage << "QwRootFile::ConstructHistograms::detectors address "
1565 << &object
1566 << " and its name " << name
1567 << QwLog::endl;
1568
1569 std::string type = typeid(object).name();
1570 fDirsByName[name] = fMapFile->GetDirectory()->mkdir(name.c_str());
1571 fDirsByType[type].push_back(name);
1572 //object.ConstructHistograms(fDirsByName[name]);
1573 object.ConstructHistograms();
1574 }
1575}
std::map< const std::string, std::vector< std::string > > fDirsByType
std::map< const std::string, TDirectory * > fDirsByName
Directories.
bool IsHistoDisabled(const std::string &name)
Does this histogram directory match a disabled histogram directory?

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

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructIndices()

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 1277 of file QwRootFile.h.

1278{
1279 // Return if we do not want this tree information
1280 if (IsTreeDisabled(from)) return;
1281 if (IsTreeDisabled(to)) return;
1282
1283 // If the trees are defined
1284 if (fTreeByName.count(from) > 0 && fTreeByName.count(to) > 0) {
1285
1286 // Construct index from the first tree to the second tree
1287 fTreeByName[from].front()->ConstructIndexTo(fTreeByName[to].front());
1288
1289 // Construct index from the second tree back to the first tree
1290 if (reverse)
1291 fTreeByName[to].front()->ConstructIndexTo(fTreeByName[from].front());
1292 }
1293}
bool IsTreeDisabled(const std::string &name)
Does this tree name match a disabled tree name?

References fTreeByName, and IsTreeDisabled().

+ Here is the call graph for this function:

◆ ConstructObjects()

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

Construct the histograms of a generic object.

Construct the objects directory of a generic object

Parameters
nameName for objects directory
objectSubsystem array

Definition at line 1511 of file QwRootFile.h.

1512{
1513 // Create the objects in a directory
1514 if (fRootFile) {
1515 std::string type = typeid(object).name();
1516 fDirsByName[name] =
1517 fRootFile->GetDirectory(("/" + name).c_str()) ?
1518 fRootFile->GetDirectory(("/" + name).c_str()) :
1519 fRootFile->GetDirectory("/")->mkdir(name.c_str());
1520 fDirsByType[type].push_back(name);
1521 object.ConstructObjects(fDirsByName[name]);
1522 }
1523
1524 // No support for directories in a map file
1525 if (fMapFile) {
1526 QwMessage << "QwRootFile::ConstructObjects::detectors address "
1527 << &object
1528 << " and its name " << name
1529 << QwLog::endl;
1530
1531 std::string type = typeid(object).name();
1532 fDirsByName[name] = fMapFile->GetDirectory()->mkdir(name.c_str());
1533 fDirsByType[type].push_back(name);
1534 object.ConstructObjects();
1535 }
1536}

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

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructTreeBranches()

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 1303 of file QwRootFile.h.

1308{
1309 // Return if we do not want this tree information
1310 if (IsTreeDisabled(name)) return;
1311
1312 // Pointer to new tree
1313 QwRootTree* tree = 0;
1314
1315 // If the tree does not exist yet, create it
1316 if (fTreeByName.count(name) == 0) {
1317
1318 // Go to top level directory
1319
1320 this->cd();
1321
1322 // New tree with name, description, object, prefix
1323 tree = new QwRootTree(name, desc, object, prefix);
1324
1325 // Settings only relevant for new trees
1326 if (name == "evt")
1328 else if (name == "mul")
1330
1331 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,00)
1332 tree->SetAutoFlush(fAutoFlush);
1333 #endif
1334 tree->SetAutoSave(fAutoSave);
1337
1338 if (fCircularBufferSize > 0)
1340
1341 } else {
1342
1343 // New tree based on existing tree
1344 tree = new QwRootTree(fTreeByName[name].front(), object, prefix);
1345 }
1346
1347 // Add the branches to the list of trees by name, object, type
1348 const void* addr = static_cast<const void*>(&object);
1349 const std::type_index type = typeid(object);
1350 fTreeByName[name].push_back(tree);
1351 fTreeByAddr[addr].push_back(tree);
1352 fTreeByType[type].push_back(tree);
1353}
void SetAutoFlush(Long64_t autoflush=30000000)
Set autoflush size.
Definition QwRootFile.h:581
void SetCircular(Long64_t buff=100000)
Definition QwRootFile.h:601
void SetMaxTreeSize(Long64_t maxsize=1900000000)
Set maximum tree size.
Definition QwRootFile.h:575
void SetAutoSave(Long64_t autosave=300000000)
Set autosave size.
Definition QwRootFile.h:589
void SetBasketSize(Int_t basketsize=16000)
Set basket size.
Definition QwRootFile.h:595
void SetPrescaling(UInt_t num_to_save, UInt_t num_to_skip)
Set tree prescaling parameters.
Definition QwRootFile.h:561
Int_t fBasketSize
Bool_t cd(const char *path=0)
UInt_t fNumHelEventsToSkip
Int_t fAutoSave
UInt_t fNumMpsEventsToSave
std::map< const std::type_index, std::vector< QwRootTree * > > fTreeByType
UInt_t fNumHelEventsToSave
Int_t fAutoFlush
UInt_t fCircularBufferSize
std::map< const void *, std::vector< QwRootTree * > > fTreeByAddr
static const Long64_t kMaxTreeSize
Maximum tree size.
UInt_t fNumMpsEventsToSkip
Prescaling of events written to tree.

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

Referenced by QwExtractor::ConstructTreeBranches(), VQwDataHandler::ConstructTreeBranches(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DefineOptions()

void QwRootFile::DefineOptions ( QwOptions & options)
static

Define the configuration options.

Defines configuration options using QwOptions functionality.

Parameters
optionsOptions object

Definition at line 165 of file QwRootFile.cc.

166{
167 // Define the ROOT files directory
168 options.AddOptions("Default options")
169 ("rootfiles", po::value<std::string>()->default_value(fDefaultRootFileDir),
170 "directory of the output ROOT files");
171
172 // Define the ROOT filename stem
173 options.AddOptions("Default options")
174 ("rootfile-stem", po::value<std::string>()->default_value(fDefaultRootFileStem),
175 "stem of the output ROOT filename");
176
177 // Define the memory map option
178 options.AddOptions()
179 ("enable-mapfile", po::value<bool>()->default_bool_value(false),
180 "enable output to memory-mapped file\n(likely requires circular-buffer too)");
181 options.AddOptions()
182 ("write-temporary-rootfiles", po::value<bool>()->default_bool_value(true),
183 "When writing ROOT files, use the PID to create a temporary filename");
184
185 // Define the histogram and tree options
186 options.AddOptions("ROOT output options")
187 ("disable-tree", po::value<std::vector<std::string>>()->composing(),
188 "disable output to tree regex");
189 options.AddOptions("ROOT output options")
190 ("disable-trees", po::value<bool>()->default_bool_value(false),
191 "disable output to all trees");
192 options.AddOptions("ROOT output options")
193 ("disable-histos", po::value<bool>()->default_bool_value(false),
194 "disable output to all histograms");
195
196 // Define the helicity window versus helicity pattern options
197 options.AddOptions("ROOT output options")
198 ("disable-mps-tree", po::value<bool>()->default_bool_value(false),
199 "disable helicity window output");
200 options.AddOptions("ROOT output options")
201 ("disable-pair-tree", po::value<bool>()->default_bool_value(false),
202 "disable helicity pairs output");
203 options.AddOptions("ROOT output options")
204 ("disable-hel-tree", po::value<bool>()->default_bool_value(false),
205 "disable helicity pattern output");
206 options.AddOptions("ROOT output options")
207 ("disable-burst-tree", po::value<bool>()->default_bool_value(false),
208 "disable burst tree");
209 options.AddOptions("ROOT output options")
210 ("disable-slow-tree", po::value<bool>()->default_bool_value(false),
211 "disable slow control tree");
212
213#ifdef HAS_RNTUPLE_SUPPORT
214 // Define the RNTuple options
215 options.AddOptions("ROOT output options")
216 ("enable-rntuples", po::value<bool>()->default_bool_value(false),
217 "enable RNTuple output");
218#endif // HAS_RNTUPLE_SUPPORT
219
220 // Define the tree output prescaling options
221 options.AddOptions("ROOT output options")
222 ("num-mps-accepted-events", po::value<int>()->default_value(0),
223 "number of accepted consecutive MPS events");
224 options.AddOptions("ROOT output options")
225 ("num-mps-discarded-events", po::value<int>()->default_value(0),
226 "number of discarded consecutive MPS events");
227 options.AddOptions("ROOT output options")
228 ("num-hel-accepted-events", po::value<int>()->default_value(0),
229 "number of accepted consecutive pattern events");
230 options.AddOptions("ROOT output options")
231 ("num-hel-discarded-events", po::value<int>()->default_value(0),
232 "number of discarded consecutive pattern events");
233 options.AddOptions("ROOT output options")
234 ("mapfile-update-interval", po::value<int>()->default_value(-1),
235 "Events between a map file update");
236
237 // Define the autoflush and autosave option (default values by ROOT)
238 options.AddOptions("ROOT performance options")
239 ("autoflush", po::value<int>()->default_value(0),
240 "TTree autoflush");
241 options.AddOptions("ROOT performance options")
242 ("autosave", po::value<int>()->default_value(300000000),
243 "TTree autosave");
244 options.AddOptions("ROOT performance options")
245 ("basket-size", po::value<int>()->default_value(16000),
246 "TTree basket size");
247 options.AddOptions("ROOT performance options")
248 ("circular-buffer", po::value<int>()->default_value(0),
249 "TTree circular buffer");
250 options.AddOptions("ROOT performance options")
251 ("compression-algorithm", po::value<int>()->default_value(1),
252 "TFile compression algorithm (default = 1 ZLIB)");
253 options.AddOptions("ROOT performance options")
254 ("compression-level", po::value<int>()->default_value(1),
255 "TFile compression level (default = 1, no compression = 0)");
256}
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:170
static std::string fDefaultRootFileDir
Default ROOT files dir.
static std::string fDefaultRootFileStem
Default ROOT file stem.

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

Referenced by QwOptions::DefineOptions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DisableHisto()

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

Add regexp to list of disabled histogram directories.

Definition at line 1167 of file QwRootFile.h.

1167 {
1168 fDisabledHistos.push_back(regexp);
1169 }
std::vector< TPRegexp > fDisabledHistos

References fDisabledHistos.

Referenced by ProcessOptions().

+ Here is the caller graph for this function:

◆ DisableTree()

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

Add regexp to list of disabled trees names.

Definition at line 1157 of file QwRootFile.h.

1157 {
1158 fDisabledTrees.push_back(regexp);
1159 }
std::vector< TPRegexp > fDisabledTrees
List of excluded trees.

References fDisabledTrees.

Referenced by ProcessOptions().

+ Here is the caller graph for this function:

◆ FillHistograms()

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

Fill histograms of the subsystem array.

Definition at line 895 of file QwRootFile.h.

895 {
896 // Update regularly
897 static Int_t update_count = 0;
898 update_count++;
899 if ((fUpdateInterval > 0) && ( update_count % fUpdateInterval == 0)) Update();
900
901 // Debug directory registration
902 std::string type = typeid(object).name();
903 bool hasDir = HasDirByType(object);
904
905 if (! hasDir) return;
906 // Fill histograms
907 object.FillHistograms();
908 }
bool HasDirByType(const T &object)
Is a directory registered for this type.
void Update()

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

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FillTree()

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

Fill the tree with name.

Definition at line 949 of file QwRootFile.h.

949 {
950 if (! HasTreeByName(name)) return 0;
951 else return fTreeByName[name].front()->Fill();
952 }
bool HasTreeByName(const std::string &name)
Is a tree registered for this name.

References fTreeByName, and HasTreeByName().

Referenced by QwExtractor::FillTreeBranches(), VQwDataHandler::FillTreeBranches(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FillTreeBranches() [1/2]

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 1362 of file QwRootFile.h.

1365{
1366 // If this name has no registered trees
1367 if (! HasTreeByName(name)) return;
1368 // If this type has no registered trees
1369 if (! HasTreeByType(object)) return;
1370
1371 // Get the address of the object
1372 const void* addr = static_cast<const void*>(&object);
1373
1374 // Fill the trees with the correct address
1375 for (size_t tree = 0; tree < fTreeByAddr[addr].size(); tree++) {
1376 if (fTreeByAddr[addr].at(tree)->GetName() == name) {
1377 fTreeByAddr[addr].at(tree)->FillTreeBranches(object);
1378 }
1379 }
1380}
bool HasTreeByType(const T &object)
Is a tree registered for this type.

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

Referenced by QwExtractor::FillTreeBranches(), VQwDataHandler::FillTreeBranches(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FillTreeBranches() [2/2]

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 1388 of file QwRootFile.h.

1390{
1391 // If this address has no registered trees
1392 if (! HasTreeByAddr(object)) return;
1393
1394 // Get the address of the object
1395 const void* addr = static_cast<const void*>(&object);
1396
1397 // Fill the trees with the correct address
1398 for (size_t tree = 0; tree < fTreeByAddr[addr].size(); tree++) {
1399 fTreeByAddr[addr].at(tree)->FillTreeBranches(object);
1400 }
1401}
bool HasTreeByAddr(const T &object)
Is a tree registered for this object.

References fTreeByAddr, and HasTreeByAddr().

+ Here is the call graph for this function:

◆ FillTrees()

Int_t QwRootFile::FillTrees ( )
inline

Fill all registered trees.

Definition at line 955 of file QwRootFile.h.

955 {
956 // Loop over all registered tree names
957 Int_t retval = 0;
958 std::map< const std::string, std::vector<QwRootTree*> >::iterator iter;
959 for (iter = fTreeByName.begin(); iter != fTreeByName.end(); iter++) {
960 retval += iter->second.front()->Fill();
961 }
962 return retval;
963 }

References fTreeByName.

◆ GetTree()

TTree * QwRootFile::GetTree ( const std::string & name)
inline

Get the tree with name.

Definition at line 943 of file QwRootFile.h.

943 {
944 if (! HasTreeByName(name)) return 0;
945 else return fTreeByName[name].front()->GetTree();
946 }

References fTreeByName, and HasTreeByName().

Referenced by QwCorrelator::ConstructTreeBranches().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAnyFilled() [1/2]

Bool_t QwRootFile::HasAnyFilled ( TDirectory * d)
private

Definition at line 339 of file QwRootFile.cc.

339 {
340 if (!d) {
341
342 return false;
343 }
344
345 // First check if any in-memory trees have been filled
346 for (auto& pair : fTreeByName) {
347 for (auto& tree : pair.second) {
348 if (tree && tree->GetTree()) {
349 Long64_t entries = tree->GetTree()->GetEntries();
350 if (entries > 0) {
351
352 return true;
353 }
354 }
355 }
356 }
357
358#ifdef HAS_RNTUPLE_SUPPORT
359 // Then check if any RNTuples have been filled
360 for (auto& pair : fNTupleByName) {
361 for (auto& ntuple : pair.second) {
362 if (ntuple && ntuple->fCurrentEvent > 0) {
363
364 return true;
365 }
366 }
367 }
368#endif // HAS_RNTUPLE_SUPPORT
369
370 TList* l = d->GetListOfKeys();
371
372
373 for( int i=0; i < l->GetEntries(); ++i) {
374 const char* name = l->At(i)->GetName();
375 TObject* obj = d->FindObjectAny(name);
376
377
378
379 // Objects which can't be found don't count.
380 if (!obj) {
381
382 continue;
383 }
384
385 // Lists of parameter files, map files, and job conditions don't count.
386 if ( TString(name).Contains("parameter_file") ) {
387
388 continue;
389 }
390 if ( TString(name).Contains("mapfile") ) {
391 continue;
392 }
393 if ( TString(name).Contains("_condition") ) {
394 continue;
395 }
396 // The EPICS tree doesn't count
397 if ( TString(name).Contains("slow") ) {
398 continue;
399 }
400
401 // Recursively check subdirectories.
402 if (obj->IsA()->InheritsFrom( "TDirectory" )) {
403 if (this->HasAnyFilled( (TDirectory*)obj )) return true;
404 }
405
406 if (obj->IsA()->InheritsFrom( "TTree" )) {
407 Long64_t entries = ((TTree*) obj)->GetEntries();
408 if ( entries ) return true;
409 }
410
411 if (obj->IsA()->InheritsFrom( "TH1" )) {
412 Double_t entries = ((TH1*) obj)->GetEntries();
413 if ( entries ) return true;
414 }
415 }
416 return false;
417}

References fTreeByName, and HasAnyFilled().

+ Here is the call graph for this function:

◆ HasAnyFilled() [2/2]

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 336 of file QwRootFile.cc.

336 {
337 return this->HasAnyFilled(fRootFile);
338}

References fRootFile, and HasAnyFilled().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasDirByName()

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

Is a tree registered for this name.

Definition at line 1243 of file QwRootFile.h.

1243 {
1244 if (fDirsByName.count(name) == 0) return false;
1245 else return true;
1246 }

References fDirsByName.

◆ HasDirByType()

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

Is a directory registered for this type.

Definition at line 1249 of file QwRootFile.h.

1249 {
1250 std::string type = typeid(object).name();
1251 if (fDirsByType.count(type) == 0) return false;
1252 else return true;
1253 }

References fDirsByType.

Referenced by FillHistograms().

+ Here is the caller graph for this function:

◆ HasTreeByAddr()

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

Is a tree registered for this object.

Definition at line 1210 of file QwRootFile.h.

1210 {
1211 const void* addr = static_cast<const void*>(&object);
1212 if (fTreeByAddr.count(addr) == 0) return false;
1213 else return true;
1214 }

References fTreeByAddr.

Referenced by FillTreeBranches().

+ Here is the caller graph for this function:

◆ HasTreeByName()

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

Is a tree registered for this name.

Definition at line 1197 of file QwRootFile.h.

1197 {
1198 if (fTreeByName.count(name) == 0) return false;
1199 else return true;
1200 }

References fTreeByName.

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

+ Here is the caller graph for this function:

◆ HasTreeByType()

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

Is a tree registered for this type.

Definition at line 1203 of file QwRootFile.h.

1203 {
1204 const std::type_index type = typeid(object);
1205 if (fTreeByType.count(type) == 0) return false;
1206 else return true;
1207 }

References fTreeByType.

Referenced by FillTreeBranches().

+ Here is the caller graph for this function:

◆ IsHistoDisabled()

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

Does this histogram directory match a disabled histogram directory?

Definition at line 1171 of file QwRootFile.h.

1171 {
1172 for (size_t i = 0; i < fDisabledHistos.size(); i++)
1173 if (fDisabledHistos.at(i).Match(name)) return true;
1174 return false;
1175 }

References fDisabledHistos.

Referenced by ConstructHistograms().

+ Here is the caller graph for this function:

◆ IsMapFile()

Bool_t QwRootFile::IsMapFile ( ) const
inline

Is the map file active?

Definition at line 854 of file QwRootFile.h.

854{ return (fMapFile); };

References fMapFile.

◆ IsRootFile()

Bool_t QwRootFile::IsRootFile ( ) const
inline

Is the ROOT file active?

Definition at line 852 of file QwRootFile.h.

852{ return (fRootFile); };

References fRootFile.

◆ IsTreeDisabled()

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

Does this tree name match a disabled tree name?

Definition at line 1161 of file QwRootFile.h.

1161 {
1162 for (size_t i = 0; i < fDisabledTrees.size(); i++)
1163 if (fDisabledTrees.at(i).Match(name)) return true;
1164 return false;
1165 }

References fDisabledTrees.

Referenced by ConstructIndices(), ConstructTreeBranches(), and NewTree().

+ Here is the caller graph for this function:

◆ ls()

void QwRootFile::ls ( )
inline

Definition at line 1041 of file QwRootFile.h.

1041{ if (fMapFile) fMapFile->ls(); if (fRootFile) fRootFile->ls(); }

References fMapFile, and fRootFile.

◆ Map()

void QwRootFile::Map ( )
inline

Definition at line 1042 of file QwRootFile.h.

1042{ if (fRootFile) fRootFile->Map(); }

References fRootFile.

◆ mkdir()

TDirectory * QwRootFile::mkdir ( const char * name,
const char * title = "" )
inline

Definition at line 1094 of file QwRootFile.h.

1094 {
1095 // TMapFile has no support for mkdir
1096 if (fRootFile) return fRootFile->mkdir(name, title);
1097 else return 0;
1098 }

References fRootFile.

◆ NewTree()

void QwRootFile::NewTree ( const std::string & name,
const std::string & desc )
inline

Create a new tree with name and description.

Definition at line 912 of file QwRootFile.h.

912 {
913 if (IsTreeDisabled(name)) return;
914 this->cd();
915 QwRootTree *tree = 0;
916 if (! HasTreeByName(name)) {
917 tree = new QwRootTree(name,desc);
918 } else {
919 tree = new QwRootTree(fTreeByName[name].front());
920 }
921 fTreeByName[name].push_back(tree);
922 }

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

Referenced by QwCorrelator::ConstructTreeBranches().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Print()

void QwRootFile::Print ( )
inline

Definition at line 1040 of file QwRootFile.h.

1040{ if (fMapFile) fMapFile->Print(); if (fRootFile) fRootFile->Print(); }

References fMapFile, and fRootFile.

◆ PrintDirs()

void QwRootFile::PrintDirs ( ) const
inline

Print registered histogram directories.

Definition at line 1001 of file QwRootFile.h.

1001 {
1002 QwMessage << "Dirs: " << QwLog::endl;
1003 // Loop ove rall registered directories
1004 std::map< const std::string, TDirectory* >::const_iterator iter;
1005 for (iter = fDirsByName.begin(); iter != fDirsByName.end(); iter++) {
1006 QwMessage << iter->first << QwLog::endl;
1007 }
1008 }

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

+ Here is the call graph for this function:

◆ PrintTrees()

void QwRootFile::PrintTrees ( ) const
inline

Print registered trees.

Definition at line 986 of file QwRootFile.h.

986 {
987 QwMessage << "Trees: " << QwLog::endl;
988 // Loop over all registered tree names
989 std::map< const std::string, std::vector<QwRootTree*> >::const_iterator iter;
990 for (iter = fTreeByName.begin(); iter != fTreeByName.end(); iter++) {
991 QwMessage << iter->first << ": " << iter->second.size()
992 << " objects registered" << QwLog::endl;
993 // Loop over all registered objects for this tree
994 std::vector<QwRootTree*>::const_iterator tree;
995 for (tree = iter->second.begin(); tree != iter->second.end(); tree++) {
996 (*tree)->Print();
997 }
998 }
999 }

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

+ Here is the call graph for this function:

◆ ProcessOptions()

void QwRootFile::ProcessOptions ( QwOptions & options)

Process the configuration options.

Parse the configuration options and store in class fields

Parameters
optionsOptions object

Definition at line 263 of file QwRootFile.cc.

264{
265 // Option 'rootfiles' to specify ROOT files dir
266 fRootFileDir = TString(options.GetValue<std::string>("rootfiles"));
267
268 // Option 'root-stem' to specify ROOT file stem
269 fRootFileStem = TString(options.GetValue<std::string>("rootfile-stem"));
270
271 // Option 'mapfile' to enable memory-mapped ROOT file
272 fEnableMapFile = options.GetValue<bool>("enable-mapfile");
273#ifndef QW_ENABLE_MAPFILE
274 if( fEnableMapFile ) {
276 QwWarning << "QwRootFile::ProcessOptions: "
277 << "The 'enable-mapfile' flag is not supported by the ROOT "
278 "version with which this app is built. Disabling it."
279 << QwLog::endl;
280 fEnableMapFile = false;
281 }
282#endif
283 fUseTemporaryFile = options.GetValue<bool>("write-temporary-rootfiles");
284
285#ifdef HAS_RNTUPLE_SUPPORT
286 // Option 'enable-rntuples' to enable RNTuple output
287 fEnableRNTuples = options.GetValue<bool>("enable-rntuples");
288#endif // HAS_RNTUPLE_SUPPORT
289
290 // Options 'disable-trees' and 'disable-histos' for disabling
291 // tree and histogram output
292 auto v = options.GetValueVector<std::string>("disable-tree");
293 std::for_each(v.begin(), v.end(), [&](const std::string& s){ this->DisableTree(s); });
294 if (options.GetValue<bool>("disable-trees")) DisableTree(".*");
295 if (options.GetValue<bool>("disable-histos")) DisableHisto(".*");
296
297 // Options 'disable-mps' and 'disable-hel' for disabling
298 // helicity window and helicity pattern output
299 if (options.GetValue<bool>("disable-mps-tree")) DisableTree("^evt$");
300 if (options.GetValue<bool>("disable-pair-tree")) DisableTree("^pr$");
301 if (options.GetValue<bool>("disable-hel-tree")) DisableTree("^mul$");
302 if (options.GetValue<bool>("disable-burst-tree")) DisableTree("^burst$");
303 if (options.GetValue<bool>("disable-slow-tree")) DisableTree("^slow$");
304
305 // Options 'num-accepted-events' and 'num-discarded-events' for
306 // prescaling of the tree output
307 fNumMpsEventsToSave = options.GetValue<int>("num-mps-accepted-events");
308 fNumMpsEventsToSkip = options.GetValue<int>("num-mps-discarded-events");
309 fNumHelEventsToSave = options.GetValue<int>("num-mps-accepted-events");
310 fNumHelEventsToSkip = options.GetValue<int>("num-mps-discarded-events");
311
312 // Update interval for the map file
313 fCircularBufferSize = options.GetValue<int>("circular-buffer");
314 fUpdateInterval = options.GetValue<int>("mapfile-update-interval");
315 fCompressionAlgorithm = options.GetValue<int>("compression-algorithm");
316 fCompressionLevel = options.GetValue<int>("compression-level");
317 fBasketSize = options.GetValue<int>("basket-size");
318
319 // Autoflush and autosave
320 fAutoFlush = options.GetValue<int>("autoflush");
321 if ((ROOT_VERSION_CODE < ROOT_VERSION(5,26,00)) && fAutoFlush != -30000000){
323 QwWarning << "QwRootFile::ProcessOptions: "
324 << "The 'autoflush' flag is not supported by ROOT version "
325 << ROOT_RELEASE
326 << QwLog::endl;
327 }
328 fAutoSave = options.GetValue<int>("autosave");
329 return;
330}
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
Definition QwOptions.h:249
T GetValue(const std::string &key)
Get a templated value.
Definition QwOptions.h:236
void DisableTree(const TString &regexp)
Add regexp to list of disabled trees names.
void DisableHisto(const TString &regexp)
Add regexp to list of disabled histogram directories.

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

Referenced by QwRootFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDefaultRootFileDir()

static void QwRootFile::SetDefaultRootFileDir ( const std::string & dir)
inlinestatic

Set default ROOT files dir.

Definition at line 842 of file QwRootFile.h.

842 {
844 }

References fDefaultRootFileDir.

◆ SetDefaultRootFileStem()

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

Set default ROOT file stem.

Definition at line 846 of file QwRootFile.h.

846 {
848 }

References fDefaultRootFileStem.

◆ Update()

void QwRootFile::Update ( )
inline

Definition at line 1022 of file QwRootFile.h.

1022 {
1023 if (fMapFile) {
1024 QwMessage << "TMapFile memory resident size: "
1025 << ((int*)fMapFile->GetBreakval() - (int*)fMapFile->GetBaseAddr()) *
1026 4 / sizeof(int32_t) / 1024 / 1024 << " MiB"
1027 << QwLog::endl;
1028 fMapFile->Update();
1029 }else{
1030 // this option will allow for reading the tree during write
1031 Long64_t nBytes(0);
1032 for (auto iter = fTreeByName.begin(); iter != fTreeByName.end(); iter++)
1033 nBytes += iter->second.front()->AutoSave("SaveSelf");
1034
1035 QwMessage << "TFile saved: "
1036 << nBytes/1000000 << "MB (inaccurate number)" //FIXME this calculation is inaccurate
1037 << QwLog::endl;
1038 }
1039 }

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

Referenced by FillHistograms().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Write()

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

Definition at line 1101 of file QwRootFile.h.

1101 {
1102 Int_t retval = 0;
1103 // TMapFile has no support for Write
1104 if (fRootFile) retval = fRootFile->Write(name, option, bufsize);
1105 return retval;
1106 }

References fRootFile.

Referenced by main().

+ Here is the caller graph for this function:

◆ WriteObject()

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 1013 of file QwRootFile.h.

1013 {
1014 Int_t retval = 0;
1015 // TMapFile has no support for WriteObject
1016 if (fRootFile) retval = fRootFile->WriteObject(obj,name,option,bufsize);
1017 return retval;
1018 }

References fRootFile.

Referenced by QwRootFile().

+ Here is the caller graph for this function:

◆ WriteParamFileList()

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

Definition at line 1579 of file QwRootFile.h.

1580{
1581 Int_t retval = 0;
1582 if (fRootFile) {
1583 TList *param_list = (TList*) fRootFile->FindObjectAny(name);
1584 if (not param_list) {
1585 retval = fRootFile->WriteObject(object.GetParamFileNameList(name), name);
1586 }
1587 }
1588 return retval;
1589}

References fRootFile.

Referenced by main().

+ Here is the caller graph for this function:

Field Documentation

◆ fAutoFlush

Int_t QwRootFile::fAutoFlush
private

Definition at line 1145 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fAutoSave

Int_t QwRootFile::fAutoSave
private

Definition at line 1146 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fBasketSize

Int_t QwRootFile::fBasketSize
private

Definition at line 1144 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fCircularBufferSize

UInt_t QwRootFile::fCircularBufferSize
private

Definition at line 1263 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fCompressionAlgorithm

Int_t QwRootFile::fCompressionAlgorithm
private

Definition at line 1142 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

◆ fCompressionLevel

Int_t QwRootFile::fCompressionLevel
private

Definition at line 1143 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

◆ fCurrentEvent

UInt_t QwRootFile::fCurrentEvent
private

Definition at line 1264 of file QwRootFile.h.

◆ fDefaultRootFileDir

std::string QwRootFile::fDefaultRootFileDir = "."
staticprivate

Default ROOT files dir.

Definition at line 1121 of file QwRootFile.h.

Referenced by DefineOptions(), and SetDefaultRootFileDir().

◆ fDefaultRootFileStem

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

Default ROOT file stem.

Definition at line 1126 of file QwRootFile.h.

Referenced by DefineOptions(), and SetDefaultRootFileStem().

◆ fDirsByName

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

Directories.

Definition at line 1239 of file QwRootFile.h.

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

◆ fDirsByType

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

Definition at line 1240 of file QwRootFile.h.

Referenced by ConstructHistograms(), ConstructObjects(), and HasDirByType().

◆ fDisabledHistos

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

Definition at line 1154 of file QwRootFile.h.

Referenced by DisableHisto(), and IsHistoDisabled().

◆ fDisabledTrees

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

List of excluded trees.

Definition at line 1153 of file QwRootFile.h.

Referenced by DisableTree(), and IsTreeDisabled().

◆ fEnableMapFile

Bool_t QwRootFile::fEnableMapFile
private

Definition at line 1140 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

◆ fMakePermanent

Bool_t QwRootFile::fMakePermanent
private

Definition at line 1131 of file QwRootFile.h.

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

◆ fMapFile

TMapFile* QwRootFile::fMapFile
private

◆ fNumHelEventsToSave

UInt_t QwRootFile::fNumHelEventsToSave
private

Definition at line 1262 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fNumHelEventsToSkip

UInt_t QwRootFile::fNumHelEventsToSkip
private

Definition at line 1261 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fNumMpsEventsToSave

UInt_t QwRootFile::fNumMpsEventsToSave
private

Definition at line 1260 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fNumMpsEventsToSkip

UInt_t QwRootFile::fNumMpsEventsToSkip
private

Prescaling of events written to tree.

Definition at line 1259 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and ProcessOptions().

◆ fPermanentName

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 1130 of file QwRootFile.h.

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

◆ fRootFile

TFile* QwRootFile::fRootFile
private

◆ fRootFileDir

TString QwRootFile::fRootFileDir
private

ROOT files dir.

Definition at line 1119 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

◆ fRootFileStem

TString QwRootFile::fRootFileStem
private

ROOT file stem.

Definition at line 1124 of file QwRootFile.h.

Referenced by ProcessOptions(), and QwRootFile().

◆ fTreeByAddr

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

◆ fTreeByName

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

◆ fTreeByType

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

Definition at line 1183 of file QwRootFile.h.

Referenced by ConstructTreeBranches(), and HasTreeByType().

◆ fUpdateInterval

Int_t QwRootFile::fUpdateInterval
private

Definition at line 1141 of file QwRootFile.h.

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

◆ fUseTemporaryFile

Bool_t QwRootFile::fUseTemporaryFile
private

Definition at line 1132 of file QwRootFile.h.

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

◆ kMaxMapFileSize

const Int_t QwRootFile::kMaxMapFileSize = 0x3fffffff
staticprivate

Definition at line 1268 of file QwRootFile.h.

Referenced by QwRootFile().

◆ kMaxTreeSize

const Long64_t QwRootFile::kMaxTreeSize = 100000000000LL
staticprivate

Maximum tree size.

Definition at line 1267 of file QwRootFile.h.

Referenced by ConstructTreeBranches().


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