本文整理汇总了C++中TBranch::GetZipBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ TBranch::GetZipBytes方法的具体用法?C++ TBranch::GetZipBytes怎么用?C++ TBranch::GetZipBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBranch
的用法示例。
在下文中一共展示了TBranch::GetZipBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTreeSize
void GetTreeSize(TString FileName, TString TreeName)
{
TFile *inf = TFile::Open(FileName);
TTree *tr = (TTree*)inf->Get(TreeName);
TObjArray *branches = (TObjArray*)tr->GetListOfBranches();
int size(0);
cout.setf(ios::right);
int N(branches->GetEntries());
TH1F *hSize = new TH1F("size","size",N,0,N);
for(int ib=0;ib<N;ib++) {
TString name(branches->At(ib)->GetName());
TBranch *br = (TBranch*)tr->GetBranch(name);
hSize->Fill(name,br->GetZipBytes()/1e+3);
size += br->GetZipBytes();
}
cout<<"Total size: "<<size<<endl;
for(int ib=0;ib<N;ib++) {
TString name(branches->At(ib)->GetName());
TBranch *br = (TBranch*)tr->GetBranch(name);
float percent = TMath::Ceil(1000*float(br->GetZipBytes())/float(size))/10;
cout<<ib<<setw(20)<<name<<setw(15)<<br->GetZipBytes()<<" "<<percent<<"%"<<endl;
}
TCanvas *can = new TCanvas("TreeSize","TreeSize",1000,400);
hSize->GetXaxis()->SetTitle("Branch Name");
hSize->GetXaxis()->SetLabelSize(0.04);
hSize->GetYaxis()->SetTitle("Size (KB)");
hSize->SetFillColor(kGray);
hSize->Draw();
}
示例2: mTree
mTree(TTree *t){
name=t->GetName();
entries=(long)t->GetEntries();
totSize=t->GetZipBytes();
leaves=t->GetListOfBranches()->GetEntriesFast();
for (int i=0; i<leaves; i++) {
TBranch* branch = (TBranch*)t->GetListOfBranches()->UncheckedAt(i);
branch->SetAddress(0);
// cout <<i<<"\t"<<branch->GetName()<<"\t BS: "<< branch->GetBasketSize()<<"\t size: "<< branch->GetTotalSize()<< "\ttotbytes: "<<branch->GetTotBytes() << endl;
branchSizes.insert(std::pair<string,long>(branch->GetName(),branch->GetZipBytes()));
}
}