ATLAS Offline Software
ReadStats.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: ReadStats.h 642099 2015-01-27 16:43:18Z krasznaa $
8 #ifndef XAODCORE_TOOLS_READSTATS_H
9 #define XAODCORE_TOOLS_READSTATS_H
10 
11 // System include(s):
12 #include <map>
13 #include <vector>
14 #include <string>
15 
16 // ROOT include(s):
17 #include <TNamed.h>
18 
19 // EDM include(s):
20 #ifndef __MAKECINT__
21 #ifndef __ROOTCLING__
23 #endif // not __ROOTCLING__
24 #endif // not __MAKECINT__
25 
26 // Forward declaration(s):
27 class TCollection;
28 class TTree;
29 class TH1;
30 
31 namespace xAOD {
32 
43  class BranchStats : public ::TNamed {
44 
45  public:
47  BranchStats( const char* name = "xAODBranch",
48  const char* type = "Int_t",
49  ::Int_t nTreesAccessed = 0, ::Long64_t nReadEntries = 0,
50  ::Long64_t nUnzippedBytes = 0, ::Long64_t nZippedBytes = 0 );
53 
56 
59 
61  ::Int_t treesAccessed() const;
63  void setTreesAccessed( ::Int_t nTreesAccessed );
64 
66  ::Long64_t readEntries() const;
68  void setReadEntries( ::Long64_t nReadEntries );
69 
71  ::Long64_t unzippedBytesRead() const;
73  void setUnzippedBytesRead( ::Long64_t nUnzippedBytes );
74 
76  ::Long64_t zippedBytesRead() const;
78  void setZippedBytesRead( ::Long64_t nZippedBytes );
79 
81 
83  BranchStats& add( const BranchStats& rh );
86 
89 
91  ::Int_t Merge( ::TCollection* coll );
92 
94  void Print( ::Option_t* option = "" ) const;
95 
97 
98  private:
102  ::Long64_t m_readEntries;
104  ::Long64_t m_unzippedBytes;
106  ::Long64_t m_zippedBytes;
107 
108  ClassDef( xAOD::BranchStats, 1 )
109 
110  }; // class BranchStats
111 
123  class ReadStats : public ::TNamed {
124 
125  public:
127  typedef std::vector< BranchStats* > Vector_t;
129  typedef std::map< std::string, Vector_t > Map_t;
130 
132  typedef std::map< std::string, BranchStats > MapC_t;
133 
135  ReadStats( const char* name = "xAODReadStats",
136  const char* title = "xAOD reading statistics" );
141 
144 
146  void Clear( ::Option_t* opt = "" );
147 
150 
152  void setBytesRead( ::Long64_t num );
154  ::Long64_t bytesRead() const;
155 
157  void setBranchNum( ::Int_t num );
159  ::Int_t branchNum() const;
160 
162  void setFileReads( ::Int_t num );
164  ::Int_t fileReads() const;
165 
167  void setCacheSize( ::Int_t size );
169  ::Int_t cacheSize() const;
170 
172  void setReadTime( ::Double_t time );
174  ::Double_t readTime() const;
175 
177  void setUnzipTime( ::Double_t time );
179  ::Double_t unzipTime() const;
180 
182  void setProcessTime( ::Double_t time );
184  ::Double_t processTime() const;
185 
187 
190 
191 #ifndef __MAKECINT__
192 #ifndef __ROOTCLING__
193  BranchStats* branch( const std::string& prefix,
195  SG::auxid_t auxid );
197  const BranchStats* branch( const std::string& prefix,
198  SG::auxid_t auxid ) const;
199 #endif // not __ROOTCLING__
200 #endif // not __MAKECINT__
201 
203  BranchStats* container( const std::string& name );
205  const BranchStats* container( const std::string& name ) const;
206 
208  const Map_t& branches() const;
210  const MapC_t& containers() const;
211 
213 
216 
218  bool isCompatible( const ReadStats& rh ) const;
220  ReadStats& add( const ReadStats& rh );
223 
225  ::Int_t Merge( ::TCollection* coll );
226 
228 
231 
233  void addToTreeCache( ::TTree* tree ) const;
236  ::Long64_t minEntries ) const;
240  ::Double_t minEvFraction ) const;
243  void addToTreeCacheByBytes( ::TTree* tree, ::Long64_t minBytes ) const;
247  ::Double_t minByteFraction ) const;
248 
250 
253 
255  std::vector< std::string >
256  branchesByEntries( ::Long64_t minEntries ) const;
258  std::vector< std::string >
259  branchesByEntryFrac( ::Double_t minEvFraction ) const;
261  std::vector< std::string >
262  branchesByBytes( ::Long64_t minBytes ) const;
265  std::vector< std::string >
266  branchesByByteFrac( ::Double_t minByteFraction ) const;
267 
269 
272 
281 
283 
285  void Print( ::Option_t* option = "" ) const;
286 
288  void printSmartSlimmingBranchList( bool autoIncludeLinks = false ) const;
289 
291  void nextEvent();
292 
294  ::Long64_t nEvents() const;
296  void setNEvents( ::Long64_t nevents );
297 
298 #ifndef __MAKECINT__
299 #ifndef __ROOTCLING__
300  void readBranch( const std::string& prefix,
302  SG::auxid_t auxid );
303 #endif // not __ROOTCLING__
304 #endif // not __MAKECINT__
305 
307  void readContainer( const std::string& name );
308 
309  private:
314 
316  ::Long64_t m_bytesRead;
318  ::Int_t m_branchNum;
320  ::Int_t m_fileReads;
322  ::Int_t m_cacheSize;
324  ::Double_t m_readTime;
326  ::Double_t m_unzipTime;
328  ::Double_t m_processTime;
329 
331  ::Long64_t m_nEvents;
333  ::Long64_t m_nEventsProcessed;
334 
335  ClassDef( xAOD::ReadStats, 1 )
336 
337  }; // class ReadStats
338 
339 } // namespace xAOD
340 
341 #endif // XAODCORE_TOOLS_READSTATS_H
xAOD::BranchStats::unzippedBytesRead
::Long64_t unzippedBytesRead() const
Get how many unzipped bytes were read from this branch in total.
xAOD::ReadStats::m_bytesRead
::Long64_t m_bytesRead
Total number of bytes read.
Definition: ReadStats.h:316
xAOD::ReadStats::~ReadStats
~ReadStats()
Destructor.
xAOD::ReadStats::addToTreeCacheByEntries
void addToTreeCacheByEntries(::TTree *tree, ::Long64_t minEntries) const
Add the branches accessed more than n times to the TTreeCache.
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
xAOD::ReadStats::Clear
void Clear(::Option_t *opt="")
Clear the statistics information (inherited from TNamed...)
xAOD::ReadStats::fileReads
::Int_t fileReads() const
Get the total number of file read calls.
xAOD::ReadStats::bytesRead
::Long64_t bytesRead() const
Get how many bytes were read in total during the analysis.
xAOD::ReadStats::cacheSize
::Int_t cacheSize() const
Get the TTreeCache size used.
xAOD::ReadStats::m_containers
MapC_t m_containers
Statistics about the containers.
Definition: ReadStats.h:313
xAOD::BranchStats::operator=
BranchStats & operator=(const BranchStats &parent)
Assignment operator.
xAOD::BranchStats::m_zippedBytes
::Long64_t m_zippedBytes
Number of zipped bytes read from this branch.
Definition: ReadStats.h:106
xAOD::ReadStats::m_nEventsProcessed
::Long64_t m_nEventsProcessed
Total processed events.
Definition: ReadStats.h:333
xAOD::ReadStats::ReadStats
ReadStats(const ReadStats &parent)
Copy constructor.
xAOD::ReadStats::isCompatible
bool isCompatible(const ReadStats &rh) const
Function checking if two objects are "compatible".
xAOD::ReadStats::unzipTime
::Double_t unzipTime() const
Get the time spent in unzipping the data.
xAOD::ReadStats::m_branches
Map_t m_branches
Full Statistics about the branches.
Definition: ReadStats.h:311
xAOD::ReadStats::m_processTime
::Double_t m_processTime
Time spent in processing the events.
Definition: ReadStats.h:328
xAOD::BranchStats::setZippedBytesRead
void setZippedBytesRead(::Long64_t nZippedBytes)
Set how many zipped bytes were read from this branch in total.
xAOD::ReadStats::addToTreeCacheByEntryFrac
void addToTreeCacheByEntryFrac(::TTree *tree, ::Double_t minEvFraction) const
Add the branches accessed more than a given fraction of times to the TTreeCache.
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::ReadStats::Print
void Print(::Option_t *option="") const
Print information about the collected statistics.
xAOD::ReadStats::Map_t
std::map< std::string, Vector_t > Map_t
Type of the internal object gathering information on aux branches.
Definition: ReadStats.h:129
xAOD::ReadStats::addToTreeCache
void addToTreeCache(::TTree *tree) const
Add all branches that were ever accessed, to the TTreeCache.
xAOD::BranchStats::Merge
::Int_t Merge(::TCollection *coll)
Function merging the information from multiple objects.
xAOD::ReadStats::operator+=
ReadStats & operator+=(const ReadStats &rh)
Operator merging two objects.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::ReadStats::container
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
xAOD::ReadStats::treeAccessStat
::TH1 * treeAccessStat() const
Get a histogram with the TTree access statistics.
xAOD::ReadStats::zippedByteReadStat
::TH1 * zippedByteReadStat() const
Get a histogram with the zipped byte reading statistics.
xAOD::ReadStats::operator=
ReadStats & operator=(const ReadStats &parent)
Assignment operator.
xAOD::ReadStats::processTime
::Double_t processTime() const
Get the time spent in processing events.
xAOD::ReadStats::nEvents
::Long64_t nEvents() const
Function getting the total number of input event.
xAOD::ReadStats::branch
BranchStats * branch(const std::string &prefix, SG::auxid_t auxid)
Access the description of a branch. Creating it if necessary.
xAOD::ReadStats::branchesByEntries
std::vector< std::string > branchesByEntries(::Long64_t minEntries) const
Get the branches accessed more than n times.
xAOD::ReadStats::nextEvent
void nextEvent()
Function incrementing the processed event counter.
xAOD::BranchStats::Print
void Print(::Option_t *option="") const
Print information about the collected statistics.
xAOD::ReadStats::branchesByEntryFrac
std::vector< std::string > branchesByEntryFrac(::Double_t minEvFraction) const
Get the branches accessed more than a given fraction of times.
xAOD::ReadStats::Vector_t
std::vector< BranchStats * > Vector_t
Type of the internal vectors describing one auxiliary store.
Definition: ReadStats.h:127
xAOD::ReadStats::Merge
::Int_t Merge(::TCollection *coll)
Function merging the information from multiple objects.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
xAOD::BranchStats::setUnzippedBytesRead
void setUnzippedBytesRead(::Long64_t nUnzippedBytes)
Set how many unzipped bytes were read from this branch in total.
xAOD::ReadStats::branchesByBytes
std::vector< std::string > branchesByBytes(::Long64_t minBytes) const
Get the branches from which more than x bytes were read.
xAOD::ReadStats::unzippedByteReadStat
::TH1 * unzippedByteReadStat() const
Get a histogram with the unzipped byte reading statistics.
xAOD::ReadStats::setNEvents
void setNEvents(::Long64_t nevents)
Function setting the total number of input events.
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
xAOD::BranchStats::readEntries
::Long64_t readEntries() const
Get how many entries were read from this branch.
xAOD::BranchStats::setTreesAccessed
void setTreesAccessed(::Int_t nTreesAccessed)
Set how many trees were accessed to read this branch.
xAOD::ReadStats::MapC_t
std::map< std::string, BranchStats > MapC_t
Type of the internal object gathering information on containers.
Definition: ReadStats.h:132
xAOD::ReadStats::ReadStats
ReadStats(const char *name="xAODReadStats", const char *title="xAOD reading statistics")
Constructor just specifying the name of the object.
xAOD::ReadStats::containers
const MapC_t & containers() const
Get information about all the containers.
covarianceTool.title
title
Definition: covarianceTool.py:542
xAOD::BranchStats::setReadEntries
void setReadEntries(::Long64_t nReadEntries)
Set how many entries were read from this branch.
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
xAOD::BranchStats
Class describing the access statistics of one (sub-)branch.
Definition: ReadStats.h:43
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::ReadStats::setBranchNum
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
xAOD::BranchStats::BranchStats
BranchStats(const char *name="xAODBranch", const char *type="Int_t", ::Int_t nTreesAccessed=0, ::Long64_t nReadEntries=0, ::Long64_t nUnzippedBytes=0, ::Long64_t nZippedBytes=0)
Constructor specifying all parameters.
xAOD::ReadStats::printSmartSlimmingBranchList
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
xAOD::ReadStats::setBytesRead
void setBytesRead(::Long64_t num)
Set how many bytes were read in total during the analysis.
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
xAOD::BranchStats::BranchStats
BranchStats(const BranchStats &parent)
Copy constructor.
xAOD::ReadStats::branchNum
::Int_t branchNum() const
Get the total number of branches on the input.
xAOD::ReadStats::setUnzipTime
void setUnzipTime(::Double_t time)
Set the time spent in unzipping the data.
xAOD::ReadStats::entryReadStat
::TH1 * entryReadStat() const
Get a histogram with the entry reading statistics.
xAOD::ReadStats::setReadTime
void setReadTime(::Double_t time)
Set the time spent in reading the data.
pmontree.opt
opt
Definition: pmontree.py:16
xAOD::ReadStats::readContainer
void readContainer(const std::string &name)
Function incrementing the read counter on a specific container.
xAOD::BranchStats::m_unzippedBytes
::Long64_t m_unzippedBytes
Number of unzipped bytes read from this branch.
Definition: ReadStats.h:104
xAOD::ReadStats::setProcessTime
void setProcessTime(::Double_t time)
Set the time spent in processing events.
xAOD::ReadStats::readBranch
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
xAOD::BranchStats::operator+=
BranchStats & operator+=(const BranchStats &rh)
Operator merging two objects.
AuxTypes.h
Basic definitions for auxiliary types.
xAOD::ReadStats::m_nEvents
::Long64_t m_nEvents
Total num events.
Definition: ReadStats.h:331
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
xAOD::ReadStats::m_readTime
::Double_t m_readTime
Time spent reading the events.
Definition: ReadStats.h:324
xAOD::ReadStats::container
const BranchStats * container(const std::string &name) const
Access the description of a container.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TH1
Definition: rootspy.cxx:268
xAOD::ReadStats::branchesByByteFrac
std::vector< std::string > branchesByByteFrac(::Double_t minByteFraction) const
Get the branches from which more than a given fraction of bytes were read.
xAOD::ReadStats::m_fileReads
::Int_t m_fileReads
Total number of file reading operations during the analysis.
Definition: ReadStats.h:320
xAOD::ReadStats::setCacheSize
void setCacheSize(::Int_t size)
Set the TTreeCache size used.
xAOD::BranchStats::m_treesAccessed
::Int_t m_treesAccessed
Number of trees/files accessed for this branch.
Definition: ReadStats.h:100
xAOD::ReadStats::readTime
::Double_t readTime() const
Get the time spent in reading the data.
LArG4GenerateShowerLib.nevents
nevents
Definition: LArG4GenerateShowerLib.py:19
xAOD::ReadStats::m_branchNum
::Int_t m_branchNum
Total number of branches in the input xAOD TTree.
Definition: ReadStats.h:318
xAOD::ReadStats
Class describing the access statistics of a collection of branches.
Definition: ReadStats.h:123
xAOD::ReadStats::branch
const BranchStats * branch(const std::string &prefix, SG::auxid_t auxid) const
Get information about a specific variable.
xAOD::BranchStats::treesAccessed
::Int_t treesAccessed() const
Get how many trees/files were accessed to read this branch.
xAOD::ReadStats::setFileReads
void setFileReads(::Int_t num)
Set the total number of file read calls.
xAOD::BranchStats::add
BranchStats & add(const BranchStats &rh)
Function merging two objects.
xAOD::ReadStats::branches
const Map_t & branches() const
Get all variable information.
xAOD::ReadStats::addToTreeCacheByByteFrac
void 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.
xAOD::BranchStats::m_readEntries
::Long64_t m_readEntries
Number of entries read from this branch.
Definition: ReadStats.h:102
xAOD::ReadStats::m_cacheSize
::Int_t m_cacheSize
Cache size used in the analysis.
Definition: ReadStats.h:322
xAOD::BranchStats::zippedBytesRead
::Long64_t zippedBytesRead() const
Get how many zipped bytes were read from this branch in total.
xAOD::ReadStats::m_unzipTime
::Double_t m_unzipTime
Time spent unzipping the events.
Definition: ReadStats.h:326
xAOD::ReadStats::addToTreeCacheByBytes
void addToTreeCacheByBytes(::TTree *tree, ::Long64_t minBytes) const
Add the branches from which more than x bytes were read, to the TTreeCache.
xAOD::ReadStats::add
ReadStats & add(const ReadStats &rh)
Function merging two objects.