AliPhysics  857879d (857879d)
 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 <TList.h>
18 #include <TObjArray.h>
19 #include <memory>
20 
22 #include "AliESDEvent.h"
23 #include "AliESDtrack.h"
24 #include "AliESDtrackCuts.h"
25 #include "AliLog.h"
26 #include "AliPicoTrack.h"
27 #include "AliVCuts.h"
29 
33 
36 {
37 }
38 
41 {
42  if(cuts) this->AddTrackCuts(cuts);
43 }
44 
47 {
48  GenerateTrackCuts(type, period);
49 }
50 
52 {
53  if (fListOfCuts) fListOfCuts->Clear();
54  fSelectionModeAny = kTRUE;
55 
56  switch (type) {
57  case kHybridTracks:
59  break;
60 
61  case kTPCOnlyTracks:
63  break;
64 
65  default:
66  break;
67  }
68 }
69 
70 bool AliEmcalTrackSelectionESD::IsTrackAccepted(AliVTrack* const trk) {
71  if (!fListOfCuts) return kTRUE;
72  AliESDtrack *esdt = dynamic_cast<AliESDtrack *>(trk);
73  if (!esdt) {
74  AliPicoTrack *picoTrack = dynamic_cast<AliPicoTrack *>(trk);
75  if (picoTrack) {
76  esdt = dynamic_cast<AliESDtrack*>(picoTrack->GetTrack());
77  }
78  else {
79  AliError("Neither Pico nor ESD track");
80  return kFALSE;
81  }
82  }
83 
84  fTrackBitmap.ResetAllBits();
85  Int_t cutcounter = 0;
86  for(auto cutIter : *fListOfCuts){
87  if((static_cast<AliVCuts *>(static_cast<AliEmcalManagedObject *>(cutIter)->GetObject()))->IsSelected(esdt)) fTrackBitmap.SetBitNumber(cutcounter);
88  cutcounter++;
89  }
90  // In case of ANY at least one bit has to be set, while in case of ALL all bits have to be set
91  if (fSelectionModeAny){
92  return fTrackBitmap.CountBits() > 0 || cutcounter == 0;
93  } else {
94  return fTrackBitmap.CountBits() == cutcounter;
95  }
96 }
97 
99  for(auto cutIter : *fListOfCuts){
100  AliEmcalManagedObject *ptr = static_cast<AliEmcalManagedObject *>(cutIter);
101  if(ptr->GetObject()->IsA() == AliESDtrackCuts::Class()){
102  outputList->Add(ptr->GetObject());
103  // Remove ownership - taken over by output list
104  ptr->SetOwner(false);
105  }
106  }
107 }
Interface for virtual track selection.
static void AddHybridTrackCuts(AliEmcalTrackSelection *trkSel, TString period)
TObject * GetObject(const TCollection *parent, const TString &name, const TClass *cls=0, Bool_t verbose=true)
TObject * GetObject()
Providing access to managed object.
TObjArray * fListOfCuts
List of track cut objects.
void SetOwner(bool owner=true)
Specifying ownership over object.
AliEmcalTrackSelectionESD()
Dummy constructor.
virtual bool IsTrackAccepted(AliVTrack *const trk)
Check whether track is accepted.
int Int_t
Definition: External.C:63
Declaration of class AliEmcalESDTrackCutsGenerator.
void AddTrackCuts(AliVCuts *cuts)
Add new track cuts to the list of cuts.
AliVTrack * GetTrack() const
Definition: AliPicoTrack.h:60
virtual void SaveQAObjects(TList *outputList)
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
ETrackFilterType_t
Pre-defined track filters.
virtual void GenerateTrackCuts(ETrackFilterType_t type, const char *period="")
Automatically generates track cuts depending on the requested type of filtering.
Smart pointer implementation for objects inheriting from TObject.
Implementation of virtual track selection for ESDs.