27 #include "TTreeHelper.h"
30 void plot_Nfit(
float pt1 = 0.2,
float pt2 = 2.0,
int nch1 = 0,
int nch2 = 1000, Int_t
id=6){
32 gROOT->LoadMacro(
"~/mymacros/Utility.C");
33 gROOT->LoadMacro(
"~/mymacros/UtilityHist.C");
34 gStyle->SetOptStat(0);
35 gStyle->SetOptDate(0);
39 char* oFile1 =
"~/outputs/Phi/out_scan_embed_mc_Phi1.root";
40 char* oFile2 =
"~/outputs/out_scan_embed_mc_KMinus.root";
43 f1 =
new TFile(oFile1);
45 TH3D* hDca = hMcDca->Clone(); hDca->SetName(
"hDca");
46 TH3D* hNfit = hNfit3->Clone();hNfit->SetName(
"hNfit");
47 TH2F* dEdx_ep = (TH2F *) ((TH2F *) f1->Get(
"dEdx"))->
Clone();
51 f2 =
new TFile(oFile2);
53 TH3D* hDcaR = hMcDcaR->Clone();hDcaR->SetName(
"hDcaR");
54 TH3D* hNfit = hNfit3->Clone();hNfit->SetName(
"hNfit");
55 TH2F* dEdx_pi = (TH2F *) ((TH2F *) f2->Get(
"dEdx"))->
Clone();
59 TCanvas *c=
new TCanvas(
"c",
"DCA",400, 400);
63 c->SetLeftMargin(0.15);
64 c->SetRightMargin(0.05);
68 TH1D *hX = (TH1D*)hDca->Project3D(
"X");
69 Int_t bin_nch1 = hX->FindBin(nch1);
70 Int_t bin_nch2 = hX->FindBin(nch2);
73 TH1D *hY = (TH1D*)hDca->Project3D(
"Y");
74 Int_t bin_pt1 = hY->FindBin(pt1);
75 Int_t bin_pt2 = hY->FindBin(pt2);
79 TH1D *hDca1 =(TH1D*) hDca->ProjectionZ(
"hDca1",bin_nch1, bin_nch2, bin_pt1, bin_pt2);
81 hDca1->SetLineColor(2);
82 hDca1->SetXTitle(
"Dca (cm)");
83 hDca1->SetYTitle(
"Counts");
84 hDca1->GetYaxis()->SetTitleOffset(1.8);
85 hDca1->GetYaxis()->SetDecimals();
88 float mscale = hDca->GetMaximum();
92 TH1D *hX_r = (TH1D*)hDcaR->Project3D(
"X");
93 Int_t bin_nch1_r = hX_r->FindBin(nch1);
94 Int_t bin_nch2_r = hX_r->FindBin(nch2);
97 TH1D *hY_r = (TH1D*)hDcaR->Project3D(
"Y");
98 Int_t bin_pt1_r = hY_r->FindBin(pt1);
99 Int_t bin_pt2_r = hY_r->FindBin(pt2);
103 TH1D *hDca1_r=(TH1D*)hDcaR->ProjectionZ(
"hDca1_r",bin_nch1_r, bin_nch2_r, bin_pt1_r, bin_pt2_r);
105 Double_t Sum_Real = hDca1_r->GetSum();
106 Double_t Sum_MC = hDca1->GetSum();
107 hDca1_r->Scale(1./Sum_Real);
108 hDca1->Scale(1./Sum_MC);
111 hDca1_r->Draw(
"same")
116 TCanvas *c1=
new TCanvas(
"c1",
"NFIT",400, 400);
119 c1->SetLeftMargin(0.15);
120 c1->SetRightMargin(0.05);
125 TH1D *hX = (TH1D*)hNfit->Project3D(
"X");
126 Int_t multL = hX->FindBin(nch1);
127 Int_t multH = hX->FindBin(nch2);
131 TH1D *hY = (TH1D*)hNfit->Project3D(
"Y");
132 Int_t bin_pt1 = hY->FindBin(pt1);
133 Int_t bin_pt2 = hY->FindBin(pt2);
137 TH1D *hNfitz =(TH1D*) hNfit->ProjectionZ(
"hNfitz",multL, multH, bin_pt1, bin_pt2);
139 hNfitz->SetLineColor(2);
140 hNfitz->SetXTitle(
"Nfit");
141 hNfitz->SetYTitle(
"Counts");
142 hNfitz->GetYaxis()->SetDecimals();
143 hNfitz->GetYaxis()->SetTitleOffset(1.7);
145 Double_t Sum_MC= hNfitz->GetSum();
150 TH1D *hX_r = (TH1D*) hNfitR->Project3D(
"X");
151 Int_t multLr = hX_r->FindBin(nch1);
152 Int_t multHr = hX_r->FindBin(nch2);
156 TH1D *hY_r = (TH1D*)hNfitR->Project3D(
"Y");
157 Int_t bin_pt1_r = hY_r->FindBin(pt1);
158 Int_t bin_pt2_r = hY_r->FindBin(pt2);
162 TH1D *hNfitz_r = (TH1D*)hNfitR->ProjectionZ(
"hNfitz_r",multLr, multHr, bin_pt1_r, bin_pt2_r);
164 Double_t sum_Real = hNfitz_r->GetSum();
165 hNfitz_r->Scale(1./sum_Real);
166 hNfitz->Scale(1./Sum_MC);
171 TCanvas *c2=
new TCanvas(
"c2",
"Delta Vertex Position",400, 400);
179 TCanvas *c3=
new TCanvas(
"c3",
"Delta Vertex Position",400, 400);
182 c3->SetLeftMargin(0.15);
183 c3->SetRightMargin(0.05);
198 TCanvas *c4=
new TCanvas(
"c4",
"Reference Multiplicity",400, 400);
203 hMult ->Fill(*nPos + *nNeg);
209 TCanvas *c5=
new TCanvas(
"c5",
"Energy Loss",400, 400);
214 hPtM_E_Pr ->Fill(PtPrMatched[itr],PtPrMatched[itr]-PtMcMatched[itr]);
215 hPtM_E_Pr ->SetLineColor(9);
219 TCanvas *c6=
new TCanvas(
"c6",
"Energy Loss",400, 400);
224 hPtM_E_Gl -> Fill (PtPrGlobal[itr],PtPrGlobal[itr]-PtMcGlobal[itr]);
225 hPtM_E_Gl -> SetLineColor(8);
230 TCanvas *c7=
new TCanvas(
"c7",
"Energy Loss",400, 400);
242 TCanvas *c8=
new TCanvas(
"c8",
"Energy Loss",400, 400);
248 dEdx_ep->SetMarkerColor(2);
252 dEdx_pi->SetXTitle(
"Momentum P (GeV/c)");
253 dEdx_pi->SetYTitle(
"dE/dx");
258 TH1D *dEdx_pi_x = (TH1D*)dEdx_pi->ProjectionX();
259 Int_t bin_pt1_r = dEdx_pi_x->FindBin(pt1);
260 Int_t bin_pt2_r = dEdx_pi_x->FindBin(pt2);
264 TH1D *dEdx_pi_y = (TH1D*)dEdx_pi->ProjectionY(
"py",bin_pt1_r, bin_pt2_r);
265 dEdx_pi_y->SetAxisRange(0.,4.,
"X");
266 dEdx_pi_y->SetXTitle(
"dE / dx");
271 g1 =
new TF1(
"g1",
"gaus",0.8.,1.6);
272 g2 =
new TF1(
"g2",
"gaus",1.7,1.9.);
273 PiFitPiE2 =
new TF1(
"PiFitPiE2",
"([0]/[2]*exp(-0.5*pow((x-[1])/[2],2))+[3]/[5]*exp(-0.5*pow((x-[4])/[5],2)))/sqrt(6.283)");
275 PiFitPiE2->SetRange(0.0,4.0);
276 dEdx_pi_y->Fit(g1,
"R");
277 dEdx_pi_y->Fit(g2,
"R");
279 g1->GetParameters(&par[0]);
280 g2->GetParameters(&par[3]);
282 PiFitPiE2->SetParameters(par);
283 PiFitPiE2->SetLineWidth(2);
284 PiFitPiE2->SetLineColor(3);
285 dEdx_pi_y->Fit(PiFitPiE2,
"R");
286 keyLine(.5,.7,
"dEdx Pi",1);
295 TH1D *dEdx_ep_x = (TH1D*)dEdx_ep->ProjectionX();
296 Int_t bin_pt1 = dEdx_ep_x->FindBin(pt1);
297 Int_t bin_pt2 = dEdx_ep_x->FindBin(pt2);
301 TH1D *dEdx_ep_y = (TH1D*)dEdx_ep->ProjectionY(
"py1",bin_pt1, bin_pt2);
302 dEdx_ep_y->SetAxisRange(0.,4.,
"X");
307 g6 =
new TF1(
"g6",
"gaus",.6,4.);
310 dEdx_ep_y->Fit(g6,
"R");
311 Double_t Mean = g6->GetParameters(&par[2]);
313 cout<<
"Mean is : "<<Mean<<endl;
314 keyLine(.5,.8,
"dEdx EPlus",2);
315 keyLine(.5, .6,
"Mean Value : Mean",2) ;
317 cout<<
"bin_pt1_r"<<bin_pt1_r<<endl;
318 cout<<
"bin_pt2_r"<<bin_pt2_r<<endl;
319 cout<<
"bin_pt1"<<bin_pt1<<endl;
320 cout<<
"bin_pt2"<<bin_pt2<<endl;
324 char title[100], gif[100];
326 sprintf(gif,
"~/Plots/dedx_%.2fpT%.2f_%d.jpg",pt1,pt2);
328 dEdx_ep_y->SetTitle(title);
329 dEdx_pi_y->SetTitle(title);
333 hDca1->SetTitle(title);
virtual TObject * Clone(const char *newname="") const
the custom implementation fo the TObject::Clone