DCA cut
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 23 May 2013 12:06:20 +0000 (12:06 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 23 May 2013 12:06:20 +0000 (12:06 +0000)
rejection of daughters of lambda decay

PWGCF/Correlations/Base/AliAnalyseLeadingTrackUE.cxx
PWGCF/Correlations/Base/AliAnalyseLeadingTrackUE.h
PWGCF/Correlations/Base/AliUEHistograms.cxx
PWGCF/Correlations/Base/AliUEHistograms.h
PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.h

index b6748c6..a8820a0 100644 (file)
@@ -50,6 +50,7 @@
 #include "AliMCEvent.h"
 #include "AliVParticle.h"
 #include "AliAODMCHeader.h"
+#include "TFormula.h"
 
 #include "AliAnalysisManager.h"
 #include "AliMCEventHandler.h"
@@ -80,6 +81,7 @@ AliAnalyseLeadingTrackUE::AliAnalyseLeadingTrackUE() :
   fTrackEtaCut(0.8),
   fTrackPtMin(0),
   fEventSelection(AliVEvent::kMB|AliVEvent::kUserDefined),
+  fDCAXYCut(0),
   fEsdTrackCuts(0x0), 
   fEsdTrackCutsExtra1(0x0), 
   fEsdTrackCutsExtra2(0x0), 
@@ -703,6 +705,27 @@ AliVParticle*  AliAnalyseLeadingTrackUE::ParticleWithCuts(TObject* obj, Int_t ip
        // track selection cuts
        if ( !(((AliAODTrack*)part)->TestFilterBit(fFilterBit)) ) return 0; 
        if (fTrackStatus != 0 && !CheckTrack(part)) return 0;
+       
+       // DCA XY
+       if (fDCAXYCut)
+       {
+         const AliVVertex* vertex = aodEvent->GetPrimaryVertex();
+         if (!vertex)
+           return 0;
+         
+         Double_t pos[2];
+         Double_t covar[2];
+         AliAODTrack* clone = (AliAODTrack*) part->Clone();
+         Bool_t success = clone->PropagateToDCA(vertex, aodEvent->GetHeader()->GetMagneticField(), 3, pos, covar);
+         delete clone;
+         if (!success)
+           return 0;
+
+//       Printf("%f", ((AliAODTrack*)part)->DCA());
+//       Printf("%f", pos[0]);
+         if (TMath::Abs(pos[0]) > fDCAXYCut->Eval(part->Pt()))
+           return 0;
+       }
 
        // eventually only hadrons
        if (fOnlyHadrons){
index 22ca085..5faffa5 100644 (file)
@@ -31,6 +31,7 @@ class TROOT;
 class TVector3;
 class AliVTrack;
 class AliHelperPID;
+class TFormula;
 
 class AliAnalyseLeadingTrackUE : public TObject {
 
@@ -70,6 +71,7 @@ class AliAnalyseLeadingTrackUE : public TObject {
   void          SetCheckMotherPDG(Bool_t checkpdg) { fCheckMotherPDG = checkpdg; }
   Bool_t        GetCheckMotherPDG() { return fCheckMotherPDG; }
   void          NextEvent() { fEventCounter++; }
+  void          SetDCAXYCut(TFormula* value) { fDCAXYCut = value; }
 
 protected:
   Bool_t CheckTrack(AliVParticle * part);
@@ -83,6 +85,7 @@ private:
   Double_t       fTrackEtaCut;       // pseudo-rapidity limit of transverse regions     
   Double_t       fTrackPtMin;        // pt limit for selecting particles
   UInt_t         fEventSelection;    // bit for physics selection
+  TFormula*      fDCAXYCut;          // additional pt dependent cut on DCA XY (only for AOD)
   AliESDtrackCuts *fEsdTrackCuts;    // set of cuts when reading ESD
   AliESDtrackCuts *fEsdTrackCutsExtra1;    // set of cuts when reading ESD
   AliESDtrackCuts *fEsdTrackCutsExtra2;    // set of cuts when reading ESD
index 63a9c75..c519d6e 100644 (file)
@@ -68,6 +68,7 @@ AliUEHistograms::AliUEHistograms(const char* name, const char* histograms, const
   fEtaOrdering(kFALSE),
   fCutConversions(kFALSE),
   fCutResonances(kFALSE),
+  fRejectResonanceDaughters(-1),
   fOnlyOneEtaSide(0),
   fWeightPerEvent(kFALSE),
   fPtOrder(kTRUE),
@@ -238,6 +239,7 @@ AliUEHistograms::AliUEHistograms(const AliUEHistograms &c) :
   fEtaOrdering(kFALSE),
   fCutConversions(kFALSE),
   fCutResonances(kFALSE),
+  fRejectResonanceDaughters(-1),
   fOnlyOneEtaSide(0),
   fWeightPerEvent(kFALSE),
   fPtOrder(kTRUE),
@@ -558,21 +560,6 @@ void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEH
   for (Int_t i=0; i<input->GetEntriesFast(); i++)
     eta[i] = ((AliVParticle*) input->UncheckedAt(i))->Eta();
   
-  // list needed to prevent double counting
-  // contains 1 if list element in list <particles> is also contained in <mixed> 
-  TArrayC* existsInMixed = 0;
-//   if (mixed && !fPtOrder)
-//   {
-//     existsInMixed = new TArrayC(particles->GetEntriesFast());
-//     for (Int_t i=0; i<particles->GetEntriesFast(); i++)
-//     {
-//       if (mixed->Contains(particles->UncheckedAt(i)))
-//     (*existsInMixed)[i] = 1;
-//       else
-//     (*existsInMixed)[i] = 0;
-//     }
-//   }
-  
   // if particles is not set, just fill event statistics
   if (particles)
   {
@@ -608,7 +595,70 @@ void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEH
        
        triggerWeighting->Fill(triggerParticle->Pt());
       }
-//       new TCanvas; triggerWeighting->Draw();
+    }
+    
+    // identify K, Lambda candidates and flag those particles
+    // a TObject bit is used for this
+    const UInt_t kResonanceDaughterFlag = 1 << 14;
+    if (fRejectResonanceDaughters > 0)
+    {
+      Double_t resonanceMass = -1;
+      Double_t massDaughter1 = -1;
+      Double_t massDaughter2 = -1;
+      const Double_t interval = 0.02;
+      
+      switch (fRejectResonanceDaughters)
+      {
+       case 1: resonanceMass = 0.9; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // method test
+       case 2: resonanceMass = 0.4976; massDaughter1 = 0.1396; massDaughter2 = massDaughter1; break; // k0
+       case 3: resonanceMass = 1.115; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // lambda
+       default: AliFatal(Form("Invalid setting %d", fRejectResonanceDaughters));
+      }
+
+      for (Int_t i=0; i<particles->GetEntriesFast(); i++)
+       particles->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
+      if (mixed)
+       for (Int_t i=0; i<jMax; i++)
+         mixed->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
+      
+      for (Int_t i=0; i<particles->GetEntriesFast(); i++)
+      {
+       AliVParticle* triggerParticle = (AliVParticle*) particles->UncheckedAt(i);
+       
+       for (Int_t j=0; j<jMax; j++)
+       {
+         if (!mixed && i == j)
+           continue;
+       
+         AliVParticle* particle = 0;
+         if (!mixed)
+           particle = (AliVParticle*) particles->UncheckedAt(j);
+         else
+           particle = (AliVParticle*) mixed->UncheckedAt(j);
+         
+         // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
+         if (mixed && triggerParticle->IsEqual(particle))
+           continue;
+        
+         if (triggerParticle->Charge() * particle->Charge() > 0)
+           continue;
+      
+         Float_t mass = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerParticle->Eta(), triggerParticle->Phi(), particle->Pt(), particle->Eta(), particle->Phi(), massDaughter1, massDaughter2);
+             
+         if (TMath::Abs(mass - resonanceMass*resonanceMass) < interval*5)
+         {
+           mass = GetInvMassSquared(triggerParticle->Pt(), triggerParticle->Eta(), triggerParticle->Phi(), particle->Pt(), particle->Eta(), particle->Phi(), massDaughter1, massDaughter2);
+
+           if (mass > (resonanceMass-interval)*(resonanceMass-interval) && mass < (resonanceMass+interval)*(resonanceMass+interval))
+           {
+             triggerParticle->SetBit(kResonanceDaughterFlag);
+             particle->SetBit(kResonanceDaughterFlag);
+             
+//           Printf("Flagged %d %d %f", i, j, TMath::Sqrt(mass));
+           }
+         }
+       }
+      }
     }
     
     for (Int_t i=0; i<particles->GetEntriesFast(); i++)
@@ -631,6 +681,13 @@ void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEH
        if (triggerParticle->Charge() * fTriggerSelectCharge < 0)
          continue;
        
+      if (fRejectResonanceDaughters > 0)
+       if (triggerParticle->TestBit(kResonanceDaughterFlag))
+       {
+//       Printf("Skipped i=%d", i);
+         continue;
+       }
+       
       for (Int_t j=0; j<jMax; j++)
       {
         if (!mixed && i == j)
@@ -643,25 +700,12 @@ void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEH
           particle = (AliVParticle*) mixed->UncheckedAt(j);
         
         // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
-        if (mixed && triggerParticle == particle)
+        if (mixed && triggerParticle->IsEqual(particle))
           continue;
         
         if (fPtOrder)
-       {
          if (particle->Pt() >= triggerParticle->Pt())
            continue;
-       }
-//     else
-//     {
-//       // if we do not use the pt ordering, we have to prevent double counting in a different way
-//       // if the trigger particle is also part of the associated particle list, the pT ordering condition is applied anyway
-//       if (!mixed || (*existsInMixed)[i] != 0)
-//         if (particle->Pt() >= triggerParticle->Pt())
-//         {
-// //        Printf("Skipping %d %d", i, j);
-//           continue;
-//         }
-//     }
        
        if (fAssociatedSelectCharge != 0)
          if (particle->Charge() * fAssociatedSelectCharge < 0)
@@ -686,7 +730,14 @@ void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEH
            continue;
        }
 
-        // conversions
+       if (fRejectResonanceDaughters > 0)
+         if (particle->TestBit(kResonanceDaughterFlag))
+         {
+//         Printf("Skipped j=%d", j);
+           continue;
+         }
+
+       // conversions
        if (fCutConversions && particle->Charge() * triggerParticle->Charge() < 0)
        {
          Float_t mass = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.510e-3, 0.510e-3);
@@ -906,8 +957,6 @@ void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEH
     }
   }
   
-  delete existsInMixed;
-  
   fCentralityDistribution->Fill(centrality);
   fCentralityCorrelation->Fill(centrality, particles->GetEntriesFast());
   FillEvent(centrality, step);
index c91af69..80061b4 100644 (file)
@@ -88,6 +88,7 @@ class AliUEHistograms : public TNamed
   void SetTriggerRestrictEta(Float_t eta) { fTriggerRestrictEta = eta; }
   void SetEtaOrdering(Bool_t flag) { fEtaOrdering = flag; }
   void SetPairCuts(Bool_t conversions, Bool_t resonances) { fCutConversions = conversions; fCutResonances = resonances; }
+  void SetRejectResonanceDaughters(Int_t value) { fRejectResonanceDaughters = value; }
   void SetOnlyOneEtaSide(Int_t flag)    { fOnlyOneEtaSide = flag; }
   void SetPtOrder(Bool_t flag) { fPtOrder = flag; }
   
@@ -145,6 +146,7 @@ protected:
   Bool_t fEtaOrdering;           // activate eta ordering to prevent shape distortions. see FillCorrelation for the details
   Bool_t fCutConversions;        // cut on conversions (inv mass)
   Bool_t fCutResonances;         // cut on resonances (inv mass)
+  Int_t fRejectResonanceDaughters; // reject all daughters of all resonance candidates (1: test method (cut at m_inv=0.9); 2: k0; 3: lambda)
   Int_t fOnlyOneEtaSide;       // decides that only trigger particle from one eta side are considered (0 = all; -1 = negative, 1 = positive)
   Bool_t fWeightPerEvent;      // weight with the number of trigger particles per event
   Bool_t fPtOrder;             // apply pT,a < pT,t condition
@@ -153,7 +155,7 @@ protected:
   
   Int_t fMergeCount;           // counts how many objects have been merged together
   
-  ClassDef(AliUEHistograms, 25)  // underlying event histogram container
+  ClassDef(AliUEHistograms, 26)  // underlying event histogram container
 };
 
 Float_t AliUEHistograms::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign)
