]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Upgrade/macros/HighPtFiltered.C
Nicer plots
[u/mrichter/AliRoot.git] / TPC / Upgrade / macros / HighPtFiltered.C
1 void DrawPTResol(){
2   //
3   // Example macro to create the 1/pt resolution plot for Marek
4   //
5   TFile * f = TFile::Open("Filtered.root");
6   TTree * treePt= (TTree*)f->Get("highPt");
7   //
8   //
9   // 
10   TCut cutNcl = "esdTrack.GetTPCClusterInfo(3,1)>120&&esdTrack.fITSncls>4";
11   TH2 *phis1PtPt[3]={0};
12   TH1 *his1PtPtRes[3]={0};
13   TObjArray  * fitArray = new TObjArray(3);
14   //
15   //
16   treePt->Draw("abs(esdTrack.fP[4])-1/particle.Pt():1/particle.Pt()>>his1Pt1Pt(20,0,0.5,100,-0.01,0.01)",cutNcl,"colz");
17   phis1PtPt[0] = (TH2*)treePt->GetHistogram()->Clone();
18   phis1PtPt[0]->FitSlicesY(0,0,-1,0,"QNR",fitArray);
19   his1PtPtRes[0]=(TH1*)fitArray->At(2)->Clone();
20   //
21   his1PtPtRes[0]->Draw();
22 }
23
24
25 void DrawMatchingEffiency(){
26   //
27   // problem with ITS simulation looks like
28   //
29   TFile * f = TFile::Open("Filtered.root");  
30   TTree * treePt= (TTree*)f->Get("highPt");
31   treePt->SetAlias("ITSrefit","(esdTrack.fFlags&0x4)!=0");
32   //
33   //
34   TCut cutNcl = "esdTrack.GetTPCClusterInfo(3,1)>120&&abs(esdTrack.fP[3])<0.9"; 
35   TCut cutPileUp = "abs(particle.fVt)<0.000000001&&abs(esdTrack.fP[1])<15"; 
36   TCut cutFindable = "particle.R()<0.2&&nrefITS>5"; 
37   treePt->Draw("ITSrefit:1/particle.Pt()>>hisMatching(20,0,2)",cutNcl+cutPileUp+cutFindable,"prof");
38 }
39
40
41
42
43 void DrawMatchingEffiency(){
44   //
45   //
46   //  
47   TCut cutNcl = "esdTrack.GetTPCClusterInfo(3,1)>120&&abs(esdTrack.fP[3])<0.9"; 
48   TCut cutPileUp = "abs(particle.fVt)<0.000000001"; 
49   TCut cutFindable = "particle.R()<0.2&&tpcTrackLength"; 
50   TCut cutBug="abs(vtxESD.fPosition[2]-particle.fVz)<0.01";  // fix the bug after  
51   //
52   //
53   TChain* chains[20]={0};
54   TProfile * hefFindable[20]={0};
55   chains[0]=AliXRDPROOFtoolkit::MakeChain("pileup_4.list","MCEffTree",0,1000,0);
56   chains[1]=0;
57   //
58   chains[2]=AliXRDPROOFtoolkit::MakeChain("pileup_6.list","MCEffTree",0,1000,0);
59   chains[3]=AliXRDPROOFtoolkit::MakeChain("pileup_6_gem.list","MCEffTree",0,1000,0);
60   //
61   chains[4]=AliXRDPROOFtoolkit::MakeChain("pileup_8.list","MCEffTree",0,1000,0);
62   //
63   chains[6]=AliXRDPROOFtoolkit::MakeChain("pileup_10.list","MCEffTree",0,1000,0);
64   chains[7]=AliXRDPROOFtoolkit::MakeChain("pileup_10_gem.list","MCEffTree",0,1000,0);
65   //
66   //  
67   TFile *fhisto = TFile::Open("histoEff.root","update");
68   for (Int_t ihis=0;ihis<20; ihis++){
69     if (!chains[ihis]) continue;
70     char hname[1000];
71     snprintf(hname,100,"EffFindable_%d_%d",ihis%2,((ihis/2)+2)*2);
72     printf("%d\t%s\n",ihis,hname);
73     //
74     hefFindable[ihis] = (TProfile*)fhisto->Get(hname);
75     if (!hefFindable[ihis]){
76       chains[ihis]->SetMarkerStyle(25);    
77       chains[ihis]->SetCacheSize(1000000000);
78       chains[ihis]->Draw("isRec:1/particle.Pt()>>his(10,0,4)",cutPileUp+cutFindable+cutBug,"prof");
79       hefFindable[ihis]=(TProfile*)(chains[ihis]->GetHistogram()->Clone());
80       hefFindable[ihis]->SetName(hname);
81       fhisto->cd();
82       hefFindable[ihis]->Write(hname);
83     }
84   }
85
86   TLegend * legend = new TLegend(0.11,0.11,0.5,0.4,"TPC Efficiency for findable tracks");
87   for (Int_t ihis=0; ihis<20; ihis++){
88     if (hefFindable[ihis]==0) continue;
89     hefFindable[ihis]->GetXaxis()->SetTitle("1/p_{T}");
90     hefFindable[ihis]->GetYaxis()->SetTitle("#epsilon");
91     hefFindable[ihis]->SetMinimum(0.85);
92     hefFindable[ihis]->SetMaximum(1.01);
93     if (ihis%2==0) hefFindable[ihis]->SetMarkerStyle(21);
94     if (ihis%2==1) hefFindable[ihis]->SetMarkerStyle(25);
95     hefFindable[ihis]->SetMarkerColor(1+ihis/2);    
96     if (ihis==0) hefFindable[ihis]->Draw();
97     hefFindable[ihis]->Draw("same");
98     legend->AddEntry(hefFindable[ihis],Form("GEM%d Pileup%d",ihis%2,((ihis/2)+2)*2));
99   }
100   legend->Draw();
101
102   
103 }
104
105
106 /*
107  for a in `ls -d /hera/alice/mkowalsk/alice/simulations/gas/pileup*/`; do 
108    echo $a; 
109    dname=`basename $a`;
110    ls $a/Filtered/*/F*.root > $dname.list
111  done;
112
113
114   
115
116 */