本文整理汇总了C++中TH1F::GetRMSError方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1F::GetRMSError方法的具体用法?C++ TH1F::GetRMSError怎么用?C++ TH1F::GetRMSError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1F
的用法示例。
在下文中一共展示了TH1F::GetRMSError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readMCPerform
//.........这里部分代码省略.........
fHistCosp[index]->GetXaxis()->SetTitle("pT (GeV/c)");
fHistCosp[index]->GetYaxis()->SetTitle("Cos Point");
fHistCosp[index]->SetTitle("Prompt CosPoint vs pT");
if (index % 2 == 1)
fHistDecLen[index]->SetTitle("FeedDown Dec Len vs pT");
htemp = (TH1F *)fHistPtYMultGenDauInAcc[index]->ProjectionX(Form("hPtDen%s%s", type[i].Data(), names[j].Data()));
hEffPt[index] = (TH1F *)fHistPtYMultRecoFilt[index]->ProjectionX(Form("hPtNum%s%s", type[i].Data(), names[j].Data()));
fHistPtYMultGenDauInAcc[index]->Sumw2();
fHistPtYMultRecoFilt[index]->Sumw2();
hEffPt[index]->Sumw2();
hEffPt[index]->Divide(htemp);
hEffPt[index]->SetLineColor(color[j]);
hEffPt[index]->SetLineWidth(2);
hEffPt[index]->GetXaxis()->SetTitle("pT (GeV/c)");
hEffPt[index]->GetYaxis()->SetTitle("Prompt Efficiency");
hEffPt[index]->SetTitle("Prompt Efficiency");
hEffPt[index]->SetStats(0);
fHistCosp[index]->SetStats(0);
fHistDecLen[index]->SetStats(0);
if (index % 2 == 1)
{
hEffPt[index]->GetYaxis()->SetTitle("Feeddown Efficiency");
hEffPt[index]->SetTitle("Feeddown Efficiency");
}
fHistInvMassRes[index] = new TH1F(*hEffPt[index]);
for (Int_t jj = 1; jj < hEffPt[index]->GetNbinsX() + 1; jj++)
{
TH1F *hTemp = (TH1F *)fHistInvMassVsPt[index]->ProjectionY("htemp", jj, jj);
fHistInvMassRes[index]->SetBinContent(jj, hTemp->GetRMS());
fHistInvMassRes[index]->SetBinError(jj, hTemp->GetRMSError());
fHistInvMassRes[index]->SetLineColor(color[j]);
fHistInvMassRes[index]->SetLineWidth(2);
fHistInvMassRes[index]->GetXaxis()->SetTitle("pT (GeV/c)");
fHistInvMassRes[index]->GetYaxis()->SetTitle("Inv Mass RMS (GeV/c2)");
fHistInvMassRes[index]->SetTitle("Inv Mass RMS vs pT");
if (index == 0)
printf("D0: pt=%f, res=%f \n", fHistInvMassRes[index]->GetBinCenter(jj), fHistInvMassRes[index]->GetBinContent(jj));
TH1F *hTempX = (TH1F *)fHistXvtxResVsPt[index]->ProjectionY("htempX", jj, jj);
TH1F *hTempY = (TH1F *)fHistYvtxResVsPt[index]->ProjectionY("htempY", jj, jj);
TH1F *hTempZ = (TH1F *)fHistZvtxResVsPt[index]->ProjectionY("htempZ", jj, jj);
fHistXvtxRes2[index]->SetBinContent(jj, hTempX->GetRMS());
fHistXvtxRes2[index]->SetBinError(jj, hTempX->GetRMSError());
fHistYvtxRes2[index]->SetBinContent(jj, hTempY->GetRMS());
fHistYvtxRes2[index]->SetBinError(jj, hTempY->GetRMSError());
fHistZvtxRes2[index]->SetBinContent(jj, hTempZ->GetRMS());
fHistZvtxRes2[index]->SetBinError(jj, hTempZ->GetRMSError());
}
}
}
fHistNCandDplus->SetLineColor(2);
fHistNCandDstar->SetLineColor(3);
fHistNCandDs->SetLineColor(4);
fHistNCandLc->SetLineColor(kOrange);
fHistNCandDplus->SetLineWidth(2);
fHistNCandDstar->SetLineWidth(2);
fHistNCandDs->SetLineWidth(2);
fHistNCandLc->SetLineWidth(2);
示例2: TCanvas
//.........这里部分代码省略.........
//d->SaveAs("tmp/d_hist.root");
s->SaveAs("tmp/s_hist.root");
s2->SaveAs("tmp/s2_hist.root");
yLabel.Form("Events /(%.2f %s)", s->GetBinWidth(2), yLabelUnit.Data());
float max = 1.1 * std::max(
d->GetMaximum(),///d->Integral(),
s->GetMaximum() ///s->Integral()
);
max=1.1*d->GetMaximum();
std::cout << "max = " << max << std::endl;
std::cout << "nEvents data: " << d->Integral() << "\t" << d->GetEntries() << std::endl;
std::cout << "nEvents signal: " << s->Integral() << "\t" << s->GetEntries() << std::endl;
std::cout << "nEvents signal2: " << s2->Integral() << "\t" << s2->GetEntries() << std::endl;
if(logy){
max*=10;
d->GetYaxis()->SetRangeUser(0.1,max);
s->GetYaxis()->SetRangeUser(0.1,max);
s2->GetYaxis()->SetRangeUser(0.1,max);
c->SetLogy();
} else {
d->GetYaxis()->SetRangeUser(0,max);
s->GetYaxis()->SetRangeUser(0,max);
s2->GetYaxis()->SetRangeUser(0,max);
}
s->GetYaxis()->SetTitle(yLabel);
s->GetXaxis()->SetTitle(xLabel);
s2->GetYaxis()->SetTitle(yLabel);
s2->GetXaxis()->SetTitle(xLabel);
d->GetYaxis()->SetTitle(yLabel);
d->GetXaxis()->SetTitle(xLabel);
d->SetMarkerStyle(20);
d->SetMarkerSize(1);
if(d != s){
s->SetMarkerStyle(20);
s->SetMarkerSize(1);
s->SetFillStyle(3001);
s->SetFillColor(kRed);
}
if(s2 != s){
//s2->SetMarkerStyle(1);
//s2->SetMarkerSize(0);
//s->SetFillStyle(0);
//s->SetFillColor(kB);
s2->SetLineWidth(3);
s2->SetLineColor(kBlack);
}
TH1F* s_norm = (TH1F *) (s->DrawNormalized("hist", d->Integral()));
TH1F* s2_norm = (TH1F *) (s2->DrawNormalized("hist same", d->Integral()));
//TH1F* d_norm = s_norm;
//if(d!=s) d_norm = (TH1F *) (d->DrawNormalized("p same", d->Integral()));
if(d!=s) d->Draw("p same");
if(logy){
//d_norm->GetYaxis()->SetRangeUser(0.1,max);
s_norm->GetYaxis()->SetRangeUser(0.1,max);
c->SetLogy();
} else {
//d_norm->GetYaxis()->SetRangeUser(0,max);
s_norm->GetYaxis()->SetRangeUser(0,max);
}
std::cout << "Variable & Data & Simulation & Simulation2 \\" << std::endl;
std::cout << "Mean & " << d->GetMean() << " " << d->GetMeanError()
<< " & " << s_norm->GetMean() << " " << s_norm->GetMeanError()
<< " & " << s2_norm->GetMean() << " " << s2_norm->GetMeanError()
<< " \\" << std::endl;
std::cout << "Std. dev. & " << d->GetRMS() << " " << d->GetRMSError()
<< " & " << s_norm->GetRMS() << " " << s_norm->GetRMSError()
<< " & " << s2_norm->GetRMS() << " " << s2_norm->GetRMSError()
<< " \\" << std::endl;
std::cout << "\\hline" << std::endl;
std::cout << "$\\Chi^2$ " << d->Chi2Test(s_norm, "UW CHI2/NDF NORM") << std::endl;
TLegend *leg = new TLegend(0.6,0.8,1,1);
if(dataLabel !="") leg->AddEntry(d,dataLabel,"p");
if(mcLabel !="") leg->AddEntry(s,mcLabel, "lf");
if(mc2Label !="") leg->AddEntry(s2,mc2Label, "l");
leg->SetBorderSize(1);
leg->SetFillColor(0);
leg->SetTextSize(0.04);
if(dataLabel !="" && mcLabel !="") leg->Draw();
//c->GetListOfPrimitives()->Add(leg,"");
TPaveText *pv = new TPaveText(0.23,0.95,0.6,1,"NDC");
pv->AddText("CMS Preliminary 2016");
pv->SetFillColor(0);
pv->SetBorderSize(0);
pv->Draw();
return c;
}
示例3: drawNoisePlotsMC
void drawNoisePlotsMC(TString InputFileName, TString suffix)
{
TFile* f = TFile::Open(InputFileName.Data(),"READ");
f -> cd();
TH1F* h_occupancy_vsNvtx = (TH1F*)( f->Get("h_occupancy_vsNvtx_EB") );
TH1F* h_occupancy_vsNavgPU = (TH1F*)( f->Get("h_occupancy_vsNavgPU_EB") );
TH1F* h_occupancy_vsIeta = (TH1F*)( f->Get("h_occupancy_vsIeta_EB") );
TH1F* h_occupancy_vsIring = (TH1F*)( f->Get("h_occupancy_vsIring_EE") );
TGraphErrors* g_RMSNoise_vsNvtx_EB = new TGraphErrors();
TGraphErrors* g_RMSNoise_vsNvtx_EE = new TGraphErrors();
TGraphErrors* g_RMSNoise_vsNavgPU_EB = new TGraphErrors();
TGraphErrors* g_RMSNoise_vsNavgPU_EE = new TGraphErrors();
int point = 0;
for(int bin = 1; bin <= nBins_nVtx; ++bin)
{
TH1F* histo;
char histoName[50];
float binCenter = h_occupancy_vsNvtx -> GetBinCenter(bin);
float binLowEdge = h_occupancy_vsNvtx -> GetBinLowEdge(bin);
float binHigEdge = h_occupancy_vsNvtx -> GetBinLowEdge(bin) + h_occupancy_vsNvtx_EB->GetBinWidth(bin);
if( binCenter < 5. ) continue;
if( binCenter > 30. ) continue;
sprintf(histoName,"hEB_recHitE_nVtx%02.1f-%02.1f",binLowEdge,binHigEdge);
histo = (TH1F*)( f->Get(histoName) );
g_RMSNoise_vsNvtx_EB -> SetPoint(point,binCenter,histo->GetRMS());
g_RMSNoise_vsNvtx_EB -> SetPointError(point,0.,histo->GetRMSError());
sprintf(histoName,"hEE_recHitE_nVtx%02.1f-%02.1f",binLowEdge,binHigEdge);
histo = (TH1F*)( f->Get(histoName) );
g_RMSNoise_vsNvtx_EE -> SetPoint(point,binCenter,histo->GetRMS());
g_RMSNoise_vsNvtx_EE -> SetPointError(point,0.,histo->GetRMSError());
++point;
}
g_RMSNoise_vsNvtx_EB -> SetPoint(g_RMSNoise_vsNvtx_EB->GetN(),-1.,-1.);
g_RMSNoise_vsNvtx_EE -> SetPoint(g_RMSNoise_vsNvtx_EE->GetN(),-1.,-1.);
point = 0;
for(int bin = 1; bin <= nBins_nAvgPU; ++bin)
{
TH1F* histo;
char histoName[50];
float binCenter = h_occupancy_vsNavgPU -> GetBinCenter(bin);
float binLowEdge = h_occupancy_vsNavgPU -> GetBinLowEdge(bin);
float binHigEdge = h_occupancy_vsNavgPU -> GetBinLowEdge(bin) + h_occupancy_vsNavgPU_EB->GetBinWidth(bin);
if( binCenter < 8. ) continue;
if( binCenter > 30. ) continue;
sprintf(histoName,"hEB_recHitE_nAvgPU%02.1f-%02.1f",binLowEdge,binHigEdge);
histo = (TH1F*)( f->Get(histoName) );
g_RMSNoise_vsNavgPU_EB -> SetPoint(point,binCenter,histo->GetRMS());
g_RMSNoise_vsNavgPU_EB -> SetPointError(bin-1,0.,histo->GetRMSError());
sprintf(histoName,"hEE_recHitE_nAvgPU%02.1f-%02.1f",binLowEdge,binHigEdge);
histo = (TH1F*)( f->Get(histoName) );
g_RMSNoise_vsNavgPU_EE -> SetPoint(point,binCenter,histo->GetRMS());
g_RMSNoise_vsNavgPU_EE -> SetPointError(bin-1,0.,histo->GetRMSError());
++point;
}
TCanvas* c1_RMSNoise_EB = new TCanvas("c1_RMSNoise_EB","EB RMS noise");
c1_RMSNoise_EB -> cd();
c1_RMSNoise_EB -> SetGridx();
c1_RMSNoise_EB -> SetGridy();
g_RMSNoise_vsNvtx_EB -> SetMarkerColor(kRed+2);
g_RMSNoise_vsNavgPU_EB -> SetMarkerColor(kGreen+2);
g_RMSNoise_vsNvtx_EB -> GetXaxis() -> SetTitle("N_{vtx} or Num^{Int}_{True}");
g_RMSNoise_vsNvtx_EB -> GetYaxis() -> SetTitle("noise RMS (GeV)");
g_RMSNoise_vsNvtx_EB -> GetXaxis() -> SetRangeUser(0.,35.);
g_RMSNoise_vsNvtx_EB -> GetYaxis() -> SetRangeUser(0.040,0.080);
g_RMSNoise_vsNvtx_EB -> Draw("AP");
g_RMSNoise_vsNavgPU_EB -> Draw("P,same");
TF1* f_pol1_vsNvtx_EB = new TF1("f_pol1_vsNvtx_EB","[0]+[1]*x",0.,35.);
f_pol1_vsNvtx_EB -> SetLineColor(kRed+2);
TF1* f_pol1_vsNavgPU_EB = new TF1("f_pol1_vsNavgPU_EB","[0]+[1]*x",0.,35.);
//.........这里部分代码省略.........
示例4: FitHistos
//.........这里部分代码省略.........
if(!Histo)
{ std::cout<<" Histo "<<thestring.Data()<<"_"<<i<<" not found."<<std::endl; i++; continue;}
if(Histo->GetEntries()) hNhits->Fill(Histo->Integral());
if(Histo->Integral()<20) //0.1
{ //std::cout<<" Not enought entries for histo "<<thestring.Data()<<std::endl;
i++; continue;}
detid = iter->first;
bool rmfit=false;
if( rmfit ||
// TIB modules
// TIB - 1.4.2.5
detid==369121605 || detid==369121606 || detid==369121614 ||
detid==369121613 || detid==369121610 || detid==369121609 ||
// TIB - 1.2.2.1
detid==369121390 || detid==369121382 || detid==369121386 ||
detid==369121385 || detid==369121389 || detid==369121381 ||
// others in TIB
detid==369121437 || detid==369142077 || detid==369121722 ||
detid==369125534 || detid==369137018 || detid==369121689 ||
detid==369121765 || detid==369137045 || detid==369169740 ||
detid==369121689 ||
// TOB modules
// TOB + 4.3.3.8
detid/10==436281512 || detid/10==436281528 || detid/10==436281508 ||
detid/10==436281524 || detid/10==436281520 || detid/10==436281516 ||
// others in TOB
detid/10==436228249 || detid/10==436232694 || detid/10==436228805 ||
detid/10==436244722 || detid/10==436245110 || detid/10==436249546 ||
detid/10==436310808 || detid/10==436312136 || detid/10==436315600 ||
// without 'sensors' option
detid==436281512 || detid==436281528 || detid==436281508 ||
detid==436281524 || detid==436281520 || detid==436281516 ||
detid==436228249 || detid==436232694 || detid==436228805 ||
detid==436244722 || detid==436245110 || detid==436249546 ||
detid==436310808 || detid==436312136 || detid==436315600 ||
// TID modules
detid==402664070 || detid==402664110 ||
// TEC modules in small scans
detid==470148196 || detid==470148200 || detid==470148204 ||
detid==470148228 || detid==470148232 || detid==470148236 ||
detid==470148240 || detid==470148261 || detid==470148262 ||
detid==470148265 || detid==470148266 || detid==470148292 ||
detid==470148296 || detid==470148300 || detid==470148304 ||
detid==470148324 || detid==470148328 || detid==470148332 ||
detid==470148336 || detid==470148340 ) {
Histo->Write();
std::cout << " Saving histo : " << thestring.Data() << std::endl;
}
if(rmfit) {nfitrm++; i++; continue;}
int subdet = ((detid>>25)&0x7);
int TECgeom=0;
if(subdet==6) TECgeom = ((detid>>5)&0x7);
// save values
detid = iter->first;
voltage = *itVolt;
index = i;
errvoltage = 2 ;
Mean = Histo->GetMean();
errMean = Histo->GetMeanError();
RMS = Histo->GetRMS();
errRMS = Histo->GetRMSError();
nhits = (int) Histo->Integral();
tree->Fill();
i++;
}
}
tree->Write();
hNhits->Write();
for(unsigned int ih=0; ih<commonHistos.size(); ih++) commonHistos[ih]->Write();
std::map<ULong64_t, TProfile* >::iterator itMon;
for(itMon=Monitors.begin(); itMon!=Monitors.end(); itMon++)
{
itMon->second->GetXaxis()->SetTimeDisplay(1);
itMon->second->GetXaxis()->SetTimeFormat("%H:%M");
itMon->second->GetXaxis()->SetTimeOffset(t_monitor_start);
itMon->second->Write();
}
//// If you want to store all the individual detId histograms uncomments this line !!!!
//myFile->Write();
myFile->Close();
}
示例5: main
int main(int argc, char* argv[])
{
string htitle = "Events rate, cloud ";
htitle = htitle+string(argv[1]);
string drootpath;
if (strcmp(argv[2],"ttreecache")==0)
{
htitle = htitle + ", TTreeCache enabled, protocol: WebDAV";
drootpath = "../../../Histograms/TDavix/";
}
else if (strcmp(argv[2],"xrootd")==0)
{
htitle = htitle + ", TTreeCache enabled xrootd";
drootpath = "../../../Histograms/xrootd/";
}
else
{
htitle = htitle + ", TTreeCache disabled, protocol: WebDAV ";
drootpath = "../../../Histograms/Davix/";
}
string cloudpath = argv[1] ;
cloudpath = cloudpath + "/";
DIR* dcloudrep = opendir(string2char(drootpath+cloudpath));
struct dirent* dcloudfichier = NULL;
string allgrid;
allgrid = string(argv[3]);
vector<ratioMatrixValue> th2array;
while ((dcloudfichier = readdir(dcloudrep))!=0)
{
if (dcloudfichier->d_name[0]=='.')
continue;
string dcloudpath = cloudpath + dcloudfichier->d_name + "/";
//DIR* drootfile = opendir(string2char(drootpath+dcloudpath));
//struct dirent* drootfichier = NULL;
string dfilepath = drootpath + dcloudpath + allgrid + "/" + dcloudfichier->d_name + ".root";
ratioMatrixValue column;
TFile *dfr = TFile::Open(string2char(dfilepath));
if (dfr==NULL)
continue;
column.analy = dcloudfichier->d_name;
for (int i=0;i<dfr->GetListOfKeys()->GetEntries();i++)
{
string dstrRead = string2char(dfr->GetListOfKeys()->At(i)->GetName());
TH1F* dhist = (TH1F*)dfr->Get(string2char(dstrRead));
if (dhist==NULL)
continue;
string otherTitle = string(dhist->GetName()) + "No Zero";
TH1F* histSansZeros = new TH1F(string2char(otherTitle),dhist->GetTitle(),3000.,0,3000);
for ( int l=2;l<3000;l++)
for (int k=0;k<dhist->GetBinContent(l);k++)
histSansZeros->Fill(l-1);
column.datadisk.push_back(string2char(dstrRead));
column.ratio.push_back(histSansZeros->GetMean());
column.error.push_back(histSansZeros->GetRMSError());
}
th2array.push_back(column);
}
TCanvas * c = new TCanvas("c", "c");
c->SetLeftMargin(0.20);
c->SetBottomMargin(0.15);
c->SetWindowSize(2100,1500);
/*for (unsigned int i=0;i<th2array.size();i++)
{
cout << th2array[i].analy << "\t";
for (unsigned int j=0;j<th2array[i].datadisk.size();j++)
cout << th2array[i].datadisk[j] << "\t" ;
cout << endl;
}*/
cout << "--------------------------" << endl;
th2array = ordenate(th2array,string(argv[1]));
cout << "--------------------------" << endl;
/*for (unsigned int i=0;i<th2array.size();i++)
{
cout << th2array[i].analy << "\t";
for (unsigned int j=0;j<th2array[i].datadisk.size();j++)
cout << th2array[i].datadisk[j] << "\t" ;
cout << endl;
}*/
unsigned int datadisk_number=0;
unsigned int analy_number=0;
for (unsigned int i=0;i<th2array.size();i++)
{
if (datadisk_number < th2array[i].datadisk.size())
//.........这里部分代码省略.........