8 #include "TGraphErrors.h"
13 #include "THnSparse.h"
14 #include "TDirectoryFile.h"
21 #include "TPaveText.h"
22 #include "TParameter.h"
23 #include "TPaveStats.h"
26 #include "AliAnalysisHelperJetTasks.h"
27 #include "AliAnalysisTaskJetServices.h"
28 #include "AliAnalysisTaskJetSpectrum2.h"
32 #include "Normalize2d.C"
33 #include "ALICEWorkInProgress.C"
37 Int_t PlotSpectraPbPb();
38 Int_t PlotJetBFluctuations();
44 void HistsFromSingleJets(char* cMask,TList *list,Int_t nJets,TH1F** h,Int_t iRebin = 1,int iFirst = 0);
45 void HistsFromSingleJets(char* cMask,TList *list,Int_t nJets,TH2F** h,Int_t iRebin = 1,int iFirst = 0);
46 void ScaleNevent(TH1 *h,TFile *fIn,Int_t iCond = 5,Int_t iMC = 0,Int_t iCen = 0);
47 void ScaleH1(TH1* h,char* cX = "",char* cY = "",Float_t fScale = 1,Bool_t bWidth = true);
48 void SetStyleH1(TH1 *h,Int_t color = 0,Int_t fillStyle = 0,Int_t markerStyle = 0);
49 void ScaleH2(TH2* h,char* cX = "",char* cY = "",char* cZ = "",Float_t fScale = 1,Bool_t bWidth = true);
50 TH1F* GetPythia8Spectrum(const char *cHist,const char *cPythia,Float_t deta,Int_t iRebin = 1,Int_t iMask = 0);
51 TF1* FitLHSgaus(TH1D *hDeltaPt, double &sigma, double &sigma_error, double &mean);
52 const char *cPrintMask = "110116_%s.eps";
53 void set_plot_style();
56 TH1F* GetPythia8Spectrum(const char *cHist,const char *cPythia,Float_t deta,Int_t iRebin,Int_t iMask){
57 TDirectory *opwd = gDirectory;
58 TFile *fPythia = (TFile*)gROOT->GetListOfFiles()->FindObject(cPythia);
60 if(!fPythia) fPythia = TFile::Open(cPythia);
63 static int iCount = 0;
66 hist = (TH1F*)fPythia->Get(cHist);
67 if(hist)hist = (TH1F*)hist->Clone(Form("%s_%d",hist->GetName(),iCount));
70 for(int i = 0;i < iMask;i++){
71 TH1F *hTmp = (TH1F*)fPythia->Get(Form(cHist,i));
73 Printf("%s not found",Form(cHist,i));
76 if(!hist)hist = (TH1F*)hTmp->Clone(Form("%s_%d_%d",hTmp->GetName(),iMask,iCount));
82 Printf("%s not found",cHist);
85 // fetch the cross section
86 TH1F *hxsec = (TH1F*)fPythia->Get("h1Xsec");
88 Float_t xsec = hxsec->GetBinContent(1);
89 Printf("%d xsec = %1.3E",__LINE__,xsec);
90 // if(xsec==0)xsec = 40.79; // tmp hack
92 hist->Scale(1./hist->GetBinWidth(1));
93 // hist->Scale(1./xsec);
96 // Double_t xtotal = 71.39; // xtotal for 7 TeV!!
97 Double_t xtotal = 62.01; // xtotal for 7 TeV!!
99 // scale with fraction of total NSD cross section
100 hist->Scale(1/xtotal);
101 Printf("%d fraction = %1.3E of total cross section %1.3E",__LINE__,xsec/xtotal,xtotal);
102 hist->SetXTitle("p_{T} (GeV/c)");
103 hist->SetYTitle("1/N dN/dp_{T}dy");
104 hist->SetDirectory(opwd);
112 PlotJetBFluctuations();
115 TList *GetList(const char *cFile,const char *cName){
116 TDirectory *opwd = gDirectory;
117 TFile *fIn = (TFile*)gROOT->GetListOfFiles()->FindObject(cFile);
119 if(!fIn) fIn = TFile::Open(cFile);
123 TDirectory *dir = (TDirectory*)fIn->Get(Form("PWG4_%s",cName));
125 Printf("GetList: Directory PWG4_%s not found",cName);
128 list = (TList*)dir->Get(Form("pwg4%s",cName));
130 Printf("GetList: list pwg4%s not found",cName);
140 gStyle->SetTitleYSize(0.7*gStyle->GetTitleYSize());
141 gStyle->SetTitleXSize(0.7*gStyle->GetTitleXSize());
142 gStyle->SetTitleXOffset(1.2*gStyle->GetTitleXOffset());
143 gStyle->SetTitleYOffset(1.5*gStyle->GetTitleYOffset());
144 gStyle->SetPadRightMargin(1.1*gStyle->GetPadRightMargin());
145 gStyle->SetPadBottomMargin(0.7*gStyle->GetPadBottomMargin());
150 TString printType = "eps";
151 const Int_t nCen = 5;
152 TString sCen[nCen] = {" 0-80"," 0-10%%","10-30","30-50","50-80"};
153 const Int_t nJets = 3;
156 TString cAdd = "Rec"; // decide whcih type to take Rec RecFull Gen GenFull
157 TString cAddFull = "RecFull"; // decide whcih type to take Rec RecFull Gen GenFull
159 TCanvas *c1 = new TCanvas();
161 TString sFile = "~/alice/data/analysis/train_maf/output_110216.root";
162 TString sinputName = "spec2_clustersAOD_ANTIKT04_B2_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000";
163 TString sinputJet = "%% Pb+Pb Anti-k_{T} R = 0.4 (B2)";
164 TString sinputPrint = "PbPb_antikt04_B2";
165 sinputName = "spec2_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B0_Filter00256_Cut00150_Skip00_0000000000";cAdd = "Gen";cAddFull = "GenFull";sinputJet = "%% Pb+Pb Anti-k_{T} R = 0.4 (B0)";sinputPrint = "PbPb_antikt04_B0";
168 sinputName = "spec2_clustersAOD_ANTIKT04_B0_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B0_Filter00256_Cut00150_Skip00_0000000000";sinputJet = "p+p #sqrt{s} = 7 TeV Anti-k_{T} R = 0.4 (B0)";sinputPrint = "pp_antikt04_B0";
170 sFile = "~/alice/jets/macros/batch/output.root";
174 TFile *fIn = TFile::Open(sFile.Data());
177 TDirectory *dir = (TDirectory*)fIn->Get("PWG4_services");
178 TList *list1 = (TList*)dir->Get("pwg4serv");
180 TH2F* hTriggerCount =(TH2F*)list1->FindObject("fh2TriggerCount");
182 for(int ic = 0;ic < (isPP?1:nCen);ic++){
184 TString cName = Form("PWG4_%s_Class%02d",sinputName.Data(),ic);
185 TDirectory *inputDir = (TDirectory*)fIn->Get(cName.Data());
187 Float_t fNevents = hTriggerCount->GetBinContent(hTriggerCount->FindBin(ic,AliAnalysisTaskJetServices::kSelected));
189 Printf(" %s: %10d events",sCen[ic].Data(),(Int_t)fNevents);
192 Printf("Dir %s not found",cName.Data());
195 cName = Form("pwg4%s_Class%02d",sinputName.Data(),ic);
196 TList *inputList = (TList*)inputDir->Get(cName.Data());
198 Printf("List %s not found",cName.Data());
202 TH2F *h2EtaPtLead[nJets+2] = {0,};
203 TH2F *h2EtaPtLeadFull[nJets+2] = {0,};
204 TH2F *h2EtaPtAll[nJets+2] = {0,};
205 HistsFromSingleJets(Form("fh2EtaPt%s_j%%d",cAdd.Data()),inputList,1,h2EtaPtLead);
206 HistsFromSingleJets(Form("fh2EtaPt%s_j%%d",cAddFull.Data()),inputList,1,h2EtaPtLeadFull);
207 HistsFromSingleJets(Form("fh2EtaPt%s_j%%d",cAddFull.Data()),inputList,nJets+1,h2EtaPtAll,1,nJets);
210 for(int i = 0; i< nJets+2;i++)Printf("Lead > %d %p",i,h2EtaPtLead[i]);
211 for(int i = 0; i< nJets+2;i++)Printf("LeadFull > %d %p",i,h2EtaPtLeadFull[i]);
212 for(int i = 0; i< nJets+2;i++)Printf("All > %d %p",i,h2EtaPtAll[i]);
213 h2EtaPtLead[0]->Draw("colz");
216 c1->SaveAs(Form("%s_%s_Cen%02d_EtaPtLead2D.%s",sinputPrint.Data(),cAdd.Data(),ic,printType.Data()));
217 if(!gROOT->IsBatch())
218 if(getchar()=='q')return 1;
222 Float_t fStepUp = fStepLo+fStep;
226 Int_t iBinLo = h2EtaPtLead[0]->GetYaxis()->FindBin(fStepLo);
227 Int_t iBinUp = h2EtaPtLead[0]->GetYaxis()->FindBin(fStepUp)-1;
228 TH1D *hProjLead = h2EtaPtLead[0]->ProjectionX(Form("hEtaPtLead_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
229 TH1D *hProjLeadFull = h2EtaPtLeadFull[0]->ProjectionX(Form("hEtaPtLeadFull_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
230 TH1D *hProjAll = h2EtaPtAll[nJets+1]->ProjectionX(Form("hEtaPtAll_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
232 ScaleH1(hProjLead,"#eta","1/N_{evt} dN_{jet}/d#eta",1./fNevents,true);
233 SetStyleH1(hProjLead,kBlue,0,kFullCircle);
234 ScaleH1(hProjLeadFull,"#eta","1/N_{evt} dN_{jet}/d#eta",1./fNevents,true);
235 SetStyleH1(hProjLeadFull,kRed,0,kFullCircle);
236 ScaleH1(hProjAll,"#eta","1/N_{evt} dN_{jet}/d#eta",1./fNevents,true);
237 SetStyleH1(hProjAll,kGray,1001,kFullCircle);
240 hProjAll->DrawCopy("hist");
241 hProjLead->DrawCopy("histsame");
242 hProjLeadFull->DrawCopy("histsame");
244 Float_t ptUp = fStepUp-h2EtaPtLead[0]->GetYaxis()->GetBinWidth(iBinUp);
246 Printf("%3.0f-%3.0f",fStepLo,ptUp);
248 txt = new TLatex(-1.1,1.1*hProjAll->GetMaximum(),Form("%s %s p_{T} = %3.0f-%3.0f GeV",sCen[ic].Data(),sinputJet.Data(),fStepLo,ptUp));
249 txt->SetTextSize(gStyle->GetTextSize());
251 c1->SaveAs(Form("%s_%s_Cen%02d_%03d-%03d_eta.%s",sinputPrint.Data(),cAdd.Data(),ic,(Int_t)fStepLo,(Int_t)ptUp,printType.Data()));
254 if(!gROOT->IsBatch())
255 if(getchar()=='q')return 1;
260 delete hProjLeadFull;
266 TH2F *h2PhiPtLead[nJets+2] = {0,};
267 TH2F *h2PhiPtLeadFull[nJets+2] = {0,};
268 TH2F *h2PhiPtAll[nJets+2] = {0,};
269 HistsFromSingleJets(Form("fh2PhiPt%s_j%%d",cAdd.Data()),inputList,1,h2PhiPtLead);
270 HistsFromSingleJets(Form("fh2PhiPt%s_j%%d",cAddFull.Data()),inputList,1,h2PhiPtLeadFull);
271 HistsFromSingleJets(Form("fh2PhiPt%s_j%%d",cAddFull.Data()),inputList,nJets+1,h2PhiPtAll,1,nJets);
274 h2PhiPtLead[0]->Draw("colz");
275 c1->SaveAs(Form("%s_%s_Cen%02d_phiPtLead2D.%s",sinputPrint.Data(),cAdd.Data(),ic,printType.Data()));
279 if(!gROOT->IsBatch())
280 if(getchar()=='q')return 1;
283 fStepUp = fStepLo+fStep;
286 Int_t iBinLo = h2PhiPtLead[0]->GetYaxis()->FindBin(fStepLo);
287 Int_t iBinUp = h2PhiPtLead[0]->GetYaxis()->FindBin(fStepUp)-1;
288 TH1D *hProjLead = h2PhiPtLead[0]->ProjectionX(Form("hPhiPtLead_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
289 TH1D *hProjLeadFull = h2PhiPtLeadFull[0]->ProjectionX(Form("hPhiPtLeadFull_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
290 TH1D *hProjAll = h2PhiPtAll[nJets+1]->ProjectionX(Form("hPhiPtAll_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
292 ScaleH1(hProjLead,"#phi","1/N_{evt} dN_{jet}/d#phi",1./fNevents,true);
293 SetStyleH1(hProjLead,kBlue,0,kFullCircle);
294 ScaleH1(hProjLeadFull,"#phi","1/N_{evt} dN_{jet}/d#phi",1./fNevents,true);
295 SetStyleH1(hProjLeadFull,kRed,0,kFullCircle);
296 ScaleH1(hProjAll,"#phi","1/N_{evt} dN_{jet}/d#phi",1./fNevents,true);
297 SetStyleH1(hProjAll,kGray,1001,kFullCircle);
299 hProjAll->SetMinimum(0);
301 hProjAll->DrawCopy("hist");
302 hProjLead->DrawCopy("histsame");
303 hProjLeadFull->DrawCopy("histsame");
305 Float_t ptUp = fStepUp-h2PhiPtLead[0]->GetYaxis()->GetBinWidth(iBinUp);
307 Printf("%3.0f-%3.0f",fStepLo,ptUp);
309 txt = new TLatex(0.0,1.1*hProjAll->GetMaximum(),Form("%s %s p_{T} = %3.0f-%3.0f GeV",sCen[ic].Data(),sinputJet.Data(),fStepLo,ptUp));
310 txt->SetTextSize(gStyle->GetTextSize());
312 c1->SaveAs(Form("%s_%s_Cen%02d_%03d-%03d_phi.%s",sinputPrint.Data(),cAdd.Data(),ic,(Int_t)fStepLo,(Int_t)ptUp,printType.Data()));
315 if(!gROOT->IsBatch())
316 if(getchar()=='q')return 1;
321 delete hProjLeadFull;
327 TH2F *h2AreaPtLead[nJets+2] = {0,};
328 TH2F *h2AreaPtLeadFull[nJets+2] = {0,};
329 TH2F *h2AreaPtAll[nJets+2] = {0,};
331 HistsFromSingleJets(Form("fh2AreaPt%s_j%%d",cAdd.Data()),inputList,1,h2AreaPtLead);
332 HistsFromSingleJets(Form("fh2AreaPt%s_j%%d",cAddFull.Data()),inputList,1,h2AreaPtLeadFull);
333 HistsFromSingleJets(Form("fh2AreaPt%s_j%%d",cAddFull.Data()),inputList,nJets+1,h2AreaPtAll,1,nJets);
336 h2AreaPtLead[0]->Draw("colz");
339 c1->SaveAs(Form("%s_%s_Cen%02d_areaPtLead2D.%s",sinputPrint.Data(),cAdd.Data(),ic,printType.Data()));
340 if(!gROOT->IsBatch())
341 if(getchar()=='q')return 1;
344 fStepUp = fStepLo+fStep;
347 Int_t iBinLo = h2AreaPtLead[0]->GetYaxis()->FindBin(fStepLo);
348 Int_t iBinUp = h2AreaPtLead[0]->GetYaxis()->FindBin(fStepUp)-1;
349 TH1D *hProjLead = h2AreaPtLead[0]->ProjectionX(Form("hAreaPtLead_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
350 TH1D *hProjLeadFull = h2AreaPtLeadFull[0]->ProjectionX(Form("hAreaPtLeadFull_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
351 TH1D *hProjAll = h2AreaPtAll[nJets+1]->ProjectionX(Form("hAreaPtAll_%d_%d_%d",iBinLo,iBinUp,ic),iBinLo,iBinUp,"e");
353 ScaleH1(hProjLead,"Area A","1/N_{evt} dN_{jet}/dA",1./fNevents,true);
354 SetStyleH1(hProjLead,kBlue,0,kFullCircle);
355 ScaleH1(hProjLeadFull,"Area A","1/N_{evt} dN_{jet}/dA",1./fNevents,true);
356 SetStyleH1(hProjLeadFull,kRed,0,kFullCircle);
357 ScaleH1(hProjAll,"Area A","1/N_{evt} dN_{jet}/dA",1./fNevents,true);
358 SetStyleH1(hProjAll,kGray,1001,kFullCircle);
360 hProjAll->SetMinimum(0);
361 hProjAll->DrawCopy("hist");
362 hProjLead->DrawCopy("histsame");
363 hProjLeadFull->DrawCopy("histsame");
365 Float_t ptUp = fStepUp-h2AreaPtLead[0]->GetYaxis()->GetBinWidth(iBinUp);
367 Printf("%3.0f-%3.0f",fStepLo,ptUp);
369 txt = new TLatex(0.,1.1*hProjAll->GetMaximum(),Form("%s %s p_{T} = %3.0f-%3.0f GeV",sCen[ic].Data(),sinputJet.Data(),fStepLo,ptUp));
370 txt->SetTextSize(gStyle->GetTextSize());
372 c1->SaveAs(Form("%s_%s_Cen%02d_%03d-%03d_area.%s",sinputPrint.Data(),cAdd.Data(),ic,(Int_t)fStepLo,(Int_t)ptUp,printType.Data()));
375 if(!gROOT->IsBatch())
376 if(getchar()=='q')return 1;
381 delete hProjLeadFull;
385 TH2F *h2AreaEta[nJets+1] = {0,};
386 HistsFromSingleJets(Form("fh2EtaArea%s_j%%d",cAdd.Data()),inputList,nJets,h2AreaEta);
387 ScaleH2(h2AreaEta[nJets],"area A","#eta","1/N_{evt} dN_{jets}/dAd#eta",1./fNevents,true);
389 h2AreaEta[nJets]->Draw("colz");
392 c1->SaveAs(Form("%s_%s_Cen%02d_areaEta2D.%s",sinputPrint.Data(),cAdd.Data(),ic,printType.Data()));
393 if(!gROOT->IsBatch())
394 if(getchar()=='q')return 1;
400 Int_t PlotSpectraPbPb(){
402 // PLot the simple 1D histos from the spectrum task
404 const Int_t iRebin = 4;
405 const int kMaxFiles = 5;
407 Double_t yMin = 0.01;
408 Double_t yMax = 1E+07;
410 TString sinputFile[kMaxFiles];
411 TFile* inputFile[kMaxFiles] = {kMaxFiles*0};
412 TString sinputDir[kMaxFiles];
413 TDirectory *inputDir[kMaxFiles] = {kMaxFiles*0};
414 TString sinputList[kMaxFiles];
415 TString sCen[kMaxFiles];
416 TList* inputList[kMaxFiles] = {kMaxFiles*0};
417 // TString sinputLegend[kMaxFiles];
418 TString sinputJet[kMaxFiles];
419 Int_t kColor[kMaxFiles];
420 Float_t nColl[kMaxFiles];
422 bool bLogLog = false;
423 // const Int_t kRef = 1; // anti -kT
426 TH1F* hJets[kMaxFiles];
431 sinputFile[iJF] = "~/alice/data/analysis/train/LHC10h_110116/PWG4_JetTasksOutput.root";
432 // sinputFile[iJF] = "~/alice/data/analysis/train_maf/output_110210.root";
433 sinputDir[iJF] = "PWG4_spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class00";
434 sinputList[iJF] = "pwg4spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class00";
435 sinputJet[iJF] = "anti-k_{T} R = 0.4";
436 sCen[iJF] = " 0-80%";
437 kColor[iJF] = kBlack;
441 // sinputFile[iJF] = "../output/PWG4_JetTasksOutput_Merge_051205b_Subtract3_UA1.root";
442 sinputFile[iJF] = "~/alice/data/analysis/train/LHC10h_110116/PWG4_JetTasksOutput.root";
443 // sinputFile[iJF] = "~/alice/data/analysis/train_maf/output_110210.root";
444 sinputDir[iJF] = "PWG4_spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class01";
445 sinputList[iJF] = "pwg4spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class01";
446 sinputJet[iJF] = " 0-10% Anti-k_{T} R = 0.4";
447 sCen[iJF] = " 0-10%";
452 // sinputFile[iJF] = "../output/PWG4_JetTasksOutput_Merge_051205b_Subtract3_UA1.root";
453 sinputFile[iJF] = "~/alice/data/analysis/train/LHC10h_110116/PWG4_JetTasksOutput.root";
454 // sinputFile[iJF] = "~/alice/data/analysis/train_maf/output_110210.root";
455 sinputDir[iJF] = "PWG4_spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class02";
456 sinputList[iJF] = "pwg4spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class02";
457 sinputJet[iJF] = "10-30% Anti-k_{T} R = 0.4";
458 sCen[iJF] = "10-30%";
459 kColor[iJF] = kRed-4;
463 // sinputFile[iJF] = "../output/PWG4_JetTasksOutput_Merge_051205b_Subtract3_UA1.root";
464 sinputFile[iJF] = "~/alice/data/analysis/train/LHC10h_110116/PWG4_JetTasksOutput.root";
465 // sinputFile[iJF] = "~/alice/data/analysis/train_maf/output_110210.root";
466 sinputDir[iJF] = "PWG4_spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class03";
467 sinputList[iJF] = "pwg4spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class03";
468 sinputJet[iJF] = "30-50% Anti-k_{T} R = 0.4";
469 sCen[iJF] = "30-50%";
470 kColor[iJF] = kRed-7;
474 // sinputFile[iJF] = "../output/PWG4_JetTasksOutput_Merge_051205b_Subtract3_UA1.root";
475 sinputFile[iJF] = "~/alice/data/analysis/train/LHC10h_110116/PWG4_JetTasksOutput.root";
476 // sinputFile[iJF] = "~/alice/data/analysis/train_maf/output_110210.root";
477 sinputDir[iJF] = "PWG4_spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class04";
478 sinputList[iJF] = "pwg4spec2_clustersAOD_ANTIKT04_B3_Filter00256_Cut00150_Skip00_clustersAOD_ANTIKT04_B1_Filter00256_Cut00150_Skip00_0000000000_Class04";
479 sinputJet[iJF] = "Anti-k_{T} R = 0.4";
480 sCen[iJF] = "50-80%";
481 kColor[iJF] = kRed-9;
486 for(int iF = 0; iF < kMaxFiles;iF++){
487 if(sinputFile[iF].Length()==0)continue;
488 if(gROOT->GetListOfFiles()->FindObject(sinputFile[iF].Data())){
489 inputFile[iF] = (TFile*)gROOT->GetListOfFiles()->FindObject(sinputFile[iF].Data());
492 inputFile[iF] = TFile::Open(sinputFile[iF].Data());
494 inputDir[iF] = (TDirectory*)inputFile[iF]->Get(sinputDir[iF].Data());
496 Printf("Dir not found %s",sinputDir[iF].Data());
499 inputList[iF] = (TList*)inputDir[iF]->Get(sinputList[iF].Data());
501 Printf("List not found %s",sinputList[iF].Data());
509 TCanvas *c1 = new TCanvas("c1","spectra",20,20,800,600);
510 TCanvas *c2 = new TCanvas("c2","ratio",820,20,800,600);
512 TLegend *leg1 = new TLegend(0.45,0.65,0.7,0.85);
513 leg1->SetHeader(Form("%s |#eta| < 0.4",sinputJet[0].Data()));
514 leg1->SetFillColor(0);
515 leg1->SetTextFont(gStyle->GetTextFont());
516 leg1->SetBorderSize(0);
518 char *cMaskRec = "fh1PtRecIn_j%d";
521 if(bLogLog)c1->SetLogx();
523 for(int iF = 0; iF < kMaxFiles;iF++){
524 if(sinputFile[iF].Length()==0)continue;
525 // Draw the jet spectra
526 if(!inputList[iF])continue;
528 HistsFromSingleJets(cMaskRec,inputList[iF],nJets,hRec,iRebin);
529 /// TH1F *hRec[nJets] = (TH1F*)inputList[iF]->FindObject("fh1PtJetsRecIn"); hRec[nJets]->Rebin(iRebin);
531 hRec[nJets]->SetMarkerStyle(kFullCircle);
532 hRec[nJets]->SetXTitle("p_{T} (GeV/c)");
533 hRec[nJets]->SetMarkerColor(kColor[iF]);
534 hRec[nJets]->Scale(1./1.6); // deta
535 hRec[nJets]->Scale(1./hRec[nJets]->GetBinWidth(1));
537 hRec[nJets]->SetYTitle("dN/dp_{T}dy");
541 ScaleNevent(hRec[nJets], inputFile[iF],AliAnalysisTaskJetServices::kSelected,0,iF); // <----- careful assumes iCen == iF
542 hRec[nJets]->SetYTitle("1/N_{evt} dN/dp_{T}");
543 // Printf("%d Ncall %f",iF,nColl[iF]);
544 // hRec[nJets]->Scale(1./nColl[iF]);
545 // hRec[nJets]->SetYTitle("1/(N_{coll}*(N_{evt}) dN/dp_{T}dy");
549 if(sCen[iF].Length()){
550 leg1->AddEntry(hRec[nJets],Form("%s",sCen[iF].Data()),"P");
553 hJets[iF] = hRec[nJets];
557 if(bLogLog)hRec[nJets]->SetAxisRange(5,100);
558 else hRec[nJets]->SetAxisRange(1,100);
561 if(yMax>0) hRec[nJets]->SetMaximum(yMax);
562 if(yMin>0) hRec[nJets]->SetMinimum(yMin);
563 hRec[nJets]->DrawCopy("P");
566 if(sinputJet[iF].Length())hRec[nJets]->DrawCopy("Psame");
569 if(getchar()=='q')return 1;
574 TString picName = "jetspectrumPbPb";
575 if(bLogLog)picName += "LogLog";
578 txt = new TLatex(5,0.1,"LHC2010 Pb+Pb #sqrt{s_{NN}} = 2.76 TeV");
579 txt->SetTextSize(gStyle->GetTextSize()*0.8);
581 ALICEWorkInProgress(c1,"02/15/2011");
582 c1->SaveAs(Form(cPrintMask,picName.Data()));
583 if(getchar()=='q')return 1;
592 picName = "jetspectrumLabels";
593 c2->SaveAs(Form(cPrintMask,picName.Data()));
594 if(getchar()=='q')return 1;
597 for(int iF = 0; iF < kMaxFiles;iF++){
598 if(sinputFile[iF].Length()==0)continue;
599 if(!hJets[iF])continue;
600 Printf("%d Ncoll %f",iF,nColl[iF]);
601 hJets[iF]->Scale(1./nColl[iF]);
602 hJets[iF]->SetYTitle("1/(N_{coll}*(N_{evt}) dN/dp_{T}dy");
605 const Int_t nPSmear = 9;
606 TH1F *hPythia[nPSmear];
607 // Fetch the smeared pythia spectra
611 TH1F* hRatio[kMaxFiles];
613 for(int i = 0;i < nPSmear;i++){
616 hPythia[i] = GetPythia8Spectrum(pName.Data(),"~/alice/sim/pythia8/examples/output/LHCJets_2.75TeV_allpt_R04.root",1.0,iRebin);
619 pName = Form("h1JetPtCh_C%02d_j%%d",i);
620 hPythia[i] = GetPythia8Spectrum(pName.Data(),"~/alice/sim/pythia8/examples/output/LHCJets_2.75TeV_allpt_R04.root",1.0,iRebin,nJets);
622 hPythia[i]->SetMarkerStyle(kOpenCircle);
623 hPythia[i]->SetMarkerColor(kBlack);
624 hPythia[i]->SetYTitle("1/(N_{coll}*N_{evt}) dN/dp_{T}dy");
625 hPythia[i]->SetAxisRange(0,100);
627 hPythia[i]->Draw("CP");
628 hPythia[i]->SetMaximum(1E-02);
629 hPythia[i]->SetMinimum(1E-09);
630 for(int iF = 0; iF < kMaxFiles;iF++){
631 if(sinputFile[iF].Length()==0)continue;
632 if(!hJets[iF])continue;
635 hJets[iF]->Draw("psame");
638 hRatio[iF] = (TH1F*)hJets[iF]->Clone(Form("hRatio%d",iF));
639 hRatio[iF]->SetMaximum(100);
640 hRatio[iF]->SetMinimum(0.01);
641 hRatio[iF]->Divide(hPythia[i]);
642 hRatio[iF]->SetYTitle("Ratio");
643 if(iF==0) hRatio[iF]->DrawCopy("p");
644 else hRatio[iF]->DrawCopy("psame");
649 if(getchar()=='q')return 1;
650 picName = Form("jetspectrumRatioPbPb_Smear%d",i);
651 c2->SaveAs(Form(cPrintMask,picName.Data()));
652 picName = Form("jetspectrumPbPb_Smear%d",i);
653 c1->SaveAs(Form(cPrintMask,picName.Data()));
654 if(getchar()=='q')return 1;
658 hPythia[nPSmear-1]->DrawCopy("P");
659 for(int i = 0;i < nPSmear-1;i++){
661 hPythia[i]->SetMarkerStyle(kFullCircle);
662 hPythia[i]->SetMarkerColor(kRed-9+i);
663 hPythia[i]->DrawCopy("psame");
665 TH1F *hRatioS = (TH1F*)hPythia[i]->Clone(Form("hPythia_%d",i));
666 hRatioS->Divide(hPythia[nPSmear-1]);
667 hRatioS->SetMaximum(1E5);
668 hRatioS->SetMinimum(0.1);
669 hRatioS->SetYTitle("Ratio");
671 if(i==0)hRatioS->DrawCopy("p");
672 else hRatioS->DrawCopy("psame");
675 if(getchar()=='q')return 1;
678 if(getchar()=='q')return 1;
679 picName = Form("jetSmearRatio");
680 c2->SaveAs(Form(cPrintMask,picName.Data()));
681 picName = Form("jetSmear");
682 c1->SaveAs(Form(cPrintMask,picName.Data()));
683 if(getchar()=='q')return 1;
685 // fetch the jet spectrum first
689 TH1F *hPythiaRef = GetPythia8Spectrum(pName.Data(),"~/alice/sim/pythia8/examples/output/LHCJets_2.75TeV_allpt_R04.root",1.0,1);
692 Float_t fMinPt[kMaxFiles];
693 for(int iF = 0; iF < kMaxFiles;iF++){
694 if(nColl[iF]<=0)continue;
695 for(int i = hPythiaRef->GetNbinsX();i >0;i--){
696 if(hPythiaRef->GetBinContent(i)>1./nColl[iF]){
697 fMinPt[iF] = hPythiaRef->GetBinCenter(i);
701 Printf("Ncoll %4.1f Min Pt %3.1f",nColl[iF],fMinPt[iF]);
704 char *cFile = "~/alice/sim/pythia8/examples/output/LHCJets_2.75TeV_allpt_R04.root";
705 TFile *fIn = (TFile*)gROOT->GetListOfFiles()->FindObject(cFile);
706 if(!fIn) fIn = TFile::Open(cFile);
709 TH1D* hPythia2[nPSmear];
710 for(int i = 0;i < nPSmear-1;i++){
712 TH2F *hCorrelation = 0;
713 for(int ij = 0;ij<2;ij++){
714 TH2F* hTmp = (TH2F*)fIn->Get(Form("h2SmearCorrelationCh_C%02d_j%d",i,ij));
715 if(hTmp&&!hCorrelation)hCorrelation = (TH2F*)hTmp->Clone(Form("%s_%d",hTmp->GetName(),i));
716 else if (hTmp) hCorrelation->Add(hTmp);
720 hPythia2[i] = hCorrelation->ProjectionY(Form("hPythia2_%d",i),10,300);
721 hPythia2[i]->SetMarkerStyle(kFullCircle);
722 hPythia2[i]->SetMarkerColor(kRed-9+i);
723 hPythia2[i]->Rebin(iRebin);
724 hPythia2[i]->SetAxisRange(0,100);
725 hPythia2[i]->Scale(1./hPythia2[i]->GetBinWidth(1));
726 // hist->Scale(1./xsec);
727 hPythia2[i]->Scale(1./1.); // deta
729 // Double_t xtotal = 71.39; // xtotal for 7 TeV!!
730 Double_t xtotal = 62.01; // xtotal for 2.76 TeV!!
731 // scale with fraction of total NSD cross section
732 hPythia2[i]->Scale(1/xtotal);
737 if(i==0)hPythia2[i]->DrawCopy("p");
738 else hPythia2[i]->DrawCopy("psame");
740 TH1F *hRatioS = (TH1F*)hPythia2[i]->Clone(Form("hPythia2_%d",i));
741 hRatioS->Divide(hPythia[nPSmear-1]);
742 hRatioS->SetMaximum(1E5);
743 hRatioS->SetMinimum(0.1);
744 hRatioS->SetYTitle("Ratio");
746 if(i==0)hRatioS->DrawCopy("p");
747 else hRatioS->DrawCopy("psame");
750 if(getchar()=='q')return 1;
757 void set_plot_style() {
758 const Int_t NRGBs = 5;
759 const Int_t NCont = 255;
761 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
762 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
763 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
764 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
765 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
766 gStyle->SetNumberContours(NCont);
770 Int_t PlotJetBFluctuations(){
771 // plot the diffent background estimates
774 const Float_t fCentLo[nCen] = {0,10,30,50};
775 const Float_t fCentUp[nCen] = {10,30,50,80};
776 TH2F *hFrame = new TH2F("hFrame",";#delta p_{T} (GeV/c);Probability/GeV",200,-70,70,100,1E-5,50);
777 hFrame->SetTitleOffset(1.5,"Y");
778 hFrame->SetTitleOffset(1.5,"X");
779 hFrame->SetLabelSize(hFrame->GetLabelSize("Y")*0.9,"Y");
780 hFrame->SetLabelSize(hFrame->GetLabelSize("X")*0.9,"X");
781 hFrame->SetTitleSize(hFrame->GetTitleSize("Y")*0.7,"Y");
782 hFrame->SetTitleSize(hFrame->GetTitleSize("X")*0.7,"X");
785 TString printType = "png";
788 TCanvas *c1 = new TCanvas("c11","c1",600,600);
791 // TFile::SetCacheFileDir("/tmp/");
793 // Martha, single particle jets
794 TFile *fM = TFile::Open("~/alice/jets/macros/corrections/tmp/MV_PWG4_JetTasksOutput_AOD_EmbeddingSingleTrack.root");
795 TH1D *hDeltaPtM[nCen] = {0};
796 TString sDeltaPtM = "";
799 Float_t fMinPtM = 20;
800 Float_t fMaxPtM = 40;
810 for(int ic = 0;ic < nCen;ic++){
811 tmpName = Form("PWG4_BkgFluctCent%dB%d",ic,iB);
812 sDeltaPtM = Form("anti-k_{T} embedded tracks %2.0f-%2.0f GeV (MV)",fMinPtM,fMaxPtM);
813 TDirectory *dir = (TDirectory*)fM->Get(tmpName.Data());
814 if(!dir)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
815 tmpName = Form("taskBkgFluctCent%dB%d",ic,iB);
816 TList *list = (TList*)dir->Get(tmpName.Data());
817 if(!list)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
819 TH3F *h3Tmp = (TH3F*)list->FindObject("fh3PtDeltaPtArea");
820 hDeltaPtM[ic] = h3Tmp->ProjectionY(Form("hDeltaM%d",ic),h3Tmp->GetXaxis()->FindBin(fMinPtM),h3Tmp->GetXaxis()->FindBin(fMaxPtM),
822 hDeltaPtM[ic]->Rebin(10);
823 Float_t fScale = hDeltaPtM[ic]->Integral("width");
824 if(fScale)hDeltaPtM[ic]->Scale(1./fScale);
825 hDeltaPtM[ic]->SetMarkerStyle(33);
826 hDeltaPtM[ic]->SetMarkerColor(kGreen+2);
827 hDeltaPtM[ic]->SetLineColor( hDeltaPtM[ic]->GetMarkerColor());
834 TFile *fL = TFile::Open("~/alice/jets/macros/corrections/tmp/2011-03-20_lcm_pw4plots.root");
836 for(int ic = 0;ic < nCen;ic++){
837 if(iB==1)tmpName = "BiA sa antikt centrality";
838 else if (iB==2)tmpName = "BiA va antikt centrality";
839 TH2F *h2Tmp = (TH2F*)fL->Get(tmpName.Data());
840 if(!h2Tmp)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
841 Int_t ibLo = h2Tmp->GetXaxis()->FindBin(fCentLo[ic]);
842 Int_t ibUp = h2Tmp->GetXaxis()->FindBin(fCentUp[ic])-1;
843 Printf("Line:%d bin %d - %d",__LINE__,ibLo,ibUp);
844 hBiaL[ic] = h2Tmp->ProjectionY(Form("hBiaL%d",ic),ibLo,ibUp,"E");
845 Float_t fScale = hBiaL[ic]->Integral("width");
846 if(fScale) hBiaL[ic]->Scale(1./fScale);
847 hBiaL[ic]->SetMarkerStyle(kFullCircle);
848 hBiaL[ic]->SetMarkerColor(kBlue);
849 hBiaL[ic]->SetLineColor( hBiaL[ic]->GetMarkerColor());
855 for(int ic = 0;ic < nCen;ic++){
856 if(iB==1)tmpName = "BiA sa RC skip0 centrality";
857 else if (iB==2)tmpName = "BiA va RC skip0 centrality";
859 TH2F *h2Tmp = (TH2F*)fL->Get(tmpName.Data());
860 if(!h2Tmp)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
861 Int_t ibLo = h2Tmp->GetXaxis()->FindBin(fCentLo[ic]);
862 Int_t ibUp = h2Tmp->GetXaxis()->FindBin(fCentUp[ic])-1;
863 Printf("Line:%d bin %d - %d",__LINE__,ibLo,ibUp);
864 hBiaRC[ic] = h2Tmp->ProjectionY(Form("hBiaRC%d",ic),ibLo,ibUp,"E");
865 Float_t fScale = hBiaRC[ic]->Integral("width");
866 if(fScale) hBiaRC[ic]->Scale(1./fScale);
867 hBiaRC[ic]->SetMarkerStyle(kFullCircle);
868 hBiaRC[ic]->SetMarkerColor(kRed);
869 hBiaRC[ic]->SetLineColor( hBiaRC[ic]->GetMarkerColor());
875 for(int ic = 0;ic < nCen;ic++){
876 if(iB==1)tmpName = "BiA sa RC skip2 centrality";
877 else if (iB==2)tmpName = "BiA va RC skip2 centrality";
878 sBiaRC2 = "BiA RC (excl. 2 leading jets)";
879 TH2F *h2Tmp = (TH2F*)fL->Get(tmpName.Data());
880 if(!h2Tmp)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
881 Int_t ibLo = h2Tmp->GetXaxis()->FindBin(fCentLo[ic]);
882 Int_t ibUp = h2Tmp->GetXaxis()->FindBin(fCentUp[ic])-1;
883 Printf("Line:%d bin %d - %d",__LINE__,ibLo,ibUp);
884 hBiaRC2[ic] = h2Tmp->ProjectionY(Form("hBiaRC2%d",ic),ibLo,ibUp,"E");
885 Float_t fScale = hBiaRC2[ic]->Integral("width");
886 if(fScale) hBiaRC2[ic]->Scale(1./fScale);
887 hBiaRC2[ic]->SetMarkerStyle(kOpenCircle);
888 hBiaRC2[ic]->SetMarkerColor(kRed);
889 hBiaRC2[ic]->SetLineColor( hBiaRC2[ic]->GetMarkerColor());
896 TLatex *txt = new TLatex();
897 txt->SetTextFont(gStyle->GetTextFont());
898 txt->SetTextSize(gStyle->GetTextSize()*0.6);
900 TLatex *txt2 = new TLatex();
901 txt2->SetTextFont(gStyle->GetTextFont());
902 txt2->SetTextSize(gStyle->GetTextSize()*0.7);
903 txt2->SetTextAlign(22);
904 txt2->SetTextColor(kRed);
907 if(iB==1)tmpName = "background sa vs multiplicity";
908 else if(iB==2)tmpName = "background va vs multiplicity";
909 TH2F *h2RhoVsMult = (TH2F*)fL->Get(tmpName.Data());
910 if(!h2RhoVsMult)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
911 c1->SetMargin(0.15,0.18,0.2,0.10);
913 h2RhoVsMult->SetTitleOffset(1.5,"Y");
914 h2RhoVsMult->SetTitleOffset(1.5,"X");
915 h2RhoVsMult->SetLabelSize(h2RhoVsMult->GetLabelSize("Y")*0.9,"Y");
916 h2RhoVsMult->SetLabelSize(h2RhoVsMult->GetLabelSize("X")*0.9,"X");
917 h2RhoVsMult->SetTitleSize(h2RhoVsMult->GetTitleSize("Y")*0.7,"Y");
918 h2RhoVsMult->SetTitleSize(h2RhoVsMult->GetTitleSize("X")*0.7,"X");
919 h2RhoVsMult->SetXTitle("input tracks");
920 h2RhoVsMult->SetYTitle("#rho (GeV/unit area)");
921 h2RhoVsMult->SetAxisRange(0,3000.);
922 h2RhoVsMult->Draw("colz");
924 txt->DrawLatex(100,180,"LHC 2010 Pb+Pb Run #sqrt{s_{NN}} = 2.76 TeV");
925 // txt2->DrawLatex(800,150,"ALICE Performance");
926 // txt2->DrawLatex(800,140,"01/03/2011");
928 c1->SaveAs(Form("rhovsmult_B%d.%s",iB,printType.Data()));
929 if(getchar()=='q')return 1;
931 if(iB==1)tmpName = "background sa vs centrality";
932 else if(iB==2)tmpName = "background va vs centrality";
933 TH2F *h2RhoVsCent = (TH2F*)fL->Get(tmpName.Data());
934 if(!h2RhoVsCent)Printf("Line:%d %s not found",__LINE__,tmpName.Data());
935 h2RhoVsCent->SetXTitle("centrality (%)");
936 h2RhoVsCent->SetYTitle("#rho (GeV/unit area)");
938 h2RhoVsCent->SetTitleOffset(1.5,"Y");
939 h2RhoVsCent->SetTitleOffset(1.5,"X");
940 h2RhoVsCent->SetLabelSize(h2RhoVsCent->GetLabelSize("Y")*0.9,"Y");
941 h2RhoVsCent->SetLabelSize(h2RhoVsCent->GetLabelSize("X")*0.9,"X");
942 h2RhoVsCent->SetTitleSize(h2RhoVsCent->GetTitleSize("Y")*0.7,"Y");
943 h2RhoVsCent->SetTitleSize(h2RhoVsCent->GetTitleSize("X")*0.7,"X");
944 h2RhoVsCent->SetAxisRange(3,200,"Y");
945 h2RhoVsCent->Draw("colz");
946 // txt->DrawLatex(20,180,"LHC 2010 Pb+Pb Run #sqrt{s_{NN}} = 2.76 TeV");
947 // txt2->DrawLatex(50,150,"ALICE Performance");
948 // txt2->DrawLatex(50,140,"01/03/2011");
950 c1->SaveAs(Form("rhovscent_B%d.%s",iB,printType.Data()));
951 if(getchar()=='q')return 1;
953 // fetch the data from bastian...
954 Float_t fMinPtB = fMinPtM;
955 Float_t fMaxPtB = fMaxPtM;
958 // the embbedded jets, carefull, take only above 60 GeV
959 // c = all jets, d = leading jets, e = single tracks
960 TFile *fB1 = TFile::Open("~/alice/jets/macros/corrections/tmp/Bastian_merged_jetemb_110304dg.root");
961 TH1D *hDeltaPtB1[nCen] = {0};
962 TString sDeltaPtB1 = "";
963 for(int ic = 0;ic < nCen;ic++){
964 tmpName = Form("PWG4_JetResponse_%s_%s%02d_B%d_Filter00256_Cut%05d_Skip00","clusters", "ANTIKT", (Int_t)(0.4*10), iB, (Int_t)(0.15*1000));
965 TDirectoryFile *df = dynamic_cast<TDirectoryFile*> (fB1->Get(tmpName.Data()));
966 sDeltaPtB1 = Form("anti-k_{T} embedded jet %2.0f-%2.0f GeV",fMinPtB,fMaxPtB);
967 if(!df)Printf("%d %s not found",__LINE__,tmpName.Data());
968 tmpName.ReplaceAll("PWG4_JetResponse","jetresponse");
969 TList *list = dynamic_cast<TList*> (df->Get(tmpName.Data()));
970 if(!list)Printf("%d %s not found",__LINE__,tmpName.Data());
971 tmpName = Form("pt_smearing%d",ic+1);
972 TH2F *hTmp = (TH2F*)list->FindObject(tmpName.Data());
973 if(!hTmp)Printf("%d %s not found",__LINE__,tmpName.Data());
974 int ibLo = hTmp->GetYaxis()->FindBin(fMinPtB);
975 int ibUp = hTmp->GetYaxis()->FindBin(fMaxPtB)-1;
976 hDeltaPtB1[ic] = hTmp->ProjectionX(Form("fHistDeltaPtB1_c%d",ic),ibLo,ibUp,"E");
977 hDeltaPtB1[ic]->SetMarkerStyle(kFullSquare);
978 hDeltaPtB1[ic]->SetMarkerColor(kBlue);
979 hDeltaPtB1[ic]->SetLineColor(hDeltaPtB1[ic]->GetMarkerColor());
980 hDeltaPtB1[ic]->Rebin(2);
981 Float_t fScale = hDeltaPtB1[ic]->Integral("width");
982 if(fScale) hDeltaPtB1[ic]->Scale(1./fScale);
986 TFile *fB2 = TFile::Open("~/alice/jets/macros/corrections/tmp/Bastian_merged_trackemb_110304h.root");
987 TH1D *hDeltaPtB2[nCen] = {0};
988 TString sDeltaPtB2 = "";
989 for(int ic = 0;ic < nCen;ic++){
990 tmpName = Form("PWG4_JetResponse_%s_%s%02d_B%d_Filter00256_Cut%05d_Skip00","clusters", "ANTIKT", (Int_t)(0.4*10), iB, (Int_t)(0.15*1000));
991 TDirectoryFile *df = dynamic_cast<TDirectoryFile*> (fB2->Get(tmpName.Data()));
992 if(!df)Printf("%d %s not found",__LINE__,tmpName.Data());
993 sDeltaPtB2 = Form("anti-k_{T} embedded track %2.0f-%2.0f GeV BB",fMinPtB,fMaxPtB);
994 tmpName.ReplaceAll("PWG4_JetResponse","jetresponse");
995 TList *list = dynamic_cast<TList*> (df->Get(tmpName.Data()));
996 if(!list)Printf("%d %s not found",__LINE__,tmpName.Data());
997 tmpName = Form("pt_smearing%d",ic+1);
998 TH2F *hTmp = (TH2F*)list->FindObject(tmpName.Data());
999 if(!hTmp)Printf("%d %s not found",__LINE__,tmpName.Data());
1000 int ibLo = hTmp->GetYaxis()->FindBin(fMinPtB);
1001 int ibUp = hTmp->GetYaxis()->FindBin(fMaxPtB)-1;
1002 hDeltaPtB2[ic] = hTmp->ProjectionX(Form("fHistDeltaPtB2_c%d",ic),ibLo,ibUp,"E");
1003 hDeltaPtB2[ic]->SetMarkerStyle(33);
1004 hDeltaPtB2[ic]->SetMarkerColor(kBlue+4);
1005 hDeltaPtB2[ic]->SetLineColor(hDeltaPtB2[ic]->GetMarkerColor());
1006 hDeltaPtB2[ic]->Rebin(2);
1007 Float_t fScale = hDeltaPtB2[ic]->Integral("width");
1008 if(fScale) hDeltaPtB2[ic]->Scale(1./fScale);
1014 c1->SetMargin(0.15,0.05,0.2,0.05);
1016 TF1 *gaus = new TF1("gaus","gaus",-60,2);
1017 TF1 *gaus2 = new TF1("gaus2","gaus",-60,2);
1020 Double_t sigma_err = 0;
1024 for(int ic = 0;ic < nCen;ic++){
1025 TLegend *leg1 = new TLegend(0.2,0.65,0.3,0.93);
1026 leg1->SetHeader(Form("Pb+Pb %2.0f-%2.0f%% R = 0.4 (B%d)",fCentLo[ic],fCentUp[ic],iB));
1027 leg1->SetFillColor(0);
1028 leg1->SetTextFont(gStyle->GetTextFont());
1029 leg1->SetTextSize(gStyle->GetTextSize()*0.6);
1030 leg1->SetBorderSize(0);
1034 hBiaL[ic]->DrawCopy("psame");
1035 leg1->AddEntry(hBiaL[ic],Form("BiA anti-k_{T}"),"P");
1039 hBiaRC2[ic]->DrawCopy("psame");
1040 tmpGaus = FitLHSgaus(hBiaRC2[ic],sigma,sigma_err,mean);
1041 tmpGaus->SetRange(-40,40);
1042 tmpGaus->SetLineColor( hBiaRC2[ic]->GetLineColor());
1043 tmpGaus->SetLineStyle(kDashed);
1044 tmpGaus->Draw("same");
1045 leg1->AddEntry(hBiaRC2[ic],sBiaRC2.Data(),"P");
1046 leg1->AddEntry(tmpGaus,Form("LHS Gaus fit: #mu = %2.2f, #sigma = %2.2f",mean,sigma),"L");
1048 hBiaRC[ic]->DrawCopy("psame");
1049 tmpGaus = FitLHSgaus(hBiaRC[ic],sigma,sigma_err,mean);
1050 tmpGaus->SetRange(-40,40);
1051 tmpGaus->SetLineColor( hBiaRC[ic]->GetLineColor());
1052 tmpGaus->Draw("same");
1053 leg1->AddEntry(hBiaRC[ic],sBiaRC.Data(),"P");
1054 leg1->AddEntry(tmpGaus,Form("LHS Gaus fit: #mu = %2.2f, #sigma = %2.2f",mean,sigma),"L");
1056 hDeltaPtB1[ic]->Draw("psame");
1057 tmpGaus = FitLHSgaus(hDeltaPtB1[ic],sigma,sigma_err,mean);
1058 tmpGaus->SetRange(-40,40);
1059 tmpGaus->SetLineColor( hDeltaPtB1[ic]->GetLineColor());
1060 tmpGaus->Draw("same");
1061 leg1->AddEntry(hDeltaPtB1[ic],sDeltaPtB1.Data(),"P");
1062 leg1->AddEntry(tmpGaus,Form("LHS Gaus fit: #mu = %2.2f, #sigma = %2.2f",mean,sigma),"L");
1065 hDeltaPtB2[ic]->Draw("psame");
1066 tmpGaus = FitLHSgaus(hDeltaPtB2[ic],sigma,sigma_err,mean);
1067 tmpGaus->SetRange(-40,40);
1068 tmpGaus->SetLineColor( hDeltaPtB2[ic]->GetLineColor());
1069 tmpGaus->Draw("same");
1070 leg1->AddEntry(hDeltaPtB2[ic],sDeltaPtB2.Data(),"P");
1071 leg1->AddEntry(tmpGaus,Form("LHS Gaus fit: #mu = %2.2f, #sigma = %2.2f",mean,sigma),"L");
1073 hDeltaPtM[ic]->DrawCopy("psame");
1074 tmpGaus = FitLHSgaus(hDeltaPtM[ic],sigma,sigma_err,mean);
1075 tmpGaus->SetRange(-40,40);
1076 tmpGaus->SetLineColor( hDeltaPtM[ic]->GetLineColor());
1077 tmpGaus->Draw("same");
1078 leg1->AddEntry(hDeltaPtM[ic],sDeltaPtM.Data(),"P");
1079 leg1->AddEntry(tmpGaus,Form("LHS Gaus fit: #mu = %2.2f, #sigma = %2.2f",mean,sigma),"L");
1085 // txt2->DrawLatex(0.5,0.97,"ALICE Performance 01/03/2011");
1087 c1->SaveAs(Form("deltaPt_pT_%d_%d_B%d_cen%02d.%s",(Int_t)fMinPtM,(Int_t)fMaxPtM,iB,ic,printType.Data()));
1088 if(getchar()=='q')return 1;
1100 void ScaleH1(TH1* h,char* cX,char* cY,Float_t fScale,Bool_t bWidth){
1106 for(int ib = 1;ib <= h->GetNbinsX();ib++){
1107 Float_t val = h->GetBinContent(ib);
1108 Float_t err = h->GetBinError(ib);
1109 Float_t w = h->GetBinWidth(ib);
1110 h->SetBinContent(ib,val/w);
1111 h->SetBinError(ib,err/w);
1112 // Printf("width %f",w);
1121 void ScaleH2(TH2* h,char* cX,char* cY,char* cZ,Float_t fScale,Bool_t bWidth){
1127 for(int ibx = 1;ibx <= h->GetNbinsX();ibx++){
1128 for(int iby = 1;iby <= h->GetNbinsY();iby++){
1129 Float_t val = h->GetBinContent(ibx,iby);
1130 Float_t err = h->GetBinError(ibx,iby);
1131 Float_t wx = h->GetXaxis()->GetBinWidth(ibx);
1132 Float_t wy = h->GetYaxis()->GetBinWidth(iby);
1133 h->SetBinContent(ibx,iby,val/(wx*wy));
1134 h->SetBinError(ibx,iby,err/(wx*wy));
1135 // Printf("width %f",w);
1145 void SetStyleH1(TH1 *h,Int_t color,Int_t fillStyle,Int_t markerStyle){
1147 h->SetLineColor(color);
1149 h->SetMarkerColor(color);
1150 h->SetFillColor(color);
1152 if(fillStyle)h->SetFillStyle(fillStyle);
1153 if(markerStyle)h->SetMarkerStyle(markerStyle);
1156 void HistsFromSingleJets(char* cMask,TList *list,Int_t nJets,TH1F** h,Int_t iRebin,int iFirst){
1158 for(int ij = iFirst;ij < nJets;ij++){
1159 h[ij] = (TH1F*)list->FindObject(Form(cMask,ij));
1163 h[ij] = (TH1F*)h[ij]->Clone();
1164 h[ij]->SetDirectory(gROOT);
1165 h[ij]->Rebin(iRebin);
1168 h[nJets] = (TH1F*)h[ij]->Clone(Form(cMask,nJets));
1171 h[nJets]->Add(h[ij]);
1175 Printf("%s not found",Form(cMask,ij));
1182 void HistsFromSingleJets(char* cMask,TList *list,Int_t nJets,TH2F** h,Int_t iRebin,int iFirst){
1184 for(int ij = iFirst;ij < nJets;ij++){
1185 h[ij] = (TH2F*)list->FindObject(Form(cMask,ij));
1188 h[ij] = (TH2F*)h[ij]->Clone();
1189 h[ij]->SetDirectory(gROOT);
1190 h[ij]->Rebin(iRebin);
1193 h[nJets] = (TH2F*)h[ij]->Clone(Form(cMask,nJets));
1196 h[nJets]->Add(h[ij]);
1200 Printf("%s not found",Form(cMask,ij));
1206 void ScaleNevent(TH1* h,TFile *fIn,Int_t iCond,Int_t iMC,Int_t iCen){
1207 // fetch the trigger histos
1209 TDirectory *dir = (TDirectory*)fIn->Get("PWG4_services");
1210 TList *list1 = (TList*)dir->Get("pwg4serv");
1212 TH2F* hTriggerCount =(TH2F*)list1->FindObject("fh2TriggerCount");
1213 Float_t nevents = hTriggerCount->GetBinContent(hTriggerCount->FindBin(0+iCen,iCond)); // we have to scale with number of triggers?
1215 Float_t xsection = 1;
1217 // 7 TeV sigma ND = 48.85 sigma NEL = 71.39 (Pythia 8... confirm with 6
1219 Printf("MC Scaling setting nevents=%f to 1, xsection = %E",nevents,xsection);
1223 Printf("Scaling %s with number of event %f",h->GetName(),nevents);
1225 Float_t scalef = 1./nevents/xsection;
1226 Printf("scale factor %E",scalef);
1232 TF1* FitLHSgaus(TH1D *hDeltaPt, double &sigma, double &sigma_error, double &mean)
1235 TF1 *f1 = new TF1("LHSgaus","gaus");
1236 f1->SetParameters(1,0,11);
1237 hDeltaPt->Fit(f1,"R0","",-50.,0.);
1238 // f1 = hDeltaPt->GetFunction("gaus");
1239 sigma = f1->GetParameter(2);
1240 mean = f1->GetParameter(1);
1241 hDeltaPt->Fit(f1,"R0","",mean-3.*sigma,mean+0.3*sigma);
1242 mean = f1->GetParameter(1);
1243 sigma = f1->GetParameter(2);
1244 sigma_error = f1->GetParError(2);