AliPhysics  d497afb (d497afb)
 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  case kITSPureTracks:
66  AddTrackCuts(AliESDtrackCuts::GetStandardITSPureSATrackCuts2010(kTRUE, kFALSE));
67  break;
68 
69  default:
70  break;
71  }
72 }
73 
74 bool AliEmcalTrackSelectionESD::IsTrackAccepted(AliVTrack* const trk) {
75  if (!fListOfCuts) return kTRUE;
76  AliESDtrack *esdt = dynamic_cast<AliESDtrack *>(trk);
77  if (!esdt) {
78  AliPicoTrack *picoTrack = dynamic_cast<AliPicoTrack *>(trk);
79  if (picoTrack) {
80  esdt = dynamic_cast<AliESDtrack*>(picoTrack->GetTrack());
81  }
82  else {
83  AliError("Neither Pico nor ESD track");
84  return kFALSE;
85  }
86  }
87 
88  fTrackBitmap.ResetAllBits();
89  UInt_t cutcounter = 0;
90  for(auto cutIter : *fListOfCuts){
91  if((static_cast<AliVCuts *>(static_cast<AliEmcalManagedObject *>(cutIter)->GetObject()))->IsSelected(esdt)) fTrackBitmap.SetBitNumber(cutcounter);
92  cutcounter++;
93  }
94  // In case of ANY at least one bit has to be set, while in case of ALL all bits have to be set
95  if (fSelectionModeAny){
96  return fTrackBitmap.CountBits() > 0 || cutcounter == 0;
97  } else {
98  return fTrackBitmap.CountBits() == cutcounter;
99  }
100 }
101 
103  for(auto cutIter : *fListOfCuts){
104  AliEmcalManagedObject *ptr = static_cast<AliEmcalManagedObject *>(cutIter);
105  if(ptr->GetObject()->IsA() == AliESDtrackCuts::Class()){
106  outputList->Add(ptr->GetObject());
107  // Remove ownership - taken over by output list
108  ptr->SetOwner(false);
109  }
110  }
111 }
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.
unsigned int UInt_t
Definition: External.C:33
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)
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.