AliPhysics  8d00e07 (8d00e07)
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 <functional>
28 #include <iostream>
29 #include <string>
30 
31 #include "TFormula.h"
32 
33 #include "AliESDtrack.h"
34 #include "AliESDtrackCuts.h"
37 #include "AliLog.h"
38 
40 ClassImp(PWG::EMCAL::AliEmcalESDHybridTrackCuts)
42 
43 using namespace PWG::EMCAL;
44 
45 AliEmcalESDHybridTrackCuts::AliEmcalESDHybridTrackCuts():
47  fLocalInitialized(kFALSE),
48  fHybridTrackDefinition(kDef2010),
49  fHybridTrackCutsGlobal(nullptr),
50  fHybridTrackCutsConstrained(nullptr),
51  fHybridTrackCutsNoItsRefit(nullptr)
52 {
53 
54 }
55 
56 AliEmcalESDHybridTrackCuts::AliEmcalESDHybridTrackCuts(const char *name, HybridDefinition_t hybriddef):
57  AliEmcalCutBase(name, ""),
58  fLocalInitialized(kFALSE),
59  fHybridTrackDefinition(hybriddef),
60  fHybridTrackCutsGlobal(nullptr),
61  fHybridTrackCutsConstrained(nullptr),
62  fHybridTrackCutsNoItsRefit(nullptr)
63 {
64 
65 }
66 
67 AliEmcalESDHybridTrackCuts::~AliEmcalESDHybridTrackCuts(){
68  if(fHybridTrackCutsGlobal) delete fHybridTrackCutsGlobal;
69  if(fHybridTrackCutsConstrained) delete fHybridTrackCutsConstrained;
70  if(fHybridTrackCutsNoItsRefit) delete fHybridTrackCutsNoItsRefit;
71 }
72 
73 AliEmcalTrackSelResultPtr AliEmcalESDHybridTrackCuts::IsSelected(TObject *o){
74  AliDebugStream(1) << "AliEmcalESDHybridTrackCuts::IsSelected(): Called" << std::endl;
75  if(!fLocalInitialized) Init();
76  AliDebugStream(1) << "Global cuts: " << (fHybridTrackCutsGlobal ? "yes" : "no") << std::endl;
77  AliDebugStream(1) << "Constrained cuts: " << (fHybridTrackCutsConstrained ? "yes" : "no") << std::endl;
78  AliDebugStream(1) << "Non-refit cuts: " << (fHybridTrackCutsNoItsRefit ? "yes" : "no") << std::endl;
79  if(auto esdtrack = dynamic_cast<AliESDtrack *>(o)) {
80  AliEmcalTrackSelResultHybrid::HybridType_t tracktype = AliEmcalTrackSelResultHybrid::kUndefined;
81  if(fHybridTrackCutsGlobal && fHybridTrackCutsGlobal->AcceptTrack(esdtrack)){
82  AliDebugStream(2) << "Track selected as global hybrid track" << std::endl;
83  tracktype = AliEmcalTrackSelResultHybrid::kHybridGlobal;
84  } else {
85  if(fHybridTrackCutsConstrained && fHybridTrackCutsConstrained->AcceptTrack(esdtrack)){
86  AliDebugStream(2) << "Track selected as constrained hybrid track" << std::endl;
87  tracktype = AliEmcalTrackSelResultHybrid::kHybridConstrained;
88  } else if(fHybridTrackCutsNoItsRefit && fHybridTrackCutsNoItsRefit->AcceptTrack(esdtrack)) {
89  AliDebugStream(2) << "Track selected as non-refit hybrid track" << std::endl;
90  tracktype = AliEmcalTrackSelResultHybrid::kHybridConstrainedNoITSrefit;
91  } else {
92  AliDebugStream(2) << "Track not selected as hybrid track" << std::endl;
93  }
94  }
95  AliEmcalTrackSelResultPtr result(esdtrack, tracktype != AliEmcalTrackSelResultHybrid::kUndefined);
96  if(result) result.SetUserInfo(new AliEmcalTrackSelResultHybrid(tracktype));
97 
98  return result;
99  }
100  AliErrorStream() << "No ESD track" << std::endl;
101  return AliEmcalTrackSelResultPtr(nullptr, kFALSE);
102 }
103 
104 void AliEmcalESDHybridTrackCuts::Init(){
105  switch(fHybridTrackDefinition){
106  case kDef2010: InitHybridTracks2010(); break;
107  case kDef2011: InitHybridTracks2011(); break;
108  default:
109  AliErrorStream() << "No matching initialization found for requested hybrid track definition" <<std::endl;
110  };
111  fLocalInitialized = true;
112 }
113 
114 void AliEmcalESDHybridTrackCuts::InitHybridTracks2010() {
115  std::cout << "Initializing hybrid track cuts based on the 2010 definition" << std::endl;
116  auto baseCutsFactory = [](std::string cutsname) -> AliESDtrackCuts * {
117  auto trackcuts = new AliESDtrackCuts(cutsname.data());
118  auto f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
119  trackcuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
120  trackcuts->SetMinNClustersTPC(70);
121  trackcuts->SetMaxChi2PerClusterTPC(4);
122  trackcuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
123  trackcuts->SetAcceptKinkDaughters(kFALSE);
124  trackcuts->SetRequireTPCRefit(kTRUE);
125  trackcuts->SetMaxFractionSharedTPCClusters(0.4);
126  // ITS
127  trackcuts->SetRequireITSRefit(kTRUE);
128  //accept secondaries
129  trackcuts->SetMaxDCAToVertexXY(2.4);
130  trackcuts->SetMaxDCAToVertexZ(3.2);
131  trackcuts->SetDCAToVertex2D(kTRUE);
132  //reject fakes
133  trackcuts->SetMaxChi2PerClusterITS(36);
134  trackcuts->SetMaxChi2TPCConstrainedGlobal(36);
135 
136  trackcuts->SetRequireSigmaToVertex(kFALSE);
137 
138  trackcuts->SetEtaRange(-0.9,0.9);
139  trackcuts->SetPtRange(0.15, 1E+15);
140 
141  return trackcuts;
142  };
143 
144  fHybridTrackCutsGlobal = baseCutsFactory("JetCuts10001006");
145  fHybridTrackCutsGlobal->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
146 
147  // the complement to the one with SPD requirement: tracks with ITS refit but no SPD hit
148  // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);
149  fHybridTrackCutsConstrained = baseCutsFactory("JetCuts10011006");
150  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
151 
152  if(this->fSelectNonRefitTracks) {
153  // all complementary hybrid tracks: no SPD requirement, no ITS refit requirement
154  // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);
155  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
156  fHybridTrackCutsNoItsRefit = baseCutsFactory("JetCuts10041006");
157  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
158  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
159  }
160 }
161 
162 void AliEmcalESDHybridTrackCuts::InitHybridTracks2011() {
163  std::cout << "Initialiing hybrid tracks based on the 2011 definition" <<std::endl;
164  // first the global tracks we want to take
165  fHybridTrackCutsGlobal = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
166  fHybridTrackCutsGlobal->SetName("Global Hybrid tracks, loose DCA");
167  fHybridTrackCutsGlobal->SetMaxDCAToVertexXY(2.4);
168  fHybridTrackCutsGlobal->SetMaxDCAToVertexZ(3.2);
169  fHybridTrackCutsGlobal->SetDCAToVertex2D(kTRUE);
170  fHybridTrackCutsGlobal->SetMaxChi2TPCConstrainedGlobal(36);
171  fHybridTrackCutsGlobal->SetMaxFractionSharedTPCClusters(0.4);
172 
173  // then the global constrainted tracks
174  fHybridTrackCutsConstrained = new AliESDtrackCuts(*fHybridTrackCutsGlobal);
175  fHybridTrackCutsConstrained->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement");
176  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);
177  fHybridTrackCutsConstrained->SetRequireITSRefit(kTRUE);
178 
179  if(fSelectNonRefitTracks){
180  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
181  fHybridTrackCutsNoItsRefit = new AliESDtrackCuts(*fHybridTrackCutsConstrained);
182  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
183  }
184 }
Structure containing the result of a given track selection step.
Namespace for EMCAL framework classes and task.
Namespace for PWG framework classes.
Interface for a cut class returning selection status and user information.