add track efficiency dicing to Esd/Aod Filter, rename matching prep macro + adjust
authormverweij <marta.verweij@cern.ch>
Mon, 17 Mar 2014 08:12:06 +0000 (09:12 +0100)
committerhristov <Peter.Hristov@cern.ch>
Thu, 27 Mar 2014 15:25:07 +0000 (16:25 +0100)
PWG/EMCAL/AliEmcalAodTrackFilterTask.cxx
PWG/EMCAL/AliEmcalAodTrackFilterTask.h
PWG/EMCAL/AliEmcalEsdTrackFilterTask.cxx
PWG/EMCAL/AliEmcalEsdTrackFilterTask.h
PWG/EMCAL/macros/AddTaskMatchingChain.C [moved from PWG/EMCAL/macros/AddTaskClusTrackMatching.C with 81% similarity]

index dc1de73..fe4794a 100644 (file)
@@ -28,6 +28,7 @@ AliEmcalAodTrackFilterTask::AliEmcalAodTrackFilterTask() :
   fAttemptProp(kFALSE),
   fAttemptPropMatch(kFALSE),
   fDist(440),
+  fTrackEfficiency(1),
   fTracksIn(0),
   fTracksOut(0)
 {
@@ -50,6 +51,7 @@ AliEmcalAodTrackFilterTask::AliEmcalAodTrackFilterTask(const char *name) :
   fAttemptProp(kFALSE),
   fAttemptPropMatch(kFALSE),
   fDist(440),
+  fTrackEfficiency(1),
   fTracksIn(0),
   fTracksOut(0)
 {
@@ -144,6 +146,12 @@ void AliEmcalAodTrackFilterTask::UserExec(Option_t *)
       }
     }
 
+    if (fTrackEfficiency < 1) {
+      Double_t r = gRandom->Rndm();
+      if (fTrackEfficiency < r)
+        continue;
+    }
+
     AliAODTrack *newt = new ((*fTracksOut)[nacc]) AliAODTrack(*track);
     newt->SetUniqueID(0);
     newt->ResetBit(TObject::kHasUUID);
