ATLAS Offline Software
Loading...
Searching...
No Matches
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):
27class TCollection;
28class TTree;
29class TH1;
30
31namespace 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 );
52 BranchStats( const BranchStats& parent );
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
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" );
138 ReadStats( const ReadStats& parent );
141
143 ReadStats& operator= ( const ReadStats& parent );
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__
194 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
274 ::TH1* treeAccessStat() const;
276 ::TH1* entryReadStat() const;
278 ::TH1* zippedByteReadStat() const;
280 ::TH1* unzippedByteReadStat() const;
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__
301 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;
334
335 ClassDef( xAOD::ReadStats, 1 )
336
337 }; // class ReadStats
338
339} // namespace xAOD
340
341#endif // XAODCORE_TOOLS_READSTATS_H
Basic definitions for auxiliary types.
Class describing the access statistics of one (sub-)branch.
Definition ReadStats.h:43
::Long64_t unzippedBytesRead() const
Get how many unzipped bytes were read from this branch in total.
void setTreesAccessed(::Int_t nTreesAccessed)
Set how many trees were accessed to read this branch.
void setUnzippedBytesRead(::Long64_t nUnzippedBytes)
Set how many unzipped bytes were read from this branch in total.
void setZippedBytesRead(::Long64_t nZippedBytes)
Set how many zipped bytes were read from this branch in total.
BranchStats & operator+=(const BranchStats &rh)
Operator merging two objects.
BranchStats(const BranchStats &parent)
Copy constructor.
::Long64_t m_zippedBytes
Number of zipped bytes read from this branch.
Definition ReadStats.h:106
::Long64_t readEntries() const
Get how many entries were read from this branch.
::Int_t Merge(::TCollection *coll)
Function merging the information from multiple objects.
::Long64_t m_readEntries
Number of entries read from this branch.
Definition ReadStats.h:102
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.
::Int_t m_treesAccessed
Number of trees/files accessed for this branch.
Definition ReadStats.h:100
BranchStats & add(const BranchStats &rh)
Function merging two objects.
void Print(::Option_t *option="") const
Print information about the collected statistics.
BranchStats & operator=(const BranchStats &parent)
Assignment operator.
::Long64_t m_unzippedBytes
Number of unzipped bytes read from this branch.
Definition ReadStats.h:104
void setReadEntries(::Long64_t nReadEntries)
Set how many entries were read from this branch.
::Int_t treesAccessed() const
Get how many trees/files were accessed to read this branch.
::Long64_t zippedBytesRead() const
Get how many zipped bytes were read from this branch in total.
Class describing the access statistics of a collection of branches.
Definition ReadStats.h:123
::Int_t m_fileReads
Total number of file reading operations during the analysis.
Definition ReadStats.h:320
const MapC_t & containers() const
Get information about all the containers.
::Long64_t bytesRead() const
Get how many bytes were read in total during the analysis.
void Clear(::Option_t *opt="")
Clear the statistics information (inherited from TNamed...)
::Long64_t m_nEvents
Total num events.
Definition ReadStats.h:331
ReadStats & operator+=(const ReadStats &rh)
Operator merging two objects.
void addToTreeCache(::TTree *tree) const
Add all branches that were ever accessed, to the TTreeCache.
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.
void Print(::Option_t *option="") const
Print information about the collected statistics.
void setBytesRead(::Long64_t num)
Set how many bytes were read in total during the analysis.
std::vector< BranchStats * > Vector_t
Type of the internal vectors describing one auxiliary store.
Definition ReadStats.h:127
::Long64_t m_nEventsProcessed
Total processed events.
Definition ReadStats.h:333
void addToTreeCacheByEntryFrac(::TTree *tree, ::Double_t minEvFraction) const
Add the branches accessed more than a given fraction of times to the TTreeCache.
void setProcessTime(::Double_t time)
Set the time spent in processing events.
::TH1 * treeAccessStat() const
Get a histogram with the TTree access statistics.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
void nextEvent()
Function incrementing the processed event counter.
::TH1 * unzippedByteReadStat() const
Get a histogram with the unzipped byte reading statistics.
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
::Int_t Merge(::TCollection *coll)
Function merging the information from multiple objects.
std::vector< std::string > branchesByEntryFrac(::Double_t minEvFraction) const
Get the branches accessed more than a given fraction of times.
::Int_t m_cacheSize
Cache size used in the analysis.
Definition ReadStats.h:322
ReadStats(const char *name="xAODReadStats", const char *title="xAOD reading statistics")
Constructor just specifying the name of the object.
::TH1 * entryReadStat() const
Get a histogram with the entry reading statistics.
std::vector< std::string > branchesByByteFrac(::Double_t minByteFraction) const
Get the branches from which more than a given fraction of bytes were read.
bool isCompatible(const ReadStats &rh) const
Function checking if two objects are "compatible".
void setUnzipTime(::Double_t time)
Set the time spent in unzipping the data.
~ReadStats()
Destructor.
void setFileReads(::Int_t num)
Set the total number of file read calls.
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
const BranchStats * branch(const std::string &prefix, SG::auxid_t auxid) const
Get information about a specific variable.
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
::Int_t cacheSize() const
Get the TTreeCache size used.
MapC_t m_containers
Statistics about the containers.
Definition ReadStats.h:313
::Long64_t nEvents() const
Function getting the total number of input event.
::Double_t m_readTime
Time spent reading the events.
Definition ReadStats.h:324
ReadStats(const ReadStats &parent)
Copy constructor.
::Int_t m_branchNum
Total number of branches in the input xAOD TTree.
Definition ReadStats.h:318
::TH1 * zippedByteReadStat() const
Get a histogram with the zipped byte reading statistics.
std::vector< std::string > branchesByEntries(::Long64_t minEntries) const
Get the branches accessed more than n times.
::Double_t processTime() const
Get the time spent in processing events.
ReadStats & operator=(const ReadStats &parent)
Assignment operator.
void setReadTime(::Double_t time)
Set the time spent in reading the data.
void readContainer(const std::string &name)
Function incrementing the read counter on a specific container.
::Double_t m_processTime
Time spent in processing the events.
Definition ReadStats.h:328
void setCacheSize(::Int_t size)
Set the TTreeCache size used.
std::vector< std::string > branchesByBytes(::Long64_t minBytes) const
Get the branches from which more than x bytes were read.
::Double_t readTime() const
Get the time spent in reading the data.
void setNEvents(::Long64_t nevents)
Function setting the total number of input events.
std::map< std::string, Vector_t > Map_t
Type of the internal object gathering information on aux branches.
Definition ReadStats.h:129
void addToTreeCacheByBytes(::TTree *tree, ::Long64_t minBytes) const
Add the branches from which more than x bytes were read, to the TTreeCache.
Map_t m_branches
Full Statistics about the branches.
Definition ReadStats.h:311
void addToTreeCacheByEntries(::TTree *tree, ::Long64_t minEntries) const
Add the branches accessed more than n times to the TTreeCache.
std::map< std::string, BranchStats > MapC_t
Type of the internal object gathering information on containers.
Definition ReadStats.h:132
const BranchStats * container(const std::string &name) const
Access the description of a container.
ReadStats & add(const ReadStats &rh)
Function merging two objects.
BranchStats * branch(const std::string &prefix, SG::auxid_t auxid)
Access the description of a branch. Creating it if necessary.
::Long64_t m_bytesRead
Total number of bytes read.
Definition ReadStats.h:316
::Int_t fileReads() const
Get the total number of file read calls.
::Int_t branchNum() const
Get the total number of branches on the input.
::Double_t m_unzipTime
Time spent unzipping the events.
Definition ReadStats.h:326
const Map_t & branches() const
Get all variable information.
::Double_t unzipTime() const
Get the time spent in unzipping the data.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TChain * tree