Update for Kink tasks:
authorbhippoly <bhippoly@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 23 Nov 2009 23:32:44 +0000 (23:32 +0000)
committerbhippoly <bhippoly@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 23 Nov 2009 23:32:44 +0000 (23:32 +0000)
i)   modifications for resonance and like sign analysis (P.Ganoti);
ii)  new AddTask macros for resonance analysis (P.G);
iii) removing AddTaskKinkResonanceLikeSign.C (P.G);
iv)  clean-up dependencies and checked for coding conventions (B.Hippolyte);

PWG2/KINK/AliAnalysisKinkESDMC.cxx
PWG2/KINK/AliAnalysisKinkESDMC.h
PWG2/KINK/AliAnalysisTaskKinkResonance.cxx
PWG2/KINK/AliAnalysisTaskKinkResonance.h
PWG2/KINK/AliResonanceKink.cxx
PWG2/KINK/AliResonanceKink.h
PWG2/KINK/AliResonanceKinkLikeSign.cxx
PWG2/KINK/AliResonanceKinkLikeSign.h
PWG2/KINK/macros/AddTaskKinkResonanceLikeSign.C [deleted file]

index 708730a718d68046908e794755de3161d927ec02..2dd8e570b96ce75c54f03019da180b5f9719075f 100644 (file)
 //      Kaons from kink topology are 'identified' in this code
 //-----------------------------------------------------------------
 
-#include "TChain.h"
-#include "TTree.h"
+#include "TF1.h"
+#include "TMath.h"
 #include "TH1F.h"
 #include "TH2F.h"
-#include "TH1D.h"
-#include "TH2D.h"
-#include "TParticle.h"
-#include <TVector3.h>
-#include "TF1.h"
 
-#include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-
-#include "AliVEvent.h"
 #include "AliESDEvent.h"
 #include "AliMCEvent.h"
-#include "AliAnalysisKinkESDMC.h"
 #include "AliStack.h"
-#include "AliESDpid.h"
 #include "AliESDkink.h"
 
-ClassImp(AliAnalysisKinkESDMC)
-
+#include "AliAnalysisKinkESDMC.h"
 
+ClassImp(AliAnalysisKinkESDMC)
 //________________________________________________________________________
 AliAnalysisKinkESDMC::AliAnalysisKinkESDMC(const char *name) 
   : AliAnalysisTaskSE(name), fHistPtESD(0),fHistPt(0),fHistQtAll(0),fHistQt1(0),fHistQt2(0)
index ff4888d3dc31c6321b8f2bdfb06917f0ed2615f1..b3d13fd6f4c040c1e1266412f444e05781f85b2e 100644 (file)
 //                    mspyrop@phys.uoa.gr
 //-----------------------------------------------------------------
 
-class AliESDVertex;
+#include "AliAnalysisTaskSE.h"
+
 class AliESDtrack;
+class AliESDVertex;
 class AliESDEvent;
-class TF1;
 class TH1F;
 class TH2F;
 class TH1D;
-class TH2D;
+class TF1;
 class TList;
 
