Changes in spectra code, Adding selection for Ruben's estimator and pt depended ...
authormchojnac <Marek.Chojnacki@cern.ch>
Mon, 21 Jul 2014 15:17:37 +0000 (17:17 +0200)
committermchojnac <Marek.Chojnacki@cern.ch>
Mon, 21 Jul 2014 15:20:30 +0000 (17:20 +0200)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraBoth.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothPID.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.h

index e988844..b129799 100644 (file)
@@ -205,7 +205,8 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                  }
        }
        if(!fdotheMCLoopAfterEventCuts)
-               if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ))return;//event selection
+               if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ))
+                       return;//event selection
        //main loop on tracks
        Int_t ntracks=0;
        //cout<<fAOD->GetNumberOfTracks()<<endl;
@@ -245,7 +246,8 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                else
                        continue;
                if (!fTrackCuts->IsSelected(track,kTRUE)) 
-                       continue;
+                       continue;       
+                       
                ntracks++;
                if(fmakePIDQAhisto)
                        fPID->FillQAHistos(fHistMan, track, fTrackCuts);
index a46a2e9..670c79b 100644 (file)
@@ -45,9 +45,11 @@ ClassImp(AliSpectraBothEventCuts)
 
 AliSpectraBothEventCuts::AliSpectraBothEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0),fAODEvent(AliSpectraBothTrackCuts::kAODobject), fTrackBits(0),fIsMC(0),fCentEstimator(""), fUseCentPatchAOD049(0), fUseSDDPatchforLHC11a(kDoNotCheckforSDD),fTriggerSettings(AliVEvent::kMB),fTrackCuts(0),
 fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), fQVectorCutMax(0), fVertexCutMin(0), fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0),fMaxChi2perNDFforVertex(0),
-fMinRun(0),fMaxRun(0),
+fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVector(0)
-,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0)
+,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0),
+fHistoCentrality(0),fHistoMultiplicty(0)
+
 {
   // Constructori
  // Bool_t oldStatus = TH1::AddDirectoryStatus();
@@ -110,6 +112,11 @@ AliSpectraBothEventCuts::~AliSpectraBothEventCuts()
                delete fHistoEP;
        if(fHistoRunNumbers)
                delete fHistoRunNumbers;
+       if(fHistoCentrality)
+               delete fHistoCentrality;
+       if(fHistoMultiplicty)
+               delete fHistoMultiplicty;
+
 }
 //______________________________________________________
 void AliSpectraBothEventCuts::InitHisto()
@@ -148,6 +155,12 @@ void AliSpectraBothEventCuts::InitHisto()
                        fHistoRunNumbers=new TH1F("fHistoRunNumbers","Run numbers",1001,120000-.5,121000+0.5);
 
        }
+       if(!fHistoCentrality)
+               fHistoCentrality = new TH2F("fHistoCentrality", "centrality",2,0,2,100,0.0,100);
+
+       if(!fHistoMultiplicty)
+               fHistoMultiplicty= new TH2F("fHistoMultiplicty", "multiplicty estimator",2,0,2,100,0.0,100);
+
        TH1::AddDirectory(oldStatus);           
 }
 //______________________________________________________
@@ -295,8 +308,12 @@ Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
   Double_t cent=0;
   if(!fUseCentPatchAOD049)cent=fAOD->GetCentrality()->GetCentralityPercentile(fCentEstimator.Data());
   else cent=ApplyCentralityPatchAOD049();
-  
-  if ( (cent <= fCentralityCutMax)  &&  (cent >= fCentralityCutMin) )  return kTRUE;   
+  fHistoCentrality->Fill(0.5,cent);    
+  if ( (cent <= fCentralityCutMax)  &&  (cent >= fCentralityCutMin) )  
+  {
+        fHistoCentrality->Fill(1.5,cent);      
+       return kTRUE;
+  }       
   fHistoCuts->Fill(kVtxCentral);
 
   return kFALSE;
