#include <ReadStats.h>
Public Types | |
typedef std::vector < BranchStats * > | Vector_t |
Type of the internal vectors describing one auxiliary store. | |
typedef std::map< std::string, Vector_t > | Map_t |
Type of the internal object gathering information on aux branches. | |
typedef std::map< std::string, BranchStats > | MapC_t |
Type of the internal object gathering information on containers. | |
Public Member Functions | |
ReadStats (const char *name="xAODReadStats", const char *title="xAOD reading statistics") | |
Constructor just specifying the name of the object. | |
ReadStats (const ReadStats &parent) | |
Copy constructor. | |
~ReadStats () | |
Destructor. | |
ReadStats & | operator= (const ReadStats &parent) |
Assignment operator. | |
void | Clear (::Option_t *opt="") |
Clear the statistics information (inherited from TNamed...). | |
void | Print (::Option_t *option="") const |
Print information about the collected statistics. | |
void | printSmartSlimmingBranchList (bool autoIncludeLinks=false) const |
Print the accessed variables, formatted for smart slimming. | |
void | nextEvent () |
Function incrementing the processed event counter. | |
::Long64_t | nEvents () const |
Function getting the total number of input event. | |
void | setNEvents (::Long64_t nevents) |
Function setting the total number of input events. | |
void | readBranch (const std::string &prefix, SG::auxid_t auxid) |
Function incrementing the read counter on a specific branch. | |
void | readContainer (const std::string &name) |
Function incrementing the read counter on a specific container. | |
Raw information accessor/setter functions | |
void | setBytesRead (::Long64_t num) |
Set how many bytes were read in total during the analysis. | |
::Long64_t | bytesRead () const |
Get how many bytes were read in total during the analysis. | |
void | setBranchNum (::Int_t num) |
Set the total number of branches on the input. | |
::Int_t | branchNum () const |
Get the total number of branches on the input. | |
void | setFileReads (::Int_t num) |
Set the total number of file read calls. | |
::Int_t | fileReads () const |
Get the total number of file read calls. | |
void | setCacheSize (::Int_t size) |
Set the TTreeCache size used. | |
::Int_t | cacheSize () const |
Get the TTreeCache size used. | |
void | setReadTime (::Double_t time) |
Set the time spent in reading the data. | |
::Double_t | readTime () const |
Get the time spent in reading the data. | |
void | setUnzipTime (::Double_t time) |
Set the time spent in unzipping the data. | |
::Double_t | unzipTime () const |
Get the time spent in unzipping the data. | |
void | setProcessTime (::Double_t time) |
Set the time spent in processing events. | |
::Double_t | processTime () const |
Get the time spent in processing events. | |
Functions used for filling the object | |
BranchStats * | branch (const std::string &prefix, SG::auxid_t auxid) |
Access the description of a branch. Creating it if necessary. | |
const BranchStats * | branch (const std::string &prefix, SG::auxid_t auxid) const |
Get information about a specific variable. | |
BranchStats * | container (const std::string &name) |
Access the description of a container. Creating it if necessary. | |
const BranchStats * | container (const std::string &name) const |
Access the description of a container. | |
const Map_t & | branches () const |
Get all variable information. | |
const MapC_t & | containers () const |
Get information about all the containers. | |
Function used for merging objects of this type | |
bool | isCompatible (const ReadStats &rh) const |
Function checking if two objects are "compatible". | |
ReadStats & | add (const ReadStats &rh) |
Function merging two objects. | |
ReadStats & | operator+= (const ReadStats &rh) |
Operator merging two objects. | |
::Int_t | Merge (::TCollection *coll) |
Function merging the information from multiple objects. | |
Function for setting up a TTreeCache object | |
void | addToTreeCache (::TTree *tree) const |
Add all branches that were ever accessed, to the TTreeCache. | |
void | addToTreeCacheByEntries (::TTree *tree,::Long64_t minEntries) const |
Add the branches accessed more than n times to the TTreeCache. | |
void | addToTreeCacheByEntryFrac (::TTree *tree,::Double_t minEvFraction) const |
void | addToTreeCacheByBytes (::TTree *tree,::Long64_t minBytes) const |
void | addToTreeCacheByByteFrac (::TTree *tree,::Double_t minByteFraction) const |
Functions accessing branch names according to certain rules | |
std::vector< std::string > | branchesByEntries (::Long64_t minEntries) const |
Get the branches accessed more than n times. | |
std::vector< std::string > | branchesByEntryFrac (::Double_t minEvFraction) const |
Get the branches accessed more than a given fraction of times. | |
std::vector< std::string > | branchesByBytes (::Long64_t minBytes) const |
Get the branches from which more than x bytes were read. | |
std::vector< std::string > | branchesByByteFrac (::Double_t minByteFraction) const |
Functions getting the statistics as histograms | |
::TH1 * | treeAccessStat () const |
Get a histogram with the TTree access statistics. | |
::TH1 * | entryReadStat () const |
Get a histogram with the entry reading statistics. | |
::TH1 * | zippedByteReadStat () const |
Get a histogram with the zipped byte reading statistics. | |
::TH1 * | unzippedByteReadStat () const |
Get a histogram with the unzipped byte reading statistics. |
Class describing the access statistics of a collection of branches
Objects of this class are used to describe the access pattern of an xAOD analysis. The object can also be used to optimize the caching for the analysis in subsequent runs.
xAOD::ReadStats::ReadStats | ( | const char * | name = "xAODReadStats" , |
|
const char * | title = "xAOD reading statistics" | |||
) |
Constructor just specifying the name of the object.
In order to be able to stream such objects, they have to have an explicit name. It can be specified using this constructor, but usually leaving the default is just fine.
name | Name for the object | |
title | Optional title for the object (not used for anything) |
xAOD::ReadStats::ReadStats | ( | const ReadStats & | parent | ) |
Copy constructor.
It's probably not needed actually, but I wanted to be explicit about how the copy constructor should behave.
parent | The object that's being copied |
xAOD::ReadStats::~ReadStats | ( | ) |
Destructor.
The destructor needs to clean up all the BranchStats objects that were created on the heap.
Function merging two objects.
This function is used to merge the information from two objects.
rh | The object to be merged into this one |
void xAOD::ReadStats::addToTreeCache | ( | ::TTree * | tree | ) | const |
Add all branches that were ever accessed, to the TTreeCache.
This function can be used to add all the branches that this object knows about, to the cache of the TTree given to the function.
It can be useful for blankly enabling caching for all the variables that an xAOD analysis accessed previously.
tree | Tree for which the caching should be configured |
void xAOD::ReadStats::addToTreeCacheByByteFrac | ( | ::TTree * | tree, | |
::Double_t | minByteFraction | |||
) | const |
Add the branches from whith more than a given fraction of the bytes were read, to the TTreeCache
This function can be used to add all the variables to the cache from which more than some fraction of the bytes were read in a previous running.
tree | Tree for which the caching should be configured | |
minByteFraction | Minimum fraction of bytes read from the variable to qualify for caching |
void xAOD::ReadStats::addToTreeCacheByBytes | ( | ::TTree * | tree, | |
::Long64_t | minBytes | |||
) | const |
Add the branches from which more than x bytes were read, to the TTreeCache
This function can be used to add all the variables to the cache from which more than some bytes were read in a previous running.
tree | Tree for which the caching should be configured | |
minBytes | Minimum number of bytes read from the variable to qualify for caching |
void xAOD::ReadStats::addToTreeCacheByEntries | ( | ::TTree * | tree, | |
::Long64_t | minEntries | |||
) | const |
Add the branches accessed more than n times to the TTreeCache.
This should be one of the most useful functions of this class. It can be used to selectively enable the caching for the branches which were accessed more than a specified number of times in a previous running.
tree | Tree for which the caching should be configured | |
minEntries | Minimum number of entries read from the variable to qualify for caching |
void xAOD::ReadStats::addToTreeCacheByEntryFrac | ( | ::TTree * | tree, | |
::Double_t | minEvFraction | |||
) | const |
Add the branches accessed more than a given fraction of times to the TTreeCache
This should be one of the most useful functions of this class. It can be used to selectively enable the caching for the branches which were accessed more than a specified fraction of times in a previous running. This is slightly more general than the version of this function expecting an absolute entry number.
tree | Tree for which the caching should be configured | |
minEvFraction | Minimum fraction of entries read from the branches that should be added to the cache |
const BranchStats * xAOD::ReadStats::branch | ( | const std::string & | prefix, | |
SG::auxid_t | auxid | |||
) | const |
Get information about a specific variable.
Get the access statistics of a single xAOD branch
prefix | The prefix for the xAOD branch | |
auxid | The auxiliary ID of the variable belonging to the branch |
BranchStats * xAOD::ReadStats::branch | ( | const std::string & | prefix, | |
SG::auxid_t | auxid | |||
) |
Access the description of a branch. Creating it if necessary.
This function is used to access a branch's description for modification. The function creates the description object if it doesn't exist yet.
prefix | The prefix for the xAOD branch | |
auxid | The auxiliary ID of the variable belonging to the branch |
std::vector< std::string > xAOD::ReadStats::branchesByByteFrac | ( | ::Double_t | minByteFraction | ) | const |
Get the branches from which more than a given fraction of bytes were read
This function can be used to get a list of branch names from which more than a specified fraction of bytes were read in the analysis.
minByteFraction | Minimum fraction of bytes read from the variables |
std::vector< std::string > xAOD::ReadStats::branchesByBytes | ( | ::Long64_t | minBytes | ) | const |
Get the branches from which more than x bytes were read.
This function can be used to get a list of branch names from which more than a specified number of bytes were read in the analysis.
minBytes | Minimum number of bytes read from the variables |
std::vector< std::string > xAOD::ReadStats::branchesByEntries | ( | ::Long64_t | minEntries | ) | const |
Get the branches accessed more than n times.
This function can be used to get a list of branch names that were accessed more than a specified number of times in the analysis.
minEntries | Minimum number of entries read from the variables |
std::vector< std::string > xAOD::ReadStats::branchesByEntryFrac | ( | ::Double_t | minEvFrac | ) | const |
Get the branches accessed more than a given fraction of times.
This function can be used to get a list of branch names that were accessed more than some fraction of times in the analysis.
minEvFrac | Minimum fraction of entries read from the variables |
TH1 * xAOD::ReadStats::entryReadStat | ( | ) | const |
Get a histogram with the entry reading statistics.
This function can be used to produce a nice histogram showing how many entries were accessed by how many of the branches.
Note that the caller is responsible for deleting the created histogram.
bool xAOD::ReadStats::isCompatible | ( | const ReadStats & | rh | ) | const |
Function checking if two objects are "compatible".
This function checks whether two objects are "compatible" with each other. This just means that it checks whether it appears as if the two statistics objects would've been recorded from the same input type or not.
rh | Object to compare to this object |
true
if the two objects are compatible, false
otherwise Int_t xAOD::ReadStats::Merge | ( | ::TCollection * | coll | ) |
Function merging the information from multiple objects.
This function makes it possible to properly merge objects coming from PROOF workers, or from separate ROOT files.
coll | A collection of xAOD::ReadStats objects |
0
in case of failure, a positive number in case of success Assignment operator.
This is probably not needed either, but again, I wanted to be explicit.
parent | The object that's being copied |
void xAOD::ReadStats::Print | ( | ::Option_t * | option = "" |
) | const |
Print information about the collected statistics.
Standard ROOT printing function. It prints the gathered information about the variables accessed in an analysis.
The option parameter understands the following value(s):
option | Possible options for the printing |
void xAOD::ReadStats::printSmartSlimmingBranchList | ( | bool | autoIncludeLinks = false |
) | const |
Print the accessed variables, formatted for smart slimming.
This is a tricky function. It prints the list of accessed variables in a way that can be copy-pasted directly into the ItemList of a derivation job. (Or into the C++ code of some analysis code.)
autoIncludeLinks | Since removing links from objects can cause problems for slow-merging in Athena, one can request all ElementLink variables to be added to the variable list, irrespective whether they're needed or not. |
Object used to collect the information
TH1 * xAOD::ReadStats::treeAccessStat | ( | ) | const |
Get a histogram with the TTree access statistics.
This function can be used to produce a nice histogram showing how many TTrees were accessed by how many of the branches.
Note that the caller is responsible for deleting the created histogram.
TH1 * xAOD::ReadStats::unzippedByteReadStat | ( | ) | const |
Get a histogram with the unzipped byte reading statistics.
This function can be used to produce a nice histogram showing how many uncompressed bytes were accessed by how many of the branches.
Note that the caller is responsible for deleting the created histogram.
TH1 * xAOD::ReadStats::zippedByteReadStat | ( | ) | const |
Get a histogram with the zipped byte reading statistics.
This function can be used to produce a nice histogram showing how many raw bytes were accessed by how many of the branches.
Note that the caller is responsible for deleting the created histogram.