本文整理汇总了C++中TH3D::Divide方法的典型用法代码示例。如果您正苦于以下问题:C++ TH3D::Divide方法的具体用法?C++ TH3D::Divide怎么用?C++ TH3D::Divide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH3D
的用法示例。
在下文中一共展示了TH3D::Divide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: much_pol_histo
void much_pol_histo(){
TString dir = "data/";
TString accFileName = dir+"polHisto.root";
TString genFileName = dir+"polHisto.root";
TString recFileName = dir+"recHisto.root";
hyperon_style();
TFile* f = new TFile(accFileName,"read");
TH3D* hJpsiAllYPtCost = (TH3D*) f->Get("fhJpsiAllYPtCost");
TH3D* hJpsiRecYPtCost = (TH3D*) f->Get("fhJpsiRecYPtCost");
hJpsiAllYPtCost->Sumw2();
hJpsiRecYPtCost->Sumw2();
TH3D* hJpsiEffYPtCost = (TH3D*) hJpsiRecYPtCost->Clone();
hJpsiEffYPtCost->Divide(hJpsiAllYPtCost);
Int_t binsY = hJpsiAllYPtCost->GetXaxis()->GetNbins();
Double_t minY = hJpsiAllYPtCost->GetXaxis()->GetXmin();
Double_t maxY = hJpsiAllYPtCost->GetXaxis()->GetXmax();
Int_t binsPt = hJpsiAllYPtCost->GetYaxis()->GetNbins();
Double_t minPt = hJpsiAllYPtCost->GetYaxis()->GetXmin();
Double_t maxPt = hJpsiAllYPtCost->GetYaxis()->GetXmax();
Int_t binsCost = hJpsiAllYPtCost->GetZaxis()->GetNbins();
Double_t minCost = hJpsiAllYPtCost->GetZaxis()->GetXmin();
Double_t maxCost = hJpsiAllYPtCost->GetZaxis()->GetXmax();
TH2D** hFidYPt = new TH2D*[binsCost];
TH2D** hAndYPt = new TH2D*[binsCost];
// Create fiducial regions
for (Int_t icost=1;icost<=binsCost;icost++){
hFidYPt[icost-1] = new TH2D(Form("hFidYPt%2i",icost),Form("hFidYPt%2i",icost),binsY,minY,maxY,binsPt,minPt,maxPt);
hAndYPt[icost-1] = new TH2D(Form("hAndYPt%2i",icost),Form("hAndYPt%2i",icost),binsY,minY,maxY,binsPt,minPt,maxPt);
for (Int_t iy=1;iy<=binsY;iy++){
for (Int_t ipt=1;ipt<=binsPt;ipt++){
Double_t rec = hJpsiRecYPtCost->GetBinContent(iy,ipt,icost);
hFidYPt[icost-1]->SetBinContent(iy,ipt,1);
hAndYPt[icost-1]->SetBinContent(iy,ipt,1);
if (rec>200) continue;
hJpsiEffYPtCost->SetBinContent(iy,ipt,icost,0.);
hFidYPt[icost-1]->SetBinContent(iy,ipt,0);
}
}
}
for (Int_t icost=1;icost<=binsCost/2;icost++){
for (Int_t i=icost;i<=binsCost+1-icost;i++)
hAndYPt[icost-1]->Multiply(hFidYPt[i-1]);
}
TCanvas* cFiducial = new TCanvas("cFiducial","cFiducial",200*5,200*4);
cFiducial->Divide(5,4);
for (Int_t icost=1;icost<=binsCost;icost++){
cFiducial->cd(icost);
gPad->SetRightMargin(0.1);
hFidYPt[icost-1]->Draw("colz");
}
TCanvas* cAnd = new TCanvas("cAnd","cAnd",200*5,200*2);
cAnd->Divide(5,2);
for (Int_t icost=1;icost<=binsCost/2;icost++){
cAnd->cd(icost);
gPad->SetRightMargin(0.1);
hAndYPt[icost-1]->Draw("colz");
}
TH3D* hJpsiRecEffCorrectedYPtCost = (TH3D*) hJpsiRecYPtCost->Clone();
hJpsiRecEffCorrectedYPtCost->Divide(hJpsiEffYPtCost);
// TH1D* hJpsiAllCost = hJpsiAllYPtCost->ProjectionZ();
// TH1D* hJpsiRecEffCorrectedCost = hJpsiRecEffCorrectedYPtCost->ProjectionZ();
// TH1D** hJpsiRecEffCorrectedCost = new TH1D*[nBinsPt];
// hJpsiAllCost->SetMinimum(0);
// hJpsiAllCost->SetLineColor(kBlue);
// hJpsiRecEffCorrectedCost->SetLineColor(kRed);
//
// TCanvas* cCost = new TCanvas("cCost","Cos #theta distributions",400,400);
// hJpsiAllCost->Draw();
// hJpsiRecEffCorrectedCost->Draw("same");
TH1D* hRecCost[nBinsPt];
TH1D* hAccCost[nBinsPt];
TH1D* hAllCost[nBinsPt];
TH1D* haccRecCost[nBinsPt];
TH1D* haccAllCost[nBinsPt];
TH1D* hResCost[nBinsPt];
for (Int_t i=0;i<nBinsPt;i++){
hRecCost[i] = new TH1D(Form("hRecCost%d",i),Form("hRecCost%d",i),binsCost,minCost,maxCost);
hAllCost[i] = new TH1D(Form("hAllCost%d",i),Form("hAllCost%d",i),binsCost,minCost,maxCost);
hAccCost[i] = new TH1D(Form("hAccCost%d",i),Form("hAccCost%d",i),binsCost,minCost,maxCost);
hResCost[i] = new TH1D(Form("hResCost%d",i),Form("hResCost%d",i),binsCost,minCost,maxCost);
haccRecCost[i] = new TH1D(Form("haccRecCost%d",i),Form("haccRecCost%d",i),binsCost,minCost,maxCost);
//.........这里部分代码省略.........