1 void PlotMatchedTracksFromData(TString datafilename="rootFiles/LHC11a4_bis/Et.ESD.simPbPb.EMCAL.LHC11a4_bis.root",TString simfilename="rootFiles/LHC11a4_bis/Et.ESD.simPbPb.EMCAL.LHC11a4_bis.root", int bin = 10, int binLast = 10, TString det = "EMCal"){
2 gStyle->SetOptTitle(0);
6 TString outnamebin = Form("%iTo%i",bin,binLast);
8 TFile *fsim = TFile::Open(simfilename, "READ");
9 TList *lsim = (TList*)fsim->Get("out1");
10 TH3F *fHistMatchedTracksEvspTBkgdvsMult = lsim->FindObject("fHistMatchedTracksEvspTBkgdMult");
11 fHistMatchedTracksEvspTBkgdvsMult->GetZaxis()->SetRange(bin,binLast);
12 TH2D *hBkgd2D = (TProfile2D*) fHistMatchedTracksEvspTBkgdvsMult->Project3D("yx");
13 TProfile * profBkgd2D = hBkgd2D->ProfileX();
14 profBkgd2D->SetLineColor(2);
15 profBkgd2D->SetLineWidth(2);
17 TFile *f = TFile::Open(datafilename, "READ");
21 TList *l = (TList*)f->Get("out1");
22 TH3F *fHistMatchedTracksEvspTvsMult = l->FindObject("fHistMatchedTracksEvspTvsMult");
23 fHistMatchedTracksEvspTvsMult->GetZaxis()->SetRange(bin,binLast);
24 TH2D *hMatchedTracks2D = (TProfile2D*) fHistMatchedTracksEvspTvsMult->Project3D("yx");
25 TProfile * profMatchedTracks2D = hMatchedTracks2D->ProfileX();
26 hMatchedTracks2D->GetXaxis()->SetTitle("p");
27 hMatchedTracks2D->GetYaxis()->SetTitle("E^{cluster}");
28 profMatchedTracks2D->SetLineWidth(2);
29 TCanvas *c1 = new TCanvas("c1","c1",600,400);
30 c1->SetTopMargin(0.02);
31 c1->SetRightMargin(0.02);
36 c1->SetFrameFillColor(0);
37 c1->SetFrameBorderMode(0);
38 hMatchedTracks2D->Draw("colz");
39 profMatchedTracks2D->Draw("same");
40 profBkgd2D->Draw("same");
41 outname = "/tmp/TrackMatchingData2D"+det+outnamebin+".png";
42 c1->SaveAs(outname.Data());