@@ -306,19 +323,36 @@ Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
 Bool_t AliSpectraBothEventCuts::CheckMultiplicityCut()
 {
   // Check multiplicity cut
-if(fMultiplicityCutMin<0.0 && fMultiplicityCutMax<0.0)
-       return kTRUE;
-  Int_t Ncharged=0;
-  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++){
-    AliVTrack* track = dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
+       if(fMultiplicityCutMin<0 && fMultiplicityCutMax<0)
+               return kTRUE;
+       Int_t Ncharged=-1;
+       if(fAODEvent==AliSpectraBothTrackCuts::kESDobject)
+       {       
+                 AliESDEvent* esdevent=dynamic_cast<AliESDEvent*>(fAOD);
+                AliESDtrackCuts::MultEstTrackType estType = esdevent->GetPrimaryVertexTracks()->GetStatus() ? AliESDtrackCuts::kTrackletsITSTPC : AliESDtrackCuts::kTracklets;
+               Ncharged=AliESDtrackCuts::GetReferenceMultiplicity(esdevent,estType,fetarangeofmultiplicitycut);
+       }
+       else if(fAODEvent==AliSpectraBothTrackCuts::kAODobject)
+       {
+               AliAODEvent* aodevent=0x0;
+               aodevent=dynamic_cast<AliAODEvent*>(fAOD);
+               if(TMath::Abs(0.8-fetarangeofmultiplicitycut)<0.1)
+                       Ncharged=aodevent->GetHeader()->GetRefMultiplicityComb08();
+               else if (TMath::Abs(0.5-fetarangeofmultiplicitycut)<0.1)
+                       Ncharged=aodevent->GetHeader()->GetRefMultiplicityComb05();
+               else 
+                       Ncharged=-1;
+       }
+       else
+               return kFALSE;   
 
-    if (!fTrackCuts->IsSelected(track,kFALSE)) continue;
-       
-    Ncharged++;
-  }
-  //Printf("NCHARGED_cut : %d",Ncharged);
-  if(Ncharged>fMultiplicityCutMin && Ncharged<fMultiplicityCutMax)return kTRUE;
-  
+   fHistoMultiplicty->Fill(0.5,Ncharged);
+   if(Ncharged>=fMultiplicityCutMin && Ncharged<fMultiplicityCutMax&& Ncharged>0)
+   { 
+       fHistoMultiplicty->Fill(1.5,Ncharged);
+       return kTRUE;
+   }
+  fHistoCuts->Fill(kVtxCentral);
   return kFALSE;
 }
 
@@ -511,6 +545,9 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
   TList collections_histoVtxalltriggerEventswithMCz;
   TList collections_histoVtxAftSelwithoutZvertexCutusingMCz;                   
   TList collections_histoRunNumbers;
+  TList collections_histoCentrality;                   
+  TList collections_histoMultiplicty;
+
   Int_t count = 0;
 
   while ((obj = iter->Next())) {
@@ -548,6 +585,14 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
     
     TH1F* histo_histoRunNumbers=entry->GetHistoRunNumbers();
     collections_histoRunNumbers.Add(histo_histoRunNumbers);
+   TH2F* histo_histoCentrality=entry->GetHistoCentrality();
+  collections_histoCentrality.Add(histo_histoCentrality);              
+
+TH2F* histo_histoMultiplicty=entry->GetHistoMultiplicty();
+  collections_histoMultiplicty.Add(histo_histoMultiplicty);
+
+
     count++;
   }
   
@@ -566,6 +611,9 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
   fHistoVtxalltriggerEventswithMCz->Merge(&collections_histoVtxalltriggerEventswithMCz);
   fHistoVtxAftSelwithoutZvertexCutusingMCz->Merge(&collections_histoVtxAftSelwithoutZvertexCutusingMCz);
   fHistoRunNumbers->Merge(&collections_histoRunNumbers);
+  fHistoCentrality->Merge(&collections_histoCentrality);
+  fHistoMultiplicty->Merge(&collections_histoMultiplicty);
+
 
   delete iter;
 
