本文整理汇总了C++中TH2D::GetSumOfWeights方法的典型用法代码示例。如果您正苦于以下问题:C++ TH2D::GetSumOfWeights方法的具体用法?C++ TH2D::GetSumOfWeights怎么用?C++ TH2D::GetSumOfWeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH2D
的用法示例。
在下文中一共展示了TH2D::GetSumOfWeights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addn2
//.........这里部分代码省略.........
gDirectory->pwd();
gDirectory->ReadAll(); // load histos
TList * lst = gDirectory->GetList();
cout << lst->GetName() << endl;
cout << lst->GetTitle() << endl;
cout << "size " << lst->GetSize() << endl;
cout << "entries " << lst->GetEntries() << endl;
cout << "last " << lst->LastIndex() << endl;
TIterator *iter = lst->MakeIterator();
int ii = 0;
TObject *obj;
TH1D *h;
TH1D *h0;
TH2D *H;
TH2D *H0;
while( obj = iter->Next() ){
ii++;
cout << setw(4) << ii << ": ";
cout << obj->ClassName() << " ";
cout << obj->InheritsFrom("TH1D") << " ";
cout << obj->GetName() << " \"";
cout << obj->GetTitle() << "\"";
cout << endl;
// if( obj->ClassName() == "TH1D" ){
if( obj->InheritsFrom("TH1D") ){
h = (TH1D*) obj;
cout << " 1D";
cout << h->GetNbinsX() << " bins, ";
cout << h->GetEntries() << " entries, ";
cout << h->GetSumOfWeights() << " inside, ";
cout << h->GetBinContent(0) << " under, ";
cout << h->GetBinContent(h->GetNbinsX()+1) << " over";
cout << endl;
f0.cd(); // output file
// TH1D* h0 = (TH1D*) h->Clone();
h0 = h; // copy
h0->Write(); // write to file f0
f1.cd(); // back to file 1 for the loop
}
else{
if( obj->InheritsFrom("TH2D") ){
H = (TH2D*) obj;
cout << " 2D";
cout << H->GetNbinsX() << " bins, ";
cout << H->GetEntries() << " entries, ";
cout << H->GetSumOfWeights() << " inside, ";
cout << H->GetBinContent(0) << " under, ";
cout << H->GetBinContent(H->GetNbinsX()+1) << " over";
cout << endl;
f0.cd(); // output file
H0 = H; // copy
H0->Write(); // write to file f0
f1.cd(); // back to file 1 for the loop
}