本文整理汇总了C++中TH1D::SetXTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1D::SetXTitle方法的具体用法?C++ TH1D::SetXTitle怎么用?C++ TH1D::SetXTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1D
的用法示例。
在下文中一共展示了TH1D::SetXTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawDum
//__________________________________________________________________________
void drawDum(float min, float max, double drawXLabel)
{
TH1D *hdum = new TH1D("hdum","",20,0,1);
hdum->SetMaximum(max);
hdum->SetStats(0);
if(drawXLabel) hdum->SetXTitle("A_{J} = (E_{T}^{j1}-E_{T}^{j2})/(E_{T}^{j1}+E_{T}^{j2})");
hdum->GetXaxis()->SetLabelSize(20);
hdum->GetXaxis()->SetLabelFont(43);
hdum->GetXaxis()->SetTitleSize(22);
hdum->GetXaxis()->SetTitleFont(43);
hdum->GetXaxis()->SetTitleOffset(1.5);
hdum->GetXaxis()->CenterTitle();
hdum->GetXaxis()->SetNdivisions(905,true);
hdum->SetYTitle("Ratio");
hdum->GetYaxis()->SetLabelSize(20);
hdum->GetYaxis()->SetLabelFont(43);
hdum->GetYaxis()->SetTitleSize(20);
hdum->GetYaxis()->SetTitleFont(43);
hdum->GetYaxis()->SetTitleOffset(2.5);
hdum->GetYaxis()->CenterTitle();
hdum->SetAxisRange(0,0.2,"Y");
hdum->Draw("");
}
示例2: drawDum
void drawDum(float min, float max, double drawXLabel){
TH1D *hdum = new TH1D("h","",10,120,220);
hdum->SetMaximum(max);
hdum->SetStats(0);
if(drawXLabel) hdum->SetXTitle("(p_{T}^{j1}-p_{T}^{j2})/(p_{T}^{j1}+p_{T}^{j2})");
hdum->GetXaxis()->SetLabelSize(20);
hdum->GetXaxis()->SetLabelFont(43);
hdum->GetXaxis()->SetTitleSize(22);
hdum->GetXaxis()->SetTitleFont(43);
hdum->GetXaxis()->SetTitleOffset(1.5);
hdum->GetXaxis()->CenterTitle();
hdum->GetXaxis()->SetNdivisions(905,true);
hdum->SetYTitle("Event Fraction");
hdum->GetYaxis()->SetLabelSize(20);
hdum->GetYaxis()->SetLabelFont(43);
hdum->GetYaxis()->SetTitleSize(20);
hdum->GetYaxis()->SetTitleFont(43);
hdum->GetYaxis()->SetTitleOffset(2.5);
hdum->GetYaxis()->CenterTitle();
hdum->SetAxisRange(0,0.2,"Y");
hdum->Draw("");
}
示例3: DrawPileupCorr
bool DrawPileupCorr(Str jetAlgo) {
JetCalibrationTool *theJES = new JetCalibrationTool(jetAlgo,_jesFile,false);
bool residual = theJES->JetAreaJES();
TH1D *temp = new TH1D("","",100,-5,5);
temp->SetXTitle("Jet #eta"); temp->SetYTitle("Jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
if (residual) temp->SetYTitle("Residual jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
temp->SetMinimum(-20); temp->SetMaximum(15); temp->SetStats(0);
if ( residual && theJES->ResidualOffsetCorr_Description() == "" ) return false;
Can->Clear(); temp->Draw();
for (int npv=0;npv<9;++npv) {
double NPV=(npv%3)*10, mu=(npv/3)*10;
if (NPV==0) NPV=1;
Graph *g = new Graph();
FormatGraph(g,npv);
for (int ieta=-50;ieta<50;++ieta) {
double eta=0.05 + 0.1*ieta;
double O = residual ? theJES->GetResidualOffset(eta,mu,NPV)/1000 :
theJES->GetOffset(eta,mu,NPV)/1000; // convert to GeV
g->SetPoint(g->GetN(),eta,O);
}
if (npv<4) DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.18,0.35-0.04*npv,npv);
else DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.48,0.35-0.04*(npv-4),npv);
g->Draw("P");
}
tex->SetNDC(); tex->SetTextAlign(12);
if (residual)
tex->DrawLatex(0.18,0.975,theJES->ResidualOffsetCorr_Description());
else
tex->DrawLatex(0.18,0.975,theJES->OffsetCorr_Description());
tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
return true;
}
示例4: testMultiTree
void testMultiTree()
{
multiTreeUtil myTrees;
myTrees.addFile("mc/ntuple-HiMPA_photon15GeV.root","Analysis",TCut("ptHat<30"),1);
myTrees.addFile("mc/ntuple-HiMPA_photon30GeV.root","Analysis",TCut("ptHat<50"),896./9517.);
myTrees.addFile("mc/ntuple-HiMPA_photon50GeV.root","Analysis",TCut(""),896./9517.*1521./11551.);
// Draw Leading Et
TCanvas *c = new TCanvas("c","",600,600);
TH1D *h = new TH1D("h","",100,10,110);
myTrees.Draw2(h,"et[0]","");
h->SetXTitle("E_{T} (GeV)");
// Draw r9
TCanvas *c2 = new TCanvas("c2","",600,600);
TH1D *h2 = new TH1D("h2","",100,0,0.02);
myTrees.Draw2(h2,"sigmaIetaIeta[0]","abs(eta[0])<1.479");
h2->SetXTitle("#sigma_{i#eta i#eta}");
// Draw ptHat
TCanvas *c3 = new TCanvas("c3","",600,600);
c3->SetLogy();
TH1D *h3 = new TH1D("h3","",100,10,110);
myTrees.Draw(h3,"ptHat","");
h3->SetXTitle("#hat{p_{T}} (GeV/c)");
// Print the first tree
myTrees.Print();
// Get the first tree and draw something
TCanvas *c4 = new TCanvas("c4","",600,600);
myTrees.getTree(0)->Draw("et");
}
示例5: peakAnalysis
void peakAnalysis( string filename2 , string filenamelist ) {
TFile * file0 = new TFile(filename2.c_str());
TFile * file1 = new TFile(filenamelist.c_str());
TTree * tree = (TTree*)file0->Get("tree");
TEventList * listsel = (TEventList*)file1->Get("listofselected");
TCanvas * can = new TCanvas( "canPeaks" , "Peak Analysis" , 7500 , 5500 , 900 , 600 );
//can->SetLogy();
can->SetGrid();
can->cd();
tree->SetEventList(listsel);
tree->Draw("GEMDEnergyGauss_1.energy[0]>>htemp(10000,10000,10000)");
TH1D * spectrum = (TH1D*)gDirectory->Get("htemp");
spectrum->SetTitle("Energy Spectrum");
spectrum->SetXTitle("Energy [keV]");
spectrum->SetYTitle("Counts");
//spectrum->SetStats(kFALSE);
TSpectrum analyzer( 8 , 2 );
// arg1: max number of peaks
// arg2: resolution between peaks
analyzer.Search( spectrum , 2 , "" , 0.0025);
// arg2: sigma of the searched peaks
// arg3: options
// arg4: peaks with amplitude less than threshold*highest_peak are discarded
vector<double> peaks;
for ( int i = 0 ; i < analyzer.GetNPeaks() ; i++ ) {
peaks.push_back(analyzer.GetPositionX()[i]);
}
sort(peaks.begin(),peaks.end());
cout << endl << "########## PEAKS ##########" << endl;
for ( int i = 0 ; i < peaks.size() ; i++ ) cout << i+1 << "\t" << peaks.at(i) << endl;
cout << "###########################" << endl << endl;
if ( peaks.size() < 6 ) {
cout << "ERROR: Not enough peaks found, try to modify TSpectrum parameters.\n\n";
return;
}
ofstream file("calib.txt");
file << "// calibration" << endl
<< "// ch\tkeV" << endl
<< peaks.at(0) << "\t1460.882 // 40K" << endl
<< peaks.at(1) << "\t1512.700 // 212Bi" << endl
<< peaks.at(2) << "\t1592.515 // 208Tl (double escape)" << endl
<< peaks.at(3) << "\t1620.738 // 212Bi" << endl
<< peaks.at(5) << "\t2103.513 // 208Tl (single escape)" << endl
<< peaks.at(6) << "\t2614.511 // 208Tl";
return;
}
示例6: ptDependence
void ptDependence()
{
TFile *inf = new TFile("histos/ppMC.root");
TTree *t = (TTree*) inf->Get("nt");
const int nBins = 4;
double ptBin[nBins+1] = {100,120,140,160,200};
// const int nBins = 1;
// double ptBin[nBins+1] = {100,400};
TH1D *hProb = new TH1D("hProb","",nBins,ptBin);
TH1D *hCSV = new TH1D("hCSV","",nBins,ptBin);
TH1D *hSVTXM = new TH1D("hSVTXM","",nBins,ptBin);
TProfile *pGen = new TProfile("pGen","",nBins,ptBin);
for (int n=0; n<nBins;n++)
{
RooRealVar f1 = bfractionFit("discr_prob",0,3.5,ptBin[n],ptBin[n+1]);
RooRealVar f2 = bfractionFit("discr_csvSimple",0,1,ptBin[n],ptBin[n+1]);
RooRealVar f3 = bfractionFit("svtxm",0,6,ptBin[n],ptBin[n+1]);
hProb->SetBinContent(n+1,f1.getVal());
hProb->SetBinError(n+1,f1.getError());
hCSV->SetBinContent(n+1,f2.getVal());
hCSV->SetBinError(n+1,f2.getError());
hSVTXM->SetBinContent(n+1,f3.getVal());
hSVTXM->SetBinError(n+1,f3.getError());
}
TCanvas *c2 = new TCanvas("c2","",600,600);
hProb->SetAxisRange(0,0.05,"Y");
hProb->SetXTitle("Jet p_{T} (GeV/c)");
hProb->SetYTitle("b-jet fraction");
hProb->SetTitleOffset(1.5,"Y");
hProb->Draw();
hCSV->SetLineColor(2);
hCSV->SetMarkerColor(2);
hCSV->SetMarkerStyle(24);
hCSV->Draw("same");
hSVTXM->SetLineColor(4);
hSVTXM->SetMarkerColor(4);
hSVTXM->SetMarkerStyle(24);
// hSVTXM->Draw("same");
t->Draw("abs(refparton_flavorForB)==5:jtpt","","prof same");
TLegend *leg = new TLegend(0.2,0.7,0.5,0.9);
leg->SetBorderSize(0);
leg->SetFillStyle(0);
leg->SetFillColor(0);
leg->AddEntry(hProb,"Jet Probability","pl");
leg->AddEntry(hCSV,"CSV","pl");
// leg->AddEntry(hSVTXM,"SV mass","pl");
leg->Draw();
}
示例7: plotCentrality
void plotCentrality(){
TFile* f4 = new TFile("histogram_test_MB_2760GeV.root");
TH1D* cent = f4->Get("demo/centhist");
TCanvas* cd = new TCanvas("cd","",600,500);
cd->SetLeftMargin(0.12);
cd->SetRightMargin(0.02);
cd->SetTopMargin(0.02);
cd->SetBottomMargin(0.12);
cd->SetTicks(1);
cent->SetTitle("");
cent->SetXTitle("Centrality (200 bins)");
cent->SetYTitle("# of Events");
cent->GetYaxis()->SetTitleOffset(1.2);
cent->GetXaxis()->SetTitleOffset(1.2);
cent->GetXaxis()->CenterTitle(1);
cent->GetYaxis()->CenterTitle(1);
cent->GetXaxis()->SetTitleSize(0.046);
cent->GetYaxis()->SetTitleSize(0.046);
cent->GetXaxis()->SetTitleFont(62);
cent->GetYaxis()->SetTitleFont(62);
cent->SetAxisRange(0,209,"Y");
cent->SetAxisRange(0,203,"X");
cent->SetMarkerStyle(20);
cent->Sumw2();
cent->SetMarkerSize(1);
cent->SetMarkerColor(1);
cent->SetLineColor(1);
//cent->SetStats(0);
cent->Draw("Pez");
TLatex *tex1= new TLatex(55.5,125.060,"Hydjet 2.76TeV MB");
tex1->SetTextColor(1);
tex1->SetTextSize(0.05);
tex1->SetTextFont(42);
tex1->Draw();
TLatex *tex2= new TLatex(55.5,99.054,"CMSSW_7_5_0_pre5");
tex2->SetTextColor(1);
tex2->SetTextSize(0.05);
tex2->SetTextFont(42);
//tex2->Draw();
cd->SaveAs("centralityDist750x2760GeV.png");
}
示例8: CheckInitialESpectrum
void CheckInitialESpectrum(std::string filename) {
TFile* file = new TFile(filename.c_str(), "READ");
TTree* tree = (TTree*) file->Get("tree");
TFile* out_file = new TFile("plots.root", "UPDATE");
double bin_width = 250; //keV
double x_low = 0;
double x_high = 25000;
int n_bins_x = (x_high - x_low) / bin_width;
TH1D* hInitialESpectrum = new TH1D("hInitialESpectrum", "Initial Energy Spectrum Generated", n_bins_x,x_low,x_high);
hInitialESpectrum->SetXTitle("Energy [keV]");
tree->Draw("(sqrt(i_px*i_px*1e6 + i_py*i_py*1e6 + i_pz*i_pz*1e6 + 938272*938272) - 938272)>>hInitialESpectrum");
hInitialESpectrum->Write();
out_file->Close();
}
示例9: scan
void scan()
{
TFile *outf = new TFile("result.root","recreate");
TH1D *h = new TH1D("h","",6,20,50);
int bin=1;
for (int i=20;i<50;i+=5)
{
TF1 *f = bFeedDownFraction(i,i+5);
h->SetBinContent(bin,f->GetParameter(2));
h->SetBinError(bin,f->GetParError(2));
bin++;
}
TCanvas *cResult = new TCanvas("cResult","",600,600);
h->SetXTitle("D^{0} p_{T} (GeV/c)");
h->SetYTitle("Prompt Fraction");
h->Draw("e");
}
示例10: plot
void plot(TString var, TString varlatex, TString varname, Int_t nbins, Double_t vmin, Double_t vmax)
{
cout<<"---- Processing - "<<var<<endl;
cout<<" -- Fill histograms"<<endl;
TFile* ifBkg = new TFile(infnameBkg[isChannel]);
TTree* ntBkg = (TTree*)ifBkg->Get(texNtuple[isChannel]);
ntBkg->AddFriend("ntHlt");
TFile* ifSgl = new TFile(infnameSgl[isChannel]);
TTree* ntSgl = (TTree*)ifSgl->Get(texNtuple[isChannel]);
ntSgl->AddFriend("ntHlt");
ntSgl->AddFriend("ntHi");
TH1D* hBkg = new TH1D(Form("hBkg_%s",varname.Data()),"",nbins,vmin,vmax);
TH1D* hSgl = new TH1D(Form("hSgl_%s",varname.Data()),"",nbins,vmin,vmax);
ntBkg->Project(Form("hBkg_%s",varname.Data()),var,Form("%s&&%s",selTriggerBkg[isChannel].Data(),selBkg[isChannel].Data()));
ntSgl->Project(Form("hSgl_%s",varname.Data()),var,TCut(weight[isChannel])*Form("%s&&%s",selTriggerSgl[isChannel].Data(),selSgl[isChannel].Data()));
cout<<" -- Calculate normalization"<<endl;
Double_t normBkg=0,normSgl=0;
//normBkg = hBkg->GetEntries();
//normSgl = hSgl->GetEntries();
normBkg = hBkg->Integral(vmin,vmax);
normSgl = hSgl->Integral(vmin,vmax);
cout<<" normBkg: "<<normBkg<<" ; normSgl: "<<normSgl<<endl;
cout<<" -- Normalize histograms"<<endl;
hBkg->Scale(1./normBkg);
hSgl->Scale(1./normSgl);
cout<<" -- Plot"<<endl;
hBkg->SetXTitle(varlatex);
hBkg->SetYTitle("#Probability");
hBkg->SetTitleOffset(1.5,"Y");
Double_t hisMax = (hBkg->GetMaximum()>hSgl->GetMaximum())?hBkg->GetMaximum():hSgl->GetMaximum();
hBkg->SetMaximum(hisMax*1.2);
hBkg->SetLineColor(kBlue+1);
hBkg->SetFillStyle(1001);
hBkg->SetFillColor(kBlue-9);
hBkg->SetLineWidth(3);
hBkg->SetStats(0);
TH1D* hSglplot = new TH1D(Form("hSglplot_%s",varname.Data()),"",nbins,vmin,vmax);
for(int ib=0;ib<nbins;ib++) hSglplot->SetBinContent(ib+1,hSgl->GetBinContent(ib+1));
hSglplot->SetLineColor(kRed);
hSglplot->SetFillStyle(3004);
hSglplot->SetFillColor(kRed);
hSglplot->SetLineWidth(3);
hSglplot->SetStats(0);
TCanvas* c = new TCanvas(Form("c_%s",varname.Data()),"",600,600);
hBkg->Draw();
hSglplot->Draw("same");
cout<<" -- Plot legends"<<endl;
TLatex* tex = new TLatex(0.18,0.935,Form("5.02TeV %s",texPP[isChannel].Data()));
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.055);
tex->Draw();
TLatex* texp;
texp = new TLatex(0.68,0.935,texDecay[isChannel]);
texp->SetNDC();
texp->SetTextFont(42);
texp->SetTextSize(0.055);
texp->Draw();
TLegend* leg = new TLegend(0.56,0.70,0.86,0.86);
leg->AddEntry(hBkg,"Background","f");
leg->AddEntry(hSglplot,"Signal","f");
leg->SetBorderSize(0);
leg->SetFillStyle(0);
leg->Draw("same");
cout<<" -- Save plots"<<endl;
c->SaveAs(Form("plots/%s_%s/c_%s.pdf",texPP[isChannel].Data(),texNtuple[isChannel].Data(),varname.Data()));
cout<<endl;
}
示例11: plotRBDphi
//.........这里部分代码省略.........
nt->Draw("bin>>h",Form("abs(dphi)>%f&&%s",dphiCut,cut1.Data()));
nt->Draw("bin>>hCut",Form("%s",cut1.Data()));
TGraphAsymmErrors *g = calcEff(hCut,h,npart);
g->SetMarkerSize(1.25);
cout <<cut2.Data()<<endl;
nt->Draw("bin>>h2",Form("abs(dphi)>%f&&%s",dphiCut2,cut2.Data()));
nt->Draw("bin>>h2Cut",Form("%s",cut2.Data()));
TGraphAsymmErrors *g2 = calcEff(h2Cut,h2,npart2);
g2->SetMarkerSize(1.25);
ntPythia->Draw("bin>>h",Form("abs(dphi)>%f&&%s",dphiCut2,cut2.Data()));
ntPythia->Draw("bin>>hCut",Form("%s",cut2.Data()));
TGraphAsymmErrors *gPythia = calcEffpythia(hCut,h,npart);
gPythia->SetMarkerSize(1.7);
if(useWeight){
ntMix->Draw("bin>>h",Form("weight*(abs(dphi)>%f&&%s)",dphiCut2,cut2.Data()));
ntMix->Draw("bin>>hCut",Form("weight*(%s)",cut2.Data()));
}else{
ntMix->Draw("bin>>h",Form("(abs(dphi)>%f&&%s)",dphiCut2,cut2.Data()));
ntMix->Draw("bin>>hCut",Form("(%s)",cut2.Data()));
}
TGraphAsymmErrors *gMix = calcEff(hCut,h,npart);
gMix->SetMarkerSize(1.25);
TCanvas *c = new TCanvas("c","",500,500);
// hTmp->SetMaximum(g->GetY()[0]*2.2);
hTmp->SetMaximum(0.85);
hTmp->SetMinimum(0.);
hTmp->SetXTitle("N_{part}");
hTmp->SetYTitle(Form("R_{B}(#Delta#phi_{12} > %.3f)",dphiCut));
hTmp->GetXaxis()->CenterTitle();
hTmp->GetYaxis()->CenterTitle();
// hTmp->GetYaxis()->SetTitleOffset(1.2);
// hTmp->GetYaxis()->SetTitleSize(0.055);
hTmp->Draw();
double errorbar = 0.02;
/*
for(int i = 0; i < g->GetN(); ++i){
double *x = g->GetX();
double *y = g->GetY();
// DrawTick(y[i],0.18*y[i],0.18*y[i],x[i],0.012,8.1,16);
}
g->Draw("p same");
g2->SetMarkerStyle(4);
*/
for(int i = 0; i < g2->GetN(); ++i){
double *x = g2->GetX();
double *y = g2->GetY();
double err = 1.5*(0.0001129*x[i]);
err = sqrt(err * err + 0.012*0.012);
cout <<err/y[i]<<" "<<1.5*(0.0001129*x[i])/y[i]<<" "<<0.012/y[i]<<endl;
double tickSize = 0.012;
if (err<tickSize) tickSize=err;
DrawTick(y[i],err,err,x[i],tickSize,8.1,dataColor);
}
gPythia->SetMarkerColor(4);
gPythia->SetLineColor(4);
gPythia->SetMarkerStyle(29);
gMix->SetMarkerColor(4);
示例12: fitDstar
void fitDstar(char *infname = "/data/wangj/MC2015/Dntuple/PbPb/ntD_Pythia8_5020GeV_DstarD0kpipipi_755patch3_GEN_SIM_PU_20151120_Dstar5p_tkPt2_20151126_Evt_All.root") {
TFile *inf = new TFile(infname);
//TTree *ntmix=(TTree*)inf->Get("ntDD0kpipipipi");
TTree *ntmix=(TTree*)inf->Get("ntDD0kpipi");
TH1D *h = new TH1D("h","",100,0.139,0.159);
TCut cutTrk = "";//"trk1PixelHit>=2&&trk1StripHit>=10&&trk1Chi2ndf<5&&trk2PixelHit>=2&&trk2StripHit>=10&&trk2Chi2ndf<5";
TCanvas *c = new TCanvas("c","",750,750);
ntmix->Draw("Dmass-DtktkResmass>>h","abs(DtktkResmass-1.86486)<0.015&&Dpt>10&&(DsvpvDistance/DsvpvDisErr)>0.&&Dchi2cl>0.05&&Dalpha<1."&&cutTrk,"",10000000);
//ntmix->Draw("Dmass-DtktkResmass>>h","abs(DtktkResmass-1.86486)<0.015&&Dpt>10&&Dtrk1Pt>0.5&&DRestrk1Pt>0.5&&DRestrk2Pt>0.5&&DRestrk3Pt>0.5&&DRestrk4Pt>0.5&&Dchi2cl>0.1&&Dalpha<0.2&&(DsvpvDistance/DsvpvDisErr)>.0"&&cutTrk,"",10000000);
h->Sumw2();
// TF1 *f = new TF1("f","(1-exp(-(x-[8])/[0]))*(((x)/[8])**[1]+[2]*(((x)/[8])-1))*[3]+[4]*(TMath::Voigt(x-[5],[6],[7]))");
TF1* f = new TF1("f","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+[5]*((1-[8])*TMath::Gaus(x,[6],[7])/(sqrt(2*3.14159)*[7])+[8]*TMath::Gaus(x,[6],[9])/(sqrt(2*3.14159)*[9]))",minmass3prong,maxmass3prong);
// TF1 *f = new TF1("f","(1-exp(-(x-0.13957018)/[0]))*(((x)/0.13957018)**[1]+[2]*(((x)/0.13957018)-1))*[3]+[4]*(TMath::Gaus(x,[5],[6]))");
//TF1 *f = new TF1("f","(1-exp(-(x-1.86486-0.13957018)/[0]))*(((x-1.86486)/0.13957018)**[1]+[2]*(((x-1.86486)/0.13957018)-1))*[3]+[4]*TMath::Gaus(x,[5],[6])");
f->SetLineColor(4);
// f->SetParameters(-2.3825e6,-7.99713e-1,-1.42957,-5.50069e10,5.33573,1.45491e-1,2.78677e-6,1.43145e-3,0.13957018);
// f->SetParameters(-7.3e5,-2.2e1,5.24e-1,-7.18e9,2e2,1.45491e-1,9e-4,0.1,8e-4);
f->SetParameters(0,0,0,0,0,2e2,1.45491e-1,9e-4,0.1,8e-4);
f->FixParameter(9,15e-4);
f->FixParameter(6,0.145491);
f->FixParameter(7,8e-4);
f->SetParLimits(8,0,1);
h->Fit("f","LL");
h->Fit("f","LL");
h->Fit("f","LL","",0.142,0.147);
f->ReleaseParameter(6);
f->ReleaseParameter(7);
f->ReleaseParameter(9);
f->SetParLimits(7,1e-4,9e-4);
f->SetParLimits(9,1e-4,9e-4);
h->Fit("f","LL","",0.142,0.148);
h->Fit("f","LL","",0.142,0.16);
h->Fit("f","LL","",0.142,0.16);
h->Fit("f","LL","",0.141,0.16);
h->Fit("f","LL","",0.141,0.16);
h->Fit("f","LL","",0.141,0.16);
h->SetXTitle("M_{K#pi#pi#pi#pi}-M_{K#pi#pi#pi} (GeV/c^{2})");
h->SetYTitle("Entries");
h->SetStats(0);
h->SetAxisRange(1,h->GetMaximum()*1.3,"Y");
TF1 *f2 = (TF1*)f->Clone("f2");
f2->SetParameter(5,0);
f2->SetRange(0.141,0.16);
TF1 *f3 = (TF1*)f->Clone("f3");
f3->SetParameter(0,0);
f3->SetParameter(1,0);
f3->SetParameter(2,0);
f3->SetParameter(3,0);
f3->SetParameter(4,0);
f->SetLineColor(4);
f2->SetLineColor(4);
f2->SetLineStyle(2);
f3->SetLineStyle(2);
f2->Draw("same");
f3->SetLineColor(2);
f3->SetFillStyle(3004);
f3->SetFillColor(2);
f3->Draw("same");
c->SaveAs("canvasDstar.pdf");
}
示例13: advancedNoiseAnalysis
//.........这里部分代码省略.........
// get the noise map.
string noiseMapName = "detector-" + toString( iDetector ) ;
noiseMapName += "/NoiseMap-d" + toString( iDetector ) ;
noiseMapName += "-l" + toString( loop ) ;
TH2D * noiseMap = ( TH2D* ) loopFolder->Get( noiseMapName.c_str() );
// create a folder in the output file
TDirectory * subfolder = outputFile->mkdir( string( "detector_" + toString( iDetector ) ).c_str(),
string( "detector_" + toString( iDetector ) ).c_str()
);
subfolder->cd();
string canvasName = "det" + toString( iDetector );
string canvasTitle = "Detector " + toString( iDetector );
TCanvas * canvas = new TCanvas( canvasName.c_str(), canvasTitle.c_str(), 1000, 500 );
canvas->Divide( kNChan, 2 );
// ok now start the loop on channels
for ( size_t iChan = 0 ; iChan < kNChan ; ++iChan ) {
if ( iDetector == 0 ) channel[iChan] = iChan - 0.5;
string tempName = "NoiseMap_d" + toString( iDetector ) + "_l" + toString( loop ) + "_ch" + toString( iChan ) ;
string tempTitle = "NoiseMap Det. " + toString( iDetector ) + " - Ch. " + toString( iChan ) ;
TH2D * noiseMapCh = new TH2D ( tempName.c_str() , tempTitle.c_str(),
kXPixel / kNChan , -0.5 + xLimit[ iChan ] , -0.5 + xLimit[ iChan + 1 ],
kYPixel, -0.5, -0.5 + kYPixel );
noiseMapCh->SetXTitle("X [pixel]");
noiseMapCh->SetYTitle("Y [pixel]");
noiseMapCh->SetZTitle("Noise [ADC]");
noiseMapCh->SetStats( false );
outputHistoList->Add( noiseMapCh ) ;
tempName = "NoiseDist_d" + toString( iDetector ) + "_l" + toString( loop ) + "_ch" + toString( iChan ) ;
tempTitle = "NoiseDist Det. " + toString( iDetector ) + " - Ch. " + toString( iChan ) ;
TH1D * noiseDistCh = new TH1D( tempName.c_str(), tempTitle.c_str(), 50, 0., 10. );
noiseDistCh->SetXTitle("Noise [ADC]");
noiseDistCh->SetLineColor( kColor[iDetector] );
noiseDistCh->SetLineStyle( iChan + 2 );
noiseDistCh->SetLineWidth( 2 );
outputHistoList->Add( noiseDistCh );
// let's start looping on pixels now
for ( size_t yPixel = 1 ; yPixel <= kYPixel ; ++yPixel ) {
for ( size_t xPixel = xLimit[ iChan ] + 1; xPixel <= xLimit[ iChan +1 ] ; ++xPixel ) {
double noise = noiseMap->GetBinContent( xPixel , yPixel );
noiseMapCh->Fill( xPixel - 1 , yPixel - 1, noise );
noiseDistCh->Fill( noise );
}
}
canvas->cd( iChan + 1 ) ;
noiseMapCh->Draw("colz");
canvas->cd( iChan + kNChan + 1 );
noiseDistCh->Draw();
topPad->cd( iDetector + 1 );
示例14: TCanvas
TF1* fitDstar5prongs(TTree* nt, Double_t ptmin, Double_t ptmax)
{
static int count5p=0;
count5p++;
TCanvas* c = new TCanvas(Form("c_5p_%d",count5p),"",600,600);
TH1D* h = new TH1D(Form("h_5p_%d",count5p),"",60,0.140,0.160);
TF1* f = new TF1(Form("f_5p_%d",count5p),"[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+[5]*((1-[8])*TMath::Gaus(x,[6],[7])/(sqrt(2*3.14159)*[7])+[8]*TMath::Gaus(x,[6],[9])/(sqrt(2*3.14159)*[9]))",minmass3prong,maxmass3prong);
nt->Project(Form("h_5p_%d",count5p),"Dmass-DtktkResmass",Form("%s*(%s&&%s&&Dpt>%f&&Dpt<%f)",weight.Data(),seldata5p.Data(),triggerselection[isData].Data(),ptmin,ptmax));
f->SetLineColor(4);
f->SetParameters(0,0,0,0,0,2e2,1.45491e-1,9e-4,0.1,8e-4);
f->FixParameter(9,15e-4);
f->FixParameter(6,0.145491);
f->FixParameter(7,8e-4);
f->SetParLimits(8,0,1);
f->SetParLimits(5,0,100000);
h->Fit(Form("f_5p_%d",count5p),"LL");
h->Fit(Form("f_5p_%d",count5p),"LL");
h->Fit(Form("f_5p_%d",count5p),"LL","",minmass3prong,maxmass3prong);
f->ReleaseParameter(6);
f->ReleaseParameter(7);
f->ReleaseParameter(9);
f->SetParLimits(6,0.144,0.147);
f->SetParLimits(7,1e-4,9e-4);
f->SetParLimits(9,1e-4,9e-4);
h->Fit(Form("f_5p_%d",count5p),"LL","",0.142,0.148);
h->Fit(Form("f_5p_%d",count5p),"LL","",0.142,0.16);
h->Fit(Form("f_5p_%d",count5p),"LL","",0.142,0.16);
h->Fit(Form("f_5p_%d",count5p),"LL","",0.141,0.16);
h->Fit(Form("f_5p_%d",count5p),"LL","",0.141,0.16);
h->Fit(Form("f_5p_%d",count5p),"LL","",0.141,0.16);
TF1* background = new TF1(Form("background_5p_%d",count5p),"[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x");
background->SetParameter(0,f->GetParameter(0));
background->SetParameter(1,f->GetParameter(1));
background->SetParameter(2,f->GetParameter(2));
background->SetParameter(3,f->GetParameter(3));
background->SetParameter(4,f->GetParameter(4));
background->SetLineColor(4);
background->SetRange(minmass3prong,maxmass3prong);
background->SetLineStyle(2);
TF1* mass = new TF1(Form("fmass_5p_%d",count5p),"[0]*((1-[3])*TMath::Gaus(x,[1],[2])/(sqrt(2*3.14159)*[2])+[3]*TMath::Gaus(x,[1],[4])/(sqrt(2*3.14159)*[4]))");
mass->SetParameters(f->GetParameter(5),f->GetParameter(6),f->GetParameter(7),f->GetParameter(8),f->GetParameter(9));
mass->SetParError(0,f->GetParError(5));
mass->SetParError(1,f->GetParError(6));
mass->SetParError(2,f->GetParError(7));
mass->SetParError(3,f->GetParError(8));
mass->SetParError(4,f->GetParError(9));
mass->SetFillColor(kOrange-3);
mass->SetFillStyle(3002);
mass->SetLineColor(kOrange-3);
mass->SetLineWidth(3);
mass->SetLineStyle(2);
h->SetXTitle("M_{K#pi#pi#pi#pi}-M_{K#pi#pi#pi} (GeV/c^{2})");
h->SetYTitle("Entries / (1/3 MeV/c^{2})");
h->SetStats(0);
h->GetXaxis()->CenterTitle();
h->GetYaxis()->CenterTitle();
h->SetAxisRange(0,h->GetMaximum()*1.4*1.2,"Y");
h->GetXaxis()->SetTitleOffset(1.3);
h->GetYaxis()->SetTitleOffset(1.8);
h->GetXaxis()->SetLabelOffset(0.007);
h->GetYaxis()->SetLabelOffset(0.007);
h->GetXaxis()->SetTitleSize(0.045);
h->GetYaxis()->SetTitleSize(0.045);
h->GetXaxis()->SetTitleFont(42);
h->GetYaxis()->SetTitleFont(42);
h->GetXaxis()->SetLabelFont(42);
h->GetYaxis()->SetLabelFont(42);
h->GetXaxis()->SetLabelSize(0.04);
h->GetYaxis()->SetLabelSize(0.04);
h->SetMarkerSize(0.8);
h->SetMarkerStyle(20);
h->SetStats(0);
h->Draw("e");
background->Draw("same");
mass->SetRange(0.142,0.152);
mass->Draw("same");
f->Draw("same");
Double_t yield = mass->Integral(minmass5prong,maxmass5prong)/binwidth5prong;
Double_t yieldErr = mass->Integral(minmass5prong,maxmass5prong)/binwidth5prong*mass->GetParError(0)/mass->GetParameter(0);
TLatex* tex;
TLegend* leg = new TLegend(0.60,0.62,0.85,0.88,NULL,"brNDC");
leg->SetBorderSize(0);
leg->SetTextSize(0.04);
leg->SetTextFont(42);
leg->SetFillStyle(0);
leg->AddEntry((TObject*)0,"D* D^{0}(K#pi#pi#pi)#pi",NULL);
leg->AddEntry(h,"Data","pl");
leg->AddEntry(f,"Fit","l");
leg->AddEntry(mass,"D*^{+}+D*^{-} Signal","f");
leg->AddEntry(background,"Combinatorial","l");
leg->Draw("same");
//.........这里部分代码省略.........
示例15: etaPlotter
//.........这里部分代码省略.........
pbpbtree->SetBranchAddress("phi2",&phi2);
pbpbtree->SetBranchAddress("eta1",&eta1);
pbpbtree->SetBranchAddress("eta2",&eta2);
pbpbtree->SetBranchAddress("hiHFplusEta4",&hiHF);
pbpbtree->SetBranchAddress("hiHFminusEta4",&hiHFminus);
for(int i=0; i<pbpbtree->GetEntries(); i++){
pbpbtree->GetEntry(i);
if(pt1>120 && pt2>30 && rawPt1>15 && rawPt2>15 && hiHF+hiHFminus>=0 && hiHF+hiHFminus<25 && acos(cos(phi1-phi2)) > 2.0944){
etaDistroPbPb[0]->Fill((eta1+eta2)/2);
}
if(pt1>120 && pt2>30 && rawPt1>15 && rawPt2>15 && hiHF+hiHFminus>=25 && hiHF+hiHFminus<50 && acos(cos(phi1-phi2)) > 2.0944){
etaDistroPbPb[1]->Fill((eta1+eta2)/2);
}
if(pt1>120 && pt2>30 && rawPt1>15 && rawPt2>15 && hiHF+hiHFminus>=50 && hiHF+hiHFminus<90 && acos(cos(phi1-phi2)) > 2.0944){
etaDistroPbPb[2]->Fill((eta1+eta2)/2);
}
if(pt1>120 && pt2>30 && rawPt1>15 && rawPt2>15 && hiHF+hiHFminus>=30 && hiHF+hiHFminus<40 && acos(cos(phi1-phi2)) > 2.0944){
etaDistroPbPb[3]->Fill((eta1+eta2)/2);
}
if(pt1>120 && pt2>30 && rawPt1>15 && rawPt2>15 && hiHF+hiHFminus>=40 && hiHF+hiHFminus<90 && acos(cos(phi1-phi2)) > 2.0944){
etaDistroPbPb[4]->Fill((eta1+eta2)/2);
}
}
TCanvas *c2 = new TCanvas("c2","",1400,800);
c2->cd();
makeMultiPanelCanvas(c2,3,2,0.,0.,0.2,0.2,0.05);
for(int i=0; i<5; i++){
c2->cd(i+1);
cout << "pPb: " << etaDistropPb[i]->Integral() << endl;
etaDistropPb[i]->Scale(1./etaDistropPb[i]->Integral());
etaDistropPb[i]->SetMaximum(0.2);
etaDistropPb[i]->SetYTitle("Event Fraction");
etaDistropPb[i]->SetXTitle("(#eta_{1}+#eta_{2})/2");
//etaDistropPb[i]->SetXTitle("#eta_{leading}");
etaDistropPb[i]->Draw();
cout << "ppMC: " << etaDistroppMC[i]->Integral() << endl;
etaDistroppMC[i]->Scale(1./etaDistroppMC[i]->Integral());
etaDistroppMC[i]->Draw("same");
etaDistropPbMC[i]->Scale(1./etaDistropPbMC[i]->Integral());
etaDistropPbMC[i]->Draw("same");
//if(etaDistroppData[i]->Integral() != 0){
cout << "pp: " << etaDistroppData[i]->Integral() << endl;
etaDistroppData[i]->Scale(1./etaDistroppData[i]->Integral());
etaDistroppData[i]->Draw("same");
//}
if(i==0){
TLatex *l1 = new TLatex(0.5, 0.15,"E_{T}^{|#eta|<4}<20");
l1->Draw();
}
if(i==1){
TLatex *l2 = new TLatex(0.5, 0.15, "20#leqE_{T}^{|#eta|<4}<25");
l2->Draw();
}
if(i==2){
TLatex *l3 = new TLatex(0.5, 0.15, "25#leqE_{T}^{|#eta|<4}<30");
l3->Draw();
}
if(i==3){
TLatex *l4 = new TLatex(0.5, 0.15, "30#leqE_{T}^{|#eta|<4}<40");
l4->Draw();
}
if(i==4){
TLatex *l5 = new TLatex(0.5, 0.15, "40#leqE_{T}^{|#eta|<4}");
l5->Draw();
}