AliPhysics  608b256 (608b256)
AliEmcalESDHybridTrackCuts.cxx
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2017, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
27 #include <algorithm>
28 #include <functional>
29 #include <iostream>
30 #include <string>
31 
32 #include "TFormula.h"
33 
34 #include "AliESDtrack.h"
35 #include "AliESDtrackCuts.h"
38 #include "AliLog.h"
39 
41 
42 using namespace PWG::EMCAL;
43 
46  fLocalInitialized(kFALSE),
47  fHybridTrackDefinition(kDef2010),
48  fHybridTrackCutsGlobal(nullptr),
49  fHybridTrackCutsConstrained(nullptr),
50  fHybridTrackCutsNoItsRefit(nullptr),
51  fRequireTPCTRDClusters(false),
52  fMinClustersTPCTRD(0),
53  fPtDepParamClusterCut(0.)
54 {
55 
56 }
57 
58 AliEmcalESDHybridTrackCuts::AliEmcalESDHybridTrackCuts(const char *name, HybridDefinition_t hybriddef):
59  AliEmcalCutBase(name, ""),
60  fLocalInitialized(kFALSE),
61  fHybridTrackDefinition(hybriddef),
62  fHybridTrackCutsGlobal(nullptr),
63  fHybridTrackCutsConstrained(nullptr),
64  fHybridTrackCutsNoItsRefit(nullptr),
65  fRequireTPCTRDClusters(false),
66  fMinClustersTPCTRD(0),
67  fPtDepParamClusterCut(0.)
68 {
69 
70 }
71 
76 }
77 
79  AliDebugStream(1) << "AliEmcalESDHybridTrackCuts::IsSelected(): Called" << std::endl;
80  if(!fLocalInitialized) Init();
81  AliDebugStream(1) << "Global cuts: " << (fHybridTrackCutsGlobal ? "yes" : "no") << std::endl;
82  AliDebugStream(1) << "Constrained cuts: " << (fHybridTrackCutsConstrained ? "yes" : "no") << std::endl;
83  AliDebugStream(1) << "Non-refit cuts: " << (fHybridTrackCutsNoItsRefit ? "yes" : "no") << std::endl;
84  if(auto esdtrack = dynamic_cast<AliESDtrack *>(o)) {
86  if(fHybridTrackCutsGlobal && fHybridTrackCutsGlobal->AcceptTrack(esdtrack)){
87  // Temporary hack for TPC+TRD number of cluster cut which is not yet available in AliESDtrackCuts
88  bool isSelected = true;
89  auto tracklength = GetTPCTRDNumberOfClusters(esdtrack);
90  auto tracklengthcut = GetPtDepCutTPCTRDNumberOfClusters(esdtrack);
91  AliDebugStream(3) << "Global: Combined track length: " << tracklength << "(" << esdtrack->GetTPCCrossedRows() << "/" << static_cast<Int_t>(esdtrack->GetTRDncls()) << "), cut " << tracklengthcut << std::endl;
92  if(fRequireTPCTRDClusters && (static_cast<Double_t>(tracklength) < tracklengthcut)) isSelected = false;
93  if(isSelected){
94  AliDebugStream(2) << "Track selected as global hybrid track" << std::endl;
96  }
97  } else {
98  if(fHybridTrackCutsConstrained && fHybridTrackCutsConstrained->AcceptTrack(esdtrack)){
99  // Temporary hack for TPC+TRD number of cluster cut which is not yet available in AliESDtrackCuts
100  bool isSelected = true;
101  auto tracklength = GetTPCTRDNumberOfClusters(esdtrack);
102  auto tracklengthcut = GetPtDepCutTPCTRDNumberOfClusters(esdtrack);
103  AliDebugStream(3) << "Constrained: Combined track length: " << tracklength << "(" << esdtrack->GetTPCCrossedRows() << "/" << static_cast<Int_t>(esdtrack->GetTRDncls()) << "), cut " << tracklengthcut << std::endl;
104  if(fRequireTPCTRDClusters && (tracklength < tracklengthcut)) isSelected = false;
105  if(isSelected){
106  AliDebugStream(2) << "Track selected as constrained hybrid track" << std::endl;
109  }
110  } else if(fHybridTrackCutsNoItsRefit && fHybridTrackCutsNoItsRefit->AcceptTrack(esdtrack)) {
111  // Temporary hack for TPC+TRD number of cluster cut which is not yet available in AliESDtrackCuts
112  bool isSelected = true;
113  if(fRequireTPCTRDClusters && (GetTPCTRDNumberOfClusters(esdtrack) < GetPtDepCutTPCTRDNumberOfClusters(esdtrack))) isSelected = false;
114  if(isSelected){
115  AliDebugStream(2) << "Track selected as non-refit hybrid track" << std::endl;
117  }
118  } else {
119  AliDebugStream(2) << "Track not selected as hybrid track" << std::endl;
120  }
121  }
123  if(result) result.SetUserInfo(new AliEmcalTrackSelResultHybrid(tracktype));
124 
125  return result;
126  }
127  AliErrorStream() << "No ESD track" << std::endl;
128  return AliEmcalTrackSelResultPtr(nullptr, kFALSE);
129 }
130 
132  switch(fHybridTrackDefinition){
133  case kDef2010: InitHybridTracks2010(); break;
134  case kDef2011: InitHybridTracks2011(); break;
135  case kDef2018TRD: InitHybridTracks2018TRD(); break;
136  default:
137  AliErrorStream() << "No matching initialization found for requested hybrid track definition" <<std::endl;
138  };
139  fLocalInitialized = true;
140 }
141 
143  auto esdtrack = static_cast<const AliESDtrack *>(trk);
144  return static_cast<Int_t>(trk->GetTPCCrossedRows()) + static_cast<Int_t>(esdtrack->GetTRDntracklets() * 20);
145 }
146 
148  return std::min(static_cast<Double_t>(fMinClustersTPCTRD), static_cast<Double_t>(fMinClustersTPCTRD) - fPtDepParamClusterCut / trk->Pt());
149 }
150 
151 Bool_t AliEmcalESDHybridTrackCuts::IsActiveITSModule(const AliESDtrack *const trk, int layer) const {
152  int det, status;
153  Float_t xloc, zloc;
154  trk->GetITSModuleIndexInfo(layer, det, status, xloc, zloc);
155  // dead status:
156  // - dead (2)
157  // - skipped (3)
158  // - outinz (4)
159  // - holeinz (7)
160  return !(status == 2 || status == 3 || status == 4 || status == 7);
161 }
162 
164  std::cout << "Initializing hybrid track cuts based on the 2010 definition" << std::endl;
165  auto baseCutsFactory = [](std::string cutsname) -> AliESDtrackCuts * {
166  auto trackcuts = new AliESDtrackCuts(cutsname.data());
167  auto f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
168  trackcuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
169  trackcuts->SetMinNClustersTPC(70);
170  trackcuts->SetMaxChi2PerClusterTPC(4);
171  trackcuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
172  trackcuts->SetAcceptKinkDaughters(kFALSE);
173  trackcuts->SetRequireTPCRefit(kTRUE);
174  trackcuts->SetMaxFractionSharedTPCClusters(0.4);
175  // ITS
176  trackcuts->SetRequireITSRefit(kTRUE);
177  //accept secondaries
178  trackcuts->SetMaxDCAToVertexXY(2.4);
179  trackcuts->SetMaxDCAToVertexZ(3.2);
180  trackcuts->SetDCAToVertex2D(kTRUE);
181  //reject fakes
182  trackcuts->SetMaxChi2PerClusterITS(36);
183  trackcuts->SetMaxChi2TPCConstrainedGlobal(36);
184 
185  trackcuts->SetRequireSigmaToVertex(kFALSE);
186 
187  trackcuts->SetEtaRange(-0.9,0.9);
188  trackcuts->SetPtRange(0.15, 1E+15);
189 
190  return trackcuts;
191  };
192 
193  fHybridTrackCutsGlobal = baseCutsFactory("JetCuts10001006");
194  fHybridTrackCutsGlobal->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
195 
196  // the complement to the one with SPD requirement: tracks with ITS refit but no SPD hit
197  // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);
198  fHybridTrackCutsConstrained = baseCutsFactory("JetCuts10011006");
199  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
200 
201  if(this->fSelectNonRefitTracks) {
202  // all complementary hybrid tracks: no SPD requirement, no ITS refit requirement
203  // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);
204  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
205  fHybridTrackCutsNoItsRefit = baseCutsFactory("JetCuts10041006");
206  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
207  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
208  }
209 }
210 
212  std::cout << "Initialiing hybrid tracks based on the 2011 definition" <<std::endl;
213  // first the global tracks we want to take
214  fHybridTrackCutsGlobal = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
215  fHybridTrackCutsGlobal->SetName("Global Hybrid tracks, loose DCA");
216  fHybridTrackCutsGlobal->SetMaxDCAToVertexXY(2.4);
217  fHybridTrackCutsGlobal->SetMaxDCAToVertexZ(3.2);
218  fHybridTrackCutsGlobal->SetDCAToVertex2D(kTRUE);
219  fHybridTrackCutsGlobal->SetMaxChi2TPCConstrainedGlobal(36);
220  fHybridTrackCutsGlobal->SetMaxFractionSharedTPCClusters(0.4);
221 
222  // then the global constrainted tracks
223  fHybridTrackCutsConstrained = new AliESDtrackCuts(*fHybridTrackCutsGlobal);
224  fHybridTrackCutsConstrained->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement");
225  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);
226  fHybridTrackCutsConstrained->SetRequireITSRefit(kTRUE);
227 
229  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
231  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
232  }
233 }
234 
236  std::cout << "Initialiing hybrid tracks based on the 2018 definition" <<std::endl;
238 
239  // Deactivate TPC crossed rows cut
240  if(fHybridTrackCutsGlobal) fHybridTrackCutsGlobal->SetMinNCrossedRowsTPC(30);
241  if(fHybridTrackCutsConstrained) fHybridTrackCutsConstrained->SetMinNCrossedRowsTPC(30);
242  if(fHybridTrackCutsNoItsRefit) fHybridTrackCutsNoItsRefit->SetMinNCrossedRowsTPC(30);
243 
244  // Set min. number of TPC+TRD clusters cut
245  fRequireTPCTRDClusters = true;
246  fMinClustersTPCTRD = 120;
247  fPtDepParamClusterCut = 10.;
248 }
Complementary hybrid track with alive SPD module (type IIb)
Bool_t fRequireTPCTRDClusters
Require TPC and TRD combined number of clusters.
double Double_t
Definition: External.C:58
void Init()
Steer initialization of track cuts objects.
AliESDtrackCuts * fHybridTrackCutsConstrained
Track cuts for constrained hybrid tracks.
Structure containing the result of a given track selection step.
Double_t GetPtDepCutTPCTRDNumberOfClusters(const AliVTrack *const trk) const
Get the -dependent number of TPC+TRD clusters cut.
Int_t fMinClustersTPCTRD
Minimum number of TPC+TRD combined clusters.
Definition for the 2018 TRD reconstruction test.
Definition used for 2010 pass1-2 and LHC11a.
Track cuts object selecting hybrid tracks from ESDs.
HybridDefinition_t
Definition of various hybrid track selections.
Namespace for EMCAL framework classes and task.
virtual AliEmcalTrackSelResultPtr IsSelected(TObject *o)
Test whether track is accepted as hybrid track.
Complementary hybrid track without alive SPD module (type IIa)
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Double_t fPtDepParamClusterCut
weight parameter for the dependent cluster cut
AliESDtrackCuts * fHybridTrackCutsNoItsRefit
Track cuts for complementary hybrid tracks (constrained without ITSrefit)
Int_t GetTPCTRDNumberOfClusters(const AliVTrack *const trk) const
Get the combined number of TPC crossed rows + TRD clusters.
Namespace for PWG framework classes.
bool fLocalInitialized
Local init status flag steering lazy initialization.
void InitHybridTracks2010()
Initialize hybrid track selection using the 2010 definition.
void InitHybridTracks2011()
Initialize hybrid track selection using the 2011 definition.
void InitHybridTracks2018TRD()
Initialize hybrid track selection used for the TRD tracking test.
HybridDefinition_t fHybridTrackDefinition
Setting for hybrid track definition.
AliESDtrackCuts * fHybridTrackCutsGlobal
Track cuts for global hybrid tracks.
Selection result of the hybrid track selection.
Interface for a cut class returning selection status and user information.
bool Bool_t
Definition: External.C:53
bool fSelectNonRefitTracks
Select tracks which did not pass ITS refit.
Bool_t IsActiveITSModule(const AliESDtrack *const trk, int layer) const
Check if ITS module in the layer is considerd as active.