AliPhysics  b752f14 (b752f14)
 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 "AliStack.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 
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  fMinClsTPCToF(0), // minimum clusters to findable clusters
72  fDodEdxSigmaITSCut(kFALSE),
73  fDodEdxSigmaTPCCut(kTRUE),
74  fDoTOFsigmaCut(kFALSE), // RRnewTOF
75  fPIDnSigmaAbovePionLineITS(100),
76  fPIDnSigmaBelowPionLineITS(-100),
77  fPIDnSigmaAbovePionLineTPC(100),
78  fPIDnSigmaBelowPionLineTPC(-100),
79  fPIDnSigmaAbovePionLineTOF(100), // RRnewTOF
80  fPIDnSigmaBelowPionLineTOF(-100), // RRnewTOF
81  fUseCorrectedTPCClsInfo(kFALSE),
82  fUseTOFpid(kFALSE),
83  fRequireTOF(kFALSE),
84  fDoMassCut(kFALSE),
85  fMassCut(10),
86  fDoWeights(kFALSE),
87  fCutString(NULL),
88  fCutStringRead(""),
89  fHistCutIndex(NULL),
90  fHistdEdxCuts(NULL),
91  fHistITSdEdxbefore(NULL),
92  fHistITSdEdxafter(NULL),
93  fHistTPCdEdxbefore(NULL),
94  fHistTPCdEdxafter(NULL),
95  fHistTPCdEdxSignalbefore(NULL),
96  fHistTPCdEdxSignalafter(NULL),
97  fHistTOFbefore(NULL),
98  fHistTOFafter(NULL),
99  fHistTrackDCAxyPtbefore(NULL),
100  fHistTrackDCAxyPtafter(NULL),
101  fHistTrackDCAzPtbefore(NULL),
102  fHistTrackDCAzPtafter(NULL),
103  fHistTrackNFindClsPtTPCbefore(NULL),
104  fHistTrackNFindClsPtTPCafter(NULL),
105  fStringITSClusterCut("")
106 {
107  InitPIDResponse();
108  for(Int_t jj=0;jj<kNCuts;jj++){ fCuts[jj]=0; }
109  fCutString=new TObjString((GetCutNumber()).Data());
110 
111  // Using standard function for setting Cuts
112  Bool_t selectPrimaries=kFALSE;
113  if (fEsdTrackCuts==NULL)fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
114 }
115 
116 //________________________________________________________________________
118  // Destructor
119  //Deleting fHistograms leads to seg fault it it's added to output collection of a task
120  // if(fHistograms)
121  // delete fHistograms;
122  // fHistograms = NULL;
123 
124  if(fCutString != NULL){
125  delete fCutString;
126  fCutString = NULL;
127  }
128 }
129 
130 //________________________________________________________________________
132 
133  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
134 
135  TString cutName = "";
136 
137  if( cutNumber==""){
138  cutName = GetCutNumber().Data();
139  }
140  else {
141  cutName = cutNumber.Data();
142  }
143 
144  if(fHistograms != NULL){
145  delete fHistograms;
146  fHistograms=NULL;
147  }
148  if(fHistograms==NULL){
149  fHistograms=new TList();
150  if(name=="")fHistograms->SetName(Form("PionCuts_%s",cutName.Data()));
151  else fHistograms->SetName(Form("%s_%s",name.Data(),cutName.Data()));
152  }
153 
154 
155  fHistCutIndex=new TH1F(Form("IsPionSelected %s",cutName.Data()),"IsPionSelected",10,-0.5,9.5);
156  fHistCutIndex->GetXaxis()->SetBinLabel(kPionIn+1,"in");
157  fHistCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
158  fHistCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
159  fHistCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
160  fHistCutIndex->GetXaxis()->SetBinLabel(kPionOut+1,"out");
162 
163  // dEdx Cuts
164  fHistdEdxCuts=new TH1F(Form("dEdxCuts %s",cutName.Data()),"dEdxCuts",5,-0.5,4.5);
165  fHistdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
166  fHistdEdxCuts->GetXaxis()->SetBinLabel(2,"ITSpion");
167  fHistdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
168  fHistdEdxCuts->GetXaxis()->SetBinLabel(4,"TOFpion");
169  fHistdEdxCuts->GetXaxis()->SetBinLabel(5,"out");
171 
172  TAxis *axisBeforeITS = NULL;
173  TAxis *axisBeforedEdx = NULL;
174  TAxis *axisBeforeTOF = NULL;
175  TAxis *axisBeforedEdxSignal = NULL;
176 
177  if(preCut){
178  fHistITSdEdxbefore=new TH2F(Form("Pion_ITS_before %s",cutName.Data()),"ITS dEdx pion before" ,150,0.05,20,400,-10,10);
180  axisBeforeITS = fHistITSdEdxbefore->GetXaxis();
181 
182  fHistTPCdEdxbefore=new TH2F(Form("Pion_dEdx_before %s",cutName.Data()),"dEdx pion before" ,150,0.05,20,400,-10,10);
184  axisBeforedEdx = fHistTPCdEdxbefore->GetXaxis();
185 
186  fHistTPCdEdxSignalbefore=new TH2F(Form("Pion_dEdxSignal_before %s",cutName.Data()),"dEdx pion signal before" ,150,0.05,20.0,800,0.0,200);
188  axisBeforedEdxSignal = fHistTPCdEdxSignalbefore->GetXaxis();
189 
190  fHistTOFbefore=new TH2F(Form("Pion_TOF_before %s",cutName.Data()),"TOF pion before" ,150,0.05,20,400,-6,10);
192  axisBeforeTOF = fHistTOFbefore->GetXaxis();
193 
194  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.);
196 
197  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.);
199 
200  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.);
202  }
203 
204  fHistITSdEdxafter=new TH2F(Form("Pion_ITS_after %s",cutName.Data()),"ITS dEdx pion after" ,150,0.05,20,400, -10,10);
206 
207  fHistTPCdEdxafter=new TH2F(Form("Pion_dEdx_after %s",cutName.Data()),"dEdx pion after" ,150,0.05,20,400, -10,10);
209 
210  fHistTPCdEdxSignalafter=new TH2F(Form("Pion_dEdxSignal_after %s",cutName.Data()),"dEdx pion signal after" ,150,0.05,20.0,800,0.0,200);
212 
213  fHistTOFafter=new TH2F(Form("Pion_TOF_after %s",cutName.Data()),"TOF pion after" ,150,0.05,20,400,-6,10);
215 
216  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.);
218 
219  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.);
221 
222  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.);
224 
225  TAxis *AxisAfter = fHistTPCdEdxafter->GetXaxis();
226  Int_t bins = AxisAfter->GetNbins();
227  Double_t from = AxisAfter->GetXmin();
228  Double_t to = AxisAfter->GetXmax();
229  Double_t *newBins = new Double_t[bins+1];
230  newBins[0] = from;
231  Double_t factor = TMath::Power(to/from, 1./bins);
232  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
233  AxisAfter->Set(bins, newBins);
234  AxisAfter = fHistTOFafter->GetXaxis();
235  AxisAfter->Set(bins, newBins);
236  AxisAfter = fHistITSdEdxafter->GetXaxis();
237  AxisAfter->Set(bins,newBins);
238  AxisAfter = fHistTPCdEdxSignalafter->GetXaxis();
239  AxisAfter->Set(bins,newBins);
240 
241  if(preCut){
242  axisBeforeITS->Set(bins, newBins);
243  axisBeforedEdx->Set(bins, newBins);
244  axisBeforedEdxSignal->Set(bins,newBins);
245  axisBeforeTOF->Set(bins, newBins);
246 
247  }
248  delete [] newBins;
249 
250  // Event Cuts and Info
251 }
252 
253 
254 //________________________________________________________________________
256 
257 // Set Pointer to AliPIDResponse
258 
259  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
260 
261  if(man) {
262  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
263  fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
264  if(fPIDResponse)return kTRUE;
265 
266  }
267 
268  return kFALSE;
269 }
271 Bool_t AliPrimaryPionCuts::PionIsSelectedMC(Int_t labelParticle,AliStack *fMCStack){
272 
273  if( labelParticle < 0 || labelParticle >= fMCStack->GetNtrack() ) return kFALSE;
274 // if( fMCStack->IsPhysicalPrimary(labelParticle) == kFALSE ) return kFALSE; // moved to actual tasks
275 
276  TParticle* particle = fMCStack->Particle(labelParticle);
277 
278  if( TMath::Abs( particle->GetPdgCode() ) != 211 ) return kFALSE;
279 
280  if( fDoEtaCut ){
281  if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
282  return kFALSE;
283  }
284 
285  return kTRUE;
286 }
287 
288 
291  //Selection of Reconstructed electrons
292 
293  Float_t b[2];
294  Float_t bCov[3];
295  if (lTrack == NULL){
297  return kFALSE;
298  }
299  lTrack->GetImpactParameters(b,bCov);
300 
301  if (bCov[0]<=0 || bCov[2]<=0) {
302  AliDebug(1, "Estimated b resolution lower or equal zero!");
303  bCov[0]=0; bCov[2]=0;
304  }
305 
306  Float_t dcaToVertexXY = b[0];
307  Float_t dcaToVertexZ = b[1];
308  Double_t clsToF = GetNFindableClustersTPC(lTrack);
309 
310 
311  if (fHistCutIndex) fHistCutIndex->Fill(kPionIn);
312 
313  if (fHistTrackDCAxyPtbefore) fHistTrackDCAxyPtbefore->Fill(dcaToVertexXY,lTrack->Pt());
314  if (fHistTrackDCAzPtbefore) fHistTrackDCAzPtbefore->Fill( dcaToVertexZ, lTrack->Pt());
315  if (fHistTrackNFindClsPtTPCbefore) fHistTrackNFindClsPtTPCbefore->Fill( clsToF, lTrack->Pt());
316 
317 
318  if ( ! lTrack->GetConstrainedParam() ){
319  return kFALSE;
320  }
321  AliVTrack * track = dynamic_cast<AliVTrack*>(lTrack);
322 
323  // Track Cuts
324  if( !TrackIsSelected(lTrack) ){
326  return kFALSE;
327  }
328 
329  // dEdx Cuts
330  if( ! dEdxCuts( track ) ) {
332  return kFALSE;
333 
334  }
335 
336  //Pion passed the cuts
338  if (fHistTrackDCAxyPtafter) fHistTrackDCAxyPtafter->Fill(dcaToVertexXY,lTrack->Pt());
339  if (fHistTrackDCAzPtafter) fHistTrackDCAzPtafter->Fill(dcaToVertexZ,lTrack->Pt());
340  if (fHistTrackNFindClsPtTPCafter) fHistTrackNFindClsPtTPCafter->Fill( clsToF, lTrack->Pt());
341 
342  return kTRUE;
343 }
344 
347  // Track Selection for Photon Reconstruction
348 
349  Double_t clsToF = GetNFindableClustersTPC(lTrack);
350 
351  if( ! fEsdTrackCuts->AcceptTrack(lTrack) ){
352  return kFALSE;
353  }
354 
355  if( fDoEtaCut ) {
356  if( lTrack->Eta() > (fEtaCut + fEtaShift) || lTrack->Eta() < (-fEtaCut + fEtaShift) ) {
357  return kFALSE;
358  }
359  }
360 
361  if( lTrack->Pt() < fPtCut ) {
362  return kFALSE;
363  }
364 
365  if( clsToF < fMinClsTPCToF){
366  return kFALSE;
367  }
368 
369  return kTRUE;
370 }
371 
373 Bool_t AliPrimaryPionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
374 
375  // Pion Identification Cuts for Photon reconstruction
376 
377  if(!fPIDResponse){ InitPIDResponse(); }// Try to reinitialize PID Response
378  if(!fPIDResponse){ AliError("No PID Response"); return kFALSE;}// if still missing fatal error
379 
380  Int_t cutIndex=0;
381 
382  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
383  if(fHistITSdEdxbefore)fHistITSdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kPion));
384  if(fHistTPCdEdxbefore)fHistTPCdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kPion));
385  if(fHistTPCdEdxSignalbefore)fHistTPCdEdxSignalbefore->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));
386 
387  cutIndex++;
388 
389  if( fDodEdxSigmaITSCut == kTRUE ){
390  if( fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kPion)<fPIDnSigmaBelowPionLineITS ||
391  fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kPion)> fPIDnSigmaAbovePionLineITS ){
392  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
393  return kFALSE;
394  }
395  }
396 
397  if(fHistITSdEdxafter)fHistITSdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kPion));
398 
399 
400  cutIndex++;
401 
402 
403  if(fDodEdxSigmaTPCCut == kTRUE){
404  // TPC Pion Line
405  if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaBelowPionLineTPC ||
406  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)>fPIDnSigmaAbovePionLineTPC){
407  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
408  return kFALSE;
409  }
410  cutIndex++;
411  } else { cutIndex+=1; }
412 
413  if( ( fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid ) && ( !( fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch) ) ){
414  if(fHistTOFbefore) fHistTOFbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion));
415  if(fUseTOFpid){
416  if( fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion)>fPIDnSigmaAbovePionLineTOF ||
417  fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion)<fPIDnSigmaBelowPionLineTOF ){
418  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
419  return kFALSE;
420  }
421  }
422  if(fHistTOFafter)fHistTOFafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion));
423  } else if ( fRequireTOF == kTRUE ) {
424  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
425  return kFALSE;
426  }
427  cutIndex++;
428 
429  if(fHistdEdxCuts)fHistdEdxCuts->Fill(cutIndex);
430  if(fHistTPCdEdxafter)fHistTPCdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kPion));
431  if(fHistTPCdEdxSignalafter)fHistTPCdEdxSignalafter->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));
432 
433  return kTRUE;
434 }
435 
437 AliVTrack *AliPrimaryPionCuts::GetTrack(AliVEvent * event, Int_t label){
438  //Returns pointer to the track with given ESD label
439  //(Important for AOD implementation, since Track array in AOD data is different
440  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
441 
442  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
443  if(esdEvent) {
444  if(label > event->GetNumberOfTracks() ) return NULL;
445  AliESDtrack * track = esdEvent->GetTrack(label);
446  return track;
447  } else {
448  for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
449  AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
450  if(track) {
451  if(track->GetID() == label) {
452  return track;
453  }
454  }
455  }
456  }
457  cout << "track not found " << label << " " << event->GetNumberOfTracks() << endl;
458  return NULL;
459 }
460 
463 
464  Double_t clsToF=0;
465  if ( !fUseCorrectedTPCClsInfo ){
466  if(lTrack->GetTPCNclsF()!=0){
467  clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();
468  }
469  } else {
470  clsToF = lTrack->GetTPCClusterInfo(2,0); //NOTE ask friederike
471  }
472  return clsToF;
473 
474 }
475 
479 
480  if(fCutString && fCutString->GetString().Length() == kNCuts) {
481  fCutString->SetString(GetCutNumber());
482  } else {
483  return kFALSE;
484  }
485  return kTRUE;
486 
487 }
488 
491  fCutStringRead = Form("%s",analysisCutSelection.Data());
492 
493  // Initialize Cuts from a given Cut string
494 
495  AliInfo(Form("Set PionCuts Number: %s",analysisCutSelection.Data()));
496 
497  if(analysisCutSelection.Length()!=kNCuts) {
498  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
499  return kFALSE;
500  }
501  if(!analysisCutSelection.IsAlnum()){
502  AliError("Cut selection is not alphanumeric");
503  return kFALSE;
504  }
505 
506  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
507  analysisCutSelectionLowerCase.ToLower();
508  const char *cutSelection = analysisCutSelectionLowerCase.Data();
509  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
510  for(Int_t ii=0;ii<kNCuts;ii++){
511  ASSIGNARRAY(ii);
512  }
513 
514  // Set Individual Cuts
515  for(Int_t ii=0;ii<kNCuts;ii++){
516  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
517  }
518 
520  return kTRUE;
521 }
525 
526  //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
527 
528  switch (cutID) {
529  case kEtaCut:
530  if( SetEtaCut(value)) {
531  fCuts[kEtaCut] = value;
532  UpdateCutString();
533  return kTRUE;
534  } else return kFALSE;
535  case kClsITSCut:
536  if( SetITSClusterCut(value) ) {
537  fCuts[kClsITSCut] = value;
538  UpdateCutString();
539  return kTRUE;
540  } else return kFALSE;
541  case kClsTPCCut:
542  if( SetTPCClusterCut(value)) {
543  fCuts[kClsTPCCut] = value;
544  UpdateCutString();
545  return kTRUE;
546  } else return kFALSE;
547  case kDCACut:
548  if( SetDCACut(value)) {
549  fCuts[kDCACut] = value;
550  UpdateCutString();
551  return kTRUE;
552  } else return kFALSE;
553  case kPtCut:
554  if( SetPtCut(value)) {
555  fCuts[kPtCut] = value;
556  UpdateCutString();
557  return kTRUE;
558  } else return kFALSE;
559  case kPidedxSigmaITSCut:
560  if( SetITSdEdxCutPionLine(value)) {
561  fCuts[kPidedxSigmaITSCut] = value;
562  UpdateCutString();
563  return kTRUE;
564  } else return kFALSE;
565  case kPidedxSigmaTPCCut:
566  if( SetTPCdEdxCutPionLine(value)) {
567  fCuts[kPidedxSigmaTPCCut] = value;
568  UpdateCutString();
569  return kTRUE;
570  } else return kFALSE;
571  case kPiTOFSigmaPID:
572  if( SetTOFPionPIDCut(value)) {
573  fCuts[kPiTOFSigmaPID] = value;
574  UpdateCutString();
575  return kTRUE;
576  } else return kFALSE;
577  case kMassCut:
578  if( SetMassCut(value)) {
579  fCuts[kMassCut] = value;
580  UpdateCutString();
581  return kTRUE;
582  } else return kFALSE;
583  case kNCuts:
584  cout << "Error:: Cut id out of range"<< endl;
585  return kFALSE;
586  }
587 
588  cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
589  return kFALSE;
590 }
591 
594  // Print out current Cut Selection
595  for(Int_t ic = 0; ic < kNCuts; ic++) {
596  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
597  }
598 }
599 
602  // Print out current Cut Selection with value
603  printf("\nCharged Pion cutnumber \n");
604  for(Int_t ic = 0; ic < kNCuts; ic++) {
605  printf("%d",fCuts[ic]);
606  }
607  printf("\n\n");
608 
609  printf("Acceptance cuts \n");
610  if (fDoEtaCut) printf("\t |eta_{pi+-}| < %3.2f \n", fEtaCut);
611  else printf("\t none \n");
612  printf("Track cuts \n");
613  printf("\t %s \n", fStringITSClusterCut.Data());
614  printf("\t min N cluster TPC > %3.2f \n", fMinClsTPC);
615  printf("\t min N cluster TPC/ findable > %3.2f \n", fMinClsTPCToF);
616 // printf("\t dca > %3.2f \n", fMinClsTPCToF);
617 // "kDCAcut", // 3
618  printf("\t min pT > %3.2f \n", fPtCut);
619  printf("PID cuts \n");
620  if (fDodEdxSigmaITSCut)printf("\t %3.2f < ITS n_sigma pi < %3.2f \n", fPIDnSigmaBelowPionLineITS, fPIDnSigmaAbovePionLineITS );
621  if (fDodEdxSigmaTPCCut)printf("\t %3.2f < TPC n_sigma pi < %3.2f \n", fPIDnSigmaBelowPionLineTPC, fPIDnSigmaAbovePionLineTPC );
622  if (fDoTOFsigmaCut)printf("\t %3.2f < TOF n_sigma pi < %3.2f \n", fPIDnSigmaBelowPionLineTOF, fPIDnSigmaAbovePionLineTOF );
623  if (fDoMassCut) printf("two-pion mass cut < %3.2f \n", fMassCut);
624  printf("\n\n");
625 }
626 
627 
628 
631  switch(ededxSigmaCut){
632  case 0:
633  fDodEdxSigmaITSCut = kFALSE;
636  break;
637  case 1: // -10,10
638  fDodEdxSigmaITSCut = kTRUE;
641  break;
642  case 2: // -6,7
643  fDodEdxSigmaITSCut = kTRUE;
646  break;
647  case 3: // -5,5
648  fDodEdxSigmaITSCut = kTRUE;
651  break;
652  case 4: // -4,5
653  fDodEdxSigmaITSCut = kTRUE;
656  break;
657  case 5: // -3,5
658  fDodEdxSigmaITSCut = kTRUE;
661  break;
662  case 6: // -4,4
663  fDodEdxSigmaITSCut = kTRUE;
666  break;
667  case 7: // -2.5,4
668  fDodEdxSigmaITSCut = kTRUE;
671  break;
672  case 8: // -2,3.5
673  fDodEdxSigmaITSCut = kTRUE;
676  break;
677  default:
678  cout<<"Warning: ITSdEdxCutPionLine not defined"<<ededxSigmaCut<<endl;
679  return kFALSE;
680 
681  }
682  return kTRUE;
683 }
684 
687  switch(ededxSigmaCut){
688  case 0:
689  fDodEdxSigmaTPCCut = kFALSE;
692  break;
693  case 1: // -10,10
694  fDodEdxSigmaTPCCut = kTRUE;
697  break;
698  case 2: // -6,7
699  fDodEdxSigmaTPCCut = kTRUE;
702  break;
703  case 3: // -5,5
704  fDodEdxSigmaTPCCut = kTRUE;
707  break;
708  case 4: // -4,5
709  fDodEdxSigmaTPCCut = kTRUE;
712  break;
713  case 5: // -4,4
714  fDodEdxSigmaTPCCut = kTRUE;
717  break;
718  case 6: // -3,4
719  fDodEdxSigmaTPCCut = kTRUE;
722  break;
723  case 7: // -3,3
724  fDodEdxSigmaTPCCut = kTRUE;
727  break;
728  case 8: // -2,3.
729  fDodEdxSigmaTPCCut = kTRUE;
732  break;
733  default:
734  cout<<"Warning: TPCdEdxCutPionLine not defined"<<ededxSigmaCut<<endl;
735  return kFALSE;
736  }
737  return kTRUE;
738 }
739 
742  if( !fEsdTrackCuts ) {
743  cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
744  return kFALSE;
745  }
746 
747  switch(clsITSCut){
748  case 0:
749  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
750  fStringITSClusterCut= "no SPD cluster requirement";
751  break;
752  case 1:
753  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
754  fStringITSClusterCut= "first SPD cluster required";
755  break; //1 hit first layer of SPD
756  case 2:
757  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
758  fStringITSClusterCut= "first or second SPD cluster required";
759  break; //1 hit in any layer of SPD
760  case 3:
761  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
762  fEsdTrackCuts->SetMinNClustersITS(4);
763  fStringITSClusterCut= "first SPD cluster required, min number of ITS clusters = 4";
764  // 4 hits in total in the ITS. At least 1 hit in the first layer of SPD
765  break;
766  case 4:
767  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
768  fEsdTrackCuts->SetMinNClustersITS(3);
769  fStringITSClusterCut= "first or second SPD cluster required, min number of ITS clusters = 3";
770  // 3 hits in total in the ITS. At least 1 hit in any layer of SPD
771  break;
772  case 5:
773  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
774  fEsdTrackCuts->SetMinNClustersITS(4);
775  fStringITSClusterCut= "first or second SPD cluster required, min number of ITS clusters = 4";
776  // 4 hits in total in the ITS. At least 1 hit in any layer of SPD
777  break;
778  case 6:
779  fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
780  fEsdTrackCuts->SetMinNClustersITS(5);
781  fStringITSClusterCut= "first or second SPD cluster required, min number of ITS clusters = 5";
782  // 5 hits in total in the ITS. At least 1 hit in any layer of SPD
783  break;
784  default:
785  cout<<"Warning: clsITSCut not defined "<<clsITSCut<<endl;
786  return kFALSE;
787  }
788  return kTRUE;
789 }
790 
793  switch(clsTPCCut){
794  case 0: // 0
795  fMinClsTPC= 0.;
796  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
797  break;
798  case 1: // 70
799  fMinClsTPC= 70.;
800  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
801  break;
802  case 2: // 80
803  fMinClsTPC= 80.;
804  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
805  break;
806  case 3: // 100
807  fMinClsTPC= 100.;
808  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
809  break;
810  case 4: // 0% of findable clusters
811  fMinClsTPC= 70.;
812  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
813  fMinClsTPCToF= 0.0;
815  break;
816  case 5: // 35% of findable clusters
817  fMinClsTPC = 70.;
818  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
819  fMinClsTPCToF= 0.35;
821  break;
822  case 6: // 60% of findable clusters
823  fMinClsTPC= 70.;
824  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
825  fMinClsTPCToF= 0.6;
827  break;
828  case 7: // 70% of findable clusters
829  fMinClsTPC= 70.;
830  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
831  fMinClsTPCToF= 0.7;
833  break;
834  case 8: fMinClsTPC = 0.;
835  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
836  fMinClsTPCToF= 0.35;
838  break;
839  case 9: // 35% of findable clusters
840  fMinClsTPC = 70.;
841  fEsdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
842  fMinClsTPCToF= 0.35;
844  break;
845 
846  default:
847  cout<<"Warning: clsTPCCut not defined "<<clsTPCCut<<endl;
848  return kFALSE;
849  }
850  return kTRUE;
851 }
852 
855  // Set eta Cut
856  switch(etaCut){
857  case 0:
858  fEtaCut = 100.;
859  fDoEtaCut = kFALSE;
860  break;
861  case 1: // 1.4
862  fEtaCut = 1.4;
863  fDoEtaCut = kTRUE;
864  break;
865  case 2: // 1.2
866  fEtaCut = 1.2;
867  fDoEtaCut = kTRUE;
868  break;
869  case 3: // 0.9
870  fEtaCut = 0.9;
871  fDoEtaCut = kTRUE;
872  break;
873  case 4: // 0.8
874  fEtaCut = 0.8;
875  fDoEtaCut = kTRUE;
876  break;
877  case 5: // 0.75
878  fEtaCut = 0.75;
879  fDoEtaCut = kTRUE;
880  break;
881  case 6: //0.6
882  fEtaCut = 0.6; //changed from 0.4 to 0.6 2013.06.10
883  fDoEtaCut = kTRUE;
884  break;
885  case 7: //0.5
886  fEtaCut = 0.5; //changed from 0.3 to 0.5 2013.06.10
887  fDoEtaCut = kTRUE;
888  break;
889  case 8:
890  fEtaCut = 0.4;
891  fDoEtaCut = kTRUE;
892  break;
893  default:
894  cout<<"Warning: EtaCut not defined "<<etaCut<<endl;
895  return kFALSE;
896  }
897  return kTRUE;
898 }
899 
902  switch(ptCut){
903  case 0:
904  fPtCut = 0.075;
905  break;
906  case 1: // 0.1
907  fPtCut = 0.1;
908  break;
909  case 2: // 0.125 GeV
910  fPtCut = 0.125;
911  break;
912  case 3: // 0.15 GeV
913  fPtCut = 0.15;
914  break;
915  default:
916  cout<<"Warning: PtCut not defined "<<ptCut<<endl;
917  return kFALSE;
918  }
919  return kTRUE;
920 }
921 
922 
925 {
926  // Set DCA Cut
927  if( !fEsdTrackCuts ) {
928  cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
929  return kFALSE;
930  }
931 
932  switch(dcaCut){
933  case 0:
934  //Open cuts//
935  fEsdTrackCuts->SetMaxDCAToVertexZ(1000);
936  fEsdTrackCuts->SetMaxDCAToVertexXY(1000);
937  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
938  break;
939  case 1:
940  fEsdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
941  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
942  break;
943  case 2:
944  fEsdTrackCuts->SetMaxDCAToVertexZ(2);
945  fEsdTrackCuts->SetMaxDCAToVertexXY(1);
946  fEsdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
947  break;
948  default:
949  cout<<"Warning: dcaCut not defined "<<dcaCut<<endl;
950  return kFALSE;
951  }
952  return kTRUE;
953 }
954 
957  // Set Cut
958  switch(TOFelectronPID){
959  case 0: // no cut
960  fRequireTOF = kFALSE;
961  fUseTOFpid = kFALSE;
964  break;
965  case 1: // -7,7
966  fRequireTOF = kFALSE;
967  fUseTOFpid = kTRUE;
970  break;
971  case 2: // -5,5
972  fRequireTOF = kFALSE;
973  fUseTOFpid = kTRUE;
976  break;
977  case 3: // -3,5
978  fRequireTOF = kFALSE;
979  fUseTOFpid = kTRUE;
982  break;
983  case 4: // -2,3
984  fRequireTOF = kFALSE;
985  fUseTOFpid = kTRUE;
988  break;
989  case 5: // -3, 3 TOF mandatory
990  fRequireTOF = kTRUE;
991  fUseTOFpid = kTRUE;
994  break;
995  default:
996  cout<<"Warning: TOFPionCut not defined "<<TOFelectronPID<<endl;
997  return kFALSE;
998  }
999  return kTRUE;
1000 }
1001 
1004  // Set Cut
1005  switch(massCut){
1006  case 0: // no cut
1007  fDoMassCut = kFALSE;
1008  fMassCut = 10;
1009  break;
1010  case 1: // cut at 1 GeV/c^2
1011  fDoMassCut = kTRUE;
1012  fMassCut = 1;
1013  break;
1014  case 2: // cut at 0.7 GeV/c^2
1015  fDoMassCut = kTRUE;
1016  fMassCut = 0.75;
1017  break;
1018  case 3: // cut at 0.6 GeV/c^2
1019  fDoMassCut = kTRUE;
1020  fMassCut = 0.6;
1021  break;
1022  case 4: // cut at eta mass
1023  fDoMassCut = kTRUE;
1024  fMassCut = 0.547853;
1025  break;
1026  case 5: // cut at 0.5 GeV/c^2
1027  fDoMassCut = kTRUE;
1028  fMassCut = 0.5;
1029  break;
1030  case 6: // cut at 0.65 GeV/c^2
1031  fDoMassCut = kTRUE;
1032  fMassCut = 0.65;
1033  break;
1034  case 7: // cut at 0.7 GeV/c^2
1035  fDoMassCut = kTRUE;
1036  fMassCut = 0.7;
1037  break;
1038  default:
1039  cout<<"Warning: MassCut not defined "<<massCut<<endl;
1040  return kFALSE;
1041  }
1042  return kTRUE;
1043 }
1044 
1045 
1048  // returns TString with current cut number
1049  return fCutStringRead;
1050 }
1051 
1052 
1055  //Create and return standard 2010 PbPb cuts
1056  AliPrimaryPionCuts *cuts=new AliPrimaryPionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
1057  if(!cuts->InitializeCutsFromCutString("000000400")){
1058  cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;
1059  }
1060  return cuts;
1061 }
1062 
1065  //Create and return standard 2010 PbPb cuts
1066  AliPrimaryPionCuts *cuts=new AliPrimaryPionCuts("StandardCuts2010pp","StandardCuts2010pp");
1067 
1068  if(!cuts->InitializeCutsFromCutString("000000400")){
1069  cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;
1070  }
1071  return cuts;
1072 }
1073 
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)
static const char * fgkCutNames[kNCuts]
AliPrimaryPionCuts(const char *name="PionCuts", const char *title="Pion Cuts")
static AliPrimaryPionCuts * GetStandardCuts2010pp()
#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
ClassImp(AliPrimaryPionCuts) const char *AliPrimaryPionCuts
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
Bool_t PionIsSelectedMC(Int_t labelParticle, AliStack *fMCStack)
Double_t fPIDnSigmaBelowPionLineTPC
void InitCutHistograms(TString name="", Bool_t preCut=kTRUE, TString cutName="")