index d8e8827..0f0d7da 100644 (file)
@@ -28,9 +28,10 @@ enum {kDoNotCheckforSDD=0,kwithSDD,kwithoutSDD};
   // Constructors
  AliSpectraBothEventCuts() : TNamed(), fAOD(0),fAODEvent(AliSpectraBothTrackCuts::kAODobject),fTrackBits(0), fIsMC(0), fCentEstimator(""), fUseCentPatchAOD049(0),fUseSDDPatchforLHC11a(kDoNotCheckforSDD),fTriggerSettings(AliVEvent::kMB),fTrackCuts(0),
 fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), fQVectorCutMax(0), fVertexCutMin(0), 
-fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0), fMaxChi2perNDFforVertex(0),fMinRun(0),fMaxRun(0),
+fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0), fMaxChi2perNDFforVertex(0),fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),
-fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0)
+fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0),fHistoCentrality(0),fHistoMultiplicty(0)
+
 {}
   AliSpectraBothEventCuts(const char *name);
   virtual ~AliSpectraBothEventCuts();// {}
@@ -63,11 +64,11 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   //void  SetQVectorNegCut(Float_t min,Float_t max)  { fQVectorNegCutMin = min; fQVectorNegCutMax = max; }
   void  SetQVectorCut(Float_t min,Float_t max)  { fQVectorCutMin = min; fQVectorCutMax = max; }
   void  SetVertexCut(Float_t min,Float_t max)  { fVertexCutMin = min; fVertexCutMax = max; }
-  void  SetMultiplicityCut(Float_t min,Float_t max)  { fMultiplicityCutMin = min; fMultiplicityCutMax = max; }
+  void  SetMultiplicityCut(Int_t min,Int_t max)  { fMultiplicityCutMin = min; fMultiplicityCutMax = max; }
   void SetTrackBits(UInt_t TrackBits) {fTrackBits=TrackBits;}
   void SetMaxChi2perNDFforVertex(Float_t cut) { fMaxChi2perNDFforVertex=cut;}
   void SetRunNumberRange(Int_t min,Int_t max); 
-
+  void SetEtaRangeforMultiplictyCut(Float_t eta) {fetarangeofmultiplicitycut=eta;}
   UInt_t GetTrackType()  const    { return fTrackBits;}
   TH1I * GetHistoCuts()         {  return fHistoCuts; }
   TH1F * GetHistoVtxBefSel()         {  return fHistoVtxBefSel; }
@@ -84,6 +85,8 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   TH1F * GetHistoQVector()         {  return fHistoQVector; }
   TH1F * GetHistoEP()         {  return fHistoEP; }
   TH1F * GetHistoRunNumbers()         {  return fHistoRunNumbers; }
+  TH2F * GetHistoCentrality()        { return fHistoCentrality;}
+  TH2F * GetHistoMultiplicty()         { return fHistoMultiplicty; }
   Float_t  GetCentralityMin()  const {  return fCentralityCutMin; }
   Float_t  GetCentralityMax()  const {  return fCentralityCutMax; }
   //Float_t  GetQVectorPosCutMin()  const {  return fQVectorPosCutMin; }
@@ -133,11 +136,12 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   Float_t         fQVectorCutMax;     // maximum qvecPos
   Float_t         fVertexCutMin;     // minimum vertex position
   Float_t         fVertexCutMax;     // maximum vertex position
-  Float_t         fMultiplicityCutMin;     // minimum multiplicity position
-  Float_t         fMultiplicityCutMax;     // maximum multiplicity position
+  Int_t         fMultiplicityCutMin;     // minimum multiplicity position
+  Int_t         fMultiplicityCutMax;     // maximum multiplicity position
   Float_t        fMaxChi2perNDFforVertex; // maximum value of Chi2perNDF of vertex
   Int_t           fMinRun;                //minmum run number                   
   Int_t          fMaxRun;                //maximum run number   