-#include "AliAnalysisTaskSE.h"
-
 class AliAnalysisKinkESDMC : public AliAnalysisTaskSE {
  public:
  // AliAnalysisKinkESDMC();
index d2139b29bcc0d85a3d8ceab597a676c0c568a8a5..0a1dfd175dc587c07c566fe7ee668b0d10798ff6 100644 (file)
 //        Example of an analysis task for reconstructing resonances having at least one kaon-kink in their decay 
 //        products. 
 //-----------------------------------------------------------------------------------------------------------------
-#include "TChain.h"
-#include "TTree.h"
-#include "TH2D.h"
 
-#include "AliAnalysisManager.h"
-#include "AliMCEvent.h"
-#include "AliVEvent.h"
 #include "AliESDEvent.h"
-#include "AliResonanceKink.h"
+
 #include "AliAnalysisTaskKinkResonance.h"
+#include "AliResonanceKink.h"
 
 ClassImp(AliAnalysisTaskKinkResonance)
 
index 891b51e1dfd9646f7cb6150397230df5a9af50b3..b03c178bc0407d5409d0f50929f600de9aa7fa30 100644 (file)
 //Author: Paraskevi Ganoti, University of Athens (pganoti@phys.uoa.gr)
 //------------------------------------------------------------------------------
 
-class TList;
-class AliResonanceKink;
-class TH1D;
-
 #include "AliAnalysisTaskSE.h"
 
+class AliResonanceKink;
+class TList;
+
 class AliAnalysisTaskKinkResonance : public AliAnalysisTaskSE {
  public:
   AliAnalysisTaskKinkResonance(const char *dname = "AliAnalysisTaskKinkResonance");
index 1acfd9fab1995d2dc437cee8b60eebae57e7e8ca..5100d770c65b4a8e6302a4e0bd65b24d9f33f7ff 100644 (file)
 //        Also, depending on the analysis mode (ESD or MC), fAnalysisType in the constructor must also be changed 
 //-----------------------------------------------------------------------------------------------------------------
 
-#include "TChain.h"
-#include "TTree.h"
 #include "TH2D.h"
 #include "TParticle.h"
 #include "TDatabasePDG.h"
-#include "TParticlePDG.h"
 #include "TF1.h"
 #include "TList.h"
-#include "TString.h"
-#include "AliMCEventHandler.h"
 #include "AliMCEvent.h"
 #include "AliResonanceKink.h"
 #include "AliESDkink.h"
@@ -67,14 +62,14 @@ fMaxDCAxy(0), fMaxDCAzaxis(0), fMinTPCclusters(0), fMaxChi2PerTPCcluster(0), fMa
    fPhiBothKinks=new TH1D("fPhiBothKinks"," ",fNbins,fLowX,fHighX);  // Applicable for phi(1020)
 
    fRecPt=new TH1D("fRecPt"," ", 50,0.0,5.0);
-   fRecEta=new TH1D("fRecEta"," ", 44,-1.1,1.1);
-   fRecEtaPt=new TH2D("fRecEtaPt"," ", 50,0.0,5.0, 44,-1.1,1.1); 
+   fRecEta=new TH1D("fRecEta"," ", 36,-0.9,0.9);
+   fRecEtaPt=new TH2D("fRecEtaPt"," ", 50,0.0,5.0, 36,-0.9,0.9); 
    fSimPt=new TH1D("fSimPt"," ", 50,0.0,5.0);
-   fSimEta=new TH1D("fSimEta"," ", 44,-1.1,1.1); 
-   fSimEtaPt=new TH2D("fSimEtaPt"," ", 50,0.0,5.0, 44,-1.1,1.1);
+   fSimEta=new TH1D("fSimEta"," ", 36,-0.9,0.9); 
+   fSimEtaPt=new TH2D("fSimEtaPt"," ", 50,0.0,5.0, 36,-0.9,0.9);
    fSimPtKink=new TH1D("fSimPtKink"," ", 50,0.0,5.0);
-   fSimEtaKink=new TH1D("fSimEtaKink"," ", 44,-1.1,1.1);
-   fSimEtaPtKink=new TH2D("fSimEtaPtKink"," ", 50,0.0,5.0, 44,-1.1,1.1);                
+   fSimEtaKink=new TH1D("fSimEtaKink"," ", 36,-0.9,0.9);
+   fSimEtaPtKink=new TH2D("fSimEtaPtKink"," ", 50,0.0,5.0, 36,-0.9,0.9);                
    fhdr=new TH1D("fhdr"," ", 100,0.0,5.0);  
    fhdz=new TH1D("fhdz"," ", 100,0.0,5.0);
    
@@ -195,30 +190,34 @@ void AliResonanceKink::InitOutputHistograms(Int_t nbins, Float_t nlowx, Float_t
   fMCInvmassPtTrue=new TH2D("fMCInvmassPtTrue"," ",fNbins,fLowX,fHighX,100,0.0,10.0);
   
 }
-  
+
 //________________________________________________________________________
 void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent) 
 {
   // Main loop
   // Called for each event
   Int_t resonancePDGcode, antiresonancePDGcode;
+  Double_t daughter1pdgMass, daughter2pdgMass;
   
-  if (fdaughter1pdg==kdaughterKaon)  {
+  if (fdaughter1pdg==kKPlus)  {
     resonancePDGcode=fresonancePDGcode;
     antiresonancePDGcode=-fresonancePDGcode;
+    daughter1pdgMass=TDatabasePDG::Instance()->GetParticle(fdaughter1pdg)->Mass();
+    daughter2pdgMass=TDatabasePDG::Instance()->GetParticle(fdaughter2pdg)->Mass(); 
   }
-  if (fdaughter1pdg!=kdaughterKaon)  {
+  
+  if (fdaughter1pdg!=kKPlus)  {
     resonancePDGcode=-fresonancePDGcode;
     antiresonancePDGcode=fresonancePDGcode;
-  }  
+    daughter1pdgMass=TDatabasePDG::Instance()->GetParticle(fdaughter2pdg)->Mass();
+    daughter2pdgMass=TDatabasePDG::Instance()->GetParticle(fdaughter1pdg)->Mass();   
+  }  // to ensure that daughter1pdgMass has always the kaon mass
+  
   if (fdaughter1pdg==fdaughter2pdg)  {
     resonancePDGcode=fresonancePDGcode;
     antiresonancePDGcode=fresonancePDGcode;
   }  
 
-   Double_t daughter1pdgMass=TDatabasePDG::Instance()->GetParticle(fdaughter1pdg)->Mass();
-   Double_t daughter2pdgMass=TDatabasePDG::Instance()->GetParticle(fdaughter2pdg)->Mass();
-   
   if (!esd) {
     Printf("ERROR: fESD not available");
     return;
@@ -264,14 +263,14 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
        AliMCParticle   *mcDaughter1 = 0;
        AliMCParticle   *mcDaughter2 = 0;       
                
-        if(fdaughter1pdg==kdaughterKaon) {  
+        if(fdaughter1pdg==kKPlus) {  
           daughterParticle1=stack->Particle(firstD);
           daughterParticle2=stack->Particle(lastD);
          mcDaughter1= (AliMCParticle*) mcEvent->GetTrack(firstD);  
          mcDaughter2= (AliMCParticle*) mcEvent->GetTrack(lastD);         
         }
         else 
-           if(fdaughter2pdg==kdaughterKaon) {
+           if(fdaughter2pdg==kKPlus) {
               daughterParticle1=stack->Particle(lastD);
               daughterParticle2=stack->Particle(firstD); 
              mcDaughter1= (AliMCParticle*) mcEvent->GetTrack(lastD);
@@ -280,16 +279,16 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
             
        if(TMath::Abs(daughterParticle1->GetPdgCode())!=321) continue;
        
-       TParticle       *daughters1Daughter = 0;
-       TParticle       *daughters2Daughter = 0;       
-       Int_t   mcProcessDaughters1Daughter = -999;
-       Int_t   mcProcessDaughters2Daughter = -999;       
+       TParticle      * daughters1Daughter=0;
+       TParticle      * daughters2Daughter=0;       
+       Int_t mcProcessDaughters1Daughter = -999;
+       Int_t mcProcessDaughters2Daughter = -999;       
        AliMCParticle *mcDaughters1Daughter = 0;
        
        if(mcDaughter1->Charge()==0) continue;
        if(mcDaughter2->Charge()==0) continue;       //accept resonance decays in two charged daughters
 
-       Int_t nDecayKaonDaughter = -99; 
+       Int_t nDecayKaonDaughter=-99; 
        for(Int_t ia=0; ia<daughterParticle1->GetNDaughters(); ia++) {
        if(((daughterParticle1->GetFirstDaughter()+ia)>0)&&((daughterParticle1->GetFirstDaughter()+ia)<stack->GetNtrack())) {
           daughters1Daughter=stack->Particle(daughterParticle1->GetFirstDaughter()+ia);
@@ -301,7 +300,7 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
         }
        }
        
-       Int_t nProcessDaughter = -99; 
+       Int_t nProcessDaughter=-99; 
        for(Int_t ib=0; ib<daughterParticle2->GetNDaughters(); ib++) {
         if(((daughterParticle2->GetFirstDaughter()+ib)>0)&&((daughterParticle2->GetFirstDaughter()+ib)<stack->GetNtrack())) {
           daughters2Daughter=stack->Particle(daughterParticle2->GetFirstDaughter()+ib);
@@ -313,7 +312,7 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
         }
        }  
        
-       Int_t numberOfCharged = 0;
+       Int_t numberOfCharged=0;
        if((mcProcessDaughters1Daughter==4)&&(nDecayKaonDaughter>=0)) {
          for(Int_t ic=nDecayKaonDaughter; ic<=daughterParticle1->GetLastDaughter(); ic++) {
           if ((ic>=0)&&(ic<stack->GetNtrack())) mcDaughters1Daughter= dynamic_cast<AliMCParticle*>(mcEvent->GetTrack(ic));
@@ -322,14 +321,14 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
          }
        }
        
+                if(numberOfCharged>=2) continue; // leave out kaon decays to more than one charged daughter
+        
          if ((particle->Pt()>0.25)&&(TMath::Abs(particle->Eta())<0.9)) {
 
          fSimEta->Fill(particle->Eta());
         fSimEtaPt->Fill(particle->Pt(), particle->Eta());
         fSimPt->Fill(particle->Pt());
-         fMCInvmassPtTrue->Fill(particle->GetMass(), particle->Pt());
-        if(numberOfCharged>=2) continue; // leave out kaon decays to more than one charged daughter
-          
+         fMCInvmassPtTrue->Fill(particle->GetMass(), particle->Pt());     
 
          if((daughterParticle1->Pt()>0.25)&&(TMath::Abs(daughterParticle1->Eta())<0.9)&&(daughterParticle2->Pt()>0.25)&&(TMath::Abs(daughterParticle2->Eta())<0.9)) {
           if((mcProcessDaughters1Daughter==4)&&(daughters1Daughter->R()>120.)&&(daughters1Daughter->R()<220.)&&( (nProcessDaughter<0)||((daughters2Daughter->R()>120.)&&(nProcessDaughter>0)))) { //below are the findable
@@ -389,10 +388,17 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
     Int_t mumpdgpos = mumpos->GetPdgCode();
     
     Int_t indexKinkPos=trackpos->GetKinkIndex(0);
+    
+    if(indexKinkPos>0) continue;
+    
     Bool_t posKaonKinkFlag=0;
-    if(indexKinkPos<0) posKaonKinkFlag=IsKink(esd, indexKinkPos, posTrackMom);
     
-    if(posKaonKinkFlag==1) anp4pos.SetVectM(posTrackMom,daughter1pdgMass);
+    if(indexKinkPos<0) {
+      posKaonKinkFlag=IsKink(esd, indexKinkPos, posTrackMom);
+    
+      if(posKaonKinkFlag==1) anp4pos.SetVectM(posTrackMom,daughter1pdgMass);
+      if(posKaonKinkFlag==0) continue;
+    }
     
     if(indexKinkPos==0) {
 
@@ -429,10 +435,17 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
         Int_t mumpdgneg = mumneg->GetPdgCode();
        
        Int_t indexKinkNeg=trackneg->GetKinkIndex(0);
+       
+       if(indexKinkNeg>0) continue;
+       
        Bool_t negKaonKinkFlag=0;
-       if(indexKinkNeg<0) negKaonKinkFlag=IsKink(esd, indexKinkNeg, negTrackMom);
        
-       if(negKaonKinkFlag==1) p4neg.SetVectM(negTrackMom,daughter1pdgMass);
+       if(indexKinkNeg<0) {
+         negKaonKinkFlag=IsKink(esd, indexKinkNeg, negTrackMom);
+       
+         if(negKaonKinkFlag==1) p4neg.SetVectM(negTrackMom,daughter1pdgMass);
+         if(negKaonKinkFlag==0) continue;
+       }
        
        if(indexKinkNeg==0)  {
  
@@ -445,23 +458,29 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
        
        Double_t openingAngle=(ptrackpos[0]*ptrackneg[0]+ptrackpos[1]*ptrackneg[1]+ptrackpos[2]*ptrackneg[2])/(posTrackMom.Mag()*negTrackMom.Mag());
 
-       if((posKaonKinkFlag==1)&&(negKaonKinkFlag==1)) {
-        p4comb=anp4pos;
-        p4comb+=p4neg;
-        if(openingAngle>0.6) fPhiBothKinks->Fill(p4comb.M());
+        if((posKaonKinkFlag==1)&&(negKaonKinkFlag==1)) {
+         p4comb=anp4pos;
+         p4comb+=p4neg;
+         if((p4comb.Vect().Pt()<=0.25)&&(TMath::Abs(anp4pos.Vect().Eta())<0.9)&&(TMath::Abs(p4neg.Vect().Eta())<0.9)&&(p4comb.Vect().Eta()<0.9)) {       
+           if(openingAngle>0.6) fPhiBothKinks->Fill(p4comb.M());
+         }
        }
                
        if(negKaonKinkFlag==1) {
          p4comb=p4pos;
           p4comb+=p4neg;
-         fInvariantMass->Fill(p4comb.M());
-         fInvmassPt->Fill(p4comb.M(), p4comb.Vect().Pt());
-         if ((mumpdgpos==(antiresonancePDGcode))&&(mumpdgneg==(antiresonancePDGcode))&&(mumlabelpos==mumlabelneg)
-          &&(pdgpos==fdaughter2pdg)&&(pdgneg==(-fdaughter1pdg))&&(TMath::Abs(trackpos->GetLabel())>=0)&&(TMath::Abs(trackneg->GetLabel())>=0)&&(mumlabelpos>=0)&&(mumlabelneg>=0)) {
-            fOpeningAngle->Fill(openingAngle);
-            fInvMassTrue->Fill(p4comb.M());
-           fInvmassPtTrue->Fill(p4comb.M(), p4comb.Vect().Pt());
-           if((TMath::Abs(p4pos.Vect().Eta())<1.1)&&(TMath::Abs(p4neg.Vect().Eta())<1.1)&&(p4comb.Vect().Eta()<1.1)) {
+         
+         if(p4comb.Vect().Pt()<=0.25) continue;
+         
+         if((TMath::Abs(p4pos.Vect().Eta())<0.9)&&(TMath::Abs(p4neg.Vect().Eta())<0.9)&&(p4comb.Vect().Eta()<0.9)) {     
+           fInvariantMass->Fill(p4comb.M());
+           fInvmassPt->Fill(p4comb.M(), p4comb.Vect().Pt());
+           if ((mumpdgpos==(antiresonancePDGcode))&&(mumpdgneg==(antiresonancePDGcode))&&(mumlabelpos==mumlabelneg)
+            &&(pdgpos==fdaughter2pdg)&&(pdgneg==(-fdaughter1pdg))&&(TMath::Abs(trackpos->GetLabel())>=0)&&(TMath::Abs(trackneg->GetLabel())>=0)&&(mumlabelpos>=0)&&(mumlabelneg>=0)) {
+              fOpeningAngle->Fill(openingAngle);
+              fInvMassTrue->Fill(p4comb.M());
+             fInvmassPtTrue->Fill(p4comb.M(), p4comb.Vect().Pt());
+
              fRecPt->Fill(p4comb.Vect().Pt());
              fRecEta->Fill(p4comb.Vect().Eta());
              fRecEtaPt->Fill(p4comb.Vect().Perp(),p4comb.Vect().Eta());
@@ -475,17 +494,21 @@ void AliResonanceKink::Analyse(AliESDEvent* esd, AliMCEvent* mcEvent)
        if(posKaonKinkFlag==1) {
           anp4comb=anp4pos;
           anp4comb+=anp4neg;  
-         fInvariantMass->Fill(anp4comb.M());
-         fInvmassPt->Fill(anp4comb.M(), anp4comb.Vect().Pt());
-         if ((mumpdgpos==resonancePDGcode)&&(mumpdgneg==resonancePDGcode)&&(mumlabelpos==mumlabelneg)
-          &&(pdgpos==fdaughter1pdg)&&(pdgneg==(-fdaughter2pdg))&&(TMath::Abs(trackpos->GetLabel())>=0)&&(TMath::Abs(trackneg->GetLabel())>=0)&&(mumlabelpos>=0)  &&(mumlabelneg>=0)) {
-            fOpeningAngle->Fill(openingAngle);
-            fInvMassTrue->Fill(p4comb.M());
-           fInvmassPtTrue->Fill(anp4comb.M(), anp4comb.Vect().Pt());
-            if((TMath::Abs(anp4neg.Vect().Eta())<1.1)&&(TMath::Abs(anp4pos.Vect().Eta())<1.1)&&(anp4comb.Vect().Eta()<1.1)) {  
-            fRecPt->Fill(anp4comb.Vect().Pt());
-            fRecEta->Fill(anp4comb.Vect().Eta());
-            fRecEtaPt->Fill(anp4comb.Vect().Pt(), anp4comb.Vect().Eta());
+         
+         if(anp4comb.Vect().Pt()<=0.25) continue;        
+         
+          if((TMath::Abs(anp4neg.Vect().Eta())<0.9)&&(TMath::Abs(anp4pos.Vect().Eta())<0.9)&&(anp4comb.Vect().Eta()<0.9)) {      
+           fInvariantMass->Fill(anp4comb.M());
+           fInvmassPt->Fill(anp4comb.M(), anp4comb.Vect().Pt());
+           if ((mumpdgpos==resonancePDGcode)&&(mumpdgneg==resonancePDGcode)&&(mumlabelpos==mumlabelneg)
+            &&(pdgpos==fdaughter1pdg)&&(pdgneg==(-fdaughter2pdg))&&(TMath::Abs(trackpos->GetLabel())>=0)&&(TMath::Abs(trackneg->GetLabel())>=0)&&(mumlabelpos>=0)  &&(mumlabelneg>=0)) {
+              fOpeningAngle->Fill(openingAngle);
+              fInvMassTrue->Fill(anp4comb.M());
+             fInvmassPtTrue->Fill(anp4comb.M(), anp4comb.Vect().Pt());
+       
+             fRecPt->Fill(anp4comb.Vect().Pt());
+             fRecEta->Fill(anp4comb.Vect().Eta());
+             fRecEtaPt->Fill(anp4comb.Vect().Pt(), anp4comb.Vect().Eta());
           }
 
          }
@@ -585,7 +608,7 @@ const AliESDVertex* AliResonanceKink::GetEventVertex(const AliESDEvent* esd) con
       return kFALSE;
   }
   
-  if(gPt < fMinPtTrackCut) {
+  if(gPt <= fMinPtTrackCut) {
       if (fDebug > 1) Printf("IsAcceptedKink: Track rejected because it has a min value of pt of %lf (min. requested: %lf)", gPt, fMinPtTrackCut);
       return kFALSE;
   } 
@@ -693,7 +716,7 @@ Bool_t AliResonanceKink::IsKink(AliESDEvent *localesd, Int_t kinkIndex, TVector3
          Float_t p3Daughter=TMath::Sqrt(((p1XM-p2XM)*(p1XM-p2XM))+((p1YM-p2YM)*(p1YM-p2YM))+((p1ZM-p2ZM)*(p1ZM-p2ZM)));
          Double_t invariantMassKmu= TMath::Sqrt((energyDaughterMu+p3Daughter)*(energyDaughterMu+p3Daughter)-motherMfromKink.Mag()*motherMfromKink.Mag());
 
-         if((kinkAngle>maxDecAngpimu)&&(qt>0.05)&&(qt<0.25)&&((kink->GetR()>110.)&&(kink->GetR()<230.))&&(TMath::Abs(trackMom.Eta())<1.1)&&(invariantMassKmu<0.6)) {
+         if((kinkAngle>maxDecAngpimu)&&(qt>0.05)&&(qt<0.25)&&((kink->GetR()>120.)&&(kink->GetR()<220.))&&(TMath::Abs(trackMom.Eta())<0.9)&&(invariantMassKmu<0.6)) {
 
            if(trackMom.Mag()<=1.1) {
                return kTRUE;
index c1afa62fe68383a26555c3cf40b166cc2d25097b..eaf047ebbce6a996af581f426b19ebf1e8f058c4 100644 (file)
@@ -9,7 +9,9 @@
 //        for analysing resonances having one kaon kink
 //Author: Paraskevi Ganoti, University of Athens (pganoti@phys.uoa.gr)
 //------------------------------------------------------------------------------
+
 #include "TVector3.h"
+
 class TF1;
 class TH1D;
 class TH2D;
@@ -24,7 +26,6 @@ class AliResonanceKink : public TObject {
  public:
  
   enum ResonanceType {kPhi=333, kKstar0=313, kLambda1520=3124};
-  enum DaughterType {kdaughterPion=211, kdaughterKaon=321, kdaughterProton=2212};
   
   AliResonanceKink();
   AliResonanceKink(Int_t nbins, Float_t nlowx, Float_t nhighx, Int_t daughter1, Int_t daughter2, Int_t resonancePDG);
index c6060bc960e2a1c21fb4cdd70dcabc34f0b3c8a4..8d91539357d60b8b0977eac20ab29d8a093dcc21 100644 (file)
 //        Background is calculated from a positive kaon kink and a negative track.
 //-----------------------------------------------------------------------------------------------------------------
 
-#include "TChain.h"
-#include "TTree.h"
-#include "TVector3.h"
-#include "TF1.h"
+#include "AliESDEvent.h"
 #include "TH1D.h"
 #include "TH2D.h"
-#include <TDatabasePDG.h>
-#include <TParticlePDG.h>
+#include "TF1.h"
+#include "TDatabasePDG.h"
 #include "TLorentzVector.h"
-#include "AliAnalysisTaskSE.h"
-#include "AliAnalysisManager.h"
-
-#include "AliESDInputHandler.h"
+#include "AliESDkink.h"
 
 #include "AliResonanceKinkLikeSign.h"
-#include "AliESDkink.h"
 
 ClassImp(AliResonanceKinkLikeSign)
 
-//________________________________________________________________________
-AliResonanceKinkLikeSign::AliResonanceKinkLikeSign() 
-  : AliAnalysisTaskSE(), fESD(0), fListOfHistos(0), f1(0), f2(0), fPosKaonLikeSign(0), fLikeSignInvmassPt(0)
-{
-  // Constructor
-}
-
 //________________________________________________________________________
 AliResonanceKinkLikeSign::AliResonanceKinkLikeSign(const char *name) 
-  : AliAnalysisTaskSE(name), fESD(0), fListOfHistos(0), f1(0), f2(0), fPosKaonLikeSign(0), fLikeSignInvmassPt(0)
+  : AliAnalysisTaskSE(name), fDebug(0), fListOfHistos(0), f1(0), f2(0), fPosKaonLikeSign(0), fLikeSignInvmassPt(0), fMaxNSigmaToVertex(0), fMinPtTrackCut(0), fMaxDCAxy(0), fMaxDCAzaxis(0), 
+fMinTPCclusters(0),fMaxChi2PerTPCcluster(0), fMaxCov0(0), fMaxCov2(0), fMaxCov5(0) , fMaxCov9(0), fMaxCov14(0), fdaughter1pdg(0), fdaughter2pdg(0), fnbins(0), fnlowx(0), fnhighx(0)
 
 {
   // Constructor
 
   // Define input and output slots here
   // Input slot #0 works with a TChain
-  DefineInput(0, TChain::Class());
   DefineOutput(1, TList::Class());
 }
 
 //________________________________________________________________________
-void AliResonanceKinkLikeSign::ConnectInputData(Option_t *option) 
-{
-  // Connect ESD or AOD here
-  // Called once
-  AliAnalysisTaskSE::ConnectInputData(option);
-  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
-  if (!tree) {
-    Printf("ERROR: Could not read chain from input slot 0");
-  } else {
-  
-    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-
-    if (!esdH) {
-      Printf("ERROR: Could not get ESDInputHandler");
-    } else
-      fESD = esdH->GetEvent();
-  }
-}
-
-//________________________________________________________________________
-void AliResonanceKinkLikeSign::CreateOutputObjects() 
+void AliResonanceKinkLikeSign::UserCreateOutputObjects() 
 {
   // Create histograms
   // Called once
@@ -93,16 +59,9 @@ void AliResonanceKinkLikeSign::CreateOutputObjects()
    f2->SetParameter(1,0.2731374);
    f2->SetParameter(2,TMath::Pi());
   
-   //OpenFile(1);  //uncomment for proof analysis 
-   
-    // for K*0(892)
-   fPosKaonLikeSign=new TH1D("fPosKaonLikeSign"," ", 60,0.6,1.2);
-   fLikeSignInvmassPt=new TH2D("fLikeSignInvmassPt"," ", 60,0.6,1.2, 100,0.0,10.0);
-   
-   // for phi(1020)
- //  fPosKaonLikeSign=new TH1D("fPosKaonLikeSign"," ", 70,0.99,1.088);
-    
-
+   fPosKaonLikeSign=new TH1D("fPosKaonLikeSign"," ", fnbins, fnlowx, fnhighx);
+   fLikeSignInvmassPt=new TH2D("fLikeSignInvmassPt"," ", fnbins, fnlowx, fnhighx, 100,0.0,10.0);
    fListOfHistos=new TList();
    fListOfHistos->Add(fPosKaonLikeSign);
    fListOfHistos->Add(fLikeSignInvmassPt);     
@@ -110,22 +69,47 @@ void AliResonanceKinkLikeSign::CreateOutputObjects()
 }
 
 //________________________________________________________________________
-void AliResonanceKinkLikeSign::Exec(Option_t *option
+void AliResonanceKinkLikeSign::UserExec(Option_t *
 {
   // Main loop
   // Called for each event
  
-   Double_t daughter1Mass=TDatabasePDG::Instance()->GetParticle(kKPlus)->Mass();
-   Double_t daughter2Mass=TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass();
+  AliVEvent *event = InputEvent();
+  if (!event) {
+     Printf("ERROR: Could not retrieve event");
+     return;
+  }
 
-   if (option) Printf("WARNING: an option was initially required");
+  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
+  if (!esd) {
+     Printf("ERROR: Could not retrieve esd");
+     return;
+  }
 
-  if (!fESD) {
-    Printf("ERROR: fESD not available");
+  AliMCEvent* mcEvent = MCEvent();
+  if (!mcEvent) {
+     Printf("ERROR: Could not retrieve MC event");
+     return;
+  }
+  
+   Double_t daughter1Mass, daughter2Mass;
+  
+   if (fdaughter1pdg==kKPlus)  {
+     daughter1Mass=TDatabasePDG::Instance()->GetParticle(fdaughter1pdg)->Mass();
+     daughter2Mass=TDatabasePDG::Instance()->GetParticle(fdaughter2pdg)->Mass(); 
+   }
+  
+   if (fdaughter1pdg!=kKPlus)  {
+     daughter1Mass=TDatabasePDG::Instance()->GetParticle(fdaughter2pdg)->Mass();
+     daughter2Mass=TDatabasePDG::Instance()->GetParticle(fdaughter1pdg)->Mass();   
+   }  // to ensure that daughter1Mass has always the kaon mass
+
+  if (!esd) {
+    Printf("ERROR: esd not available");
     return;
   }  
 
-  const AliESDVertex* vertex = GetEventVertex(fESD);
+  const AliESDVertex* vertex = GetEventVertex(esd);
   if(!vertex) return;
   
   Double_t ptrackpos[3], ptrackneg[3];
@@ -134,142 +118,68 @@ void AliResonanceKinkLikeSign::Exec(Option_t *option)
   TLorentzVector p4neg;
   TLorentzVector p4comb; 
 
-  for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
-    AliESDtrack* trackpos = fESD->GetTrack(iTracks);
+  for (Int_t iTracks = 0; iTracks < esd->GetNumberOfTracks(); iTracks++) {
+    
+    AliESDtrack* trackpos = esd->GetTrack(iTracks);
     if (!trackpos) {
       if (fDebug > 0) Printf("ERROR: Could not receive track %d", iTracks);
       continue;
     }
-    
     if (trackpos->GetSign() < 0) continue;
     
-    trackpos->GetPxPyPz(ptrackpos);
+    AliExternalTrackParam *tpcTrackpos = (AliExternalTrackParam *)trackpos->GetTPCInnerParam();
+    if(!tpcTrackpos) continue;
+    ptrackpos[0]=tpcTrackpos->Px();
+    ptrackpos[1]=tpcTrackpos->Py();   
+    ptrackpos[2]=tpcTrackpos->Pz();  
     
-    Float_t nSigmaToVertex = GetSigmaToVertex(trackpos);      
-    
-    Float_t bpos[2];
-    Float_t bCovpos[3];
-    trackpos->GetImpactParameters(bpos,bCovpos);
-    
-    if (bCovpos[0]<=0 || bCovpos[2]<=0) {
-     if (fDebug > 0) Printf("Estimated b resolution lower or equal zero!");
-     bCovpos[0]=0; bCovpos[2]=0;
-    }
-
-    Float_t dcaToVertexXYpos = bpos[0];
-    Float_t dcaToVertexZpos = bpos[1];
-
-    if(nSigmaToVertex>=4) continue;
-    if((dcaToVertexXYpos>3.0)||(dcaToVertexZpos>3.0)) continue;
+    Bool_t firstLevelAcceptPosTrack=IsAcceptedForKink(esd, vertex, trackpos);
+    if(firstLevelAcceptPosTrack==kFALSE) continue;
     
     TVector3 posTrackMom(ptrackpos[0],ptrackpos[1],ptrackpos[2]);
-  
-    if(posTrackMom.Perp()<=0.25) continue; 
-       
-    //Uncomment the following block if the Like Sign is made of K+ kink + positive track
     
-    Int_t indexKink=trackpos->GetKinkIndex(0);
-    Int_t kaonKinkFlag=0;
-    if(indexKink<0){
-               
-        AliESDkink *kink=fESD->GetKink(TMath::Abs(indexKink)-1);
-       const TVector3 motherMfromKink(kink->GetMotherP());
-       const TVector3 daughterMKink(kink->GetDaughterP());
-       Float_t qt=kink->GetQt();
-
-        Double_t maxDecAngKmu=f1->Eval(motherMfromKink.Mag(),0.,0.,0.);
-        Double_t maxDecAngpimu=f2->Eval(motherMfromKink.Mag(),0.,0.,0.);
-
-        Float_t kinkAngle=TMath::RadToDeg()*kink->GetAngle(2);
-        
-       Float_t energyDaughterMu=TMath::Sqrt(daughterMKink.Mag()*daughterMKink.Mag()+0.105658*0.105658);
-        Float_t p1XM= motherMfromKink.Px();
-        Float_t p1YM= motherMfromKink.Py();
-        Float_t p1ZM= motherMfromKink.Pz();
-        Float_t p2XM= daughterMKink.Px();
-        Float_t p2YM= daughterMKink.Py();
-        Float_t p2ZM= daughterMKink.Pz();
-        Float_t p3Daughter=TMath::Sqrt(((p1XM-p2XM)*(p1XM-p2XM))+((p1YM-p2YM)*(p1YM-p2YM))+((p1ZM-p2ZM)*(p1ZM-p2ZM)));
-        Double_t invariantMassKmu= TMath::Sqrt((energyDaughterMu+p3Daughter)*(energyDaughterMu+p3Daughter)-motherMfromKink.Mag()*motherMfromKink.Mag());
-
-        if((kinkAngle>maxDecAngpimu)&&(qt>0.05)&&(qt<0.25)&&((kink->GetR()>110.)&&(kink->GetR()<230.))&&(TMath::Abs(posTrackMom.Eta())<1.1)&&(invariantMassKmu<0.6)) {
-
-          if(posTrackMom.Mag()<=1.1) {
-          kaonKinkFlag=1;
-         }
-         else 
-         if (kinkAngle<maxDecAngKmu) {
-          kaonKinkFlag=1;      
-         }
-       }
+    Int_t indexKinkPos=trackpos->GetKinkIndex(0);
+    Bool_t posKaonKinkFlag=0;
+    if(indexKinkPos<0) posKaonKinkFlag=IsKink(esd, indexKinkPos, posTrackMom);
+    if(posKaonKinkFlag==0) continue; 
+    if(posKaonKinkFlag==1) p4pos.SetVectM(posTrackMom, daughter1Mass);
 
-    }  //End Kink Information   
-    
-    if(kaonKinkFlag==0) continue; 
-    if(kaonKinkFlag==1) p4pos.SetVectM(posTrackMom,daughter1Mass);
-
-      // Comment the following statements till the "for" if the Like Sign of K+ kink + positive track is needed
-
-//       UInt_t status=trackpos->GetStatus();
-//       if((status&AliESDtrack::kTPCrefit)==0) continue;
-//       if(trackpos->GetTPCclusters(0)<50) continue;
-//       if((trackpos->GetTPCchi2()/trackpos->GetTPCclusters(0))>3.5) continue;
-//       Double_t extCovPos[15];
-//       trackpos->GetExternalCovariance(extCovPos);    
-//       if(extCovPos[0]>2) continue;
-//       if(extCovPos[2]>2) continue;    
-//       if(extCovPos[5]>0.5) continue;  
-//       if(extCovPos[9]>0.5) continue;
-//       if(extCovPos[14]>2) continue; 
-// 
-//        p4pos.SetVectM(posTrackMom,daughter1Mass);
-
-      for (Int_t j=0; j<fESD->GetNumberOfTracks(); j++) {
+    for (Int_t j=0; j<esd->GetNumberOfTracks(); j++) {
         if(iTracks==j) continue;
-        AliESDtrack* trackneg=fESD->GetTrack(j);
+        AliESDtrack* trackneg=esd->GetTrack(j);
+        if (!trackneg) {
+          if (fDebug > 0) Printf("ERROR: Could not receive track %d", j);
+          continue;
+        } 
         if (trackneg->GetSign() < 0) continue;
-       
-       trackneg->GetPxPyPz(ptrackneg);
-        Float_t negSigmaToVertex = GetSigmaToVertex(trackneg);
-      
-        Float_t bneg[2];
-        Float_t bCovneg[3];
-        trackneg->GetImpactParameters(bneg,bCovneg);
-        if (bCovneg[0]<=0 || bCovneg[2]<=0) {
-          if (fDebug > 0) Printf("Estimated b resolution lower or equal zero!");
-          bCovneg[0]=0; bCovneg[2]=0;
-        }
-
-        Float_t dcaToVertexXYneg = bneg[0];
-        Float_t dcaToVertexZneg = bneg[1];
-    
-        if(negSigmaToVertex>=4) continue;
-        if((dcaToVertexXYneg>3.0)||(dcaToVertexZneg>3.0)) continue;
 
-        TVector3 negTrackMom(ptrackneg[0],ptrackneg[1],ptrackneg[2]);
-
-        if(negTrackMom.Perp()<=0.25) continue; 
+       AliExternalTrackParam *tpcTrackneg = (AliExternalTrackParam *)trackneg->GetTPCInnerParam();
+        if(!tpcTrackneg) continue;
+        ptrackneg[0]=tpcTrackneg->Px();
+        ptrackneg[1]=tpcTrackneg->Py();   
+        ptrackneg[2]=tpcTrackneg->Pz();  
+    
+        Bool_t firstLevelAcceptNegTrack=IsAcceptedForKink(esd, vertex, trackneg);
+        if(firstLevelAcceptNegTrack==kFALSE) continue; 
        
-       UInt_t statusneg=trackneg->GetStatus();
-
-        if((statusneg&AliESDtrack::kTPCrefit)==0) continue;
-
-        if(trackneg->GetTPCclusters(0)<50) continue;
-        if((trackneg->GetTPCchi2()/trackneg->GetTPCclusters(0))>3.5) continue;
-               Double_t extCovneg[15];
-        trackneg->GetExternalCovariance(extCovneg);
-        if(extCovneg[0]>2) continue;
-        if(extCovneg[2]>2) continue;    
-        if(extCovneg[5]>0.5) continue;  
-        if(extCovneg[9]>0.5) continue;
-        if(extCovneg[14]>2) continue;
+        TVector3 negTrackMom(ptrackneg[0],ptrackneg[1],ptrackneg[2]);
 
-       p4neg.SetVectM(negTrackMom, daughter2Mass);
+       Bool_t secondLevelAcceptNegTrack=IsAcceptedForTrack(esd, vertex, trackneg);
+        if(secondLevelAcceptNegTrack==kFALSE) continue;  
+               
+       p4neg.SetVectM(negTrackMom, daughter2Mass);  
        
        p4comb=p4pos;
        p4comb+=p4neg;
-       fPosKaonLikeSign->Fill(p4comb.M());
-       fLikeSignInvmassPt->Fill(p4comb.M(), p4comb.Vect().Pt());
+       
+       if(p4comb.Vect().Pt()<=0.25) continue;  
+       
+        if((TMath::Abs(p4pos.Vect().Eta())<0.9)&&(TMath::Abs(p4neg.Vect().Eta())<0.9)&&(p4comb.Vect().Eta()<0.9)) {
+       
+         fPosKaonLikeSign->Fill(p4comb.M());
+         fLikeSignInvmassPt->Fill(p4comb.M(), p4comb.Vect().Pt());
+       
+       }
        
       } //inner track loop 
 
@@ -278,6 +188,12 @@ void AliResonanceKinkLikeSign::Exec(Option_t *option)
     PostData(1, fListOfHistos);
 }      
 
+//________________________________________________________________________
+void AliResonanceKinkLikeSign::Terminate(Option_t *) 
+{
+}
+
 //____________________________________________________________________//
 
 Float_t AliResonanceKinkLikeSign::GetSigmaToVertex(AliESDtrack* esdTrack) const {
@@ -326,3 +242,163 @@ const AliESDVertex* AliResonanceKinkLikeSign::GetEventVertex(const AliESDEvent*
   }
 }
 
+//________________________________________________________________________
+
+ Bool_t AliResonanceKinkLikeSign::IsAcceptedForKink(AliESDEvent *localesd,
+            const AliESDVertex *localvertex, AliESDtrack* localtrack) {
+   // Apply the selections for each kink
+
+  Double_t gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
+  Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
+  Double_t dca3D = 0.0;
+  
+  AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)localtrack->GetTPCInnerParam();
+  if(!tpcTrack) {
+    gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
+    dca[0] = -100.; dca[1] = -100.; dca3D = -100.;
+    cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
+  }
+  else {
+    gPt = tpcTrack->Pt();
+    gPx = tpcTrack->Px();
+    gPy = tpcTrack->Py();
+    gPz = tpcTrack->Pz();
+    tpcTrack->PropagateToDCA(localvertex,
+              localesd->GetMagneticField(),100.,dca,cov);
+  }
+  
+  if(GetSigmaToVertex(localtrack) > fMaxNSigmaToVertex) {
+      if (fDebug > 1) Printf("IsAcceptedKink: Track rejected because it has a %lf sigmas to vertex TPC (max. requested: %lf)",   GetSigmaToVertex(localtrack),fMaxNSigmaToVertex);
+      return kFALSE;
+  }
+  
+  if(TMath::Abs(dca[0]) > fMaxDCAxy) {
+      if (fDebug > 1) Printf("IsAcceptedKink: Track rejected because it has a value of dca(xy) (TPC) of %lf (max. requested: %lf)", TMath::Abs(dca[0]), fMaxDCAxy);
+      return kFALSE;
+  }
+    
+  if(TMath::Abs(dca[1]) > fMaxDCAzaxis) {
+      if (fDebug > 1) Printf("IsAcceptedKink: Track rejected because it has a value of dca(z) of %lf (max. requested: %lf)", TMath::Abs(dca[1]), fMaxDCAzaxis);
+      return kFALSE;
+  }
+  
+  if(gPt <= fMinPtTrackCut) {
+      if (fDebug > 1) Printf("IsAcceptedKink: Track rejected because it has a min value of pt of %lf (min. requested: %lf)", gPt, fMinPtTrackCut);
+      return kFALSE;
+  } 
+  
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliResonanceKinkLikeSign::IsAcceptedForTrack(AliESDEvent *localesd,                                                                                                                                          const AliESDVertex *localvertex, AliESDtrack *localtrack) {
+   // Apply the selections for each track
+
+  Double_t gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
+  Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
+  Double_t dca3D = 0.0;
+  
+  AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)localtrack->GetTPCInnerParam();
+  if(!tpcTrack) {
+    gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
+    dca[0] = -100.; dca[1] = -100.; dca3D = -100.;
+    cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
+  }
+  else {
+    gPt = tpcTrack->Pt();
+    gPx = tpcTrack->Px();
+    gPy = tpcTrack->Py();
+    gPz = tpcTrack->Pz();
+    tpcTrack->PropagateToDCA(localvertex,
+              localesd->GetMagneticField(),100.,dca,cov);
+  }
+  
+  Int_t fcls[200];
+  Int_t nClustersTPC=localtrack->GetTPCclusters(fcls);
+  Float_t chi2perTPCcluster=-1.0;
+  if(nClustersTPC!=0) chi2perTPCcluster=(localtrack->GetTPCchi2())/Float_t(nClustersTPC);
+  
+  Double_t extCov[15];
+  localtrack->GetExternalCovariance(extCov);
+  
+  if((localtrack->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because of no refited in TPC");
+      return kFALSE;
+  } 
+
+  if(nClustersTPC < fMinTPCclusters) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of nclusters (TPC) of %ld (min. requested: %ld)", nClustersTPC, fMinTPCclusters);
+      return kFALSE;
+  } 
+  
+  if(chi2perTPCcluster > fMaxChi2PerTPCcluster) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of chi2perTPCcluster of %lf (max. requested: %lf)", chi2perTPCcluster, fMaxChi2PerTPCcluster);
+      return kFALSE;
+  } 
+
+  if(extCov[0] > fMaxCov0) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of cov[0] of %lf (max. requested: %lf)", cov[0], fMaxCov0);
+      return kFALSE;
+  }
+  
+  if(extCov[2] > fMaxCov2) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of cov[2] of %lf (max. requested: %lf)", cov[2], fMaxCov2);
+      return kFALSE;
+  }
+    
+  if(extCov[5] > fMaxCov5) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of cov[5] of %lf (max. requested: %lf)", cov[5], fMaxCov5);
+      return kFALSE;
+  }  
+  
+  if(extCov[9] > fMaxCov9) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of cov[9] of %lf (max. requested: %lf)", cov[9], fMaxCov9);
+      return kFALSE;
+  }  
+  
+  if(extCov[14] > fMaxCov14) {
+      if (fDebug > 1) Printf("IsAccepted: Track rejected because it has a value of cov[14] of %lf (max. requested: %lf)", cov[14], fMaxCov14);
+      return kFALSE;
+  } 
+  return kTRUE;
+
+}
+
+//________________________________________________________________________
+Bool_t AliResonanceKinkLikeSign::IsKink(AliESDEvent *localesd, Int_t kinkIndex, TVector3 trackMom) 
+{
+   // Test some kinematical criteria for each kink
+
+        AliESDkink *kink=localesd->GetKink(TMath::Abs(kinkIndex)-1);
+        const TVector3 motherMfromKink(kink->GetMotherP());
+        const TVector3 daughterMKink(kink->GetDaughterP());
+        Float_t qt=kink->GetQt();
+
+        Double_t maxDecAngKmu=f1->Eval(motherMfromKink.Mag(),0.,0.,0.);
+        Double_t maxDecAngpimu=f2->Eval(motherMfromKink.Mag(),0.,0.,0.);
+
+         Float_t kinkAngle=TMath::RadToDeg()*kink->GetAngle(2);
+        
+        Float_t energyDaughterMu=TMath::Sqrt(daughterMKink.Mag()*daughterMKink.Mag()+0.105658*0.105658);
+        Float_t p1XM= motherMfromKink.Px();
+         Float_t p1YM= motherMfromKink.Py();
+         Float_t p1ZM= motherMfromKink.Pz();
+         Float_t p2XM= daughterMKink.Px();
+         Float_t p2YM= daughterMKink.Py();
+         Float_t p2ZM= daughterMKink.Pz();
+         Float_t p3Daughter=TMath::Sqrt(((p1XM-p2XM)*(p1XM-p2XM))+((p1YM-p2YM)*(p1YM-p2YM))+((p1ZM-p2ZM)*(p1ZM-p2ZM)));
+         Double_t invariantMassKmu= TMath::Sqrt((energyDaughterMu+p3Daughter)*(energyDaughterMu+p3Daughter)-motherMfromKink.Mag()*motherMfromKink.Mag());
+
+         if((kinkAngle>maxDecAngpimu)&&(qt>0.05)&&(qt<0.25)&&((kink->GetR()>120.)&&(kink->GetR()<220.))&&(TMath::Abs(trackMom.Eta())<0.9)&&(invariantMassKmu<0.6)) {
+
+           if(trackMom.Mag()<=1.1) {
+               return kTRUE;
+           }
+          else 
+          if (kinkAngle<maxDecAngKmu) {
+               return kTRUE;
+          }
+        }
+        return kFALSE;
+}
index de155c9ff5aa75c7b2445ecefdaf1dac5aa5c7b3..72110c960fa17c6e0f10d78ae69515083b39ac0a 100644 (file)
 //        kaon-kink in their decay products. 
 //        Author: Paraskevi Ganoti, University of Athens (pganoti@phys.uoa.gr)
 //---------------------------------------------------------------------------------
+
+#include "AliAnalysisTaskSE.h"
+#include "TVector3.h"
+
 class TF1;
-class TTree;
+class TH1D;
+class TH2D;
+class AliESDtrack;
+class AliESDVertex;
 class AliESDEvent;
-class AliAnalysisTaskSE;
 
 class AliResonanceKinkLikeSign : public AliAnalysisTaskSE {
  public:
-  AliResonanceKinkLikeSign();
-  AliResonanceKinkLikeSign(const char *name);
+  AliResonanceKinkLikeSign(const char *name = "AliResonanceKinkLikeSign");
   virtual ~AliResonanceKinkLikeSign() {}
   
-  virtual void   ConnectInputData(Option_t *option);
-  virtual void   CreateOutputObjects();
-  virtual void   Exec(Option_t *option);
+  virtual void   UserCreateOutputObjects();
+  virtual void   UserExec(Option_t *option);
+  virtual void   Terminate(Option_t *);
   
+  void SetPDGCodes(Int_t d1, Int_t d2) {fdaughter1pdg=d1; fdaughter2pdg=d2;}
+  void SetHistoSettings(Int_t nbins, Float_t nlowx, Float_t nhighx) {fnbins=nbins; fnlowx=nlowx; fnhighx=nhighx;}
   Float_t GetSigmaToVertex(AliESDtrack* esdTrack) const ; 
   const AliESDVertex *GetEventVertex(const AliESDEvent* esd) const;
+  void SetDebugLevel(Int_t level) {fDebug = level;}
+  Bool_t IsAcceptedForKink(AliESDEvent *localesd, const AliESDVertex *localvertex, AliESDtrack *localtrack);
+  Bool_t IsAcceptedForTrack(AliESDEvent *localesd, const AliESDVertex *localvertex, AliESDtrack *localtrack);
+  Bool_t IsKink(AliESDEvent *localesd, Int_t kinkIndex, TVector3 trackMom); 
+  
+  void SetMaxNsigmaToVertex(Float_t maxNSigmaToVertex) {
+   fMaxNSigmaToVertex=maxNSigmaToVertex;
+  }
+  Float_t GetMaxNsigmaToVertex() const {return fMaxNSigmaToVertex;} 
+  
+  void SetPtTrackCut(Double_t minPtTrackCut) {
+   fMinPtTrackCut=minPtTrackCut;
+  }
+  Double_t GetPtTrackCut() const {return fMinPtTrackCut;} 
+  
+  void SetMaxDCAxy(Double_t maxDCAxy) {
+   fMaxDCAxy=maxDCAxy;
+  }
+  Double_t GetMaxDCAxy() const {return fMaxDCAxy;}
+  
+  void SetMaxDCAzaxis(Double_t maxDCAzaxis) {
+   fMaxDCAzaxis=maxDCAzaxis;
+  }
+  Double_t GetMaxDCAzaxis() const {return fMaxDCAzaxis;}   
+  
+  void SetMinTPCclusters(Int_t minTPCclusters) {
+   fMinTPCclusters=minTPCclusters;
+  }
+  Int_t GetMinTPCclusters() const {return fMinTPCclusters;}    
+  
+  void SetMaxChi2PerTPCcluster(Double_t maxChi2PerTPCcluster) {
+   fMaxChi2PerTPCcluster=maxChi2PerTPCcluster;
+  }
+  Double_t GetMaxChi2PerTPCcluster() const {return fMaxChi2PerTPCcluster;} 
+  
+  void SetMaxCov0(Double_t maxCov0) {
+   fMaxCov0=maxCov0;
+  }
+  Double_t GetMaxCov0() const {return fMaxCov0;}     
+  
+  void SetMaxCov2(Double_t maxCov2) {
+   fMaxCov2=maxCov2;
+  }
+  Double_t GetMaxCov2() const {return fMaxCov2;}   
+  
+  void SetMaxCov5(Double_t maxCov5) {
+   fMaxCov5=maxCov5;
+  }
+  Double_t GetMaxCov5() const {return fMaxCov5;}   
+  
+  void SetMaxCov9(Double_t maxCov9) {
+   fMaxCov9=maxCov9;
+  }
+  Double_t GetMaxCov9() const {return fMaxCov9;}   
+  
+  void SetMaxCov14(Double_t maxCov14) {
+   fMaxCov14=maxCov14;
+  }
+  Double_t GetMaxCov14() const {return fMaxCov14;}      
   
  private:
-  AliESDEvent *fESD;    //! ESD object
-  TList       *fListOfHistos; //! List 
+  Int_t       fDebug;        //  Debug flag
+ // AliESDEvent *fESD;    // ESD object
+  TList       *fListOfHistos; // List 
   TF1         *f1; //upper limit curve for the decay K->mu
   TF1         *f2;  //upper limit curve for the decay pi->mu
-  TH1D        *fPosKaonLikeSign; //! negative spectrum
-  TH2D        *fLikeSignInvmassPt; //! negative spectrum
-  
+  TH1D        *fPosKaonLikeSign; // negative spectrum
+  TH2D        *fLikeSignInvmassPt; // negative spectrum
+  Float_t     fMaxNSigmaToVertex; // standard cut to select primary tracks
+  Double_t    fMinPtTrackCut; // lower pt cut for the tracks
+  Double_t    fMaxDCAxy; // impact parameter in the xy plane
+  Double_t    fMaxDCAzaxis; // impact parameter in the z axis
+  Int_t       fMinTPCclusters; // standard cut for the TPC clusters
+  Double_t    fMaxChi2PerTPCcluster; // standard cut for the chi2 of the TPC clusters
+  Double_t    fMaxCov0;  // standard cut
+  Double_t    fMaxCov2; // standard cut
+  Double_t    fMaxCov5; // standard cut
+  Double_t    fMaxCov9; // standard cut
+  Double_t    fMaxCov14; // standard cut
+  Int_t       fdaughter1pdg; // pdg code of the resonance's first daughter
+  Int_t       fdaughter2pdg;  // pdg code of the resonance's second daughter  
+  Int_t       fnbins; // Inv mass histo number of bins
+  Float_t     fnlowx; // Inv mass histo lower limit
+  Float_t     fnhighx; // Inv mass histo upper limit
   AliResonanceKinkLikeSign(const AliResonanceKinkLikeSign&); // not implemented
   AliResonanceKinkLikeSign& operator=(const AliResonanceKinkLikeSign&); // not implemented
 
diff --git a/PWG2/KINK/macros/AddTaskKinkResonanceLikeSign.C b/PWG2/KINK/macros/AddTaskKinkResonanceLikeSign.C
deleted file mode 100644 (file)
index c6d84e9..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-AliResonanceKinkLikeSign *AddTaskKinkResonanceLikeSign(Short_t lCollidingSystems=0  /*0 = pp, 1 = AA*/)
-{
-// Creates, configures and attaches to the train a V0 check task.
-   // Get the pointer to the existing analysis manager via the static access method.
-   //==============================================================================
-   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-   if (!mgr) {
-      ::Error("AddTaskKinkResonanceLikeSign", "No analysis manager to connect to.");
-      return NULL;
-   }   
-
-   // Check the analysis type using the event handlers connected to the analysis manager.
-   //==============================================================================
-   if (!mgr->GetInputEventHandler()) {
-      ::Error("AddTaskKinkResonanceLikeSign", "This task requires an input event handler");
-      return NULL;
-   }   
-   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
-   if (type != "ESD") {
-      ::Error("AddTaskKinkResonanceLikeSign", "This task needs ESD input handler");
-      return NULL;
-   }   
-
-   // Create and configure the task
-       AliResonanceKinkLikeSign *taskkinkreslikesign = new AliResonanceKinkLikeSign("TaskResLikeSign");
-   mgr->AddTask(taskkinkreslikesign);
-
-   // Create ONLY the output containers for the data produced by the task.
-   // Get and connect other common input/output containers via the manager as below
-   //==============================================================================
-   TString outputFileName = AliAnalysisManager::GetCommonFileName();
-   outputFileName += ":PWG2KINKResonanceLikeSign";
-   if (lCollidingSystems) outputFileName += "_AA";
-   else outputFileName += "_PP";
-   if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";
-
-   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("KinkResLikeSign",
-                                                            TList::Class(),
-                                                            AliAnalysisManager::kOutputContainer,
-                                                            outputFileName );
-
-   mgr->ConnectInput(taskkinkreslikesign, 0, mgr->GetCommonInputContainer());
-   mgr->ConnectOutput(taskkinkreslikesign, 1, coutput1);
-   return taskkinkreslikesign;
-}