AliPhysics  58f3d52 (58f3d52)
 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 #include <iostream>
21 
25 #include "AliESDEvent.h"
26 #include "AliESDtrack.h"
27 #include "AliESDtrackCuts.h"
28 #include "AliLog.h"
29 #include "AliPicoTrack.h"
30 #include "AliVCuts.h"
31 
35 
38 {
39 }
40 
43 {
44  if(cuts) this->AddTrackCuts(cuts);
45 }
46 
49 {
50  GenerateTrackCuts(type, period);
51 }
52 
54 {
55  using PWG::EMCAL::AliEmcalESDHybridTrackCuts;
56  if (fListOfCuts) fListOfCuts->Clear();
57  fSelectionModeAny = kTRUE;
58 
59  switch (type) {
60  case kHybridTracks:
62  break;
63 
64  case kTPCOnlyTracks:
66  break;
67 
68  case kITSPureTracks:
69  AddTrackCuts(AliESDtrackCuts::GetStandardITSPureSATrackCuts2010(kTRUE, kFALSE));
70  break;
71 
73  {
74  auto hybridcuts = new AliEmcalESDHybridTrackCuts("hybrid_2010_wNoRefit", AliEmcalESDHybridTrackCuts::kDef2010);
75  hybridcuts->SetUseNoITSrefitTracks(kTRUE);
76  AddTrackCuts(hybridcuts);
77  break;
78  }
79 
81  {
82  auto hybridcuts = new AliEmcalESDHybridTrackCuts("hybrid_2010_wNoRefit", AliEmcalESDHybridTrackCuts::kDef2010);
83  hybridcuts->SetUseNoITSrefitTracks(kFALSE);
84  AddTrackCuts(hybridcuts);
85  break;
86  }
87 
89  {
90  auto hybridcuts = new AliEmcalESDHybridTrackCuts("hybrid_2010_wNoRefit", AliEmcalESDHybridTrackCuts::kDef2011);
91  hybridcuts->SetUseNoITSrefitTracks(kTRUE);
92  AddTrackCuts(hybridcuts);
93  break;
94  }
95 
97  {
98  auto hybridcuts = new AliEmcalESDHybridTrackCuts("hybrid_2010_wNoRefit", AliEmcalESDHybridTrackCuts::kDef2011);
99  hybridcuts->SetUseNoITSrefitTracks(kFALSE);
100  AddTrackCuts(hybridcuts);
101  break;
102  }
103 
104  default:
105  break;
106  }
107 }
108 
109 bool AliEmcalTrackSelectionESD::IsTrackAccepted(AliVTrack* const trk) {
110  if (!fListOfCuts){
111  AliDebugStream(2) << "No cut array " << std::endl;
112  return kTRUE;
113  }
114  AliESDtrack *esdt = dynamic_cast<AliESDtrack *>(trk);
115  if (!esdt) {
116  AliPicoTrack *picoTrack = dynamic_cast<AliPicoTrack *>(trk);
117  if (picoTrack) {
118  esdt = dynamic_cast<AliESDtrack*>(picoTrack->GetTrack());
119  }
120  else {
121  AliError("Neither Pico nor ESD track");
122  return kFALSE;
123  }
124  }
125 
126  fTrackBitmap.ResetAllBits();
127  UInt_t cutcounter = 0;
128  AliDebugStream(2) << "Found cut array with " << fListOfCuts->GetEntries() << " cuts\n" << std::endl;
129  for(auto cutIter : *fListOfCuts){
130  AliDebugStream(3) << "executing nect cut: " << static_cast<AliVCuts *>(static_cast<AliEmcalManagedObject *>(cutIter)->GetObject())->GetName() << std::endl;
131  if((static_cast<AliVCuts *>(static_cast<AliEmcalManagedObject *>(cutIter)->GetObject()))->IsSelected(esdt)) fTrackBitmap.SetBitNumber(cutcounter);
132  cutcounter++;
133  }
134  // In case of ANY at least one bit has to be set, while in case of ALL all bits have to be set
135  if (fSelectionModeAny){
136  return fTrackBitmap.CountBits() > 0 || cutcounter == 0;
137  } else {
138  return fTrackBitmap.CountBits() == cutcounter;
139  }
140 }
141 
143  for(auto cutIter : *fListOfCuts){
144  AliEmcalManagedObject *ptr = static_cast<AliEmcalManagedObject *>(cutIter);
145  if(ptr->GetObject()->IsA() == AliESDtrackCuts::Class()){
146  outputList->Add(ptr->GetObject());
147  // Remove ownership - taken over by output list
148  ptr->SetOwner(false);
149  }
150  }
151 }
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.
Hybrid tracks using the 2011 definition including NoITSrefit tracks (ESD-only)
Hybrid tracks using the 2010 definition including NoITSrefit tracks (ESD-only)
unsigned int UInt_t
Definition: External.C:33
Hybrid tracks using the 2010 definition excluding NoITSrefit tracks (ESD-only)
Hybrid tracks using the 2011 definition excluding NoITSrefit tracks (ESD-only)
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.