+  Float_t         fetarangeofmultiplicitycut; // eta range fot multipilicty cut 
   TH1I            *fHistoCuts;        // Cuts statistics
   TH1F            *fHistoVtxBefSel;        // Vtx distr before event selection         
   TH1F            *fHistoVtxAftSel;        // Vtx distr after event selection
@@ -151,15 +155,17 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   TH1F                   *fHistoVtxAftSelwithoutZvertexCut;        // Vtx distr after event selection but without z vertex cut
   TH1F                   *fHistoVtxalltriggerEventswithMCz;        // MC z vertex ditribution of generated events
   TH1F                   *fHistoVtxAftSelwithoutZvertexCutusingMCz;        // Vtx distr after event selection but without z vertex cut
-  TH1F            *fHistoRunNumbers;   // histogram of numbers of events per run                       
-       
+  TH1F            *fHistoRunNumbers;   // histogram of numbers of events per run
+  TH2F                   *fHistoCentrality; // centrality histogram
+  TH2F                   *fHistoMultiplicty; // multiplicty histogram
+                               
 
 
 
   AliSpectraBothEventCuts(const AliSpectraBothEventCuts&);
   AliSpectraBothEventCuts& operator=(const AliSpectraBothEventCuts&);
   
-  ClassDef(AliSpectraBothEventCuts, 8);
+  ClassDef(AliSpectraBothEventCuts, 9);
   
 };
 #endif
index 2912051..7349de2 100644 (file)
@@ -68,8 +68,8 @@ void AliSpectraBothPID::FillQAHistos(AliSpectraBothHistoManager * hman, AliVTrac
                nsigmaTPCTOFkPion   =100.0;
 
        }
-
-       if(track->Pt()>trackCuts->GetPtTOFMatching())
+       Float_t tmppt=TMath::Min(trackCuts->GetPtTOFMatchingPion(),TMath::Min(trackCuts->GetPtTOFMatchingKaon(),trackCuts->GetPtTOFMatchingProton()));
+       if(track->Pt()>tmppt&&trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trackCuts->CheckTOFMatchingParticleType(kSpPion))
        {
     
                 hman->GetPIDHistogram(kHistPIDTOF)->Fill(track->P(),(track->GetTOFsignal()/100)*track->Charge()); // PID histo
@@ -199,7 +199,9 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
   
  
 
-       Double_t nsigmaTOFkProton=0.0,nsigmaTOFkKaon=0.0,nsigmaTOFkPion=0.0;
+       Double_t nsigmaTOFkProton=0.0;
+       Double_t nsigmaTOFkKaon=0.0;
+       Double_t nsigmaTOFkPion=0.0;
 
 
 
@@ -208,18 +210,57 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
        Double_t nsigmaTPCTOFkPion   = TMath::Abs(nsigmaTPCkPion);
        if(fPIDType==kNSigmaTOF)
        {
-               nsigmaTPCTOFkProton = 100.0;
-               nsigmaTPCTOFkKaon   = 100.0;
-               nsigmaTPCTOFkPion   =100.0;
-               nsigmaTOFkProton = 100.0;
-               nsigmaTOFkKaon   = 100.0;
-               nsigmaTOFkPion   =100.0;
+               nsigmaTPCTOFkProton = 10000.0;
+               nsigmaTPCTOFkKaon   = 10000.0;
+               nsigmaTPCTOFkPion   =10000.0;
+               nsigmaTOFkProton = 10000.0;
+               nsigmaTOFkKaon   = 10000.0;
+               nsigmaTOFkPion   =10000.0;
 
        }
        
 
+       if(trackCuts->GetUseTypeDependedTOFCut())
+       {
+               if(trackCuts->CheckTOFMatchingParticleType(kSpPion)&&trk->Pt()>trackCuts->GetPtTOFMatchingPion())
+               {       
+                       nsigmaTOFkPion   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kPion)+fshiftTOF); 
+                       nsigmaTPCTOFkPion   = TMath::Sqrt((nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion)/2.);
+               }
+               else if (trk->Pt()>trackCuts->GetPtTOFMatchingPion()) // tracks without proper flags
+               {
+                       nsigmaTOFkPion   = 10000.0; 
+                       nsigmaTPCTOFkPion   =10000.0;
+
+               }       
+                       
+               if(trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trk->Pt()>trackCuts->GetPtTOFMatchingKaon())
+               {       
+                       nsigmaTOFkKaon   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kKaon)+fshiftTOF); 
+                       nsigmaTPCTOFkKaon   = TMath::Sqrt((nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon)/2.);
+               }
+               else if (trk->Pt()>trackCuts->GetPtTOFMatchingKaon()) // tracks without proper flags
+               {
+                       nsigmaTOFkKaon   = 10000.0; 
+                       nsigmaTPCTOFkKaon   =10000.0;
 
-       if(trk->Pt()>trackCuts->GetPtTOFMatching())
+               }       
+
+               if(trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trk->Pt()>trackCuts->GetPtTOFMatchingProton())
+               {       
+                       nsigmaTOFkProton   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kProton)+fshiftTOF); 
+                       nsigmaTPCTOFkProton   = TMath::Sqrt((nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton)/2.);
+               }
+               else if (trk->Pt()>trackCuts->GetPtTOFMatchingProton()) // tracks without proper flags
+               {
+                       nsigmaTOFkProton   = 10000.0; 
+                       nsigmaTPCTOFkProton   =10000.0;
+
+               }       
+
+
+       }
+       else if(trk->Pt()>trackCuts->GetPtTOFMatching())
        {
                nsigmaTOFkProton = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kProton)+fshiftTOF);
                nsigmaTOFkKaon   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kKaon)+fshiftTOF); 
