AliPhysics  fe039ad (fe039ad)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalTrackSelectionAOD.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 
16 #include <TClonesArray.h>
17 #include <TBits.h>
18 #include <TObjArray.h>
19 
20 #include <AliAODEvent.h>
21 #include <AliAODTrack.h>
25 #include <AliESDtrack.h>
26 #include <AliESDtrackCuts.h>
27 #include <AliPicoTrack.h>
28 
32 
35  fFilterBits(0),
36  fFilterHybridTracks(kFALSE),
37  fFilterTPCTracks(kFALSE)
38 {
39  fHybridFilterBits[0] = -1;
40  fHybridFilterBits[1] = -1;
41 }
42 
45  fFilterBits(filterbits),
46  fFilterHybridTracks(kFALSE),
47  fFilterTPCTracks(kFALSE)
48 {
49  fHybridFilterBits[0] = -1;
50  fHybridFilterBits[1] = -1;
51  if(cuts) AddTrackCuts(cuts);
52 }
53 
56  fFilterBits(0),
57  fFilterHybridTracks(kFALSE),
58  fFilterTPCTracks(kFALSE)
59 {
60  fHybridFilterBits[0] = -1;
61  fHybridFilterBits[1] = -1;
62  GenerateTrackCuts(type, period);
63 }
64 
66 {
67  switch (type) {
68  case kHybridTracks:
69  if (fListOfCuts) fListOfCuts->Clear();
70  fFilterBits = 0;
71  fFilterHybridTracks = kTRUE;
72  fFilterTPCTracks = kFALSE;
74  fSelectionModeAny = kTRUE;
75  break;
76 
77  case kTPCOnlyTracks:
78  if (fListOfCuts) fListOfCuts->Clear();
79  fFilterBits = 0;
80  fFilterHybridTracks = kFALSE;
81  fHybridFilterBits[0] = -1;
82  fHybridFilterBits[1] = -1;
83  fFilterTPCTracks = kTRUE;
84  break;
85 
87  if (fListOfCuts) fListOfCuts->Clear();
88  AddTrackCuts(AliESDtrackCuts::GetStandardITSSATrackCuts2010());
89  fFilterHybridTracks = kFALSE;
90  fFilterTPCTracks = kFALSE;
91  fHybridFilterBits[0] = -1;
92  fHybridFilterBits[1] = -1;
93  break;
94 
96  {
97  auto trackcuts = new PWG::EMCAL::AliEmcalAODHybridTrackCuts("hybridcuts2010_wNoRefit");
98  AddTrackCuts(trackcuts);
99  break;
100  }
101 
103  {
104  auto trackcuts = new PWG::EMCAL::AliEmcalAODHybridTrackCuts("hybridcuts2010_woNoRefit");
105  trackcuts->SetSelectNonITSrefitTracks(kFALSE);
106  AddTrackCuts(trackcuts);
107  break;
108  }
109 
111  {
112  auto trackcuts = new PWG::EMCAL::AliEmcalAODHybridTrackCuts("hybridcuts2011_wNoRefit");
113  AddTrackCuts(trackcuts);
114  break;
115  }
116 
118  {
119  auto trackcuts = new PWG::EMCAL::AliEmcalAODHybridTrackCuts("hybridcuts2011_woNoRefit");
120  trackcuts->SetSelectNonITSrefitTracks(kFALSE);
121  AddTrackCuts(trackcuts);
122  break;
123  }
124 
125  default:
126  break;
127  }
128 }
129 
131 {
132  AliAODTrack *aodt = dynamic_cast<AliAODTrack*>(trk);
133  if (!aodt){
134  AliPicoTrack *picotrack = dynamic_cast<AliPicoTrack*>(trk);
135  if(picotrack) {
136  aodt = dynamic_cast<AliAODTrack *>(picotrack->GetTrack());
137  }
138  else {
139  AliError("Track neither AOD track nor pico track");
140  return kFALSE;
141  }
142  }
143  if(!aodt){
144  AliError("Failed getting AOD track");
145  return kFALSE;
146  }
147 
148  fTrackBitmap.ResetAllBits();
149  UInt_t cutcounter(0);
150  if (fFilterBits) {
151  if(aodt->TestFilterBit(fFilterBits)) fTrackBitmap.SetBitNumber(cutcounter);
152  cutcounter++;
153  }
154  if (fFilterHybridTracks) {
155  if (aodt->IsHybridGlobalConstrainedGlobal()) {
156  // If the hybrid filter bits are not provided (fHybridFilterBits[0] == 0) all hybrid tracks will be selected in the same group
157  if (fHybridFilterBits[0] < 0 || aodt->TestFilterBit(BIT(fHybridFilterBits[0]))) fTrackBitmap.SetBitNumber(cutcounter);
158  if (aodt->TestFilterBit(BIT(fHybridFilterBits[1]))) fTrackBitmap.SetBitNumber(cutcounter+1);
159  }
160  cutcounter += 2;
161  }
162  if (fFilterTPCTracks) {
163  if(aodt->IsHybridTPCConstrainedGlobal()) fTrackBitmap.SetBitNumber(cutcounter);
164  cutcounter++;
165  }
166  if (fListOfCuts) {
167  for (auto cutIter : *fListOfCuts){
168  AliVCuts *trackCuts = static_cast<AliVCuts*>(static_cast<AliEmcalManagedObject *>(cutIter)->GetObject());
169  if (trackCuts->IsSelected(aodt)) fTrackBitmap.SetBitNumber(cutcounter);
170  cutcounter++;
171  }
172  }
173 
174  if (fSelectionModeAny){
175  // In case of ANY one of the cuts need to be fulfilled (equivalent to one but set)
176  return fTrackBitmap.CountBits() > 0 || cutcounter == 0;
177  }
178  else {
179  // In case of ALL all of the cuts need to be fulfilled (equivalent to all bits set)
180  return fTrackBitmap.CountBits() == cutcounter;
181  }
182 }
183 
185 {
186  period.ToLower();
187  if (period == "lhc10b" || period == "lhc10c" || period == "lhc10d" ||
188  period == "lhc10e" || period == "lhc10h" ||
189  period == "lhc11h" || period == "lhc12a" || period == "lhc12b" ||
190  period == "lhc12c" || period == "lhc12d" || period == "lhc12e" ||
191  period == "lhc12f" || period == "lhc12g" || period == "lhc12h" ||
192  period == "lhc12i" || period == "lhc13b" || period == "lhc13c" ||
193  period == "lhc13d" || period == "lhc13e" || period == "lhc13f" ||
194  period == "lhc13g" ||
195  (period.Length() == 6 && (period.BeginsWith("lhc15") || period.BeginsWith("lhc16") || period.BeginsWith("lhc17"))) // all Run-2 data, excluding MC productions
196  ) {
197  bits[0] = 8;
198  bits[1] = 9;
199  }
200 
201  else if (period == "lhc10f7a" || period == "lhc12a15e" || period.BeginsWith("lhc12a17") ||
202  period == "lhc13b4" || period == "lhc13b4_fix" || period == "lhc13b4_plus" || period == "lhc14k1a" || period == "lhc14k1b" || period == "lhc13e4" ||
203  period.BeginsWith("lhc14a1") || period.BeginsWith("lhc13b2_efix") ||
204  period.BeginsWith("lhc15g6") || period.BeginsWith("lhc16e1") || period.BeginsWith("lhc17f8")) {
205  bits[0] = 8;
206  bits[1] = 9;
207  }
208 
209  else if (period == "lhc11a" || period == "lhc10hold" || period == "lhc11c" || period == "lhc11d") {
210  bits[0] = 8;
211  bits[1] = 4;
212  }
213 
214  else if (period.Contains("lhc12a15a") || period == "lhc12a15f" ||
215  period == "lhc12a15g" || period.BeginsWith("lhc11a1")) {
216  bits[0] = 8;
217  bits[1] = 4;
218  }
219 
220  else {
221  ::Error("AliEmcalTrackSelectionAOD::GetHybridFilterBits", "Could not find period %s! Hybrid tracks will be selected, but will not be able to distinguish between global and constrained.", period.Data());
222  bits[0] = -1;
223  bits[1] = -1;
224  return kFALSE;
225  }
226 
227  return kTRUE;
228 }
Interface for virtual track selection.
TObject * GetObject(const TCollection *parent, const TString &name, const TClass *cls=0, Bool_t verbose=true)
Char_t fHybridFilterBits[2]
Filter bits of hybrid tracks.
char Char_t
Definition: External.C:18
TObjArray * fListOfCuts
List of track cut objects.
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)
Bool_t fFilterHybridTracks
Filter hybrid tracks using AliAODTrack::IsHybridGlobalConstrainedGlobal.
Hybrid tracks using the 2011 definition excluding NoITSrefit tracks (ESD-only)
Bool_t fFilterTPCTracks
Filter TPC-only tracks using AliAODTrack::IsHybridGlobalConstrainedGlobal.
void AddTrackCuts(AliVCuts *cuts)
Add new track cuts to the list of cuts.
Implement virtual track selection for AOD analysis.
virtual bool IsTrackAccepted(AliVTrack *const trk)
Performing track selection.
Cut class selecting hybrid tracks using the IsHybrid function.
AliVTrack * GetTrack() const
Definition: AliPicoTrack.h:60
Bool_t fSelectionModeAny
Accept track if any of the cuts is fulfilled.
TBits fTrackBitmap
Bitmap of last accepted/rejected track.
ETrackFilterType_t
Pre-defined track filters.
virtual void GenerateTrackCuts(ETrackFilterType_t type, const char *="")
Automatically generates track cuts depending on the requested type of filtering.
static Bool_t GetHybridFilterBits(Char_t bits[], TString period)
Returns the hybrid filter bits according to a hard-coded look-up table.
AliEmcalTrackSelectionAOD()
Main constructor.
Smart pointer implementation for objects inheriting from TObject.
UInt_t fFilterBits
Track filter bits.
bool Bool_t
Definition: External.C:53