]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/macros/DrawTPCPIDSplines.C
TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / ANALYSIS / macros / DrawTPCPIDSplines.C
1 /*
2
3  // example usage:
4  TH2D h2("h2",";p (GeV/#it{c});d#it{E}/d#it{x} (arb. units)",100,0,20,100,0,200);
5  h2.Draw();
6  .L $ALICE_ROOT/ANALYSIS/macros/DrawSplines.C
7  DrawTPCPIDSplines(122374,2);
8
9
10
11 */
12
13 void DrawTPCPIDSplines(Int_t run, Int_t pass, Float_t dEdxMin=0., Float_t dEdxMax=200, Float_t pMin=0.1, Float_t pMax=20.)
14 {
15   //
16   // simple macro to draw splines using the AliPIDResponse class
17   // only splines for electrons, pions, kaons and protons 
18   // NOTE: This is only for simple overlaying purposes not for QA.
19   //       The TPC pid depends on eta, the splines are eta averaged
20   //         so an overlay could look wrong, depending on the eta
21   //         of the track selection.
22   //       For QA purposes the nSigma values with full eta correction
23   //         should be used as done e.g. in AliAnalysisTaskPIDqa
24   //
25   AliPIDResponse *pidres = new AliPIDResponse(kFALSE);
26   //
27   pidres->SetOADBPath("$ALICE_ROOT/OADB");
28   pidres->SetCachePID(kFALSE);
29   pidres->SetUseTPCEtaCorrection(kFALSE);
30   pidres->SetUseTPCMultiplicityCorrection(kFALSE);
31   pidres->SetTunedOnData(kFALSE,2);
32   pidres->SetCurrentAliRootRev(62720);
33
34   AliESDEvent *ev=new AliESDEvent;
35   pidres->InitialiseEvent(ev,pass,run);
36
37   const  Double_t first=pMin;
38   const  Double_t last=pMax;
39   const  Double_t expMax=TMath::Log(last/first);
40   const  Int_t nbinsX=100;
41
42   AliTPCPIDResponse &tpcpid=pidres->GetTPCResponse();
43
44   for (Int_t i=0; i<AliPID::kSPECIES; ++i){
45     if (i==AliPID::kMuon) continue;
46     TGraph *gr=new TGraph;
47     gr->SetNameTitle(Form("Spline_Graph_%s",AliPID::ParticleName(i)),Form("%s splines;p (GeV/#it{c});d#it{E}/d#it{x} (arb. units)",AliPID::ParticleName(i)));
48     for (Int_t ip=0; ip<nbinsX; ++ip) {
49       Double_t p=first*TMath::Exp(expMax/nbinsX*(Double_t)ip);
50       Double_t dEdx=tpcpid.GetExpectedSignal(p,i);
51       if (p<pMin || p>pMax || dEdx<dEdxMin || dEdx>dEdxMax ) continue;
52       gr->SetPoint(gr->GetN(),p,dEdx);
53     }
54     gr->Draw("c");
55     gr->SetLineWidth(2);
56   }
57 }
58
59