5 TH1D *GetHisto(float ptcut = 0.15, char *name, char *filename, float etacut){
6 TFile *file = new TFile(filename);
7 TList *list = file->FindObject("out2");
8 //TH2F *allhad = ((TH2F*) out2->FindObject("EtSimulatedAllHadron"))->Clone("allhad");
9 TH2F *allhad = ((TH2F*) out2->FindObject("EtSimulatedChargedHadron"))->Clone("allhad");
10 TH2F *ptlow = ((TH2F*) out2->FindObject("EtSimulatedChargedHadronAssumingNoPt"))->Clone("ptlow");
12 if(ptcut>0.14){//TPC cut off
13 (TH2F*)pthigh =(TH2F*) ((TH2F*) out2->FindObject("EtSimulatedChargedHadronAssumingPtTPCCut"))->Clone("pthigh");
16 (TH2F*)pthigh =(TH2F*) ((TH2F*) out2->FindObject("EtSimulatedChargedHadronAssumingPtITSCut"))->Clone("pthigh");
19 int lowbin = allhad->GetXaxis()->FindBin(0.0);//make sure we don't accidentally get the wrong bin
20 int highbin = allhad->GetXaxis()->FindBin(ptcut);
21 int nbins = allhad->GetXaxis()->GetNbins();
22 cout<<"Projecting from "<<allhad->GetXaxis()->GetBinLowEdge(lowbin)<<" to "<<allhad->GetXaxis()->GetBinLowEdge(highbin+1)<<endl;
23 cout<<"Projecting from "<<allhad->GetXaxis()->GetBinLowEdge(lowbin)<<" to "<<allhad->GetXaxis()->GetBinLowEdge(nbins)<<endl;
28 TH1D *numerator = allhad->ProjectionY("name",lowbin,highbin);
29 TH1D *denominator = allhad->ProjectionY("denominator",lowbin,nbins);
30 TH1D *numeratorLow = ptlow->ProjectionY("nameLow",lowbin,highbin);
31 TH1D *denominatorLow = allhad->ProjectionY("denominatorLow",highbin,nbins);
32 denominatorLow->Add(ptlow);
33 TH1D *numeratorHigh = pthigh->ProjectionY("nameHigh",lowbin,highbin);
34 TH1D *denominatorHigh = allhad->ProjectionY("denominatorHigh",highbin,nbins);
35 denominatorHigh->Add(pthigh);
37 numerator->Divide(denominator);
38 numeratorLow->Divide(denominatorLow);
39 numeratorHigh->Divide(denominatorHigh);
41 TF1 *funcLow = new TF1("funcLow","[0]",-.7,.7);
42 funcLow->SetParameter(0,0.01);
43 numeratorLow->Fit(funcLow);
44 TF1 *func = new TF1("func","[0]",-.7,.7);
45 func->SetParameter(0,0.02);
47 TF1 *funcHigh = new TF1("funcHigh","[0]",-.7,.7);
48 funcHigh->SetParameter(0,0.02);
49 numeratorHigh->Fit(funcHigh);
51 mean = 1.0-func->GetParameter(0);
52 lowbound = 1.0-funcHigh->GetParameter(0);
53 highbound = 1.0-funcLow->GetParameter(0);
54 cout<<"fpTcut = "<<mean<<","<<lowbound<<","<<highbound<<endl;
55 cout<<"1/fpTcut = "<<1.0/mean<<","<<1.0/lowbound<<","<<1.0/highbound<<endl;
56 //cout<<"fpTcut = "<<mean<<"-"<<mean-lowbound<<"+"<<highbound-mean<<endl;
57 cout<<Form("%2.5f_{+%2.5f}_{-%2.5f}",mean,highbound-mean,mean-lowbound)<<endl;
58 cout<<"1/fpTcut = "<<1.0/mean<<"+"<<1.0/lowbound-1.0/mean<<"-"<<1.0/mean-1.0/highbound<<endl;
59 numerator->SetYTitle("E_{T}^{had, p_{T}<cut-off}/E_{T}^{had, all p_{T}}");
60 numerator->GetYaxis()->SetTitleOffset(1.);
61 numerator->GetYaxis()->SetTitleSize(0.08);
62 numerator->GetYaxis()->SetLabelSize(0.05);
63 numerator->GetXaxis()->SetTitleSize(0.08);
64 numerator->GetXaxis()->SetLabelSize(0.05);
65 numerator->GetXaxis()->SetTitleOffset(.6);
66 //numerator->Rebin(2);
67 //numerator->Scale(0.5);
68 //numerator->Draw("e");
72 //Christine Nattrass, University of Tennessee at Knoxville
73 //This macro is for calculating the correction for the pT cut-off and its systematic error
74 //Uses the output of AliAnalysisTaskHadEt
75 //This is not actually what gets used in the correction class AliAnalysisHadEtCorrections - that is done in the macro GetCorrections.C - but this is useful for making plots and playing around with different options
77 void CorrPtCut(char *prodname = "LHC10d4 PYTHIA D6T 7 TeV p+p", char *shortprodname = "LHC10d4", char *filename="Et.ESD.new.sim.LHC10d4.pp.merged.root"){
79 gStyle->SetOptTitle(0);
80 gStyle->SetOptStat(0);
82 TCanvas *c = new TCanvas("c","c",500,400);
83 c->SetTopMargin(0.04);
84 c->SetRightMargin(0.04);
85 c->SetLeftMargin(0.181452);
86 c->SetBottomMargin(0.134409);
91 c->SetFrameFillColor(0);
92 c->SetFrameBorderMode(0);
94 TH1D *High = GetHisto(0.15-.001,"High",filename,etacut);
95 float tpcHigh=highbound;
96 float tpcLow=lowbound;
97 float x1 = High->GetXaxis()->GetBinLowEdge(1);
98 TBox *tpcBox = new TBox(-x1*.99,1.0-tpcLow,x1*.99,1.0-tpcHigh);
99 tpcBox->SetFillColor(5);
100 tpcBox->SetLineColor(0);
101 tpcBox->SetFillStyle(1001);
102 TH1D *Low = GetHisto(0.1-.001,"Low",filename,etacut);
103 float itsHigh=highbound;
104 float itsLow=lowbound;
105 float x = Low->GetXaxis()->GetBinLowEdge(1);
106 TBox *itsBox = new TBox(-x*.99,1.0-itsLow,x*.99,1.0-itsHigh);
107 itsBox->SetFillColor(5);
108 itsBox->SetLineColor(0);
109 itsBox->SetFillStyle(1001);
110 TH1D *Lowest = GetHisto(0.05-.001,"Lowest",filename,etacut);
111 TF1 *funcLow = new TF1("funcLow","[0]",-.7,.7);
112 funcLow->SetParameter(0,0.01);
114 TF1 *funcHigh = new TF1("funcHigh","[0]",-.7,.7);
115 funcHigh->SetParameter(0,0.02);
117 High->SetMaximum(0.04);
118 High->SetMinimum(0.0);
119 High->SetMarkerColor(2);
120 Low->SetMarkerColor(4);
121 High->SetLineColor(2);
122 Low->SetLineColor(4);
123 High->SetMinimum(0.0);
124 High->SetMarkerStyle(20);
125 Low->SetMarkerStyle(21);
126 Lowest->SetMarkerStyle(22);
133 //Lowest->Draw("same");
134 TLatex *tex = new TLatex(-0.723444,0.0373593,prodname);
135 tex->SetTextSize(0.0537634);
137 TLegend *leg = new TLegend(0.217742,0.696237,0.477823,0.873656);
138 leg->AddEntry(High,"p_{T} cut-off = 0.15 GeV/c");
139 leg->AddEntry(Low,"p_{T} cut-off = 0.1 GeV/c");
140 //leg->AddEntry(Lowest,"p_{T} cut-off = 0.05 GeV/c");
141 leg->SetFillStyle(0);
142 leg->SetFillColor(0);
143 leg->SetBorderSize(0);
144 leg->SetTextSize(0.0537634);
146 c->SaveAs(Form("pics/%s/fptcut.eps",shortprodname));
147 c->SaveAs(Form("pics/%s/fptcut.png",shortprodname));
148 c->SaveAs(Form("pics/%s/fptcut.pdf",shortprodname));