本文整理汇总了C++中TH1F::Multiply方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1F::Multiply方法的具体用法?C++ TH1F::Multiply怎么用?C++ TH1F::Multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1F
的用法示例。
在下文中一共展示了TH1F::Multiply方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
cout << "Analysing RECO sys" << endl;
getAllEffSys("RECO", xvar, xnbins, xbins, weight,
treeMC, baseCut, treeMCGen, extCut,
treeMCjpsi, baseJpsiCut+binCut, treeMCjpsi_Gen, extCut+binCut,
&hdefault, &lfsys_plus, &lfsys_minus, &decaysys, &polsys_minus, &polsys_plus,
&poljpsi1, &poljpsi2, &poljpsi3, &poljpsi4, &poljpsi5, &poljpsi6, &poljpsi7, &poljpsi8, &DDsys, doSys, "", jpsi );
cout << "Analysing MVA sys" << endl;
getAllEffSys("MVA", xvar, xnbins, xbins, weight,
treeMCmva, baseCut+CutsDef::MVAcut, treeMCmva, baseCut,
treeMCjpsi, baseJpsiCut+CutsDef::MVAcut+binCut, treeMCjpsi, baseJpsiCut+binCut,
&hdefault, &lfsys_plus, &lfsys_minus, &decaysys, &polsys_minus, &polsys_plus,
&poljpsi1, &poljpsi2, &poljpsi3, &poljpsi4, &poljpsi5, &poljpsi6, &poljpsi7, &poljpsi8, &DDsys, doSys, "", jpsi );
cout << "Analysing TRIG sys" << endl;
getAllEffSys("TRIG", xvar, xnbins, xbins, weight,
treeMC, baseCut+CutsDef::MVAcut+CutsDef::TrigPassed, treeMC, baseCut+CutsDef::MVAcut,
treeMCjpsi, baseJpsiCut+CutsDef::MVAcut+CutsDef::TrigPassed+binCut, treeMCjpsi, baseJpsiCut+CutsDef::MVAcut+binCut,
&hdefault, &lfsys_plus, &lfsys_minus, &decaysys, &polsys_minus, &polsys_plus,
&poljpsi1, &poljpsi2, &poljpsi3, &poljpsi4, &poljpsi5, &poljpsi6, &poljpsi7, &poljpsi8, &DDsys, doSys, "", jpsi );
TH1F * toteff_lowSel = NULL;
if(rel || jpsi)
{
TString polweight = "physRate_polp006";
if(jpsi) polweight = "physRate_pol0";
TH1F * mva_lowSel = getEff("UPPER", xvar, xnbins, xbins,
treeMCmva, baseCut+CutsDef::MVAcut, treeMCmva, baseCut,
weight+"*lifeTimeW*pt_weight*"+polweight,
treeMCjpsi, baseJpsiCut+CutsDef::MVAcut_lowSel+binCut, treeMCjpsi, baseJpsiCut+binCut,
weight+"*lifeTimeW*physRate_pol0*pt_weight" );
mva_lowSel->Write("hmvaeff_lowSel");
TH1F * uppereff_lowSel = (TH1F *)hdefault[2]->Clone("huppereff_lowSel");
uppereff_lowSel->Multiply(hdefault[3]);
uppereff_lowSel->Multiply(mva_lowSel);
toteff_lowSel = (TH1F *)hdefault[0]->Clone("htoteff_lowSel");
toteff_lowSel->Multiply(hdefault[1]);
toteff_lowSel->Multiply(uppereff_lowSel);
uppereff_lowSel->Write("huppereff_lowSel");
toteff_lowSel->Write("htoteff_lowSel");
}
//Simply model
//TH1F * simpleeff = getEff("SIMPLY", xvar, xnbins, xbins,
// treeMCgeom, simpleEffCut, treeMCgeom, "", weight);
TCanvas * c = new TCanvas();
gStyle->SetOptStat(0);
gStyle->SetOptFit();
TH1F * uppereff = (TH1F *)hdefault[2]->Clone("huppereff");
uppereff->Multiply(hdefault[3]);
uppereff->Multiply(hdefault[4]);
TH1F * toteff = (TH1F *)hdefault[0]->Clone("htoteff");
if(xvar=="cosThetaB") hdefault[1]->Scale(1./hdefault[1]->Integral());
toteff->Multiply(hdefault[1]);
toteff->Multiply(uppereff);
toteff->SetTitle("Total eff");
//toteff->Fit("pol2");
c->Print("effvs"+xvarname+"_"+type+"_tot.pdf");
toteff->Write("htoteff");
//uppereff->Fit("pol2");
c->Print("effvs"+xvarname+"_"+type+"_upper.pdf");
uppereff->Write("huppereff");
示例2: DrawFits
//.........这里部分代码省略.........
if(j==0) PlotDistribution(gPad, TemplatesP[j],"Reconstructed Mass [GeV/c^2]","Counts",1,"same",1,TemplatesP[j]->GetBinContent(TemplatesP[j]->GetMaximumBin())*1.13,10);
else PlotDistribution(gPad, TemplatesP[j],"Reconstructed Mass [GeV/c^2]","Counts",colorbase + j,"same",1,TemplatesP[j]->GetBinContent(TemplatesP[j]->GetMaximumBin())*1.13,7,"",false,false,true);
}
Plots.Add(c1);
Plots.writeObjsInFolder((FIT->GetName()+"/Fits/Bin"+to_string(i)).c_str());
TCanvas * c2 = new TCanvas("Modified T. Fits");
c2->SetCanvasSize(2000,1500);
PlotDistribution(gPad, TemplatesP[0], "Reconstructed Mass [GeV/c^2]","Counts",2,"same",1,Datas[0]->GetBinContent(Datas[0]->GetMaximumBin())*1.13,10,"Original Protons MC Template");
PlotDistribution(gPad, TemplatesD[0], "Reconstructed Mass [GeV/c^2]","Counts",4,"same",1,1e5,10,"Original Deuterons MC Template");
PlotDistribution(gPad, TemplatesHe[0],"Reconstructed Mass [GeV/c^2]","Counts",3,"same",1,1e5,10,"Original He Fragm. MC Template");
for(int j=TemplatesP.size()-1;j>=1;j--){
PlotDistribution(gPad, TemplatesP[j],"Reconstructed Mass [GeV/c^2]","Counts",2,"same",1,1e5,1,"",false,false,true);
PlotDistribution(gPad, TemplatesD[j],"Reconstructed Mass [GeV/c^2]","Counts",4,"same",1,1e5,1,"",false,false,true);
//PlotDistribution(gPad, TemplatesHe[j],"Reconstructed Mass [GeV/c^2]","Counts",3,"same",1,1e5,1,"",false,false,true);
}
PlotDistribution(gPad, Datas[0],"Reconstructed Mass [GeV/c^2]","Counts",1,"ePsame",1,1e5,3,"ISS data",false,true);
Plots.Add(c2);
Plots.writeObjsInFolder((FIT->GetName()+"/Fits/Bin"+to_string(i)).c_str());
TCanvas * c3 = new TCanvas("Template Fits");
c3->SetCanvasSize(2000,1500);
PlotDistribution(gPad, TemplatesP[0] ,"Reconstructed Mass [GeV/c^2]","Counts",2,"same",1,Datas[0]->GetBinContent(Datas[0]->GetMaximumBin())*1.13,2,"Original Protons MC Template");
PlotDistribution(gPad, TemplatesD[0] ,"Reconstructed Mass [GeV/c^2]","Counts",4,"same",1,1e5,2,"Original Deuterons MC Template");
PlotDistribution(gPad, TemplatesHe[0],"Reconstructed Mass [GeV/c^2]","Counts",3,"same",1,1e5,2,"Original He Fragm. MC Template");
PlotDistribution(gPad, TemplatesP[1] ,"Reconstructed Mass [GeV/c^2]","Counts",2,"same",1,Datas[0]->GetBinContent(Datas[0]->GetMaximumBin())*1.13,10,"Best #chi^{2} Protons MC Template");
PlotDistribution(gPad, TemplatesD[1] ,"Reconstructed Mass [GeV/c^2]","Counts",4,"same",1,1e5,10,"Best #chi^{2} Deuterons MC Template");
PlotDistribution(gPad, TemplatesHe[1],"Reconstructed Mass [GeV/c^2]","Counts",3,"same",1,1e5,10,"Best #chi^{2} he Fragm. MC Template");
PlotDistribution(gPad, Datas[0],"Reconstructed Mass [GeV/c^2]","Counts",1,"ePsame",1,1e5,3,"ISS data",false,true);
if(Fits.size()>0) PlotDistribution(gPad, Fits[0],"Reconstructed Mass [gev/c^2]","counts",6,"same",1,1e5,4,"Fraction Fit");
Plots.Add(c3);
Plots.writeObjsInFolder((FIT->GetName()+"/Fits/Bin"+to_string(i)).c_str());
TCanvas * c5 = new TCanvas("Transfer Functions");
c5->SetCanvasSize(2000,1500);
for(int j=0;j<Transfer.size();j++){
Transfer[j]->Smooth(3);
PlotDistribution(gPad, Transfer[j],"Reconstructed Mass [GeV/c^2]","Prim. / (Prim. + Sec.)",j,"hist,same",0,1,7,("Bin. "+to_string(j)).c_str(),false,false);
}
Plots.Add(c5);
Plots.writeObjsInFolder((FIT->GetName()+"/Fits").c_str());
TCanvas * c4 = new TCanvas("ChiSquare");
c4->SetCanvasSize(2000,1500);
gPad->SetLogz();
TH2F * Chi = (TH2F*) infile->Get((FIT->GetName()+"/Fit Results/Spreads/ChiSquare/ChiSquare Bin "+to_string(i)).c_str());
Chi->GetZaxis()->SetRangeUser(0.2,100);
PlotTH2F(gPad, Chi, "Additive #sigma","Mean shift", "colz");
Plots.Add(c4);
Plots.writeObjsInFolder((FIT->GetName()+"/Fits/Bin"+to_string(i)).c_str());
TCanvas * c6 = new TCanvas("OverCutoff Events");
c6->SetCanvasSize(2000,1500);
TH1F * OverCutoffP = (TH1F *) TemplatesP[1]->Clone();
OverCutoffP->Multiply(Transfer[i]);
TH1F * OverCutoffD = (TH1F *) TemplatesD[1]->Clone();
OverCutoffD->Multiply(Transfer[i]);
TH1F * NoCutoffP = (TH1F *) TemplatesP[1]->Clone();
NoCutoffP->Scale(
OverCutoffP->GetBinContent(OverCutoffP->GetMaximumBin())/
NoCutoffP->GetBinContent(NoCutoffP->GetMaximumBin()) );
PlotDistribution(gPad, NoCutoffP,"Reconstructed Mass [GeV/c^2]","Primary Counts",2,"same",1,Datas[1]->GetBinContent(Datas[1]->GetMaximumBin())*1.13,3,"Best #chi^{2} Protons MC Template");
PlotDistribution(gPad, OverCutoffP,"Reconstructed Mass [GeV/c^2]","Counts",2,"same",1,Datas[0]->GetBinContent(Datas[0]->GetMaximumBin())*1.13,10,"Best #chi^{2} Protons MC (Cutoff filtered)");
PlotDistribution(gPad, OverCutoffD,"Reconstructed Mass [GeV/c^2]","Counts",4,"same",1,Datas[0]->GetBinContent(Datas[0]->GetMaximumBin())*1.13,10,"Best #chi^{2} Deutons MC (Cutoff filtered)");
PlotDistribution(gPad, Datas[1],"Reconstructed Mass [GeV/c^2]","Primary Counts",1,"ePsame",1,Datas[1]->GetBinContent(Datas[1]->GetMaximumBin())*1.13,3,"ISS data",false,true);
Plots.Add(c6);
Plots.writeObjsInFolder((FIT->GetName()+"/Fits/Bin"+to_string(i)).c_str());
}
return;
}
示例3: ExtractOutputHistos
//.........这里部分代码省略.........
// Count trackable MC tracks
CountPrimaries(hMultCount);
// Get Errors right
hMultCount->Sumw2();
hAllMC->Sumw2();
hAllFound->Sumw2();
hPerfect->Sumw2();
hImperfect->Sumw2();
h2Dpt->Sumw2();
h2Ddca->Sumw2();
// -- Global efficienies
nTrackTotalMC = hAllMC->GetEntries();
Double_t eff = ((Double_t)nTrackPerfect)/nTrackTotalMC;
printf("-> Total number of events: %lld -> MCtracks %d -> nPerfect %d -> Eff: %3.2lf \n",
tree->GetEntries(),nTrackTotalMC,nTrackPerfect,eff);
Double_t purity = ((Double_t)nTrackPerfect)/nTrackFound;
printf("-> Total number of events: %lld -> FoundTracks %d -> nPerfect %d -> Purity: %3.2lf \n",
tree->GetEntries(),nTrackFound,nTrackPerfect,purity);
// Efficiencies - and normalize to 100%
TF1 f1("f1","100+x*0",0.,1.e3);
hPurity->Divide(hPerfect,hAllFound,1,1,"b");
hPurity->Multiply(&f1);
hPurity->SetMarkerColor(kGreen);
hPurity->SetMarkerStyle(21);
hPurity->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hPurity->SetStats(0);
hPurity->GetYaxis()->SetRangeUser(0,100);
hPurity->SetTitle("Efficiency & Purity");
hEff->Divide(hPerfect,hAllMC,1,1,"b");
hEff->Multiply(&f1);
hEff->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hEff->SetMarkerColor(kBlue);
hEff->SetMarkerStyle(21);
hEff->SetStats(0);
hFake->Divide(hImperfect,hAllMC,1,1,"b");
hFake->Multiply(&f1);
hFake->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hFake->SetMarkerColor(kRed);
hFake->SetMarkerStyle(21);
hFake->SetStats(0);
hAnna->Divide(hAllFound,hAllMC,1,1,"b");
hAnna->Multiply(&f1);
hAnna->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hAnna->SetMarkerColor(kBlack);
hAnna->SetMarkerStyle(21);
hAnna->SetStats(0);
TCanvas *c1 = new TCanvas("c1","NoMCTrackFound");//,200,10,900,900);
TVirtualPad *pad = c1->cd();
示例4: plotMerged
void plotMerged(Bool_t onlyPlot=0) {
gStyle->SetPalette(1);
TFile f("histoSum.root","UPDATE");
TH1F* hAllMC = f.Get("allMC");
TH1F* hAllFound= f.Get("allFound");
TH1F* hImperfect= f.Get("imperfect");
TH1F* hPerfect= f.Get("perfect");
TH1F* hNoMCTrack= f.Get("noMCtrack");
// have to be recalculated
TH1F* hPurity = f.Get("purity");
TH1F* hEff= f.Get("efficiency");
TH1F* hFake= f.Get("fake");
TH1F* hAnna= f.Get("annaEff");
TH2D* h2Ddca= f.Get("dca2D");
TGraphErrors *d0= f.Get("dca");
TH2D* h2Dpt= f.Get("dPt2D");
TGraphErrors *gPt= f.Get("dPt");
if (!onlyPlot) {
/* // Get Errors right
hAllMC->Sumw2();
hAllFound->Sumw2();
hPerfect->Sumw2();
hImperfect->Sumw2();
h2Dpt->Sumw2();
h2Ddca->Sumw2();
*/
// Efficiencies - and normalize to 100%
TF1 f1("f1","100+x*0",0.,1.e3);
hPurity->Divide(hPerfect,hAllFound,1,1,"b");
hPurity->Multiply(&f1);
hPurity->SetMarkerColor(kGreen);
hPurity->SetMarkerStyle(21);
hPurity->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hPurity->SetStats(0);
hPurity->GetYaxis()->SetRangeUser(0,100);
hPurity->SetTitle("Efficiency & Purity");
hEff->Divide(hPerfect,hAllMC,1,1,"b");
hEff->Multiply(&f1);
hEff->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hEff->SetMarkerColor(kBlue);
hEff->SetMarkerStyle(21);
hEff->SetStats(0);
hFake->Divide(hImperfect,hAllMC,1,1,"b");
hFake->Multiply(&f1);
hFake->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hFake->SetMarkerColor(kRed);
hFake->SetMarkerStyle(21);
hFake->SetStats(0);
hAnna->Divide(hAllFound,hAllMC,1,1,"b");
hAnna->Multiply(&f1);
hAnna->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hAnna->SetMarkerColor(kBlack);
hAnna->SetMarkerStyle(21);
hAnna->SetStats(0);
// Impact parameter resolution ---------------
TCanvas *c3 = new TCanvas("c3","impact");//,200,10,900,900);
c3->Divide(2,1); c3->cd(1);
h2Ddca->DrawCopy("colz");
h2Ddca->FitSlicesY() ;
TH2D *dcaM = (TH2D*)gDirectory->Get("dca2D_1"); dcaM->Draw("same");
TH2D *dcaRMS = (TH2D*)gDirectory->Get("dca2D_2"); //dcaRMS->Draw();
TGraphErrors *d0 = new TGraphErrors();
for (Int_t ibin =1; ibin<=dcaRMS->GetXaxis()->GetNbins(); ibin++) {
d0->SetPoint( ibin-1,dcaRMS->GetBinCenter(ibin),dcaRMS->GetBinContent(ibin)*1e4); // microns
d0->SetPointError(ibin-1,0,dcaRMS->GetBinError(ibin)*1e4); // microns
}
d0->SetMarkerStyle(21);
d0->SetMaximum(200); d0->SetMinimum(0);
d0->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
d0->GetYaxis()->SetTitle("R-#phi Pointing Resolution (#mum)");
d0->SetName("dca"); d0->SetTitle("DCAvsPt");
// c3->cd(1); h2Ddca->Draw("surf2");
c3->cd(2); d0->Draw("APE");
// PT RESOLUTION ------------
TCanvas *c4 = new TCanvas("c4","pt resolution");//,200,10,900,900);
c4->Divide(2,1); c4->cd(1);
h2Dpt->DrawCopy("colz");
h2Dpt->FitSlicesY() ;
TH2D *dPtM = (TH2D*)gDirectory->Get("dPt2D_1"); dPtM->Draw("same");
TH2D *dPtRMS = (TH2D*)gDirectory->Get("dPt2D_2"); // dPtRMS->Draw("");
TGraphErrors *gPt = new TGraphErrors();
//.........这里部分代码省略.........
示例5: syst_MCeta
//.........这里部分代码省略.........
cout<<"ERROR !! The syst2 plot is void. Exiting now ..."<<endl;
return;
}
TH1F* factor = new TH1F("factor","factor",hbase->GetNbinsX(),hbase->GetXaxis()->GetXbins()->GetArray());
if(E==0.9){
for(int i=1;i<=hbase->GetNbinsX();++i){
if(hsyst1->GetBinContent(i)!=0)
factor->SetBinContent(i,hsyst2->GetBinContent(i) / hsyst1->GetBinContent(i));
else
factor->SetBinContent(i,1.);
}
}
else if(E==2.36){
double start = -0.5;
double ratio = 1;
if((getEdgeLastFilledBin(hsyst1) - start)!=0)
ratio = (getEdgeLastFilledBin(hbase) - start) / (getEdgeLastFilledBin(hsyst1) - start);
//part with no stretching
for( int i = 1 ; i < hbase->GetXaxis()->FindFixBin(start) ; ++i ){
if(hsyst1->GetBinContent(i)!=0)
factor->SetBinContent(i,hsyst2->GetBinContent(i) / hsyst1->GetBinContent(i));
else
factor->SetBinContent(i,1.);
}
//part with stretching
for( int i = hbase->GetXaxis()->FindFixBin(start) ; i <= hbase->GetNbinsX() ; ++i ){
int bin = hsyst1->GetXaxis()->FindFixBin( (hbase->GetBinCenter(i)-start) / ratio + start);
if(hsyst1->GetBinContent(bin)!=0)
factor->SetBinContent(i,hsyst2->GetBinContent(bin) / hsyst1->GetBinContent(bin));
else
factor->SetBinContent(i,1.);
}
}
TH1F* hsyst = (TH1F*) hbase->Clone("eta_syst");
hsyst->Multiply(factor);
TMoments* msyst = new TMoments(hsyst);
msyst->ComputeMoments();
msyst->print();
//Making output file
outstr.str("");
outstr << "hyp" << 1 << "_niter" << 0 << "_cut" << cut << "_DataType" << 0;
TString toutput = fileManager(3,typeMC,E,1,500,-1,outstr.str());
TFile* foutput = TFile::Open(toutput,"RECREATE");
cout<<"Output file : " << toutput << endl;
//Making kno plot
double knomean = hsyst->GetMean();
TString tkno = toutput;
tkno.ReplaceAll("plots/","plots/current_b1_2/");
cout<<"Opening for kno mean the file : "<<tkno<<endl;
TFile* fkno = TFile::Open(tkno,"READ");
if(fkno!=0){
TMoments* mom_kno = (TMoments*) fkno->Get("unfolding/moments/moments");
knomean = mom_kno->mean->GetMean();
}
else{
cout<<"WARNING !! The file does not exist, taking the mean of the hist instead"<<endl;
}
TH1F* kno = new TH1F("kno_corrected","kno_corrected;z = n_{ch} / < n_{ch} >;#psi(z)",hsyst->GetNbinsX(),Divide(hsyst->GetXaxis()->GetXbins(),knomean));
kno->Sumw2();
/*for( int k = 60 ; k <= nch_corrected->GetNbinsX() ; ++k)
nch_corrected->SetBinContent(k,0);*/
for( int k = 1 ; k <= hsyst->GetNbinsX() ; ++k){
kno->SetBinContent(k , knomean * hsyst->GetBinContent(k) / hsyst->Integral());
kno->SetBinError(k , knomean * hsyst->GetBinError(k) / hsyst->Integral());
}
foutput->cd();
foutput->mkdir("unfolding");
foutput->cd("unfolding");
factor->Write();
hsyst->Write("nch_data_corrected");
kno->Write();
gDirectory->mkdir("moments");
gDirectory->cd("moments");
msyst->Write("moments");
foutput->Close();
}
示例6: MakePi0Analysis
//.........这里部分代码省略.........
if(iFit==0){
if(pol==0){
fFitScale->SetParameter(0,fFitRatio_SignalBG->GetParameter(5));
}
else if(pol==1){
fFitScale->SetParameters(fFitRatio_SignalBG->GetParameter(5),fFitRatio_SignalBG->GetParameter(6));
}
else if(pol==2){
fFitScale->SetParameters(fFitRatio_SignalBG->GetParameter(5),fFitRatio_SignalBG->GetParameter(6),fFitRatio_SignalBG->GetParameter(7));
}
}
if(iFit==1){
if(pol==0){
fFitScale->SetParameter(0,fFitRatio_SignalBG->GetParameter(4));
}
else if(pol==1){
fFitScale->SetParameters(fFitRatio_SignalBG->GetParameter(4),fFitRatio_SignalBG->GetParameter(5));
}
else if(pol==2){
fFitScale->SetParameters(fFitRatio_SignalBG->GetParameter(4),fFitRatio_SignalBG->GetParameter(5),fFitRatio_SignalBG->GetParameter(6));
}
}
c3 = new TCanvas("c3","c3",600,600);
c3->cd();
fHistRatio->Draw();
fFitRatio_SignalBG->Draw("same");
fFitScale->Draw("same");
c3->SetName(Form("cRatioSameBG_Pol%d_No%d",pol,i+1)+fitName[iFit]+tofName[itof]+modName[iMod]);
tfout->WriteTObject(c3);
TH1F* fHistScaledMix = (TH1F*)fHistBasicMix->Clone();
fHistScaledMix->Multiply(fFitScale);
fHistFinalBG[i] = (TH1F*)fHistScaledMix->Clone();;
TH1F* fHistSignal = (TH1F*)fHistBasicSame->Clone();
fHistSignal->SetName(Form("fHistSignal_Pol%d_No%d",pol,i+1)+fitName[iFit]+tofName[itof]+modName[iMod]);
fHistScaledMix->SetName(Form("fHistScaledMix_Pol%d_No%d",pol,i+1)+fitName[iFit]+tofName[itof]+modName[iMod]);
tfout->WriteTObject(fHistSignal);
tfout->WriteTObject(fHistScaledMix);
for(Int_t j=0; j<fHistBasicSame->GetXaxis()->FindBin(0.3); ++j){
Double_t same = fHistSignal->GetBinContent(j);
Double_t e_same = fHistSignal->GetBinError(j);
Double_t mix = fHistScaledMix->GetBinContent(j);
Double_t e_mix = fHistScaledMix->GetBinError(j);
Double_t signal = same - mix;
Double_t e_signal = sqrt(pow(e_same,2)+pow(e_mix,2));
if(same>0){
signal = same - mix;
e_signal = sqrt(pow(e_same,2)+pow(e_mix,2));
}
else{
signal = same;
e_signal = e_same;
}
fHistSignal->SetBinContent(j,signal);
fHistSignal->SetBinError(j,e_signal);
}
fHistFinalSignal[i] = (TH1F*)fHistSignal->Clone();
fHistFinalSignal[i]->SetTitle(Form("%.2f < #it{p}_{T} %.2f (GeV/c)", bins[i], bins[i+1]));