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;
34 size_type getBasketSize(TObjArray* branches) {
36 size_t n = branches->GetEntries();
37 for (
size_t i = 0;
i <
n; ++
i) {
38 TBranch*
b =
dynamic_cast<TBranch*
>(branches->At(
i));
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());
61 TBufferFile
buf(TBuffer::kWrite, 10000);
64 if (
br->GetZipBytes() > 0)
65 size[kUncompressed] +=
buf.Length();
83 if (
file ==
nullptr || (!(*file).IsOpen()))
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);
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")
117 std::bind(std::greater<double>(),
125 std::bind(std::less<std::string>(),
133 size_t b =
br.fullName.find(
'_');
134 size_t e =
br.fullName.rfind(
'_');
136 br.name =
br.fullName;
139 br.name =
br.fullName.substr(
b + 1,
e -
b - 1);
141 e =
br.name.rfind(
'_');
142 if (
e != std::string::npos)
143 br.name.replace(
e, 1,
":");
145 br.name.append(
" (" +
br.fullName.substr(0,
b) +
")");
156 co <<
br.name <<
" " <<
br.uncompr_size <<
" " <<
br.compr_size <<
"\n";
163 co <<
"Branch Name | Average Uncompressed Size (Bytes/Event) | Average Compressed Size (Bytes/Event) \n";
181 cxAxis->SetBinLabel(
x + 1,
br.name.c_str());
182 uxAxis->SetBinLabel(
x + 1,
br.name.c_str());
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();
242 h.uncompressed.Draw();
243 h.compressed.Draw(
"same");
244 c.SaveAs(
plot.c_str());
247 TFile
f(
file.c_str(),
"RECREATE");
248 h.compressed.Write();
249 h.uncompressed.Write();
edm::ErrorSummaryEntry Error
__host__ __device__ VT * co
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.