@@ -237,9 +278,9 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
        }
        
        // select the nsigma to be used for the actual PID
-       Double_t nsigmaPion=100; 
-       Double_t nsigmaKaon=100; 
-       Double_t nsigmaProton=100;
+       Double_t nsigmaPion=10000.0; 
+       Double_t nsigmaKaon=10000.0; 
+       Double_t nsigmaProton=10000.0;
 
        switch (fPIDType) 
        {
index aee0960..ef5a37e 100644 (file)
@@ -61,6 +61,7 @@ ClassImp(AliSpectraBothTrackCuts)
 
 AliSpectraBothTrackCuts::AliSpectraBothTrackCuts(const char *name) : TNamed(name, "AOD Track Cuts"), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0), fDCACut(0), fPCut(0), fPtCut(0), fYCutMax(0),fYCutMin(0),
   fPtCutTOFMatching(0),fAODtrack(kotherobject), fHashitinSPD1(0),fusedadditionalcuts(kTRUE),
+fPtCutTOFMatchingPion(-1.0),fPtCutTOFMatchingKaon(-1.0),fPtCutTOFMatchingProton(-1.0),fUseTypeDependedTOFCut(kFALSE),
 fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),
 fHistoDCAzQA(0),fHistoNclustersQA(0),fHistochi2perNDFQA(0),
 fTrack(0),fCuts(0)
@@ -148,6 +149,9 @@ void AliSpectraBothTrackCuts::InitHisto()
 
  TH1::AddDirectory(oldStatus);
 
+if(fUseTypeDependedTOFCut) 
+       fPtCutTOFMatching=TMath::Max(fPtCutTOFMatchingPion,TMath::Max(fPtCutTOFMatchingKaon,fPtCutTOFMatchingProton));
 
 
 }
