]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG/EMCAL/AliEmcalAodTrackFilterTask.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalAodTrackFilterTask.cxx
index 8e89f8b3e0fc6733d8e3fd1106a8376788c73239..3dabc51a424f8b288b778e3fb284175a21ca256c 100644 (file)
@@ -1,4 +1,3 @@
-// $Id: AliEmcalAodTrackFilterTask.cxx | Fri Dec 6 10:29:20 2013 +0100 | Constantin Loizides  $
 //
 // Class to filter Aod tracks
 //
@@ -21,11 +20,14 @@ AliEmcalAodTrackFilterTask::AliEmcalAodTrackFilterTask() :
   fTracksOutName("PicoTracks"),
   fTracksInName("tracks"),
   fIncludeNoITS(kTRUE),
-  fCutMaxFrShTPCClus(0.4),
+  fCutMaxFrShTPCClus(0),
   fUseNegativeLabels(kTRUE),
   fIsMC(kFALSE),
   fDoPropagation(kFALSE),
+  fAttemptProp(kFALSE),
+  fAttemptPropMatch(kFALSE),
   fDist(440),
+  fTrackEfficiency(0),
   fTracksIn(0),
   fTracksOut(0)
 {
@@ -41,11 +43,14 @@ AliEmcalAodTrackFilterTask::AliEmcalAodTrackFilterTask(const char *name) :
   fTracksOutName("PicoTracks"),
   fTracksInName("tracks"),
   fIncludeNoITS(kTRUE),
-  fCutMaxFrShTPCClus(0.4),
+  fCutMaxFrShTPCClus(0),
   fUseNegativeLabels(kTRUE),
   fIsMC(kFALSE),
   fDoPropagation(kFALSE),
+  fAttemptProp(kFALSE),
+  fAttemptPropMatch(kFALSE),
   fDist(440),
+  fTrackEfficiency(0),
   fTracksIn(0),
   fTracksOut(0)
 {
@@ -135,13 +140,34 @@ void AliEmcalAodTrackFilterTask::UserExec(Option_t *)
 
     if (fCutMaxFrShTPCClus > 0) {
       Double_t frac = Double_t(track->GetTPCnclsS()) / Double_t(track->GetTPCncls());
-      if (frac > fCutMaxFrShTPCClus) 
+      if (frac > fCutMaxFrShTPCClus) {
        continue;
+      }
+    }
+
+    if (fTrackEfficiency) {
+      Double_t r = gRandom->Rndm();
+      if (fTrackEfficiency->Eval(track->Pt()) < r)
+        continue;
     }
 
     AliAODTrack *newt = new ((*fTracksOut)[nacc]) AliAODTrack(*track);
+    newt->SetUniqueID(0);
+    newt->ResetBit(TObject::kHasUUID);
+    newt->ResetBit(TObject::kIsReferenced);
+
+    Bool_t propthistrack = kFALSE;
     if (fDoPropagation)
+      propthistrack = kTRUE;
+    else if (!newt->IsExtrapolatedToEMCAL()) {
+      if (fAttemptProp)
+       propthistrack = kTRUE;
+      else if (fAttemptPropMatch && newt->IsEMCAL())
+       propthistrack = kTRUE;
+    }
+    if (propthistrack)
       AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(newt,fDist);
+
     Int_t label = 0;
     if (fIsMC) {
       if (fUseNegativeLabels)
@@ -151,6 +177,7 @@ void AliEmcalAodTrackFilterTask::UserExec(Option_t *)
       if (label == 0) 
        AliDebug(2,Form("Track %d with label==0", iTracks));
     }
+    newt->SetLabel(label);
     if (type==0) {
       newt->SetBit(BIT(22),0);
       newt->SetBit(BIT(23),0);