本文整理汇总了C++中TProfile::GetBinEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ TProfile::GetBinEntries方法的具体用法?C++ TProfile::GetBinEntries怎么用?C++ TProfile::GetBinEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TProfile
的用法示例。
在下文中一共展示了TProfile::GetBinEntries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char * argv[]){
if(argc < 3){cout<<" Usage: executable input_file.root outfile.txt"<<endl; return -4;}
int sm_ = 18;
TFile f(argv[1]);
TProfile* pr = 0;
pr = (TProfile*) f.Get("rel_timing_prof_conv_blu");
if( !pr ){cout<<" timing profile not found in the root file"<<endl; return -1;}
float time[1701]; for(int i=0;i<1701;i++){time[i]=-100;}
float half_mean = 0;
for(int ch=1;ch<1701;ch++){
if ( ch<101 || (ch-1)%20 > 9){half_mean=137.4/25.;}// half1
else {half_mean=137.1/25.;}
time[ch] = pr->GetBinContent(ch)+half_mean;
if( fabs(pr->GetBinContent(ch))>0.2 || pr->GetBinEntries(ch)<500 ){
cout<<"cry: "<<ch<<" entries: "<<pr->GetBinEntries(ch)<<" rel timing: "<<pr->GetBinContent(ch)<<endl;
}
}
f.Close();
ofstream txt_channels;
txt_channels.open(argv[2],ios::out);
for(int i=1;i<1701;i++){
txt_channels <<sm_<<" "<<setw(4)<<i<<" \t "<<setw(8)<<setprecision(7)<<time[i]<< endl;
}
txt_channels.close();
return 0;
}
示例2: meanY
//------------------------------------------------------------------------------
double meanY( char* hs ) // for profiles only
{
TObject* obj = gDirectory->Get(hs);
if( !obj->InheritsFrom( "TProfile" ) ) {
cout << hs << " is not profile plot" << endl;
return 0;
}
TProfile* p = (TProfile*)obj;
double sumw = 0;
double sumy = 0;
for( int i = 1; i <= p->GetNbinsX(); ++i ) { // bin 0 is underflow
double w = p->GetBinEntries(i);
sumw += w;
sumy += w * p->GetBinContent(i);
}
if( sumw > 0.1 )
return sumy/sumw;
else
return 0;
}