@@ -391,35 +395,46 @@ Bool_t AliSpectraBothTrackCuts::CheckTOFMatching(Bool_t FillHistStat)
 {
   // check Pt cut
   //    if ((fTrack->Pt() < fPtCut) && (fTrack->Pt() > 0.3 )) return kTRUE;
-  
-  if (fTrack->Pt() < fPtCutTOFMatching) return kTRUE;
-  else{
-    if(FillHistStat)fHistoCuts->Fill(kTrkPtTOF);
-    if(fTrack->Charge()>0)fHistoNSelectedPos->Fill(fTrack->Pt());
-    else fHistoNSelectedNeg->Fill(fTrack->Pt());
-    UInt_t status; 
-    status=fTrack->GetStatus();
-    if((status&AliAODTrack::kTOFout)&&FillHistStat)fHistoCuts->Fill(kTrTOFout);
-    if((status&AliAODTrack::kTIME)&&FillHistStat)fHistoCuts->Fill(kTrTIME);
-    if((status&AliAODTrack::kTOFpid)&&FillHistStat)fHistoCuts->Fill(kTrTOFpid);
+       if (fTrack->Pt() < fPtCutTOFMatching) 
+               return kTRUE;
+       else
+       {
+               if(FillHistStat)
+                       fHistoCuts->Fill(kTrkPtTOF);
+               if(fTrack->Charge()>0)
+                       fHistoNSelectedPos->Fill(fTrack->Pt());
+               else 
+                       fHistoNSelectedNeg->Fill(fTrack->Pt());
+               UInt_t status=fTrack->GetStatus();
+               if((status&AliAODTrack::kTOFout)&&FillHistStat)
+                       fHistoCuts->Fill(kTrTOFout);
+               if((status&AliAODTrack::kTIME)&&FillHistStat)
+                       fHistoCuts->Fill(kTrTIME);
+               if((status&AliAODTrack::kTOFpid)&&FillHistStat)
+                       fHistoCuts->Fill(kTrTOFpid);
     
-    if((status&AliAODTrack::kTOFout)==0 || (status&AliAODTrack::kTIME)==0){//kTOFout and kTIME
-      return kFALSE; 
-    } 
-    if(FillHistStat)fHistoCuts->Fill(kTOFMatching);
-    if(fTrack->Charge()>0)fHistoNMatchedPos->Fill(fTrack->Pt());
-    else fHistoNMatchedNeg->Fill(fTrack->Pt());
-    if(fTrack->Pt()>1.5){
-      //fHistoEtaPhiHighPt->Fill(fTrack->GetOuterParam()->Eta(),fTrack->GetOuterParam()->Phi());
-      //Printf("AliExternalTrackParam * extpar=(AliExternalTrackParam*)fTrack->GetOuterParam();");
-      //AliExternalTrackParam * extpar=(AliExternalTrackParam*)fTrack->GetOuterParam();
-      fHistoEtaPhiHighPt->Fill(fTrack->Eta(),fTrack->Phi());
-      //Printf("fHistoEtaPhiHighPt->Fill(extpar->Eta(),extpar->Phi());");
-      //fHistoEtaPhiHighPt->Fill(extpar->Eta(),extpar->Phi());
-      //delete extpar;
-    }
-    return kTRUE;
-  }
+                if((status&AliAODTrack::kTOFout)==0 || (status&AliAODTrack::kTIME)==0)
+               {//kTOFout and kTIME
+                       return kFALSE; 
+               } 
+               if(FillHistStat)
+                       fHistoCuts->Fill(kTOFMatching);
+               if(fTrack->Charge()>0)
+                       fHistoNMatchedPos->Fill(fTrack->Pt());
+                else 
+                       fHistoNMatchedNeg->Fill(fTrack->Pt());
+               if(fTrack->Pt()>1.5)
+               {
+                       //fHistoEtaPhiHighPt->Fill(fTrack->GetOuterParam()->Eta(),fTrack->GetOuterParam()->Phi());
+                       //Printf("AliExternalTrackParam * extpar=(AliExternalTrackParam*)fTrack->GetOuterParam();");
+                       //AliExternalTrackParam * extpar=(AliExternalTrackParam*)fTrack->GetOuterParam();
+                       fHistoEtaPhiHighPt->Fill(fTrack->Eta(),fTrack->Phi());
+                        //Printf("fHistoEtaPhiHighPt->Fill(extpar->Eta(),extpar->Phi());");
+                       //fHistoEtaPhiHighPt->Fill(extpar->Eta(),extpar->Phi());
+                       //delete extpar;
+               }
+               return kTRUE;
+       }
 }
 //_______________________________________________________
 void AliSpectraBothTrackCuts::PrintCuts() const
