本文整理汇总了C++中TH1I::SetBinError方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1I::SetBinError方法的具体用法?C++ TH1I::SetBinError怎么用?C++ TH1I::SetBinError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1I
的用法示例。
在下文中一共展示了TH1I::SetBinError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Loop
void Zlumi::Loop()
{
// In a ROOT session, you can do:
// Root > .L Zlumi.C
// Root > Zlumi t
// Root > t.GetEntry(12); // Fill t data members with entry number 12
// Root > t.Show(); // Show values of entry 12
// Root > t.Show(16); // Read and show values of entry 16
// Root > t.Loop(); // Loop on all entries
//
// This is the loop skeleton where:
// jentry is the global entry number in the chain
// ientry is the entry number in the current Tree
// Note that the argument to GetEntry must be:
// jentry for TChain::GetEntry
// ientry for TTree::GetEntry and TBranch::GetEntry
//
// To read only selected branches, Insert statements like:
// METHOD1:
// fChain->SetBranchStatus("*",0); // disable all branches
// fChain->SetBranchStatus("branchname",1); // activate branchname
// METHOD2: replace line
// fChain->GetEntry(jentry); //read all branches
//by b_branchname->GetEntry(ientry); //read only this branch
gROOT->ForceStyle();
tdrStyle();
if (fChain == 0) return;
int minRun=0;
int maxRun=0;
int maxLS=0;
bool forminRun=true;
//TH2I * LumiSRun = new TH2I("LumiSRun", "LS vs Run", 3000, 0., 3000., 20000, 160000., 180000.);
//TH1I * test2 = new TH1I("test2","test2", 3000,0, 3000);
Long64_t nentries = fChain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
if(forminRun && (Run!=0)){minRun=Run; forminRun=false;}
if((Run!=0) && (Run>maxRun)){maxRun=Run;}
if((LS!=0) && (LS>maxLS)){maxLS=LS;}
//printf("run %i ls %i \n",Run,LS);
}
cout << nentries << " nentries \n";
TH2I *LumiSRun = new TH2I("LumiSRun", "LS vs Run", maxLS, 0, maxLS, maxRun-minRun+2, minRun-1, maxRun+1);
TH1I *Runs = new TH1I("Runs","Run", maxRun-minRun+2, minRun-1, maxRun+1);
Runs->Sumw2();
nbytes = 0; nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
LumiSRun->Fill(LS,Run);
//printf("run %i ls %i \n",Run,LS);
Runs->Fill(Run);
//test2->Fill(LS);
}
printf("minRun %i maxRun %i \n",minRun,maxRun);
LumiSRun->Draw();
for (int h=0;h<Runs->GetNbinsX();h++){
Runs->SetBinError(h+1,sqrt(Runs->GetBinContent(h+1)) );
}
Runs->Draw();
//test->Draw();
//test2->Draw();
TH1F *FileRuns = new TH1F("FileRuns","Run from Lumicalc", maxRun-minRun+2, minRun-1, maxRun+1);
TH1D *XsecDistro = new TH1D("XsecDistro","X sec distribution", 60, 0., 0.6);
//-------------
const Int_t mpt = maxRun-minRun;
int fileRun[mpt];
double Lumi[mpt];
int npt = 0;
// read data file
ifstream file;
//file.open("./2011-run-lumi.txt");
file.open("./LumiAeB-dav.txt");
while (1) {
file >> fileRun[npt] >> Lumi[npt];
if ( ! file.good() ) break;
cout << "x = " << fileRun[npt] << " y = " << Lumi[npt] << endl;
FileRuns->SetBinContent((fileRun[npt]-minRun+2),0.2);
npt++;
//.........这里部分代码省略.........