AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliPrimaryPionCuts.cxx
Go to the documentation of this file.
1 
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * *
5  * Authors: Friederike Bock *
6  * Version 1.0 *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
18 //---------------------------------------------
19 // Class handling all kinds of selection cuts for
20 // Gamma Conversion analysis
21 //---------------------------------------------
23 
24 
25 #include "AliPrimaryPionCuts.h"
26 #include "AliAODConversionPhoton.h"
27 #include "AliKFVertex.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
30 #include "AliAnalysisManager.h"
31 #include "AliInputEventHandler.h"
32 #include "AliMCEventHandler.h"
33 #include "AliAODHandler.h"
34 #include "AliPIDResponse.h"
35 #include "TH1.h"
36 #include "TH2.h"
37 #include "AliMCEvent.h"
38 #include "TObjString.h"
39 #include "AliAODEvent.h"
40 #include "AliESDEvent.h"
41 #include "TList.h"
42 class iostream;
43 
44 using namespace std;
45 
46 ClassImp(AliPrimaryPionCuts)
47 
48 
49 const char* AliPrimaryPionCuts::fgkCutNames[AliPrimaryPionCuts::kNCuts] = {
50  "kEtaCut", // 0
51  "kClsITSCut", // 1
52  "kClsTPCCut", // 2
53  "kDCAcut", // 3
54  "kPtCut", // 4
55  "kPiDedxSigmaITSCut", // 5
56  "kPiDedxSigmaTPCCut", // 6
57  "kPiTOFSigmaCut", // 7
58  "kMassCut" // 8
59 };
60 
61 //________________________________________________________________________
62 AliPrimaryPionCuts::AliPrimaryPionCuts(const char *name,const char *title) : AliAnalysisCuts(name,title),
63  fHistograms(NULL),
64  fPIDResponse(NULL),
65  fEsdTrackCuts(NULL),
66  fEtaCut(0.9),
67  fEtaShift(0.0),
68  fDoEtaCut(kFALSE),
69  fPtCut(0.0),
70  fMinClsTPC(0), // minimum clusters in the TPC
71  fChi2PerClsTPC(0), // maximum Chi2 per cluster in the TPC
72  fRequireTPCRefit(kFALSE), // require a refit in the TPC
73  fMinClsTPCToF(0), // minimum clusters to findable clusters
74  fDodEdxSigmaITSCut(kFALSE),
75  fDodEdxSigmaTPCCut(kTRUE),
76  fDoTOFsigmaCut(kFALSE), // RRnewTOF
77  fPIDnSigmaAbovePionLineITS(100),
78  fPIDnSigmaBelowPionLineITS(-100),
79  fPIDnSigmaAbovePionLineTPC(100),
80  fPIDnSigmaBelowPionLineTPC(-100),
81  fPIDnSigmaAbovePionLineTOF(100), // RRnewTOF
82  fPIDnSigmaBelowPionLineTOF(-100), // RRnewTOF
83  fUseCorrectedTPCClsInfo(kFALSE),
84  fUseTOFpid(kFALSE),
85  fRequireTOF(kFALSE),
86  fDoMassCut(kFALSE),
87  fMassCut(10),
88  fDoWeights(kFALSE),
89  fMaxDCAToVertexZ(8000),
90  fCutString(NULL),
91  fCutStringRead(""),
92  fHistCutIndex(NULL),
93  fHistdEdxCuts(NULL),
94  fHistITSdEdxbefore(NULL),
95  fHistITSdEdxafter(NULL),
96  fHistTPCdEdxbefore(NULL),
97  fHistTPCdEdxafter(NULL),
98  fHistTPCdEdxSignalbefore(NULL),
99  fHistTPCdEdxSignalafter(NULL),
100  fHistTOFbefore(NULL),
101  fHistTOFafter(NULL),
102  fHistTrackDCAxyPtbefore(NULL),
103  fHistTrackDCAxyPtafter(NULL),
104  fHistTrackDCAzPtbefore(NULL),
105  fHistTrackDCAzPtafter(NULL),
106  fHistTrackNFindClsPtTPCbefore(NULL),
107  fHistTrackNFindClsPtTPCafter(NULL),
108  fStringITSClusterCut("")
109 {
110  InitPIDResponse();
111  for(Int_t jj=0;jj<kNCuts;jj++){ fCuts[jj]=0; }
112  fCutString=new TObjString((GetCutNumber()).Data());
113 
114  // Using standard function for setting Cuts
115  Bool_t selectPrimaries=kFALSE;
116  if (fEsdTrackCuts==NULL)fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
117 }
118 
119 //________________________________________________________________________
121  // Destructor
122  //Deleting fHistograms leads to seg fault it it's added to output collection of a task
123  // if(fHistograms)
124  // delete fHistograms;
125  // fHistograms = NULL;
126 
127  if(fCutString != NULL){
128  delete fCutString;
129  fCutString = NULL;
130  }
131 }
132 
133 //________________________________________________________________________
135 
136  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
137 
138  TString cutName = "";
139 
140  if( cutNumber==""){
141  cutName = GetCutNumber().Data();
142  }
143  else {
144  cutName = cutNumber.Data();
145  }
146 
147  if(fHistograms != NULL){
148  delete fHistograms;
149  fHistograms=NULL;
150  }
151  if(fHistograms==NULL){
152  fHistograms=new TList();
153  if(name=="")fHistograms->SetName(Form("PionCuts_%s",cutName.Data()));
154  else fHistograms->SetName(Form("%s_%s",name.Data(),cutName.Data()));
155  }
156 
157 
158  fHistCutIndex=new TH1F(Form("IsPionSelected %s",cutName.Data()),"IsPionSelected",10,-0.5,9.5);
159  fHistCutIndex->GetXaxis()->SetBinLabel(kPionIn+1,"in");
160  fHistCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
161  fHistCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
162  fHistCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
163  fHistCutIndex->GetXaxis()->SetBinLabel(kPionOut+1,"out");
165 
166  // dEdx Cuts
167  fHistdEdxCuts=new TH1F(Form("dEdxCuts %s",cutName.Data()),"dEdxCuts",5,-0.5,4.5);
168  fHistdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
169  fHistdEdxCuts->GetXaxis()->SetBinLabel(2,"ITSpion");
170  fHistdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
171  fHistdEdxCuts->GetXaxis()->SetBinLabel(4,"TOFpion");
172  fHistdEdxCuts->GetXaxis()->SetBinLabel(5,"out");
174 
175  TAxis *axisBeforeITS = NULL;
176  TAxis *axisBeforedEdx = NULL;
177  TAxis *axisBeforeTOF = NULL;
178  TAxis *axisBeforedEdxSignal = NULL;
179 
180  if(preCut){
181  fHistITSdEdxbefore=new TH2F(Form("Pion_ITS_before %s",cutName.Data()),"ITS dEdx pion before" ,150,0.05,20,400,-10,10);
183  axisBeforeITS = fHistITSdEdxbefore->GetXaxis();
184 
185  fHistTPCdEdxbefore=new TH2F(Form("Pion_dEdx_before %s",cutName.Data()),"dEdx pion before" ,150,0.05,20,400,-10,10);
187  axisBeforedEdx = fHistTPCdEdxbefore->GetXaxis();
188 
189  fHistTPCdEdxSignalbefore=new TH2F(Form("Pion_dEdxSignal_before %s",cutName.Data()),"dEdx pion signal before" ,150,0.05,20.0,800,0.0,200);
191  axisBeforedEdxSignal = fHistTPCdEdxSignalbefore->GetXaxis();
192 
193  fHistTOFbefore=new TH2F(Form("Pion_TOF_before %s",cutName.Data()),"TOF pion before" ,150,0.05,20,400,-6,10);
195  axisBeforeTOF = fHistTOFbefore->GetXaxis();
196 
197  fHistTrackDCAxyPtbefore = new TH2F(Form("hTrack_DCAxy_Pt_before %s",cutName.Data()),"DCAxy Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);
199 
200  fHistTrackDCAzPtbefore = new TH2F(Form("hTrack_DCAz_Pt_before %s",cutName.Data()), "DCAz Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);
202 
203  fHistTrackNFindClsPtTPCbefore = new TH2F(Form("hTrack_NFindCls_Pt_TPC_before %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt before",100,0,1,400,0.,10.);
205  }
206 
207  fHistITSdEdxafter=new TH2F(Form("Pion_ITS_after %s",cutName.Data()),"ITS dEdx pion after" ,150,0.05,20,400, -10,10);
209 
210  fHistTPCdEdxafter=new TH2F(Form("Pion_dEdx_after %s",cutName.Data()),"dEdx pion after" ,150,0.05,20,400, -10,10);
212 
213  fHistTPCdEdxSignalafter=new TH2F(Form("Pion_dEdxSignal_after %s",cutName.Data()),"dEdx pion signal after" ,150,0.05,20.0,800,0.0,200);
215 
216  fHistTOFafter=new TH2F(Form("Pion_TOF_after %s",cutName.Data()),"TOF pion after" ,150,0.05,20,400,-6,10);
218 
219  fHistTrackDCAxyPtafter = new TH2F(Form("hTrack_DCAxy_Pt_after %s",cutName.Data()),"DCAxy Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);
221 
222  fHistTrackDCAzPtafter = new TH2F(Form("hTrack_DCAz_Pt_after %s",cutName.Data()), "DCAz Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);
224 
225  fHistTrackNFindClsPtTPCafter = new TH2F(Form("hTrack_NFindCls_Pt_TPC_after %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt after",100,0,1,400,0.,10.);
227 
228  TAxis *AxisAfter = fHistTPCdEdxafter->GetXaxis();
229  Int_t bins = AxisAfter->GetNbins();
230  Double_t from = AxisAfter->GetXmin();
231  Double_t to = AxisAfter->GetXmax();
232  Double_t *newBins = new Double_t[bins+1];
233  newBins[0] = from;
234  Double_t factor = TMath::Power(to/from, 1./bins);
235  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
236  AxisAfter->Set(bins, newBins);
237  AxisAfter = fHistTOFafter->GetXaxis();
238  AxisAfter->Set(bins, newBins);
239  AxisAfter = fHistITSdEdxafter->GetXaxis();
240  AxisAfter->Set(bins,newBins);
241  AxisAfter = fHistTPCdEdxSignalafter->GetXaxis();
242  AxisAfter->Set(bins,newBins);
243 
244  if(preCut){
245  axisBeforeITS->Set(bins, newBins);
246  axisBeforedEdx->Set(bins, newBins);
247  axisBeforedEdxSignal->Set(bins,newBins);
248  axisBeforeTOF->Set(bins, newBins);
249 
250  }
251  delete [] newBins;
252 
253  // Event Cuts and Info
254 }
255 
256 
257 //________________________________________________________________________
259 
260 // Set Pointer to AliPIDResponse
261 
262  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
263 
264  if(man) {
265  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
266  fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
267  if(fPIDResponse)return kTRUE;
268 
269  }
270 
271  return kFALSE;
272 }
274 Bool_t AliPrimaryPionCuts::PionIsSelectedMC(Int_t labelParticle,AliMCEvent *mcEvent){
275 
276  if( labelParticle < 0 || labelParticle >= mcEvent->GetNumberOfTracks() ) return kFALSE;
277 // if( mcEvent->IsPhysicalPrimary(labelParticle) == kFALSE ) return kFALSE; // moved to actual tasks
278 
279  TParticle* particle = mcEvent->Particle(labelParticle);
280 
281  if( TMath::Abs( particle->GetPdgCode() ) != 211 ) return kFALSE;
282 
283  if( fDoEtaCut ){
284  if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
285  return kFALSE;
286  }
287 
288  return kTRUE;
289 }
290 
291 
294  //Selection of Reconstructed electrons
295 
296  Float_t b[2];
297  Float_t bCov[3];
298  if (lTrack == NULL){
300  return kFALSE;
301  }
302  lTrack->GetImpactParameters(b,bCov);
303 
304  if (bCov[0]<=0 || bCov[2]<=0) {
305  AliDebug(1, "Estimated b resolution lower or equal zero!");
306  bCov[0]=0; bCov[2]=0;
307  }
308 
309  Float_t dcaToVertexXY = b[0];
310  Float_t dcaToVertexZ = b[1];
311  Double_t clsToF = GetNFindableClustersTPC(lTrack);
312 
313 
314  if (fHistCutIndex) fHistCutIndex->Fill(kPionIn);
315 
316  if (fHistTrackDCAxyPtbefore) fHistTrackDCAxyPtbefore->Fill(dcaToVertexXY,lTrack->Pt());
317  if (fHistTrackDCAzPtbefore) fHistTrackDCAzPtbefore->Fill( dcaToVertexZ, lTrack->Pt());
318  if (fHistTrackNFindClsPtTPCbefore) fHistTrackNFindClsPtTPCbefore->Fill( clsToF, lTrack->Pt());
319 
320 
321  if ( ! lTrack->GetConstrainedParam() ){
322  return kFALSE;
323  }
324  AliVTrack * track = dynamic_cast<AliVTrack*>(lTrack);
325 
326  // Track Cuts
327  if( !TrackIsSelected(lTrack) ){
329  return kFALSE;
330  }
331 
332  // dEdx Cuts
333  if( ! dEdxCuts( track ) ) {
335  return kFALSE;
336 
337  }
338 
339  //Pion passed the cuts
341  if (fHistTrackDCAxyPtafter) fHistTrackDCAxyPtafter->Fill(dcaToVertexXY,lTrack->Pt());
342  if (fHistTrackDCAzPtafter) fHistTrackDCAzPtafter->Fill(dcaToVertexZ,lTrack->Pt());
343  if (fHistTrackNFindClsPtTPCafter) fHistTrackNFindClsPtTPCafter->Fill( clsToF, lTrack->Pt());
344 
345  return kTRUE;
346 }
347 
350  // Track Selection for Photon Reconstruction
351 
352  Double_t clsToF = GetNFindableClustersTPC(lTrack);
353 
354  if( ! fEsdTrackCuts->AcceptTrack(lTrack) ){
355  return kFALSE;
356  }
357 
358  if( fDoEtaCut ) {
359  if( lTrack->Eta() > (fEtaCut + fEtaShift) || lTrack->Eta() < (-fEtaCut + fEtaShift) ) {
360  return kFALSE;
361  }
362  }
363 
364  if( lTrack->Pt() < fPtCut ) {
365  return kFALSE;
366  }
367 
368  if( clsToF < fMinClsTPCToF){
369  return kFALSE;
370  }
371 
372  return kTRUE;
373 }
374 
376 Bool_t AliPrimaryPionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
377 
378  // Pion Identification Cuts for Photon reconstruction
379 
380  if(!fPIDResponse){ InitPIDResponse(); }// Try to reinitialize PID Response
381  if(!fPIDResponse){ AliError("No PID Response"); return kFALSE;}// if still missing fatal error
382 
383  Int_t cutIndex=0;
384 
385  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
386  if(fHistITSdEdxbefore)fHistITSdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kPion));
387  if(fHistTPCdEdxbefore)fHistTPCdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kPion));
388  if(fHistTPCdEdxSignalbefore)fHistTPCdEdxSignalbefore->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));
389 
390  cutIndex++;
391 
392  if( fDodEdxSigmaITSCut == kTRUE ){
393  if( fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kPion)<fPIDnSigmaBelowPionLineITS ||
394  fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kPion)> fPIDnSigmaAbovePionLineITS ){
395  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
396  return kFALSE;
397  }
398  }
399 
400  if(fHistITSdEdxafter)fHistITSdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kPion));
401 
402 
403  cutIndex++;
404 
405 
406  if(fDodEdxSigmaTPCCut == kTRUE){
407  // TPC Pion Line
408  if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaBelowPionLineTPC ||
409  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)>fPIDnSigmaAbovePionLineTPC){
410  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
411  return kFALSE;
412  }
413  cutIndex++;
414  } else { cutIndex+=1; }
415 
416  if( ( fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid ) && ( !( fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch) ) ){
417  if(fHistTOFbefore) fHistTOFbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion));
418  if(fUseTOFpid){
419  if( fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion)>fPIDnSigmaAbovePionLineTOF ||
420  fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion)<fPIDnSigmaBelowPionLineTOF ){
421  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
422  return kFALSE;
423  }
424  }
425  if(fHistTOFafter)fHistTOFafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion));
426  } else if ( fRequireTOF == kTRUE ) {
427  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
428  return kFALSE;
429  }
430  cutIndex++;
431 
432  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
433  if(fHistTPCdEdxafter)fHistTPCdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kPion));
434  if(fHistTPCdEdxSignalafter)fHistTPCdEdxSignalafter->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));
435 
436  return kTRUE;
437 }
438 
440 AliVTrack *AliPrimaryPionCuts::GetTrack(AliVEvent * event, Int_t label){
441  //Returns pointer to the track with given ESD label
442  //(Important for AOD implementation, since Track array in AOD data is different
443  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
444 
445  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
446  if(esdEvent) {
447  if(label > event->GetNumberOfTracks() ) return NULL;
448  AliESDtrack * track = esdEvent->GetTrack(label);
449  return track;
450  } else {
451  for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
452  AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
453  if(track) {
454  if(track->GetID() == label) {
455  return track;
456  }
457  }
458  }
459  }
460  cout << "track not found " << label << " " << event->GetNumberOfTracks() << endl;
461  return NULL;
462 }
463 
466 
467  Double_t clsToF=0;
468  if ( !fUseCorrectedTPCClsInfo ){
469  if(lTrack->GetTPCNclsF()!=0){
470  clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();
471  }
472  } else {
473  clsToF = lTrack->GetTPCClusterInfo(2,0); //NOTE ask friederike
474  }
475  return clsToF;
476 
477 }
478 
482 
483  if(fCutString && fCutString->GetString().Length() == kNCuts) {
484  fCutString->SetString(GetCutNumber());
485  } else {
486  return kFALSE;
487  }
488  return kTRUE;
489 
490 }
491 
494  fCutStringRead = Form("%s",analysisCutSelection.Data());
495 
496  // Initialize Cuts from a given Cut string
497 
498  AliInfo(Form("Set PionCuts Number: %s",analysisCutSelection.Data()));
499 
500  if(analysisCutSelection.Length()!=kNCuts) {
501  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
502  return kFALSE;
503  }
504  if(!analysisCutSelection.IsAlnum()){
505  AliError("Cut selection is not alphanumeric");
506  return kFALSE;
507  }
508 
509  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
510  analysisCutSelectionLowerCase.ToLower();
511  const char *cutSelection = analysisCutSelectionLowerCase.Data();
512  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
513  for(Int_t ii=0;ii<kNCuts;ii++){
514  ASSIGNARRAY(ii);
515  }
516 
517  // Set Individual Cuts
518  for(Int_t ii=0;ii<kNCuts;ii++){
519  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
520  }
521 
523  return kTRUE;
524 }
528 
529  //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
530 
531  switch (cutID) {
532  case kEtaCut:
533  if( SetEtaCut(value)) {
534  fCuts[kEtaCut] = value;
535  UpdateCutString();
536  return kTRUE;
537  } else return kFALSE;
538  case kClsITSCut:
539  if( SetITSClusterCut(value) ) {
540  fCuts[kClsITSCut] = value;
541  UpdateCutString();
542  return kTRUE;
543  } else return kFALSE;
544  case kClsTPCCut:
545  if( SetTPCClusterCut(value)) {
546  fCuts[kClsTPCCut] = value;
547  UpdateCutString();
548  return kTRUE;
549  } else return kFALSE;
550  case kDCACut:
551  if( SetDCACut(value)) {
552  fCuts[kDCACut] = value;
553  UpdateCutString();
554  return kTRUE;
555  } else return kFALSE;
556  case kPtCut:
557  if( SetPtCut(value)) {
558  fCuts[kPtCut] = value;
559  UpdateCutString();
560  return kTRUE;
561  } else return kFALSE;
562  case kPidedxSigmaITSCut:
563  if( SetITSdEdxCutPionLine(value)) {
564  fCuts[kPidedxSigmaITSCut] = value;
565  UpdateCutString();
566  return kTRUE;
567  } else return kFALSE;
568  case kPidedxSigmaTPCCut:
569  if( SetTPCdEdxCutPionLine(value)) {
570  fCuts[kPidedxSigmaTPCCut] = value;
571  UpdateCutString();
572  return kTRUE;
573  } else return kFALSE;
574  case kPiTOFSigmaPID:
575  if( SetTOFPionPIDCut(value)) {
576  fCuts[kPiTOFSigmaPID] = value;
577  UpdateCutString();
578  return kTRUE;
579  } else return kFALSE;
580  case kMassCut:
581  if( SetMassCut(value)) {
582  fCuts[kMassCut] = value;
583  UpdateCutString();
584  return kTRUE;
585  } else return kFALSE;
586  case kNCuts:
587  cout << "Error:: Cut id out of range"<< endl;
588  return kFALSE;
589  }
590 
591  cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
592  return kFALSE;
593 }
594 
597  // Print out current Cut Selection
598  for(Int_t ic = 0; ic < kNCuts; ic++) {
599  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
600  }
601 }
602 
605  // Print out current Cut Selection with value
606  printf("\nCharged Pion cutnumber \n");
607  for(Int_t ic = 0; ic < kNCuts; ic++) {
608  printf("%d",fCuts[ic]);
609  }
610  printf("\n\n");
611 
612  printf("Acceptance cuts \n");
613  if (fDoEtaCut) printf("\t |eta_{pi+-}| < %3.2f \n", fEtaCut);
614  else printf("\t none \n");
615  printf("Track cuts \n");
616  printf("\t %s \n", fStringITSClusterCut.Data());
617  printf("\t min N cluster TPC > %3.2f \n", fMinClsTPC);
618  printf("\t min N cluster TPC/ findable > %3.2f \n", fMinClsTPCToF);
619 
620  printf("\t max Chi2 per cluster TPC < %3.2f \n", fChi2PerClsTPC);
621  printf("\t require TPC refit ? %d \n", fRequireTPCRefit);
622 // printf("\t dca > %3.2f \n", fMinClsTPCToF);
623 // "kDCAcut", // 3
624  printf("\t min pT > %3.2f \n", fPtCut);
625  printf("PID cuts \n");
626  if (fDodEdxSigmaITSCut)printf("\t %3.2f < ITS n_sigma pi < %3.2f \n", fPIDnSigmaBelowPionLineITS, fPIDnSigmaAbovePionLineITS );
627  if (fDodEdxSigmaTPCCut)printf("\t %3.2f < TPC n_sigma pi < %3.2f \n", fPIDnSigmaBelowPionLineTPC, fPIDnSigmaAbovePionLineTPC );
628  if (fDoTOFsigmaCut)printf("\t %3.2f < TOF n_sigma pi < %3.2f \n", fPIDnSigmaBelowPionLineTOF, fPIDnSigmaAbovePionLineTOF );
629  if (fDoMassCut) printf("two-pion mass cut < %3.2f \n", fMassCut);
630  printf("\n\n");
631 }
632 
633 
634 
637  switch(ededxSigmaCut){
638  case 0:
639  fDodEdxSigmaITSCut = kFALSE;
642  break;
643  case 1: // -10,10
644  fDodEdxSigmaITSCut = kTRUE;
647  break;
648  case 2: // -6,7
649  fDodEdxSigmaITSCut = kTRUE;
652  break;
653  case 3: // -5,5
654  fDodEdxSigmaITSCut = kTRUE;
657  break;
658  case 4: // -4,5
659  fDodEdxSigmaITSCut = kTRUE;
662  break;
663  case 5: // -3,5
664  fDodEdxSigmaITSCut = kTRUE;
667  break;
668  case 6: // -4,4
669  fDodEdxSigmaITSCut = kTRUE;
672  break;
673  case 7: // -2.5,4
674  fDodEdxSigmaITSCut = kTRUE;
677  break;
678  case 8: // -2,3.5
679  fDodEdxSigmaITSCut = kTRUE;
682  break;
683  default:
684  cout<<"Warning: ITSdEdxCutPionLine not defined"<<ededxSigmaCut<<endl;
685  return kFALSE;
686 
687  }
688  return kTRUE;
689 }
690 
693  switch(ededxSigmaCut){
694  case 0:
695  fDodEdxSigmaTPCCut = kFALSE;
698  break;
699  case 1: // -10,10
700  fDodEdxSigmaTPCCut = kTRUE;
703  break;
704  case 2: // -6,7
705  fDodEdxSigmaTPCCut = kTRUE;
708  break;
709  case 3: // -5,5
710  fDodEdxSigmaTPCCut = kTRUE;
713  break;
714  case 4: // -4,5
715  fDodEdxSigmaTPCCut = kTRUE;
718  break;
719  case 5: // -4,4
720  fDodEdxSigmaTPCCut = kTRUE;
723  break;
724  case 6: // -3,4
725  fDodEdxSigmaTPCCut = kTRUE;
728  break;
729  case 7: // -3,3
730  fDodEdxSigmaTPCCut = kTRUE;
733  break;
734  case 8: // -2,3.
735  fDodEdxSigmaTPCCut = kTRUE;
738  break;
739  default:
740  cout<<"Warning: TPCdEdxCutPionLine not defined"<<ededxSigmaCut<<endl;
741  return kFALSE;
742  }
743  return kTRUE;
744 }
745 
748  if( !fEsdTrackCuts ) {
749  cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
750  return kFALSE;
751  }
752 
753  switch(clsITSCut){
754  case 0:
755  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
756  fStringITSClusterCut= "no SPD cluster requirement";
757  break;
758  case 1:
759  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
760  fStringITSClusterCut= "first SPD cluster required";
761  break; //1 hit first layer of SPD
762  case 2:
763  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
764  fStringITSClusterCut= "first or second SPD cluster required";
765  break; //1 hit in any layer of SPD
766  case 3:
767  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
768  fEsdTrackCuts->SetMinNClustersITS(4);
769  fStringITSClusterCut= "first SPD cluster required, min number of ITS clusters = 4";
770  // 4 hits in total in the ITS. At least 1 hit in the first layer of SPD
771  break;
772  case 4:
773  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
774  fEsdTrackCuts->SetMinNClustersITS(3);
775  fStringITSClusterCut= "first or second SPD cluster required, min number of ITS clusters = 3";
776  // 3 hits in total in the ITS. At least 1 hit in any layer of SPD
777  break;
778  case 5:
779  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
780  fEsdTrackCuts->SetMinNClustersITS(4);
781  fStringITSClusterCut= "first or second SPD cluster required, min number of ITS clusters = 4";
782  // 4 hits in total in the ITS. At least 1 hit in any layer of SPD
783  break;
784  case 6:
785  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
786  fEsdTrackCuts->SetMinNClustersITS(5);
787  fStringITSClusterCut= "first or second SPD cluster required, min number of ITS clusters = 5";
788  // 5 hits in total in the ITS. At least 1 hit in any layer of SPD
789  break;
790  default:
791  cout<<"Warning: clsITSCut not defined "<<clsITSCut<<endl;
792  return kFALSE;
793  }
794  return kTRUE;
795 }
796 
799  switch(clsTPCCut){
800  case 0: // 0
801  fMinClsTPC= 0.;
802  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
803  break;
804  case 1: // 70
805  fMinClsTPC= 70.;
806  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
807  break;
808  case 2: // 80
809  fMinClsTPC= 80.;
810  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
811  break;
812  case 3: // 100
813  fMinClsTPC= 100.;
814  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
815  break;
816  case 4: // 0% of findable clusters
817  fMinClsTPC= 70.;
818  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
819  fMinClsTPCToF= 0.0;
821  break;
822  case 5: // 35% of findable clusters
823  fMinClsTPC = 70.;
824  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
825  fMinClsTPCToF= 0.35;
827  break;
828  case 6: // 60% of findable clusters
829  fMinClsTPC= 70.;
830  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
831  fMinClsTPCToF= 0.6;
833  break;
834  case 7: // 70% of findable clusters
835  fMinClsTPC= 70.;
836  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
837  fMinClsTPCToF= 0.7;
839  break;
840  case 8: fMinClsTPC = 0.;
841  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
842  fMinClsTPCToF= 0.35;
844  break;
845  case 9: // 35% of findable clusters
846  fMinClsTPC = 70.;
847  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
848  fMinClsTPCToF= 0.35;
850  break;
851  case 10:
852  fMinClsTPC = 80.;
853  fChi2PerClsTPC = 4;
854  fRequireTPCRefit = kTRUE;
855  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
856  // Other Cuts concerning TPC
857  fEsdTrackCuts->SetMaxChi2PerClusterTPC(fChi2PerClsTPC);
858  fEsdTrackCuts->SetRequireTPCRefit(fRequireTPCRefit);
859  break;
860 
861  default:
862  cout<<"Warning: clsTPCCut not defined "<<clsTPCCut<<endl;
863  return kFALSE;
864  }
865  return kTRUE;
866 }
867 
870  // Set eta Cut
871  switch(etaCut){
872  case 0:
873  fEtaCut = 100.;
874  fDoEtaCut = kFALSE;
875  break;
876  case 1: // 1.4
877  fEtaCut = 1.4;
878  fDoEtaCut = kTRUE;
879  break;
880  case 2: // 1.2
881  fEtaCut = 1.2;
882  fDoEtaCut = kTRUE;
883  break;
884  case 3: // 0.9
885  fEtaCut = 0.9;
886  fDoEtaCut = kTRUE;
887  break;
888  case 4: // 0.8
889  fEtaCut = 0.8;
890  fDoEtaCut = kTRUE;
891  break;
892  case 5: // 0.75
893  fEtaCut = 0.75;
894  fDoEtaCut = kTRUE;
895  break;
896  case 6: //0.6
897  fEtaCut = 0.6; //changed from 0.4 to 0.6 2013.06.10
898  fDoEtaCut = kTRUE;
899  break;
900  case 7: //0.5
901  fEtaCut = 0.5; //changed from 0.3 to 0.5 2013.06.10
902  fDoEtaCut = kTRUE;
903  break;
904  case 8:
905  fEtaCut = 0.4;
906  fDoEtaCut = kTRUE;
907  break;
908  default:
909  cout<<"Warning: EtaCut not defined "<<etaCut<<endl;
910  return kFALSE;
911  }
912  return kTRUE;
913 }
914 
917  switch(ptCut){
918  case 0:
919  fPtCut = 0.075;
920  break;
921  case 1: // 0.1
922  fPtCut = 0.1;
923  break;
924  case 2: // 0.125 GeV
925  fPtCut = 0.125;
926  break;
927  case 3: // 0.15 GeV
928  fPtCut = 0.15;
929  break;
930  default:
931  cout<<"Warning: PtCut not defined "<<ptCut<<endl;
932  return kFALSE;
933  }
934  return kTRUE;
935 }
936 
937 
940 {
941  // Set DCA Cut
942  if( !fEsdTrackCuts ) {
943  cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
944  return kFALSE;
945  }
946 
947  switch(dcaCut){
948  case 0:
949  //Open cuts//
950  fEsdTrackCuts->SetMaxDCAToVertexZ(1000);
951  fEsdTrackCuts->SetMaxDCAToVertexXY(1000);
952  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
953  break;
954  case 1:
955  fEsdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
956  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
957  break;
958  case 2:
959  fEsdTrackCuts->SetMaxDCAToVertexZ(2);
960  fEsdTrackCuts->SetMaxDCAToVertexXY(1);
961  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
962  break;
963  case 3:
964  fMaxDCAToVertexZ = 3.0;
965  fEsdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
966  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
967  fEsdTrackCuts->SetMaxDCAToVertexZ(fMaxDCAToVertexZ);
968  break;
969  default:
970  cout<<"Warning: dcaCut not defined "<<dcaCut<<endl;
971  return kFALSE;
972  }
973  return kTRUE;
974 }
975 
978  // Set Cut
979  switch(TOFelectronPID){
980  case 0: // no cut
981  fRequireTOF = kFALSE;
982  fUseTOFpid = kFALSE;
985  break;
986  case 1: // -7,7
987  fRequireTOF = kFALSE;
988  fUseTOFpid = kTRUE;
991  break;
992  case 2: // -5,5
993  fRequireTOF = kFALSE;
994  fUseTOFpid = kTRUE;
997  break;
998  case 3: // -3,5
999  fRequireTOF = kFALSE;
1000  fUseTOFpid = kTRUE;
1003  break;
1004  case 4: // -2,3
1005  fRequireTOF = kFALSE;
1006  fUseTOFpid = kTRUE;
1009  break;
1010  case 5: // -3, 3 TOF mandatory
1011  fRequireTOF = kTRUE;
1012  fUseTOFpid = kTRUE;
1015  break;
1016  default:
1017  cout<<"Warning: TOFPionCut not defined "<<TOFelectronPID<<endl;
1018  return kFALSE;
1019  }
1020  return kTRUE;
1021 }
1022 
1025  // Set Cut
1026  switch(massCut){
1027  case 0: // no cut
1028  fDoMassCut = kFALSE;
1029  fMassCut = 10;
1030  break;
1031  case 1: // cut at 1 GeV/c^2
1032  fDoMassCut = kTRUE;
1033  fMassCut = 1;
1034  break;
1035  case 2: // cut at 0.7 GeV/c^2
1036  fDoMassCut = kTRUE;
1037  fMassCut = 0.75;
1038  break;
1039  case 3: // cut at 0.6 GeV/c^2
1040  fDoMassCut = kTRUE;
1041  fMassCut = 0.6;
1042  break;
1043  case 4: // cut at eta mass
1044  fDoMassCut = kTRUE;
1045  fMassCut = 0.547853;
1046  break;
1047  case 5: // cut at 0.5 GeV/c^2
1048  fDoMassCut = kTRUE;
1049  fMassCut = 0.5;
1050  break;
1051  case 6: // cut at 0.65 GeV/c^2
1052  fDoMassCut = kTRUE;
1053  fMassCut = 0.65;
1054  break;
1055  case 7: // cut at 0.7 GeV/c^2
1056  fDoMassCut = kTRUE;
1057  fMassCut = 0.7;
1058  break;
1059  default:
1060  cout<<"Warning: MassCut not defined "<<massCut<<endl;
1061  return kFALSE;
1062  }
1063  return kTRUE;
1064 }
1065 
1066 
1069  // returns TString with current cut number
1070  return fCutStringRead;
1071 }
1072 
1073 
1076  //Create and return standard 2010 PbPb cuts
1077  AliPrimaryPionCuts *cuts=new AliPrimaryPionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
1078  if(!cuts->InitializeCutsFromCutString("000000400")){
1079  cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;
1080  }
1081  return cuts;
1082 }
1083 
1086  //Create and return standard 2010 PbPb cuts
1087  AliPrimaryPionCuts *cuts=new AliPrimaryPionCuts("StandardCuts2010pp","StandardCuts2010pp");
1088 
1089  if(!cuts->InitializeCutsFromCutString("000000400")){
1090  cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;
1091  }
1092  return cuts;
1093 }
1094 
Bool_t dEdxCuts(AliVTrack *track)
Cut functions.
static AliPrimaryPionCuts * GetStandardCuts2010PbPb()
double Double_t
Definition: External.C:58
Bool_t SetITSClusterCut(Int_t clsITSCut)
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
Bool_t SetPtCut(Int_t ptCut)
Bool_t SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
Double_t fPIDnSigmaAbovePionLineITS
Bool_t SetDCACut(Int_t dcaCut)
Double_t fPIDnSigmaAbovePionLineTPC
Double_t GetNFindableClustersTPC(AliESDtrack *lTrack)
AliPrimaryPionCuts(const char *name="PionCuts", const char *title="Pion Cuts")
static AliPrimaryPionCuts * GetStandardCuts2010pp()
static const char * fgkCutNames[kNCuts]
Bool_t PionIsSelectedMC(Int_t labelParticle, AliMCEvent *mcEvent)
#define ASSIGNARRAY(i)
Double_t fPIDnSigmaBelowPionLineTOF
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Bool_t SetEtaCut(Int_t etaCut)
Bool_t SetMassCut(Int_t massCut)
Bool_t SetCut(cutIds cutID, Int_t cut)
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Double_t fPIDnSigmaAbovePionLineTOF
Double_t fPIDnSigmaBelowPionLineITS
Bool_t SetITSdEdxCutPionLine(Int_t ededxSigmaCut)
Bool_t TrackIsSelected(AliESDtrack *lTrack)
AliPIDResponse * fPIDResponse
static AliVTrack * GetTrack(AliVEvent *event, Int_t label)
Bool_t PionIsSelected(AliESDtrack *lTrack)
bool Bool_t
Definition: External.C:53
Bool_t SetTOFPionPIDCut(Int_t TOFelectronPID)
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection)
Bool_t SetTPCClusterCut(Int_t clsTPCCut)
AliESDtrackCuts * fEsdTrackCuts
Double_t fPIDnSigmaBelowPionLineTPC
void InitCutHistograms(TString name="", Bool_t preCut=kTRUE, TString cutName="")