@@ -514,4 +529,49 @@ Long64_t AliSpectraBothTrackCuts::Merge(TCollection* list)
 
   return count+1;
 }
+//________________________________________________________________________________________________________________________
+  void AliSpectraBothTrackCuts::SetPtTOFMatchingPartDepended(Float_t pion,Float_t kaon,Float_t proton)
+{
+       // configure the task in case of the use particle depended TOF matching cut 
+       // the value fPtCutTOFMatching is set as max pt of all
+       fPtCutTOFMatchingPion=pion;
+       fPtCutTOFMatchingKaon=kaon;
+       fPtCutTOFMatchingProton=proton;
+       fUseTypeDependedTOFCut=kTRUE;
+       fPtCutTOFMatching=TMath::Max(fPtCutTOFMatchingPion,TMath::Max(fPtCutTOFMatchingKaon,fPtCutTOFMatchingProton));
+}
+//___________________________________________________________________________________________________________________________
+Bool_t AliSpectraBothTrackCuts::CheckTOFMatchingParticleType(Int_t type) 
+{
+       Float_t ptcut=fPtCutTOFMatching;
+       switch (type) 
+       {       
+           case  kSpPion:
+           ptcut=fPtCutTOFMatchingPion;
+           break;
+           case kSpKaon:
+           ptcut=fPtCutTOFMatchingKaon;
+           break;
+           case  kSpProton:
+           ptcut=fPtCutTOFMatchingProton;
+           break;
+           default: 
+           ptcut=0.0;
+           break;              
+               
+
+       }       
+       if (fTrack->Pt() < ptcut) 
+               return kTRUE;
+       else
+       {
+               UInt_t status=fTrack->GetStatus();
+                if((status&AliAODTrack::kTOFout)==0 || (status&AliAODTrack::kTIME)==0)
+               {//kTOFout and kTIME
+                       return kFALSE; 
+               } 
+               return kTRUE;
+       }
 
+}
index f01f9cb..3b7bd01 100644 (file)
@@ -33,6 +33,7 @@ class AliSpectraBothTrackCuts : public TNamed
   enum {kAODobject=0,kESDobject,kotherobject};
   
  AliSpectraBothTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0),fDCACut(0) ,fPCut(0), fPtCut(0),fYCutMax(0),fYCutMin(0), fPtCutTOFMatching(0),fAODtrack(0), fHashitinSPD1(0),fusedadditionalcuts(kTRUE),
+ fPtCutTOFMatchingPion(-1.0),fPtCutTOFMatchingKaon(-1.0),fPtCutTOFMatchingProton(-1.0),fUseTypeDependedTOFCut(kFALSE),
 fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),
 fHistoDCAzQA(0),fHistoNclustersQA(0),fHistochi2perNDFQA(0),
 fTrack(0),fCuts(0) {}
@@ -51,6 +52,8 @@ fTrack(0),fCuts(0) {}
   Bool_t CheckPCut();
   Bool_t CheckPtCut();
   Bool_t CheckTOFMatching(Bool_t FillHistStat);
+  Bool_t CheckTOFMatchingParticleType(Int_t type);
+       
   void PrintCuts() const;
   
    UInt_t GetTrackType()  const    { return fTrackBits;}
@@ -64,17 +67,20 @@ fTrack(0),fCuts(0) {}
    TH3F * GetHistoDCAzQA() {return fHistoDCAzQA;}
    TH3F * GetHistoNclustersQA() {return fHistoNclustersQA ;}
    TH3F * GetHistochi2perNDFQA() {return fHistochi2perNDFQA; }
