AliPhysics  6b290e4 (6b290e4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliV0CutsStrange.cxx
Go to the documentation of this file.
1 #include "AliV0CutsStrange.h"
2 
3 #include "AliAODTrack.h"
4 #include "AliESDtrack.h"
5 #include "AliAnalysisManager.h"
6 #include "AliInputEventHandler.h"
7 #include "AliMCEventHandler.h"
8 #include "AliAODHandler.h"
9 #include "TH1.h"
10 #include "TH2.h"
11 #include "TF1.h"
12 #include "AliStack.h"
13 #include "TObjString.h"
14 #include "AliAODEvent.h"
15 #include "AliESDEvent.h"
16 #include "AliCentrality.h"
17 #include "AliMultSelection.h"
18 #include "TList.h"
19 #include "TFile.h"
20 #include "AliLog.h"
21 #include "AliGenCocktailEventHeader.h"
22 #include "AliGenDPMjetEventHeader.h"
23 #include "AliGenPythiaEventHeader.h"
24 #include "AliGenHijingEventHeader.h"
25 #include "AliTriggerAnalysis.h"
26 #include "AliV0ReaderV1.h"
27 #include "AliVCaloCells.h"
28 #include "AliAODMCParticle.h"
29 #include "AliAODMCHeader.h"
30 #include "AliEMCALTriggerPatchInfo.h"
31 
32 class iostream;
33 
34 using namespace std;
35 
37 
38 
39 const char* AliV0CutsStrange::fgkCutNames[AliV0CutsStrange::kNCuts] = {
40  "V0FinderType" // 0
41 };
42 
43 
44 //________________________________________________________________________
45 AliV0CutsStrange::AliV0CutsStrange(const char *name,const char *title) :
46  AliAnalysisCuts(name, title),
47  fHistograms(NULL),
48  fPIDResponse(NULL),
49  fIsQA(kFALSE),
50  fV0ReaderStrangeName("V0ReaderStrange"),
51  fCutString(NULL),
52  fCutStringRead(""),
53  fPreSelCut(kFALSE),
54  fUseOnFlyV0Finder(kTRUE),
55  fUseOnFlyV0FinderSameSign(0),
56  fMinClsTPC(0.),
57  fMinClsTPCToF(0.),
58  fUseCorrectedTPCClsInfo(kFALSE),
59  fPIDTPCnSigmaProtonLow(0),
60  fPIDTPCnSigmaProtonUp(0),
61  fPIDTPCnSigmaPionLow(0),
62  fPIDTPCnSigmaPionUp(0),
63  fPIDTOFnSigmaProtonLow(0),
64  fPIDTOFnSigmaProtonUp(0),
65  fPIDTOFnSigmaPionLow(0),
66  fPIDTOFnSigmaPionUp(0),
67  fHistoCutIndex(NULL),
68  fHistodEdxCutsProton(NULL),
69  fHistoTPCdEdxProtonBefore(NULL),
70  fHistoTPCdEdxSigmaProtonBefore(NULL),
71  fHistoTPCdEdxProtonAfter(NULL),
72  fHistoTPCdEdxSigmaProtonAfter(NULL),
73  fHistoTOFdEdxProtonBefore(NULL),
74  fHistoTOFdEdxSigmaProtonBefore(NULL),
75  fHistoTOFdEdxProtonAfter(NULL),
76  fHistoTOFdEdxSigmaProtonAfter(NULL),
77  fHistodEdxCutsPion(NULL),
78  fHistoTPCdEdxPionBefore(NULL),
79  fHistoTPCdEdxSigmaPionBefore(NULL),
80  fHistoTPCdEdxPionAfter(NULL),
81  fHistoTPCdEdxSigmaPionAfter(NULL),
82  fHistoTOFdEdxPionBefore(NULL),
83  fHistoTOFdEdxSigmaPionBefore(NULL),
84  fHistoTOFdEdxPionAfter(NULL),
85  fHistoTOFdEdxSigmaPionAfter(NULL)
86 {
88  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
89  fCutString=new TObjString((GetCutNumber()).Data());
90 }
91 
92 
93 
94 //________________________________________________________________________
96  AliAnalysisCuts(ref),
97  fHistograms(NULL),
98  fPIDResponse(NULL),
99  fIsQA(kFALSE),
100  fV0ReaderStrangeName("V0ReaderStrange"),
101  fCutString(ref.fCutString),
102  fCutStringRead(ref.fCutStringRead),
103  fPreSelCut(ref.fPreSelCut),
104  fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
105  fUseOnFlyV0FinderSameSign(ref.fUseOnFlyV0FinderSameSign),
106  fMinClsTPC(ref.fMinClsTPC),
107  fMinClsTPCToF(ref.fMinClsTPCToF),
108  fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
109  fPIDTPCnSigmaProtonLow(ref.fPIDTPCnSigmaProtonLow),
110  fPIDTPCnSigmaProtonUp(ref.fPIDTPCnSigmaProtonUp),
111  fPIDTPCnSigmaPionLow(ref.fPIDTPCnSigmaPionLow),
112  fPIDTPCnSigmaPionUp(ref.fPIDTPCnSigmaPionUp),
113  fPIDTOFnSigmaProtonLow(ref.fPIDTOFnSigmaProtonLow),
114  fPIDTOFnSigmaProtonUp(ref.fPIDTOFnSigmaProtonUp),
115  fPIDTOFnSigmaPionLow(ref.fPIDTOFnSigmaPionLow),
116  fPIDTOFnSigmaPionUp(ref.fPIDTOFnSigmaPionUp),
117  fHistoCutIndex(NULL),
118  fHistodEdxCutsProton(NULL),
119  fHistoTPCdEdxProtonBefore(NULL),
120  fHistoTPCdEdxSigmaProtonBefore(NULL),
121  fHistoTPCdEdxProtonAfter(NULL),
122  fHistoTPCdEdxSigmaProtonAfter(NULL),
123  fHistoTOFdEdxProtonBefore(NULL),
124  fHistoTOFdEdxSigmaProtonBefore(NULL),
125  fHistoTOFdEdxProtonAfter(NULL),
126  fHistoTOFdEdxSigmaProtonAfter(NULL),
127  fHistodEdxCutsPion(NULL),
128  fHistoTPCdEdxPionBefore(NULL),
129  fHistoTPCdEdxSigmaPionBefore(NULL),
130  fHistoTPCdEdxPionAfter(NULL),
131  fHistoTPCdEdxSigmaPionAfter(NULL),
132  fHistoTOFdEdxPionBefore(NULL),
133  fHistoTOFdEdxSigmaPionBefore(NULL),
134  fHistoTOFdEdxPionAfter(NULL),
135  fHistoTOFdEdxSigmaPionAfter(NULL)
136 {
137  // Copy Constructor
138  for(Int_t jj=0;jj<kNCuts;jj++){
139  fCuts[jj]=ref.fCuts[jj];
140  }
141  fCutString=new TObjString((GetCutNumber()).Data());
142 }
143 
144 
145 
146 //________________________________________________________________________
148  // Destructor
149  if(fCutString != NULL){
150  delete fCutString;
151  fCutString = NULL;
152  }
153 }
154 
155 
156 //________________________________________________________________________
158 
159  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
160  TH1::AddDirectory(kFALSE);
161 
162  if(fHistograms != NULL){
163  delete fHistograms;
164  fHistograms=NULL;
165  }
166  if(fHistograms==NULL){
167  fHistograms=new TList();
168  fHistograms->SetOwner(kTRUE);
169  if(name=="")fHistograms->SetName(Form("V0Cuts_%s",GetCutNumber().Data()));
170  else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
171  }
172 
173  // IsV0Selected
174  fHistoCutIndex=new TH1F(Form("IsV0Selected %s",GetCutNumber().Data()),"IsV0Selected",12,-0.5,11.5);
175  fHistoCutIndex->GetXaxis()->SetBinLabel(kV0In+1,"in");
176  fHistoCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
177  fHistoCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
178  fHistoCutIndex->GetXaxis()->SetBinLabel(kNoV0+1,"miss. V0 in AOD");
179 // if (!fSwitchToKappa)fHistoCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"PID");
180 // else fHistoCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"Kappa+[TOF,ITS,TRD] PID");
181  fHistoCutIndex->GetXaxis()->SetBinLabel(kSameSign+1,"Same sign");
182  fHistoCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
183  fHistoCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
184  fHistoCutIndex->GetXaxis()->SetBinLabel(kEventPlane+1,"EventPlane");
185  fHistoCutIndex->GetXaxis()->SetBinLabel(kV0Out+1,"out");
187 
188  // dEdx Cuts proton
189  fHistodEdxCutsProton=new TH2F(Form("dEdxCuts proton %s",GetCutNumber().Data()),"dEdxCuts proton vs p_{T,e}",11,-0.5,10.5,250,0,50);
190  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(1,"in");
191  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(2,"TPCproton");
192  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(3,"TOF proton");
193  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(4,"out");
194  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(5,"empty");
195  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(6,"empty");
196  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(7,"empty");
197  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(8,"empty");
198  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(9,"empty");
199  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(10,"empty");
200  fHistodEdxCutsProton->GetXaxis()->SetBinLabel(11,"empty");
202 
203  if(fIsQA==kTRUE){
204  fHistoTPCdEdxProtonBefore=new TH2F(Form("Proton_dEdx_TPC_before %s",GetCutNumber().Data()),"dEdx Proton before; p_{T}; TPC signal" ,150,0.03,20,800,0,200);
206  fHistoTPCdEdxSigmaProtonBefore=new TH2F(Form("Proton_dEdxSigma_TPC_before %s",GetCutNumber().Data()),"dEdx Sigma Proton before; p_{T}; TPC sigma proton" ,150,0.03,20,400,-10,10);
208  fHistoTPCdEdxProtonAfter=new TH2F(Form("Proton_dEdx_TPC_after%s",GetCutNumber().Data()),"dEdx Proton after; p_{T}; TPC signal" ,150,0.03,20,800,0,200);
210  fHistoTPCdEdxSigmaProtonAfter=new TH2F(Form("Proton_dEdxSigma_TPC_after %s",GetCutNumber().Data()),"dEdx Sigma Proton after; p_{T}; TPC sigma proton" ,150,0.03,20,400,-10,10);
212 
213  fHistoTOFdEdxProtonBefore=new TH2F(Form("Proton_dEdx_TOF_before %s",GetCutNumber().Data()),"dEdx Proton before; p_{T}; TOF signal" ,150,0.03,20,800,0,30000);
215  fHistoTOFdEdxSigmaProtonBefore=new TH2F(Form("Proton_dEdxSigma_TOF_before %s",GetCutNumber().Data()),"dEdx Sigma Proton before; p_{T}; TOF sigma proton" ,150,0.03,20,400,-10,10);
217  fHistoTOFdEdxProtonAfter=new TH2F(Form("Proton_dEdx_TOF_after%s",GetCutNumber().Data()),"dEdx Proton after; p_{T}; TOF signal" ,150,0.03,20,800,0,30000);
219  fHistoTOFdEdxSigmaProtonAfter=new TH2F(Form("Proton_dEdxSigma_TOF_after %s",GetCutNumber().Data()),"dEdx Sigma Proton after; p_{T}; TOF sigma proton" ,150,0.03,20,400,-10,10);
221  }
222 
223 
224  // dEdx Cuts pion
225  fHistodEdxCutsPion=new TH2F(Form("dEdxCuts pion %s",GetCutNumber().Data()),"dEdxCuts pion vs p_{T,e}",11,-0.5,10.5,250,0,50);
226  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(1,"in");
227  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(2,"TPCpion");
228  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(3,"TPCpion");
229  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
230  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
231  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
232  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
233  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(8,"TOFelectron");
234  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(9,"ITSelectron");
235  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(10,"TRDelectron");
236  fHistodEdxCutsPion->GetXaxis()->SetBinLabel(11,"out");
238 
239  if(fIsQA==kTRUE){
240  fHistoTPCdEdxPionBefore=new TH2F(Form("Pion_dEdx_TPC_before %s",GetCutNumber().Data()),"dEdx Pion before; p_{T}; TPC signal" ,150,0.03,20,800,0,200);
242  fHistoTPCdEdxSigmaPionBefore=new TH2F(Form("Pion_dEdxSigma_TPC_before %s",GetCutNumber().Data()),"dEdx Sigma Pion before; p_{T}; TPC sigma pion" ,150,0.03,20,400,-10,10);
244  fHistoTPCdEdxPionAfter=new TH2F(Form("Pion_dEdx_TPC_after%s",GetCutNumber().Data()),"dEdx Pion after; p_{T}; TPC signal" ,150,0.03,20,800,0,200);
246  fHistoTPCdEdxSigmaPionAfter=new TH2F(Form("Pion_dEdxSigma_TPC_after %s",GetCutNumber().Data()),"dEdx Sigma Pion after; p_{T}; TPC sigma pion" ,150,0.03,20,400,-10,10);
248 
249  fHistoTOFdEdxPionBefore=new TH2F(Form("Pion_dEdx_TOF_before %s",GetCutNumber().Data()),"dEdx Pion before; p_{T}; TOF signal" ,150,0.03,20,800,0,30000);
251  fHistoTOFdEdxSigmaPionBefore=new TH2F(Form("Pion_dEdxSigma_TOF_before %s",GetCutNumber().Data()),"dEdx Sigma Pion before; p_{T}; TOF sigma proton" ,150,0.03,20,400,-10,10);
253  fHistoTOFdEdxPionAfter=new TH2F(Form("Pion_dEdx_TOF_after%s",GetCutNumber().Data()),"dEdx Pion after; p_{T}; TOF signal" ,150,0.03,20,800,0,30000);
255  fHistoTOFdEdxSigmaPionAfter=new TH2F(Form("Pion_dEdxSigma_TOF_after %s",GetCutNumber().Data()),"dEdx Sigma Pion after; p_{T}; TOF sigma proton" ,150,0.03,20,400,-10,10);
257  }
258 
259  TH1::AddDirectory(kTRUE);
260 }
261 
262 
265  // returns TString with current cut number
266  return fCutStringRead;
267 }
268 
269 
270 //________________________________________________________________________
272  // Set Pointer to AliPIDResponse
273 
274  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
275  if(man) {
276  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
277  fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
278  if(fPIDResponse)return kTRUE;
279  }
280  return kFALSE;
281 }
282 
283 
287 
288  switch (cutID) {
289 
290  case kv0FinderType:
291  if( SetV0Finder(value)) {
292  fCuts[kv0FinderType] = value;
293  UpdateCutString();
294  return kTRUE;
295  } else return kFALSE;
296  case kclsTPCCut:
297  if( SetTPCClusterCut(value)) {
298  fCuts[kclsTPCCut] = value;
299  UpdateCutString();
300  return kTRUE;
301  } else return kFALSE;
302  case kProtonPIDcut:
303  if( SetProtonPIDCut(value)) {
304  fCuts[kProtonPIDcut] = value;
305  UpdateCutString();
306  return kTRUE;
307  } else return kFALSE;
308  case kPionPIDcut:
309  if( SetPionPIDCut(value)) {
310  fCuts[kPionPIDcut] = value;
311  UpdateCutString();
312  return kTRUE;
313  } else return kFALSE;
314  case kNCuts:
315  AliError("Cut id out of range");
316  return kFALSE;
317  }
318 
319  AliError("Cut id %d not recognized");
320  return kFALSE;
321 }
322 
323 
326  fCutStringRead = Form("%s",analysisCutSelection.Data());
327 
328  // Initialize Cuts from a given Cut string
329 
330  AliInfo(Form("Set V0 Cut Number: %s",analysisCutSelection.Data()));
331  if(analysisCutSelection.Length()!=kNCuts) {
332  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
333  return kFALSE;
334  }
335  if(!analysisCutSelection.IsAlnum()){
336  AliError("Cut selection is not alphanumeric");
337  return kFALSE;
338  }
339 
340 // if (fV0ReaderStrangeName.CompareTo("") == 0){
341 // fV0ReaderStrangeName = "V0ReaderV1";
342 // }
343  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
344  analysisCutSelectionLowerCase.ToLower();
345  const char *cutSelection = analysisCutSelectionLowerCase.Data();
346  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
347  for(Int_t ii=0;ii<kNCuts;ii++){
348  ASSIGNARRAY(ii);
349  }
350 
351  // Set Individual Cuts
352  for(Int_t ii=0;ii<kNCuts;ii++){
353  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
354  }
355 
357 
358  return kTRUE;
359 }
360 
364 
365  if(fCutString && fCutString->GetString().Length() == kNCuts) {
366  fCutString->SetString(GetCutNumber());
367  } else {
368  return kFALSE;
369  }
370  return kTRUE;
371 }
372 
375  // Print out current Cut Selection
376  for(Int_t ic = 0; ic < kNCuts; ic++) {
377  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
378  }
379 }
380 
383  printf("\nConversion cutnumber \n");
384  for(Int_t ic = 0; ic < kNCuts; ic++) {
385  printf("%d",fCuts[ic]);
386  }
387 
388  if (!fUseCorrectedTPCClsInfo) printf("\t # TPC clusters > %3.2f \n", fMinClsTPC);
389  if (fUseCorrectedTPCClsInfo) printf("\t #cluster TPC/ #findable clusters TPC (corrected for radius) > %3.2f\n", fMinClsTPCToF );
390 
391 }
392 
393 
394 
396 Bool_t AliV0CutsStrange::SetV0Finder(Int_t v0FinderType){ // Set Cut
397  switch (v0FinderType){
398  case 0: // on fly V0 finder
399  cout << "have chosen onfly V0" << endl;
400  fUseOnFlyV0Finder=kTRUE;
402  break;
403  case 1: // offline V0 finder
404  cout << "have chosen offline V0" << endl;
405  fUseOnFlyV0Finder=kFALSE;
407  break;
408  case 2: // on fly V0 finder with same signs
409  cout << "have chosen onfly V0 same sign pairing" << endl;
410  fUseOnFlyV0Finder=kTRUE;
412  break;
413  case 3: // on fly V0 finder with unlike signs and same signs
414  cout << "have chosen onfly V0 unlike sign and same signs pairing" << endl;
415  fUseOnFlyV0Finder=kTRUE;
417  break;
418  default:
419  AliError(Form(" v0FinderType not defined %d",v0FinderType));
420  return kFALSE;
421  }
422  return kTRUE;
423 }
424 
426 AliVTrack *AliV0CutsStrange::GetTrack(AliVEvent * event, Int_t label){
427  //Returns pointer to the track with given ESD label
428  //(Important for AOD implementation, since Track array in AOD data is different
429  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
430 
431  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
432  if(esdEvent) {
433  if(label > event->GetNumberOfTracks() ) return NULL;
434  AliESDtrack * track = esdEvent->GetTrack(label);
435  return track;
436 
437  } else {
438  if(label == -999999) return NULL; // if AOD relabelling goes wrong, immediately return NULL
439  AliVTrack * track = 0x0;
440  if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderStrangeName.Data()))->AreAODsRelabeled()){
441  if(event->GetTrack(label)) track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
442  return track;
443  }
444  else{
445  for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
446  if(event->GetTrack(ii)) track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
447  if(track){
448  if(track->GetID() == label) {
449  return track;
450  }
451  }
452  }
453  }
454  }
455  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
456  return NULL;
457 }
458 
460 AliESDtrack *AliV0CutsStrange::GetESDTrack(AliESDEvent * event, Int_t label){
461  //Returns pointer to the track with given ESD label
462  //(Important for AOD implementation, since Track array in AOD data is different
463  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
464 
465  if(event) {
466  if(label > event->GetNumberOfTracks() ) return NULL;
467  AliESDtrack * track = event->GetTrack(label);
468  return track;
469  }
470  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
471  return NULL;
472 }
473 
474 
475 
477 Bool_t AliV0CutsStrange::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma)
478 {
479  // MonteCarlo Photon Selection
480 
481  if(!fMCStack)return kFALSE;
482 
483 // if (particle->GetPdgCode() == 22){
484 
485 //many many cuts to be included
486  // if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
487  // return kFALSE;
488  // if(fEtaCutMin>-0.1){
489  // if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
490  // return kFALSE;
491  // }
492 
493  // if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
494  // return kFALSE; // no photon as mothers!
495  // }
496  /*
497  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
498  TParticle* ePos = NULL;
499  TParticle* eNeg = NULL;
500 
501  if(particle->GetNDaughters() >= 2){
502  for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
503  if(daughterIndex<0) continue;
504  TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
505 
506  if(tmpDaughter->GetUniqueID() == 5){
507  if(tmpDaughter->GetPdgCode() == 11){
508  eNeg = tmpDaughter;
509  } else if(tmpDaughter->GetPdgCode() == -11){
510  ePos = tmpDaughter;
511  }
512  }
513  }
514  }
515 
516  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
517  return kFALSE;
518  }
519 
520  if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
521  return kFALSE; // no reconstruction below the Pt cut
522  }
523 
524  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
525  eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
526  return kFALSE;
527 
528  if(fEtaCutMin > -0.1){
529  if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
530  (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
531  return kFALSE;
532  }
533 
534  if(ePos->R()>fMaxR){
535  return kFALSE; // cuts on distance from collision point
536  }
537 
538  if(fabs(ePos->Vz()) > fMaxZ){
539  return kFALSE; // outside material
540  }
541  if(fabs(eNeg->Vz()) > fMaxZ){
542  return kFALSE; // outside material
543  }
544 
545  if( ePos->R() <= ((fabs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
546  return kFALSE; // line cut to exclude regions where we do not reconstruct
547  } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((fabs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
548  return kFALSE;
549  }
550 
551  if( eNeg->R() <= ((fabs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
552  return kFALSE; // line cut to exclude regions where we do not reconstruct
553  } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((fabs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
554  return kFALSE;
555  }
556 
557  return kTRUE;
558  //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
559  }*/
560  return kFALSE;
561 }
562 
563 
564 
566 Bool_t AliV0CutsStrange::GetPIDpion(AliVTrack *fCurrentTrack){
567  // Pion Identification Cuts for V0 reconstruction
568  if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
569  if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
570 
571  // use TOF signal if available, for tracks with p > 0.75
572  AliPIDResponse::EDetPidStatus statusPosTOF = fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF, fCurrentTrack);
573  Bool_t isPIDTOF = kFALSE;
574  if (AliPIDResponse::kDetPidOk == statusPosTOF && fCurrentTrack->GetP()>0.75) {
575  isPIDTOF = kTRUE;
576  }
577 
578  Int_t cutIndex=0;
579  if(fHistodEdxCutsPion)fHistodEdxCutsPion->Fill(cutIndex,fCurrentTrack->Pt());
580  if(fHistoTPCdEdxSigmaPionBefore)fHistoTPCdEdxSigmaPionBefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kPion));
581  if(fHistoTPCdEdxPionBefore)fHistoTPCdEdxPionBefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
582  cutIndex++;
583 
584  //select protons
585  if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDTPCnSigmaPionLow || fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)>fPIDTPCnSigmaPionUp){
586  return kFALSE;
587  }
588 
589  if(fHistodEdxCutsPion)fHistodEdxCutsPion->Fill(cutIndex,fCurrentTrack->Pt());
590  cutIndex++;
591 
592  //select protons with TOF
593  if(isPIDTOF){
594  if(fHistoTOFdEdxSigmaPionBefore)fHistoTOFdEdxSigmaPionBefore->Fill(fCurrentTrack->Pt(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kPion));
595  if(fHistoTOFdEdxPionBefore)fHistoTOFdEdxPionBefore->Fill(fCurrentTrack->Pt(),fCurrentTrack->GetTOFsignal());
596  if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack,AliPID::kPion)<fPIDTOFnSigmaPionLow || fPIDResponse->NumberOfSigmasTOF(fCurrentTrack,AliPID::kPion)>fPIDTOFnSigmaPionUp){
597  return kFALSE;
598  }
599  }
600 
601  if(fHistodEdxCutsProton)fHistodEdxCutsPion->Fill(cutIndex,fCurrentTrack->Pt());
602  cutIndex++;
603 
604  if(fHistodEdxCutsPion)fHistodEdxCutsPion->Fill(cutIndex,fCurrentTrack->Pt());
605  if(fHistoTPCdEdxSigmaPionAfter)fHistoTPCdEdxSigmaPionAfter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kPion));
606  if(fHistoTPCdEdxPionAfter)fHistoTPCdEdxPionAfter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
607  if(isPIDTOF){
608  if(fHistoTOFdEdxSigmaPionAfter)fHistoTOFdEdxSigmaPionAfter->Fill(fCurrentTrack->Pt(), fPIDResponse->NumberOfSigmasTOF(fCurrentTrack,AliPID::kPion));
609  if(fHistoTOFdEdxPionAfter)fHistoTOFdEdxPionAfter->Fill(fCurrentTrack->Pt(),fCurrentTrack->GetTOFsignal());
610  }
611 
612  return kTRUE;
613 }
614 
615 
616 
618 Bool_t AliV0CutsStrange::GetPIDproton(AliVTrack *fCurrentTrack){
619  // Proton Identification Cuts for V0 reconstruction
620  if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
621  if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
622 
623  // use TOF signal if available, for tracks with p > 0.75
624  AliPIDResponse::EDetPidStatus statusPosTOF = fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF, fCurrentTrack);
625  Bool_t isPIDTOF = kFALSE;
626  if (AliPIDResponse::kDetPidOk == statusPosTOF && fCurrentTrack->GetP()>0.75) {
627  isPIDTOF = kTRUE;
628  }
629 
630  Int_t cutIndex=0;
631  if(fHistodEdxCutsProton)fHistodEdxCutsProton->Fill(cutIndex,fCurrentTrack->Pt());
632  if(fHistoTPCdEdxSigmaProtonBefore)fHistoTPCdEdxSigmaProtonBefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kProton));
633  if(fHistoTPCdEdxProtonBefore)fHistoTPCdEdxProtonBefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
634  cutIndex++;
635 
636  //select protons with TPC
637  if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton)<fPIDTPCnSigmaProtonLow || fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton)>fPIDTPCnSigmaProtonUp){
638  return kFALSE;
639  }
640 
641  if(fHistodEdxCutsProton)fHistodEdxCutsProton->Fill(cutIndex,fCurrentTrack->Pt());
642  cutIndex++;
643 
644  //select protons with TOF
645  if(isPIDTOF){
646  if(fHistoTOFdEdxSigmaProtonBefore)fHistoTOFdEdxSigmaProtonBefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kProton));
647  if(fHistoTOFdEdxProtonBefore)fHistoTOFdEdxProtonBefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTOFsignal());
648  if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack,AliPID::kProton)<fPIDTOFnSigmaProtonLow || fPIDResponse->NumberOfSigmasTOF(fCurrentTrack,AliPID::kProton)>fPIDTOFnSigmaProtonUp){
649  return kFALSE;
650  }
651  }
652 
653  if(fHistodEdxCutsProton)fHistodEdxCutsProton->Fill(cutIndex,fCurrentTrack->Pt());
654  cutIndex++;
655 
656  if(fHistodEdxCutsProton)fHistodEdxCutsProton->Fill(cutIndex,fCurrentTrack->Pt());
657  if(fHistoTPCdEdxSigmaProtonAfter)fHistoTPCdEdxSigmaProtonAfter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kProton));
658  if(fHistoTPCdEdxProtonAfter)fHistoTPCdEdxProtonAfter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
659 
660  if(isPIDTOF){
661  if(fHistoTOFdEdxSigmaProtonAfter)fHistoTOFdEdxSigmaProtonAfter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kProton));
662  if(fHistoTOFdEdxProtonAfter)fHistoTOFdEdxProtonAfter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTOFsignal());
663  }
664 
665  return kTRUE;
666 }
667 
668 
671  switch(clsTPCCut){
672  case 0: // 0
673  fMinClsTPC= 0.;
674  break;
675  case 1: // 60
676  fMinClsTPC= 60.;
677  break;
678  case 2: // 80
679  fMinClsTPC= 80.;
680  break;
681  case 3: // 100
682  fMinClsTPC= 100.;
683  break;
684  case 4: // 95% of findable clusters
685  fMinClsTPCToF= 0.95;
687  break;
688  case 5: // 0% of findable clusters
689  fMinClsTPCToF= 0.0;
691  break;
692  case 6: // 70% of findable clusters
693  fMinClsTPCToF= 0.7;
695  break;
696  case 7: // 0% of findable clusters
697  fMinClsTPCToF= 0.35;
699  break;
700  case 8:
701  fMinClsTPCToF= 0.35;
703  break;
704  case 9:
705  fMinClsTPCToF= 0.6;
707  break;
708  default:
709  AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
710  return kFALSE;
711  }
712  return kTRUE;
713 }
714 
715 
718  switch(pPIDcut){
719  case 0:
724  break;
725  case 1:
730  default:
731  AliError(Form("Warning: ProtonPIDcut not defined %d",pPIDcut));
732  return kFALSE;
733  }
734  return kTRUE;
735 
736 
737  return kTRUE;
738 }
739 
742  switch(pPIDcut){
743  case 0:
748  break;
749  case 1:
754  default:
755  AliError(Form("Warning: Pion PIDcut not defined %d",pPIDcut));
756  return kFALSE;
757  }
758  return kTRUE;
759 }
TH2F * fHistoTPCdEdxSigmaPionAfter
Double_t fPIDTOFnSigmaProtonLow
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
AliPIDResponse * fPIDResponse
TH2F * fHistoTPCdEdxSigmaPionBefore
TH2F * fHistoTPCdEdxProtonBefore
Double_t fPIDTPCnSigmaProtonUp
Bool_t SetTPCClusterCut(Int_t clsTPCCut)
Double_t fPIDTPCnSigmaPionUp
Double_t fPIDTPCnSigmaPionLow
static const char * fgkCutNames[kNCuts]
Bool_t GetPIDproton(AliVTrack *fCurrentTrack)
TH2F * fHistoTOFdEdxProtonAfter
Bool_t GetPIDpion(AliVTrack *fCurrentTrack)
TObjString * fCutString
Bool_t PhotonIsSelectedMC(TParticle *particle, AliStack *fMCStack, Bool_t checkForConvertedGamma)
TH2F * fHistoTOFdEdxProtonBefore
AliVTrack * GetTrack(AliVEvent *event, Int_t label)
TH2F * fHistoTOFdEdxSigmaProtonBefore
void InitCutHistograms(TString name="", Bool_t preCut=kTRUE)
Bool_t SetPionPIDCut(Int_t pPIDcut)
#define ASSIGNARRAY(i)
Double_t fPIDTOFnSigmaPionUp
int Int_t
Definition: External.C:63
TH2F * fHistoTPCdEdxSigmaProtonAfter
ClassImp(AliV0CutsStrange) const char *AliV0CutsStrange
Double_t fPIDTOFnSigmaPionLow
TH2F * fHistoTPCdEdxSigmaProtonBefore
Int_t fCuts[kNCuts]
Double_t fUseCorrectedTPCClsInfo
Bool_t SetProtonPIDCut(Int_t pPIDcut)
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)
TH2F * fHistoTPCdEdxProtonAfter
Double_t fPIDTPCnSigmaProtonLow
Double_t fPIDTOFnSigmaProtonUp
TH2F * fHistoTOFdEdxPionBefore
Bool_t SetCut(cutIds cutID, Int_t cut)
Bool_t SetV0Finder(Int_t v0FinderType)
bool Bool_t
Definition: External.C:53
AliV0CutsStrange(const char *name="V0ReaderCutsStrange", const char *title="V0ReaderCutsStrange")
TH2F * fHistoTPCdEdxPionBefore
TH2F * fHistoTOFdEdxSigmaPionAfter
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection)
TH2F * fHistoTOFdEdxSigmaPionBefore
AliESDtrack * GetESDTrack(AliESDEvent *event, Int_t label)
TH2F * fHistoTOFdEdxSigmaProtonAfter
TString fV0ReaderStrangeName