index ff10900..467d35c 100644 (file)
@@ -24,6 +24,7 @@ class AliEmcalAodTrackFilterTask : public AliAnalysisTaskSE {
   void               SetTracksInName(const char *name)                    { fTracksInName      = name; }
   void               SetTracksOutName(const char *name)                   { fTracksOutName     = name; }
   void               SetUseNegativeLabels(Bool_t f)                       { fUseNegativeLabels = f   ; }
+  void               SetTrackEfficiency(Double_t eff = 0.95)              { fTrackEfficiency   = eff ; }
 
  protected:
   void               UserCreateOutputObjects();
@@ -40,6 +41,7 @@ class AliEmcalAodTrackFilterTask : public AliAnalysisTaskSE {
   Bool_t             fAttemptProp;          // if true then attempt to propagate if not done yet
   Bool_t             fAttemptPropMatch;     // if true then attempt to propagate if not done yet but IsEMCAL is true
   Double_t           fDist;                 // distance to surface (440cm default)
+  Double_t           fTrackEfficiency;      // track efficiency
   TClonesArray      *fTracksIn;             //!track array in
   TClonesArray      *fTracksOut;            //!track array out
 
@@ -47,6 +49,6 @@ class AliEmcalAodTrackFilterTask : public AliAnalysisTaskSE {
   AliEmcalAodTrackFilterTask(const AliEmcalAodTrackFilterTask&);            // not implemented
   AliEmcalAodTrackFilterTask &operator=(const AliEmcalAodTrackFilterTask&); // not implemented
 
-  ClassDef(AliEmcalAodTrackFilterTask, 2); // Task to filter Aod tracks
+  ClassDef(AliEmcalAodTrackFilterTask, 3); // Task to filter Aod tracks
 };
 #endif
index c6291ab..83d7c94 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "AliEmcalEsdTrackFilterTask.h"
 #include <TClonesArray.h>
+#include <TRandom3.h>
 #include <TGeoGlobalMagField.h>
 #include <AliAnalysisManager.h>
 #include <AliEMCALRecoUtils.h>
@@ -14,6 +15,7 @@
 #include <AliMagF.h>
 #include <AliTrackerBase.h>
 
+
 ClassImp(AliEmcalEsdTrackFilterTask)
 
 //________________________________________________________________________
@@ -26,6 +28,7 @@ AliEmcalEsdTrackFilterTask::AliEmcalEsdTrackFilterTask() :
   fIncludeNoITS(kTRUE),
   fDoPropagation(kFALSE),
   fDist(440),
+  fTrackEfficiency(1),
   fEsdEv(0),
   fTracks(0)
 {
@@ -42,6 +45,7 @@ AliEmcalEsdTrackFilterTask::AliEmcalEsdTrackFilterTask(const char *name) :
   fIncludeNoITS(kTRUE),
   fDoPropagation(kFALSE),
   fDist(440),
+  fTrackEfficiency(1),
   fEsdEv(0),
   fTracks(0)
 {
@@ -124,8 +128,16 @@ void AliEmcalEsdTrackFilterTask::UserExec(Option_t *)
         AliESDtrack *etrack = fEsdEv->GetTrack(i);
         if (!etrack)
           continue;
+
+       if (fTrackEfficiency < 1) {
+         Double_t r = gRandom->Rndm();
+         if (fTrackEfficiency < r)
+           continue;
+       }
+
         if (!fEsdTrackCuts->AcceptTrack(etrack))
           continue;
+
         AliESDtrack *ntrack = AliESDtrackCuts::GetTPCOnlyTrack(fEsdEv,etrack->GetID());
         if (!ntrack)
           continue;
@@ -158,6 +170,11 @@ void AliEmcalEsdTrackFilterTask::UserExec(Option_t *)
         AliESDtrack *etrack = fEsdEv->GetTrack(i);
         if (!etrack)
           continue;
+       if (fTrackEfficiency < 1) {
+         Double_t r = gRandom->Rndm();
+         if (fTrackEfficiency < r)
+           continue;
+       }
        if ((fEsdTrackCuts!=0) && !fEsdTrackCuts->AcceptTrack(etrack))
           continue;
         AliESDtrack *ntrack = new ((*fTracks)[ntrnew++]) AliESDtrack(*etrack);
@@ -174,6 +191,13 @@ void AliEmcalEsdTrackFilterTask::UserExec(Option_t *)
       AliESDtrack *etrack = fEsdEv->GetTrack(i);
       if (!etrack) 
        continue;
+
+      if (fTrackEfficiency < 1) {
+       Double_t r = gRandom->Rndm();
+       if (fTrackEfficiency < r)
+         continue;
+      }
+
       if (fEsdTrackCuts->AcceptTrack(etrack)) {
         AliESDtrack *newTrack = new ((*fTracks)[ntrnew]) AliESDtrack(*etrack);
        if (fDoPropagation) 
index bc65798..a943fa8 100644 (file)
@@ -23,6 +23,7 @@ class AliEmcalEsdTrackFilterTask : public AliAnalysisTaskSE {
   void SetIncludeNoITS(Bool_t f)                 { fIncludeNoITS     = f;    }
   void SetTrackCuts(AliESDtrackCuts *cuts)       { fEsdTrackCuts     = cuts; }
   void SetTracksName(const char *name)           { fTracksName       = name; }
+  void SetTrackEfficiency(Double_t eff = 0.95)   { fTrackEfficiency   = eff; }
 
  protected:
   void UserCreateOutputObjects();
@@ -35,6 +36,7 @@ class AliEmcalEsdTrackFilterTask : public AliAnalysisTaskSE {
   Bool_t             fIncludeNoITS;      // includes tracks with failed ITS refit
   Bool_t             fDoPropagation;     // propagate all hybrid tracks to EMCal surface
   Double_t           fDist;              // distance to surface (440cm default)
+  Double_t           fTrackEfficiency;   // track efficiency
   AliESDEvent       *fEsdEv;             //!esd event
   TClonesArray      *fTracks;            //!track array
 
@@ -42,7 +44,7 @@ class AliEmcalEsdTrackFilterTask : public AliAnalysisTaskSE {
   AliEmcalEsdTrackFilterTask(const AliEmcalEsdTrackFilterTask&);            // not implemented
   AliEmcalEsdTrackFilterTask &operator=(const AliEmcalEsdTrackFilterTask&); // not implemented
 
-  ClassDef(AliEmcalEsdTrackFilterTask, 1); // Class to constrain TPC tracks to SPD vertex
+  ClassDef(AliEmcalEsdTrackFilterTask, 2); // Class to constrain TPC tracks to SPD vertex
 };
 
 #endif
similarity index 81%
rename from PWG/EMCAL/macros/AddTaskClusTrackMatching.C
rename to PWG/EMCAL/macros/AddTaskMatchingChain.C
index 2538cc4..330cdef 100644 (file)
@@ -1,11 +1,12 @@
-AliAnalysisTaskSE * AddTaskClusTrackMatching(
-                                            const char*    periodstr          = "LHC11h",
-                                            const UInt_t   pSel               = AliVEvent::kAny,
-                                            const char*    inClus             = "EmcCaloClusters",
-                                            const Double_t trackeff           = 1.0,
-                                            const Bool_t   doAODTrackProp     = kFALSE,
-                                            const Bool_t   modifyMatchObjs    = kTRUE,
-                                            const Bool_t   doHistos           = kFALSE
+AliAnalysisTaskSE * AddTaskMatchingChain(
+                                        const char*    periodstr          = "LHC11h",
+                                        const UInt_t   pSel               = AliVEvent::kAny,
+                                        const char*    inClus             = "EmcCaloClusters",
+                                        const Double_t trackeff           = 1.0,
+                                        const Bool_t   doAODTrackProp     = kFALSE,
+                                        const Double_t maxMatchR          = 0.1,
+                                        const Bool_t   modifyMatchObjs    = kTRUE,
+                                        const Bool_t   doHistos           = kFALSE
 ) {
 
   // Add task macros for EMCal cluster track matching
@@ -43,6 +44,7 @@ AliAnalysisTaskSE * AddTaskClusTrackMatching(
     esdfilter->SetDoPropagation(kTRUE);
     esdfilter->SetDist(edist);
     esdfilter->SelectCollisionCandidates(pSel);
+    esdfilter->SetTrackEfficiency(trackeff);
   } else if (dType == "AOD") {
     gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalAodTrackFilter.C");
     AliEmcalAodTrackFilterTask *aodfilter = AddTaskEmcalAodTrackFilter(inputTracks,"tracks",period);
@@ -51,6 +53,7 @@ AliAnalysisTaskSE * AddTaskClusTrackMatching(
       aodfilter->SetDoPropagation(kTRUE);
     }
     aodfilter->SelectCollisionCandidates(pSel);
+    aodfilter->SetTrackEfficiency(trackeff);
   }
 
   //----------------------- Produce EmcalParticles -----------------------------------------------------
@@ -65,7 +68,7 @@ AliAnalysisTaskSE * AddTaskClusTrackMatching(
 
   //----------------------- Cluster-Track matching -----------------------------------------------------
   gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalClusTrackMatcher.C");
-  AliEmcalClusTrackMatcherTask *emcalClus =  AddTaskEmcalClusTrackMatcher(emctracks,emcclusters,0.1,modifyMatchObjs,kTRUE);
+  AliEmcalClusTrackMatcherTask *emcalClus =  AddTaskEmcalClusTrackMatcher(emctracks,emcclusters,maxMatchR,modifyMatchObjs,kTRUE);
   emcalClus->SelectCollisionCandidates(pSel);
 
   Printf("3-- inputTracks: %s emctracks: %s emcclusters: %s",inputTracks.Data(),emctracks.Data(),emcclusters.Data());