index b186797..a009c5d 100644 (file)
@@ -122,6 +122,7 @@ fCentralityMethod("V0M"),
 fTrackEtaCut(0.8),
 fOnlyOneEtaSide(0),
 fPtMin(0.5),
+fDCAXYCut(0),
 fFilterBit(0xFF),
 fTrackStatus(0),
 fSelectBit(AliVEvent::kMB|AliVEvent::kUserDefined),
@@ -136,6 +137,7 @@ fTriggerRestrictEta(-1),
 fEtaOrdering(kFALSE),
 fCutConversions(kFALSE),
 fCutResonances(kFALSE),
+fRejectResonanceDaughters(-1),
 fFillOnlyStep0(kFALSE),
 fSkipStep6(kFALSE),
 fRejectCentralityOutliers(kFALSE),
@@ -217,6 +219,7 @@ void  AliAnalysisTaskPhiCorrelations::CreateOutputObjects()
   // Initialize class with main algorithms, event and track selection. 
   fAnalyseUE = new AliAnalyseLeadingTrackUE();
   fAnalyseUE->SetParticleSelectionCriteria(fFilterBit, fUseChargeHadrons, fTrackEtaCut, fPtMin);
+  fAnalyseUE->SetDCAXYCut(fDCAXYCut);
   fAnalyseUE->SetTrackStatus(fTrackStatus);
   fAnalyseUE->SetCheckMotherPDG(fCheckMotherPDG);
   fAnalyseUE->SetDebug(fDebug); 
