18 #include "TObjArray.h"
22 #include "Riostream.h"
24 #include "TBufferFile.h"
28 enum Indices { kUncompressed, kCompressed };
30 typedef std::valarray<Long64_t>
size_type;
32 size_type getBasketSize(TBranch*);
34 size_type getBasketSize(TObjArray* branches) {
35 size_type
result(static_cast<Long64_t>(0), 2);
36 size_t n = branches->GetEntries();
37 for (
size_t i = 0;
i <
n; ++
i) {
38 TBranch*
b =
dynamic_cast<TBranch*
>(branches->At(
i));
40 result += getBasketSize(b);
45 size_type getBasketSize(TBranch*
b) {
46 size_type
result(static_cast<Long64_t>(0), 2);
48 if (b->GetZipBytes() > 0) {
49 result[kUncompressed] = b->GetTotBytes();
50 result[kCompressed] = b->GetZipBytes();
52 result[kUncompressed] = b->GetTotalSize();
53 result[kCompressed] = b->GetTotalSize();
55 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();
82 TFile*
file = TFile::Open(fileName.c_str());
83 if (file ==
nullptr || (!(*file).IsOpen()))
84 throw Error(
"unable to open data file " + fileName, 7002);
86 TObject*
o = file->Get(treeName.c_str());
88 throw Error(
"no object \"" + treeName +
"\" found in file: " + fileName, 7003);
90 TTree*
events =
dynamic_cast<TTree*
>(
o);
91 if (events ==
nullptr)
92 throw Error(
"object \"" + treeName +
"\" is not a TTree in file: " + fileName, 7004);
96 throw Error(
"tree \"" + treeName +
"\" in file " + fileName +
" contains no Events", 7005);
98 TObjArray* branches = events->GetListOfBranches();
99 if (branches ==
nullptr)
100 throw Error(
"tree \"" + treeName +
"\" in file " + fileName +
" contains no branches", 7006);
102 const size_t n = branches->GetEntries();
104 for (
size_t i = 0;
i <
n; ++
i) {
105 TBranch* b =
dynamic_cast<TBranch*
>(branches->At(
i));
109 if (
name ==
"EventAux")
111 size_type
s = getTotalSize(b);
117 std::bind(std::greater<double>(),
125 std::bind(std::less<std::string>(),
141 e = br.
name.rfind(
'_');
142 if (e != std::string::npos)
143 br.
name.replace(e, 1,
":");
163 co <<
"Branch Name | Average Uncompressed Size (Bytes/Event) | Average Compressed Size (Bytes/Event) \n";
191 for (
int i = 1;
i <=
top; ++
i) {
193 if (cm > 0 && cm < mn)
195 if (um > 0 && um < mn)
205 cxAxis->SetLabelOffset(-0.32);
206 cxAxis->LabelsOption(
"v");
207 cxAxis->SetLabelSize(0.03);
208 uxAxis->SetLabelOffset(-0.32);
209 uxAxis->LabelsOption(
"v");
210 uxAxis->SetLabelSize(0.03);
238 gROOT->SetStyle(
"Plain");
239 gStyle->SetOptStat(kFALSE);
240 gStyle->SetOptLogy();
244 c.SaveAs(plot.c_str());
247 TFile
f(file.c_str(),
"RECREATE");
edm::ErrorSummaryEntry Error
const edm::EventSetup & c
__host__ __device__ VT * co
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
tuple size
Write out results.