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