本文整理汇总了C++中TH3D::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ TH3D::Clone方法的具体用法?C++ TH3D::Clone怎么用?C++ TH3D::Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH3D
的用法示例。
在下文中一共展示了TH3D::Clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetHistFile
//
// GetHistFile
//
// Sets pointers to the scaler and random-subtracted asymmetry 3D histograms
// for a certain input file (full/empty and perp/para). Results are NOT
// dead-time corrected.
//
void GetHistFile( TFile* file, Bool_t cthflag = kFALSE)
{
Double_t pa;
TString prompt, random, scalers;
TH3D* hP;
TH3D* hR;
pa = 0.0833;
if ( cthflag == kFALSE ) {
// prompt = "PhiCMCut2P_v_ThetaCMCut2P_v_TChanCut2P";
// random = "PhiCMCut2R_v_ThetaCMCut2R_v_TChanCut2R";
prompt = "PhiCMCut1P_v_ThetaCMCut1P_v_TChanCut1P";
random = "PhiCMCut1R_v_ThetaCMCut1R_v_TChanCut1R";
}
else {
prompt = "PhiCMCut1P_v_CosThetaCMCut1P_v_TChanCut1P";
random = "PhiCMCut1R_v_CosThetaCMCut1R_v_TChanCut1R";
}
scalers = "SumScalers152to503";
hP = (TH3D*) file->Get( prompt);
hR = (TH3D*) file->Get( random);
hsc = (TH1D*) file->Get( scalers);
hS = (TH3D*) hP->Clone( "sub");
hS->Sumw2();
hS->Add( hR, -pa);
}
示例2: bToDRawYield
void bToDRawYield()
{
gStyle->SetTextSize(0.05);
gStyle->SetTextFont(42);
gStyle->SetPadRightMargin(0.04);
gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadTopMargin(0.1);
gStyle->SetPadBottomMargin(0.14);
gStyle->SetTitleX(.0f);
gStyle->SetOptFit(1111);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
TCanvas* c4 = new TCanvas("c4","",800,600);
c4->Divide(2,2);
TCanvas* c2 = new TCanvas("c2","",400,600);
c2->Divide(1,2);
TCanvas* c1 = new TCanvas();
TCanvas* c15 = new TCanvas("c15","",810,1000);
c15->Divide(3,5);
TFile* fPbPb = new TFile("bFeedDownPbPb.hist.root");
TFile* fPbPbMB = new TFile("bFeedDownPbPbMB.hist.root");
TFile* fPbPbMC = new TFile("bFeedDownPbPbMC.hist.root");
TFile* fPbPbMBMC = new TFile("bFeedDownPbPbMBMC.hist.root");
TH3D* hDataPbPb = (TH3D*)fPbPb->Get("hData");
TH3D* hSidebandPbPb = (TH3D*)fPbPb->Get("hSideband");
TH3D* hDataPbPbMB = (TH3D*)fPbPbMB->Get("hData");
TH3D* hSidebandPbPbMB = (TH3D*)fPbPbMB->Get("hSideband");
TH3D* hPtMD0DcaPbPb = (TH3D*)fPbPb->Get("hPtMD0Dca");
TH3D* hPtMD0DcaPbPbMB = (TH3D*)fPbPbMB->Get("hPtMD0Dca");
TH3D* hMCPSignalPbPb = (TH3D*)fPbPbMC->Get("hMCPSignal");
TH3D* hMCNPSignalPbPb = (TH3D*)fPbPbMC->Get("hMCNPSignal");
TH3D* hMCPSignalPbPbMB = (TH3D*)fPbPbMBMC->Get("hMCPSignal");
TH3D* hMCNPSignalPbPbMB = (TH3D*)fPbPbMBMC->Get("hMCNPSignal");
TH3D* hPtMD0DcaMCPSignalPbPb = (TH3D*)fPbPbMC->Get("hPtMD0DcaMCPSignal");
TH3D* hPtMD0DcaMCPSwappedPbPb = (TH3D*)fPbPbMC->Get("hPtMD0DcaMCPSwapped");
TH3D* hPtMD0DcaMCPSignalPbPbMB =(TH3D*)fPbPbMBMC->Get("hPtMD0DcaMCPSignal");
TH3D* hPtMD0DcaMCPSwappedPbPbMB = (TH3D*)fPbPbMBMC->Get("hPtMD0DcaMCPSwapped");
TH3D* hData = (TH3D*)hDataPbPb->Clone("hData");
hData->Sumw2();
hData->Add(hDataPbPbMB);
TH3D* hSideband = (TH3D*)hSidebandPbPb->Clone("hSideband");
hSideband->Sumw2();
hSideband->Add(hSidebandPbPbMB);
TH3D* hPtMD0Dca = (TH3D*)hPtMD0DcaPbPb->Clone("hPtMD0Dca");
hPtMD0Dca->Sumw2();
hPtMD0Dca->Add(hPtMD0DcaPbPbMB);
TH3D* hMCPSignal = (TH3D*)hMCPSignalPbPb->Clone("hMCPSignal");
hMCPSignal->Sumw2();
hMCPSignal->Add(hMCPSignalPbPbMB);
TH3D* hMCNPSignal = (TH3D*)hMCNPSignalPbPb->Clone("hMCNPSignal");
hMCNPSignal->Sumw2();
hMCNPSignal->Add(hMCNPSignalPbPbMB);
TH3D* hPtMD0DcaMCPSignal = (TH3D*)hPtMD0DcaMCPSignalPbPb->Clone("hPtMD0DcaMCPSignal");
hPtMD0DcaMCPSignal->Sumw2();
hPtMD0DcaMCPSignal->Add(hPtMD0DcaMCPSignalPbPbMB);
TH3D* hPtMD0DcaMCPSwapped =(TH3D*)hPtMD0DcaMCPSwappedPbPb->Clone("hPtMD0DcaMCPSwapped");
hPtMD0DcaMCPSwapped->Sumw2();
hPtMD0DcaMCPSwapped->Add(hPtMD0DcaMCPSwappedPbPbMB);
TLatex* texCms = new TLatex(0.18,0.93, "#scale[1.25]{CMS} Preliminary");
texCms->SetNDC();
texCms->SetTextAlign(12);
texCms->SetTextSize(0.06);
texCms->SetTextFont(42);
TLatex* texCol = new TLatex(0.96,0.93, "PbPb #sqrt{s_{NN}} = 5.02 TeV");
texCol->SetNDC();
texCol->SetTextAlign(32);
texCol->SetTextSize(0.06);
texCol->SetTextFont(42);
const int nPtBins = 14;
float ptBins[nPtBins+1] = {2.,3.,4.,5.,6.,8.,10.,12.5,15.0,20.,25.,30.,40.,60.,100};
float pts[nPtBins];
float ptErrors[nPtBins];
float promptFraction[nPtBins];
float totalYield[nPtBins];
float totalYieldInvMassFit[nPtBins];
float totalYieldInvMassFitError[nPtBins];
float bToDYield[nPtBins];
float bToDYieldError[nPtBins];
float bToDYieldErrorDataOnly[nPtBins];
float promptDYield[nPtBins];
float promptDYieldError[nPtBins];
float promptDYieldErrorDataOnly[nPtBins];
//.........这里部分代码省略.........
示例3: function_fit
void function_fit(){
gStyle->SetTextSize(0.05);
gStyle->SetTextFont(42);
gStyle->SetPadRightMargin(0.04);
gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadTopMargin(0.1);
gStyle->SetPadBottomMargin(0.14);
gStyle->SetTitleX(.0f);
gStyle->SetOptFit(1111);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
TFile* fPbPb = new TFile("bFeedDownPbPb.hist.root");
TFile* fPbPbMB = new TFile("bFeedDownPbPbMB.hist.root");
// TFile* fPbPbMC = new TFile("bFeedDownPbPbMC_funfit.hist.root");
// TFile* fPbPbMBMC = new TFile("bFeedDownPbPbMBMC_funfit.hist.root");
TFile* fPbPbMC = new TFile("bFeedDownPbPbMC.hist.root");
TFile* fPbPbMBMC = new TFile("bFeedDownPbPbMBMC.hist.root");
TH3D* hDataPbPb = (TH3D*)fPbPb->Get("hData");
TH3D* hSidebandPbPb = (TH3D*)fPbPb->Get("hSideband");
TH3D* hDataPbPbMB = (TH3D*)fPbPbMB->Get("hData");
TH3D* hSidebandPbPbMB = (TH3D*)fPbPbMB->Get("hSideband");
TH3D* hPtMD0DcaPbPb = (TH3D*)fPbPb->Get("hPtMD0Dca");
TH3D* hPtMD0DcaPbPbMB = (TH3D*)fPbPbMB->Get("hPtMD0Dca");
TH3D* hMCPSignalPbPb = (TH3D*)fPbPbMC->Get("hMCPSignal");
TH3D* hMCNPSignalPbPb = (TH3D*)fPbPbMC->Get("hMCNPSignal");
TH3D* hMCPSignalPbPbMB = (TH3D*)fPbPbMBMC->Get("hMCPSignal");
TH3D* hMCNPSignalPbPbMB = (TH3D*)fPbPbMBMC->Get("hMCNPSignal");
TH3D* hPtMD0DcaMCPSignalPbPb = (TH3D*)fPbPbMC->Get("hPtMD0DcaMCPSignal");
TH3D* hPtMD0DcaMCPSwappedPbPb = (TH3D*)fPbPbMC->Get("hPtMD0DcaMCPSwapped");
TH3D* hPtMD0DcaMCPSignalPbPbMB =(TH3D*)fPbPbMBMC->Get("hPtMD0DcaMCPSignal");
TH3D* hPtMD0DcaMCPSwappedPbPbMB = (TH3D*)fPbPbMBMC->Get("hPtMD0DcaMCPSwapped");
TH3D* hData = (TH3D*)hDataPbPb->Clone("hData");
hData->Sumw2();
hData->Add(hDataPbPbMB);
TH3D* hSideband = (TH3D*)hSidebandPbPb->Clone("hSideband");
hSideband->Sumw2();
hSideband->Add(hSidebandPbPbMB);
TH3D* hPtMD0Dca = (TH3D*)hPtMD0DcaPbPb->Clone("hPtMD0Dca");
hPtMD0Dca->Sumw2();
hPtMD0Dca->Add(hPtMD0DcaPbPbMB);
TH3D* hMCPSignal = (TH3D*)hMCPSignalPbPb->Clone("hMCPSignal");
hMCPSignal->Sumw2();
hMCPSignal->Add(hMCPSignalPbPbMB);
TH3D* hMCNPSignal = (TH3D*)hMCNPSignalPbPb->Clone("hMCNPSignal");
hMCNPSignal->Sumw2();
hMCNPSignal->Add(hMCNPSignalPbPbMB);
TH3D* hPtMD0DcaMCPSignal = (TH3D*)hPtMD0DcaMCPSignalPbPb->Clone("hPtMD0DcaMCPSignal");
hPtMD0DcaMCPSignal->Sumw2();
hPtMD0DcaMCPSignal->Add(hPtMD0DcaMCPSignalPbPbMB);
TH3D* hPtMD0DcaMCPSwapped =(TH3D*)hPtMD0DcaMCPSwappedPbPb->Clone("hPtMD0DcaMCPSwapped");
hPtMD0DcaMCPSwapped->Sumw2();
hPtMD0DcaMCPSwapped->Add(hPtMD0DcaMCPSwappedPbPbMB);
// TH1D *h_DcaData = (TH1D*)fDcaData->Get("D0DcaDatafitOut_pt5");
// const int nPtBins = 14;
// float ptBins[nPtBins+1] = {2.,3.,4.,5.,6.,8.,10.,12.5,15.0,20.,25.,30.,40.,60.,100};
const int nPtBins = 9;
float ptBins[nPtBins+1] = {2.,4.,6.,8.,10.,12.5,20.,40.,60.,100};
const int nBinY = 20;
const Double_t binsY[nBinY+1] = {-0.0734,-0.0562,-0.0428,-0.0320,-0.0236,-0.0170,-0.0118,-0.0078,-0.0046,-0.002,0.0,0.002,0.0046,0.0078,0.0118,0.0170,0.0236,0.0320,0.0428,0.0562,0.0734};
TFile *fDcaData = new TFile("bFeedDownResult.root");
TH1D *h_DcaData[nPtBins];
// TH1D *h_DcaData = (TH1D*)fDcaData->Get("D0DcaDatafitOut_pt5");
RooBinning bin_dcaxy(nBinY,binsY);
// TH1D* h_MCP_DCAxy = new TH1D("h_MCP_DCAxy", "h_MCP_DCAxy", nBinY, binsY);
// TH1D* h_MCNP_DCAxy = new TH1D("h_MCNP_DCAxy", "h_MCNP_DCAxy", nBinY, binsY);
TFile *fout= new TFile("function_fit_result.root","RECREATE");
TH1D *h_PromptYield_fix = new TH1D("h_PromptYield_fix","h_PromptYield_fix",nPtBins,ptBins);
TH1D *h_NonPromptYield_fix = new TH1D("h_NonPromptYield_fix","h_NonPromptYield_fix",nPtBins,ptBins);
TH1D *h_NonPromptFraction_fix= new TH1D("h_NonPromptFraction_fix","h_NonPromptFraction_fix",nPtBins,ptBins);
TH1D *h_PromptYield_float = new TH1D("h_PromptYield_float","h_PromptYield_float",nPtBins,ptBins);
TH1D *h_NonPromptYield_float = new TH1D("h_NonPromptYield_float","h_NonPromptYield_float",nPtBins,ptBins);
TH1D *h_NonPromptFraction_float= new TH1D("h_NonPromptFraction_float","h_NonPromptFraction_float",nPtBins,ptBins);
hMCPSignal->GetXaxis()->SetRangeUser(8,10);
//.........这里部分代码省略.........
示例4: 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);
//.........这里部分代码省略.........