9 #include <boost/bind.hpp>
19 #include "TObjArray.h"
23 #include "Riostream.h"
25 #include "TBufferFile.h"
31 typedef std::valarray<Long64_t>
size_type;
33 size_type getBasketSize( TBranch *);
35 size_type getBasketSize( TObjArray * branches) {
36 size_type
result(static_cast<Long64_t>(0),2);
37 size_t n = branches->GetEntries();
38 for(
size_t i = 0;
i <
n; ++
i ) {
39 TBranch *
b =
dynamic_cast<TBranch*
>( branches->At(
i ) );
41 result += getBasketSize(b);
46 size_type getBasketSize( TBranch *
b) {
47 size_type
result(static_cast<Long64_t>(0),2);
49 if ( b->GetZipBytes() > 0 ) {
50 result[kUncompressed] = b->GetTotBytes();
result[kCompressed] = b->GetZipBytes();
52 result[kUncompressed] = b->GetTotalSize();
result[kCompressed] = b->GetTotalSize();
54 result += getBasketSize( b->GetListOfBranches() );
60 size_type getTotalSize( TBranch *
br) {
61 TBufferFile buf( TBuffer::kWrite, 10000 );
62 TBranch::Class()->WriteBuffer( buf, br );
63 size_type
size = getBasketSize(br);
64 if ( br->GetZipBytes() > 0 )
65 size[kUncompressed] += buf.Length();
84 TFile *
file = TFile::Open( fileName.c_str() );
85 if( file==0 || ( !(*file).IsOpen() ) )
86 throw Error(
"unable to open data file " + fileName, 7002);
88 TObject *
o = file->Get(treeName.c_str() );
90 throw Error(
"no object \"" + treeName +
"\" found in file: " + fileName, 7003);
92 TTree *
events =
dynamic_cast<TTree*
> (
o);
94 throw Error(
"object \"" + treeName +
"\" is not a TTree in file: " + fileName, 7004);
98 throw Error(
"tree \"" + treeName +
"\" in file " + fileName +
" contains no Events", 7005);
101 TObjArray * branches = events->GetListOfBranches();
103 throw Error(
"tree \"" + treeName+
"\" in file " + fileName +
" contains no branches", 7006);
105 const size_t n = branches->GetEntries();
107 for(
size_t i = 0;
i <
n; ++
i ) {
108 TBranch * b =
dynamic_cast<TBranch*
>( branches->At(
i ) );
111 if (
name ==
"EventAux" )
continue;
112 size_type
s = getTotalSize(b);
116 boost::bind(std::greater<double>(),
125 boost::bind(std::less<std::string>(),
142 e = br.
name.rfind(
'_');
143 if (e!=std::string::npos) br.
name.replace(e,1,
":");
169 co <<
"Branch Name | Average Uncompressed Size (Bytes/Event) | Average Compressed Size (Bytes/Event) \n";
199 for(
int i = 1;
i <=
top; ++
i ) {
201 if ( cm > 0 && cm < mn ) mn = cm;
202 if ( um > 0 && um < mn ) mn = um;
211 cxAxis->SetLabelOffset( -0.32 );
212 cxAxis->LabelsOption(
"v" );
213 cxAxis->SetLabelSize( 0.03 );
214 uxAxis->SetLabelOffset( -0.32 );
215 uxAxis->LabelsOption(
"v" );
216 uxAxis->SetLabelSize( 0.03 );
243 if( !plot.empty() ) {
244 gROOT->SetStyle(
"Plain" );
245 gStyle->SetOptStat( kFALSE );
246 gStyle->SetOptLogy();
250 c.SaveAs( plot.c_str() );
252 if ( !file.empty() ) {
253 TFile
f( file.c_str(),
"RECREATE" );
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
tuple size
Write out results.