@@ -268,6 +271,9 @@ void  AliAnalysisTaskPhiCorrelations::CreateOutputObjects()
   fHistos->SetPairCuts(fCutConversions, fCutResonances);
   fHistosMixed->SetPairCuts(fCutConversions, fCutResonances);
   
+  fHistos->SetRejectResonanceDaughters(fRejectResonanceDaughters);
+  fHistosMixed->SetRejectResonanceDaughters(fRejectResonanceDaughters);
+  
   fHistos->SetTrackEtaCut(fTrackEtaCut);
   fHistosMixed->SetTrackEtaCut(fTrackEtaCut);
   
@@ -395,6 +401,7 @@ void  AliAnalysisTaskPhiCorrelations::AddSettingsTree()
   settingsTree->Branch("fEtaOrdering", &fEtaOrdering,"EtaOrdering/O");
   settingsTree->Branch("fCutConversions", &fCutConversions,"CutConversions/O");
   settingsTree->Branch("fCutResonances", &fCutResonances,"CutResonances/O");
+  settingsTree->Branch("fRejectResonanceDaughters", &fRejectResonanceDaughters,"RejectResonanceDaughters/I");
   settingsTree->Branch("fFillpT", &fFillpT,"FillpT/O");
   settingsTree->Branch("fMixingTracks", &fMixingTracks,"MixingTracks/I");
   settingsTree->Branch("fSkipTrigger", &fSkipTrigger,"SkipTrigger/O");
