updated task to make it possible to run on the grid
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliConversionTrackCuts.cxx
CommitLineData
4267afec 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Primary Author: Svein Lindal <slindal@fys.uio.no> *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/// @file AliConversionTrackCuts.cxx
17/// @author Svein Lindal
92efd725 18/// @brief Base class for analysation of conversion particle - track correlations
4267afec 19
20
21#include "AliConversionTrackCuts.h"
92efd725 22//#include "AliAODTrack.h"
4267afec 23#include "AliAODEvent.h"
24#include <TFormula.h>
25#include <iostream>
26#include "TH2F.h"
27
28
29using namespace std;
30ClassImp(AliConversionTrackCuts)
31
32
33const char* AliConversionTrackCuts::fgkCutNames[AliConversionTrackCuts::kNCuts] = {
34 "nClusTPC",
35 "FoundFindable",
36 "Chi2PerNDF",
37 "Kink",
38 "DCA_Z",
39 "DCA_XY",
40 "TPCRefit"
41 "kAccTracks"
42};
43
44
45
46//________________________________________________________________________
47AliConversionTrackCuts::AliConversionTrackCuts() :
92efd725 48AliAnalysisCuts(),
4267afec 49 fFlagsOn(0x0),
50 fFlagsOff(0x0),
51 fRejectKinkDaughters(kTRUE),
52 fDCARfixed(kTRUE),
53 fDCARptFormula(""),
54 fDCARmax(1E20),
55 fDCAZfixed(kTRUE),
56 fDCAZptFormula(""),
57 fDCAZmax(1E20),
58 fDCAXYmax(1E20),
59 fSPDminNClusters(0),
60 fITSminNClusters(0),
61 fITSmaxChi2(1E20),
62 fTPCminNClusters(0),
63 fTPCClusOverFindable(0.0),
64 fTPCmaxChi2(1E20),
65 fAODTestFilterBit(-1),
66 fRequireTPCRefit(kFALSE),
67 fhPhi(NULL),
68 fhPt(NULL),
69 fhPhiPt(NULL),
70 fhdcaxyPt(NULL),
a280ac15 71 fhdcazPt(NULL),
72 fhnclpt(NULL),
73 fhnclsfpt(NULL),
4267afec 74 fHistograms(NULL)
75{
76 //Constructor
92efd725 77 //SetUpAxes();
4267afec 78}
79//________________________________________________________________________
80AliConversionTrackCuts::AliConversionTrackCuts(TString name, TString title = "title") :
81 AliAnalysisCuts(name, title),
82 fFlagsOn(0x0),
83 fFlagsOff(0x0),
84 fRejectKinkDaughters(kTRUE),
85 fDCARfixed(kTRUE),
86 fDCARptFormula(""),
87 fDCARmax(1E20),
88 fDCAZfixed(kTRUE),
89 fDCAZptFormula(""),
90 fDCAZmax(1E20),
91 fDCAXYmax(1E20),
92 fSPDminNClusters(0),
93 fITSminNClusters(0),
94 fITSmaxChi2(1E20),
95 fTPCminNClusters(0),
a280ac15 96 fTPCClusOverFindable(0.0),
4267afec 97 fTPCmaxChi2(1E20),
98 fAODTestFilterBit(-1),
99 fRequireTPCRefit(kFALSE),
100 fhPhi(NULL),
101 fhPt(NULL),
102 fhPhiPt(NULL),
103 fhdcaxyPt(NULL),
a280ac15 104 fhdcazPt(NULL),
105 fhnclpt(NULL),
106 fhnclsfpt(NULL),
4267afec 107 fHistograms(NULL)
108{
109 //Constructor
92efd725 110// SetUpAxes();
849102f9 111}
4267afec 112
113
114//________________________________________________________________________________
115 AliConversionTrackCuts::~AliConversionTrackCuts() {
116 ///destructor
117 // if(fHistograms)
118 // delete fHistograms;
119 // fHistograms = NULL;
120
121}
122
123TList * AliConversionTrackCuts::CreateHistograms() {
124 //Create the histograms
125 if(!fHistograms) fHistograms = new TList();
126
127 fHistograms->SetOwner(kTRUE);
128 fHistograms->SetName("trackCuts");
129
130 fhPhi = new TH2F("phi", "phi", kNCuts+2, kPreCut -0.5, kNCuts + 0.5,
131 128, 0, TMath::TwoPi());
132 TAxis * xax = fhPhi->GetXaxis();
133 for(Int_t i = 0; i < kNCuts; i++){
134 xax->SetBinLabel(xax->FindFixBin(i), fgkCutNames[i]);
135 }
136 fHistograms->Add(fhPhi);
137
138
139
140 fhPt = new TH2F("pt", "pt", kNCuts+2, kPreCut -0.5, kNCuts + 0.5,
141 100, 0., 100.);
142 xax = fhPt->GetXaxis();
143 for(Int_t i = 0; i < kNCuts; i++){
144 xax->SetBinLabel(xax->FindFixBin(i), fgkCutNames[i]);
145 }
146 fHistograms->Add(fhPt);
147
148 fhPhiPt = new TH2F("phipt", "phipt", 100, 0, 100, 64, 0, TMath::TwoPi());
149 fHistograms->Add(fhPhiPt);
150
151 fhdcaxyPt = new TH2F("dcaxypt", "dcaxypt", 100, 0, 100, 100, 0, 100);
152 fHistograms->Add(fhdcaxyPt);
153
154 fhdcazPt = new TH2F("dcazpt", "dcazpt", 100, 0, 100, 100, 0, 100);
155 fHistograms->Add(fhdcazPt);
156
157 fhnclpt = new TH2F("nclstpcvspt", "nclstpcvspt", 100, 0, 100, 100, 0, 100);
158 fHistograms->Add(fhnclpt);
159
160 fhnclsfpt = new TH2F("nclsfpt", "nclsfpt", 100, 0, 100, 100, 0, 1.2);
161 fHistograms->Add(fhnclsfpt);
162
163 return fHistograms;
164}
165
166
167void AliConversionTrackCuts::FillHistograms(Int_t cutIndex, AliVTrack * track, Bool_t passed = kFALSE) {
168 //Fill histograms
169 fhPhi->Fill(cutIndex, track->Phi());
170 fhPt->Fill(cutIndex, track->Pt());
171 if(passed) fhPhiPt->Fill(track->Pt(), track->Phi());
172
173}
174
175Bool_t AliConversionTrackCuts::AcceptTrack(AliAODTrack * track) {
176 //Check aod track
177
178 fhdcaxyPt->Fill(track->Pt(), TMath::Sqrt(track->XAtDCA()*track->XAtDCA() + track->YAtDCA()*track->YAtDCA()));
179 fhdcazPt->Fill(track->Pt(), TMath::Abs(track->ZAtDCA()));
180
181 fhnclpt->Fill(track->Pt(), track->GetTPCNcls());
182 if(track->GetTPCNclsF() > 0) fhnclsfpt->Fill(track->Pt(), ((Double_t) track->GetTPCNcls())/track->GetTPCNclsF());
183
184
185 FillHistograms(kPreCut, track);
186
92efd725 187 if (track->GetTPCNcls() < fTPCminNClusters) return kFALSE;
188 FillHistograms(kCutNcls, track);
4267afec 189
92efd725 190 Double_t foundclusters = 0.0001;
191 if(track->GetTPCNclsF() > 0) foundclusters = ( (Double_t) track->GetTPCNcls() )/track->GetTPCNclsF();
192 if (foundclusters < fTPCClusOverFindable) return kFALSE;
193 FillHistograms(kCutNclsFrac, track);
194
195 if (track->Chi2perNDF() > fTPCmaxChi2) return kFALSE;
196 FillHistograms(kCutNDF, track);
4267afec 197
92efd725 198 AliAODVertex *vertex = track->GetProdVertex();
199 if (vertex && fRejectKinkDaughters) {
200 if (vertex->GetType() == AliAODVertex::kKink) {
201 return kFALSE;
202 }
203 }
204 FillHistograms(kCutKinc, track);
4267afec 205
92efd725 206 if(TMath::Abs(track->ZAtDCA()) > fDCAZmax) {
207 return kFALSE;
208 }
209 FillHistograms(kCutDCAZ, track);
210
211
212 Float_t xatdca = track->XAtDCA();
213 Float_t yatdca = track->YAtDCA();
214 Float_t xy = xatdca*xatdca + yatdca*yatdca;
215 if(xy > fDCAXYmax) {
216 AliDebug(AliLog::kDebug + 2, "Kink daughter. Rejected");
217 return kFALSE;
218 }
219 FillHistograms(kCutDCAXY, track);
220
221 ULong_t status = track->GetStatus();
222 if (fRequireTPCRefit && (status&AliESDtrack::kTPCrefit) == 0) {
223 AliDebug(AliLog::kDebug + 2, "Kink daughter. Rejected");
224 return kFALSE;
225 }
226 FillHistograms(kCutTPCRefit, track);
4267afec 227
92efd725 228 FillHistograms(kNCuts, track, kTRUE);
229 return kTRUE;
4267afec 230}
231
232// void AliConversionTrackCuts::SetUpAxes() {
233// //
234// fCutAxis.Set(kNCuts + 1, -1.5, kNCuts -0.5);
235// fCutAxis.SetAxisLabel(-1, "track in");
236// for (Int_t i = 0; i < kNCuts; i++) {
237// fCutAxis.SetAxisLabel(i, fgkCutNames[i]);
238// }
239// for(Int_t i = 0, i < kNCuts; i++) {
240// }
241// }
242
243
244//_________________________________________________________________________________________________
245void AliConversionTrackCuts::Print(const Option_t *) const
246{
247//
248// Print information on this cut
249//
250
251 printf("Cut name : %s \n", GetName());
252 printf("Kink daughters are : %s \n", (fRejectKinkDaughters ? "rejected" : "accepted"));
253 printf("TPC requirements : clusters/findable %f, min. cluster = %d, max chi2 = %f, %s require refit\n", fTPCClusOverFindable, fTPCminNClusters, fTPCmaxChi2, (fRequireTPCRefit) ? "" : "Don't");
254 printf("ITS requirements : min. cluster = %d (all), %d (SPD), max chi2 = %f \n", fITSminNClusters, fSPDminNClusters, fITSmaxChi2);
255 printf("DCA z cut : fixed to %f cm \n", fDCAZmax);
256 printf("DCA xy cut : fixed to %f cm \n", fDCAXYmax);
257
258}
259
260
261
262
263
264