AliPhysics  2c8507d (2c8507d)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalTrackSelectionESD.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2015, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <TBits.h>
16 #include <TClonesArray.h>
17 #include <TObjArray.h>
18 #include <memory>
19 
21 #include "AliESDEvent.h"
22 #include "AliESDtrack.h"
23 #include "AliESDtrackCuts.h"
24 #include "AliLog.h"
25 #include "AliPicoTrack.h"
26 #include "AliVCuts.h"
28 
32 
38 {
39 }
40 
46 {
47  this->AddTrackCuts(cuts);
48 }
49 
58 {
59  GenerateTrackCuts(type, period);
60 }
61 
69 {
70  if (fListOfCuts) fListOfCuts->Clear();
71  fSelectionModeAny = kTRUE;
72 
73  switch (type) {
74  case kHybridTracks:
76  break;
77 
78  case kTPCOnlyTracks:
80  break;
81 
82  default:
83  break;
84  }
85 }
86 
93 bool AliEmcalTrackSelectionESD::IsTrackAccepted(AliVTrack* const trk) {
94  if (!fListOfCuts) return kTRUE;
95  AliESDtrack *esdt = dynamic_cast<AliESDtrack *>(trk);
96  if (!esdt) {
97  AliPicoTrack *picoTrack = dynamic_cast<AliPicoTrack *>(trk);
98  if (picoTrack) {
99  esdt = dynamic_cast<AliESDtrack*>(picoTrack->GetTrack());
100  }
101  else {
102  AliError("Neither Pico nor ESD track");
103  return kFALSE;
104  }
105  }
106 
107  fTrackBitmap.ResetAllBits();
108  Int_t cutcounter = 0;
109  for (TIter cutIter = TIter(fListOfCuts).Begin(); cutIter != TIter::End(); ++cutIter){
110  if((static_cast<AliVCuts *>(*cutIter))->IsSelected(esdt)) fTrackBitmap.SetBitNumber(cutcounter);
111  cutcounter++;
112  }
113  // In case of ANY at least one bit has to be set, while in case of ALL all bits have to be set
114  if (fSelectionModeAny){
115  return fTrackBitmap.CountBits() > 0 || cutcounter == 0;
116  } else {
117  return fTrackBitmap.CountBits() == cutcounter;
118  }
119 }
Interface for virtual track selection.
static void AddHybridTrackCuts(AliEmcalTrackSelection *trkSel, TString period)
TObjArray * fListOfCuts
List of track cut objects.
virtual bool IsTrackAccepted(AliVTrack *const trk)
int Int_t
Definition: External.C:63
Declaration of class AliEmcalESDTrackCutsGenerator.
void AddTrackCuts(AliVCuts *cuts)
AliVTrack * GetTrack() const
Definition: AliPicoTrack.h:59
Bool_t fSelectionModeAny
Accept track if any of the cuts is fulfilled.
TBits fTrackBitmap
Bitmap of last accepted/rejected track.
static void AddTPCOnlyTrackCuts(AliEmcalTrackSelection *trkSel, TString period)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
virtual void GenerateTrackCuts(ETrackFilterType_t type, const char *period="")
Implementation of virtual track selection for ESDs.