index 457407d..afddb64 100644 (file)
@@ -46,6 +46,7 @@ class AliEventPoolManager;
 class AliESDEvent;
 class AliHelperPID;
 class AliAnalysisUtils;
+class TFormula;
 
 
 class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
@@ -87,6 +88,7 @@ class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
     void   SetOnlyOneEtaSide(Int_t flag)     { fOnlyOneEtaSide = flag; }
     void   SetPtMin(Double_t val)            { fPtMin = val; }
     void   SetFilterBit( UInt_t val )        { fFilterBit = val;  }
+    void   SetDCAXYCut(TFormula* value)      { fDCAXYCut = value; }
     void   SetTrackStatus(UInt_t status)     { fTrackStatus = status; }
     void   SetCheckMotherPDG(Bool_t checkpdg) { fCheckMotherPDG = checkpdg; }
     
@@ -99,6 +101,7 @@ class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
     void   SetTriggerRestrictEta(Float_t eta) { fTriggerRestrictEta = eta; }
     void   SetEtaOrdering(Bool_t flag) { fEtaOrdering = flag; }
     void   SetPairCuts(Bool_t conversions, Bool_t resonances) { fCutConversions = conversions; fCutResonances = resonances; }
+    void   SetRejectResonanceDaughters(Int_t value) { fRejectResonanceDaughters = value; }
     void   SetCentralityMethod(const char* method) { fCentralityMethod = method; }
     void   SetFillpT(Bool_t flag) { fFillpT = flag; }
     void   SetStepsFillSkip(Bool_t step0, Bool_t step6) { fFillOnlyStep0 = step0; fSkipStep6 = step6; }
@@ -173,7 +176,8 @@ class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
     // Track cuts
     Double_t           fTrackEtaCut;          // Eta cut on particles
     Int_t              fOnlyOneEtaSide;       // decides that only trigger particle from one eta side are considered (0 = all; -1 = negative, 1 = positive)
-    Double_t           fPtMin;                // Min pT to start correlations
+    Double_t            fPtMin;                // Min pT to start correlations
+    TFormula*           fDCAXYCut;             // additional pt dependent cut on DCA XY (only for AOD)
     UInt_t             fFilterBit;            // Select tracks from an specific track cut 
     UInt_t             fTrackStatus;          // if non-0, the bits set in this variable are required for each track
     UInt_t             fSelectBit;            // Select events according to AliAnalysisTaskJetServices bit maps 
@@ -189,6 +193,7 @@ class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
     Bool_t fEtaOrdering;           // eta ordering, see AliUEHistograms.h for documentation
     Bool_t fCutConversions;        // cut on conversions (inv mass)
     Bool_t fCutResonances;         // cut on resonances (inv mass)
+    Int_t fRejectResonanceDaughters; // reject all daughters of all resonance candidates (1: test method (cut at m_inv=0.9); 2: k0; 3: lambda)
     Bool_t fFillOnlyStep0;        // fill only step 0
     Bool_t fSkipStep6;            // skip step 6 when filling
     Bool_t fRejectCentralityOutliers;  // enable rejection of outliers in centrality vs no track correlation
@@ -201,7 +206,7 @@ class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
     
     Bool_t fFillpT;                // fill sum pT instead of number density
     
-    ClassDef( AliAnalysisTaskPhiCorrelations, 32); // Analysis task for delta phi correlations
+    ClassDef( AliAnalysisTaskPhiCorrelations, 33); // Analysis task for delta phi correlations
   };
 
 class AliDPhiBasicParticle : public AliVParticle