Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:34

0001 void test()
0002 {
0003 /*
0004   TFile* f = new TFile("treefile_b0old.root");
0005   TTree* tree = f->Get("ana/hi");
0006   TH1D* heta = new TH1D("eta","",120,-12,12);
0007   TH1D* hpt = new TH1D("pt","",200,0.,20);
0008   TH1D* hb = new TH1D("b","",300,0.,30);
0009   heta->SetMarkerColor(2);
0010   hpt->SetMarkerColor(2);
0011   hb->SetMarkerColor(2);
0012   tree->Draw("b>>b","","GOFF");
0013   tree->Draw("eta>>eta","abs(eta)<10.&&chg!=0","GOFF");
0014   heta->Scale(1.0/heta->GetBinWidth(1)/hb->GetEntries());
0015   heta->SetTitle(";#eta;dN/d#eta");
0016   tree->Draw("pt>>pt","chg!=0","GOFF");
0017   hpt->Scale(1.0/hpt->Integral());
0018   hpt->SetTitle(";p_{T};dN/dp_{T}");
0019 
0020   TFile* f1 = new TFile("treefile_b0pt5old.root");
0021   TTree* tree1 = f1->Get("ana/hi");
0022   TH1D* heta1 = new TH1D("eta1","",120,-12,12);
0023   TH1D* hpt1 = new TH1D("pt1","",200,0.,20);
0024   TH1D* hb1 = new TH1D("b1","",300,0.,30);
0025   heta1->SetMarkerColor(3);
0026   hpt1->SetMarkerColor(3);
0027   hb1->SetMarkerColor(3);
0028   tree1->Draw("b>>b1","","GOFF");
0029   tree1->Draw("eta>>eta1","abs(eta)<10.&&chg!=0","GOFF");
0030   heta1->Scale(1.0/heta1->GetBinWidth(1)/hb1->GetEntries());
0031   heta1->SetTitle(";#eta;dN/d#eta");
0032   tree1->Draw("pt>>pt1","chg!=0","GOFF");
0033   hpt1->Scale(1.0/hpt1->Integral());
0034   hpt1->SetTitle(";p_{T};dN/dp_{T}");
0035 
0036   TFile* f2 = new TFile("treefile_b0new.root");
0037   TTree* tree2 = f2->Get("ana/hi");
0038   TH1D* heta2 = new TH1D("eta2","",120,-12,12);
0039   TH1D* hpt2 = new TH1D("pt2","",200,0.,20);
0040   TH1D* hb2 = new TH1D("b2","",300,0.,30);
0041   heta2->SetMarkerColor(4);
0042   hpt2->SetMarkerColor(4);
0043   hb2->SetMarkerColor(4);
0044   tree2->Draw("b>>b2","","GOFF");
0045   tree2->Draw("eta>>eta2","abs(eta)<10.&&chg!=0","GOFF");
0046   heta2->Scale(1.0/heta2->GetBinWidth(1)/hb2->GetEntries());
0047   heta2->SetTitle(";#eta;dN/d#eta");
0048   tree2->Draw("pt>>pt2","chg!=0","GOFF");
0049   hpt2->Scale(1.0/hpt2->Integral());
0050   hpt2->SetTitle(";p_{T};dN/dp_{T}");
0051 
0052   TFile* f3 = new TFile("treefile_b0ampt_old.root");
0053   TTree* tree3 = f3->Get("ana/hi");
0054   TH1D* heta3 = new TH1D("eta3","",120,-12,12);
0055   TH1D* hpt3 = new TH1D("pt3","",200,0.,20);
0056   TH1D* hb3 = new TH1D("b3","",300,0.,30);
0057   heta3->SetMarkerColor(2);
0058   hpt3->SetMarkerColor(2);
0059   hb3->SetMarkerColor(2);
0060   tree3->Draw("b>>b3","","GOFF");
0061   tree3->Draw("eta>>eta3","abs(eta)<10.&&chg!=0","GOFF");
0062   heta3->Scale(1.0/heta3->GetBinWidth(1)/hb3->GetEntries());
0063   heta3->SetTitle(";#eta;dN/d#eta");
0064   tree3->Draw("pt>>pt3","chg!=0","GOFF");
0065   hpt3->Scale(1.0/hpt3->Integral());
0066   hpt3->SetTitle(";p_{T};dN/dp_{T}");
0067 */
0068   TFile* f4 = new TFile("treefile_ampt.root");
0069   TTree* tree4 = f4->Get("ana/hi");
0070   TH1D* heta4 = new TH1D("eta4","",80,-12,12);
0071   TH1D* hpt4 = new TH1D("pt4","",200,0.,20);
0072   TH1D* hb4 = new TH1D("b4","",300,0.,30);
0073   TH1D* hpdg4 = new TH1D("pdg4","",2000,-1000,1000);
0074 //  heta4->SetMarkerColor(6);
0075 //  hpt4->SetMarkerColor(6);
0076 //  hb4->SetMarkerColor(6);
0077   tree4->Draw("b>>b4","","GOFF");
0078 //  tree4->Draw("eta>>eta4","abs(eta)<10.&& (abs(pdg)==11 || abs(pdg)==13 || abs(pdg)==211 || abs(pdg)==321 || abs(pdg)==3222 || abs(pdg)==3112 || abs(pdg)==3312 || abs(pdg)==3332 || abs(pdg)==15 || abs(pdg)==411 || abs(pdg)==431 || abs(pdg)==24 || abs(pdg)==4122)","GOFF");
0079   tree4->Draw("eta>>eta4","abs(eta)<10.&&chg!=0","GOFF");
0080   tree4->Draw("pdg>>pdg4","abs(eta)<5.","GOFF");
0081   heta4->Scale(1.0/heta4->GetBinWidth(1)/hb4->GetEntries());
0082   heta4->SetTitle(";#eta;dN/d#eta");
0083   tree4->Draw("pt>>pt4","chg!=0","GOFF");
0084   hpt4->Scale(1.0/hpt4->Integral());
0085   hpt4->SetTitle(";p_{T};dN/dp_{T}");
0086 
0087   TCanvas* c1 = new TCanvas("c1","",500,500);
0088   hpdg4->Draw("hist");
0089 
0090   TCanvas* cd = new TCanvas("cd","",500,500);
0091 //  cd->Divide(2,1);
0092 //  cd->cd(1);
0093   heta4->SetTitle("AMPT, Pb+Pb, b=0");
0094 //  heta1->SetAxisRange(0,4500,"Y");
0095 //  heta1->Draw("PE");
0096 //  heta->Draw("PESAME");
0097 //  heta2->Draw("PESAME");
0098   heta4->Draw("PE");
0099 //  heta3->Draw("PESAME");
0100 
0101 return;
0102   TLegend* legend = new TLegend(0.3,0.75,0.9,0.9);
0103   legend->SetFillColor(0);
0104   legend->AddEntry(heta,"HYDJET, 2.8TeV, Old settings","P");
0105   legend->AddEntry(heta1,"HYDJET, 2.8TeV, Old settings, p_{T}^{hard}>5.0","P");
0106   legend->AddEntry(heta2,"HYDJET, 4TeV, Old settings","P");
0107   legend->AddEntry(heta3,"HYDJET, 2.8TeV, New settings","P");
0108   legend->AddEntry(heta4,"AMPT, 2.8TeV","P");
0109   legend->Draw("SAME");
0110   cd->cd(2);
0111   cd->GetPad(2)->SetLogy();
0112   hpt3->SetTitle("b=0");
0113   hpt3->SetAxisRange(0.00001,0.3,"Y");
0114   hpt3->SetAxisRange(0,4.0,"X");
0115   hpt3->Draw("PE");
0116   hpt->Draw("PESAME");
0117   hpt1->Draw("PESAME");
0118   hpt2->Draw("PESAME");
0119   hpt4->Draw("PESAME");
0120   TLegend* legend1 = new TLegend(0.6,0.7,0.9,0.9);
0121   legend1->SetFillColor(0);
0122   legend1->AddEntry(hpt,Form("<p_{T}>=%.3f",hpt->GetMean()),"P");
0123   legend1->AddEntry(hpt1,Form("<p_{T}>=%.3f",hpt1->GetMean()),"P");
0124   legend1->AddEntry(hpt2,Form("<p_{T}>=%.3f",hpt2->GetMean()),"P");
0125   legend1->AddEntry(hpt3,Form("<p_{T}>=%.3f",hpt3->GetMean()),"P");
0126   legend1->AddEntry(hpt4,Form("<p_{T}>=%.3f",hpt4->GetMean()),"P");
0127   legend1->Draw("SAME");
0128 }