+   Bool_t GetUseTypeDependedTOFCut () {return fUseTypeDependedTOFCut;}
                 
    void SetEta(Float_t etamin,Float_t etamax)   { fEtaCutMin = etamin;fEtaCutMax = etamax; }
    void SetDCA(Float_t dca)   { fDCACut = dca; }
    void SetP(Float_t p)       { fPCut = p; }
    void SetPt(Float_t pt)     { fPtCut = pt; }
    void SetY(Float_t ymax,Float_t ymin) { fYCutMax = ymax;fYCutMin=ymin;}
-   void SetPtTOFMatching(Float_t pt)     { fPtCutTOFMatching = pt; }
+   void SetPtTOFMatching(Float_t pt)     { fPtCutTOFMatching = pt; fUseTypeDependedTOFCut=kFALSE;}
    void SetTrackBits(UInt_t TrackBits) {fTrackBits=TrackBits;}
    void SetMinTPCcls(UInt_t MinTPCcls) {fMinTPCcls=MinTPCcls;}
    void SetHashitinSPD1 (Bool_t value) {fHashitinSPD1=value;}  
-   void SetUsedAdditionalCuts (Bool_t value) {fusedadditionalcuts=value;}      
+   void SetUsedAdditionalCuts (Bool_t value) {fusedadditionalcuts=value;}
+   void SetPtTOFMatchingPartDepended(Float_t pion,Float_t kaon,Float_t proton);
+       
    Float_t GetEtaMin()       const    { return fEtaCutMin; }
    Float_t GetEtaMax()       const    { return fEtaCutMax; }
    Float_t GetYMax()         const    { return fYCutMax; }
@@ -84,6 +90,10 @@ fTrack(0),fCuts(0) {}
    Float_t GetP()         const    { return fPCut; }
    Float_t GetPt()        const    { return fPtCut; }
    Float_t GetPtTOFMatching()        const    { return fPtCutTOFMatching; } 
+   Float_t GetPtTOFMatchingPion()        const    { return fPtCutTOFMatchingPion; } 
+   Float_t GetPtTOFMatchingKaon()        const    { return fPtCutTOFMatchingKaon; } 
+   Float_t GetPtTOFMatchingProton()        const    { return fPtCutTOFMatchingProton; } 
+
    Long64_t Merge(TCollection* list);
    void SetAliESDtrackCuts(AliESDtrackCuts*  cuts ){fCuts=cuts;}
    void InitHisto();    
@@ -102,7 +112,11 @@ fTrack(0),fCuts(0) {}
    Float_t          fPtCutTOFMatching;           // TOF Matching
    Int_t            fAODtrack; // 0 ESD track connected , 1 AOD track conected , else nothing
    Bool_t          fHashitinSPD1; // Check if SPD1 has a hit   
-   Bool_t          fusedadditionalcuts;          //If set to true the TPCrefit, ITSrefit, SPDany and Ncluster cut is check             
+   Bool_t          fusedadditionalcuts;          //If set to true the TPCrefit, ITSrefit, SPDany and Ncluster cut is check     
+   Float_t          fPtCutTOFMatchingPion; // TOF Matching cut for pions
+   Float_t          fPtCutTOFMatchingKaon; // TOF Matching cut for kaons
+   Float_t          fPtCutTOFMatchingProton;   // TOF Matching cut for protons 
+   Bool_t           fUseTypeDependedTOFCut;   // if yes use particle depened tof cut   
    TH1I             *fHistoCuts;       // Cuts statistics
    TH1F             *fHistoNSelectedPos;       // Selected positive tracks
    TH1F             *fHistoNSelectedNeg;       // Selected negative tracks
@@ -122,8 +136,10 @@ fTrack(0),fCuts(0) {}
    
    AliSpectraBothTrackCuts(const AliSpectraBothTrackCuts&);
    AliSpectraBothTrackCuts& operator=(const AliSpectraBothTrackCuts&);
-   
-   ClassDef(AliSpectraBothTrackCuts, 6);
+   void ConfigurePtTOFCut();   
+  
+
+   ClassDef(AliSpectraBothTrackCuts, 7);
 };
 #endif