AliPhysics  b555aef (b555aef)
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  if(auto esdtrack = dynamic_cast<AliESDtrack *>(o)) {
77  AliEmcalTrackSelResultHybrid::HybridType_t tracktype = AliEmcalTrackSelResultHybrid::kUndefined;
78  if(fHybridTrackCutsGlobal && fHybridTrackCutsGlobal->AcceptTrack(esdtrack)) tracktype = AliEmcalTrackSelResultHybrid::kHybridGlobal;
79  else
80  {
81  if(fHybridTrackCutsConstrained && fHybridTrackCutsConstrained->AcceptTrack(esdtrack)) tracktype = AliEmcalTrackSelResultHybrid::kHybridConstrained;
82  else if(fHybridTrackCutsNoItsRefit && fHybridTrackCutsNoItsRefit->AcceptTrack(esdtrack)) tracktype = AliEmcalTrackSelResultHybrid::kHybridConstrainedNoITSrefit;
83  }
84  AliEmcalTrackSelResultPtr result(esdtrack, tracktype != AliEmcalTrackSelResultHybrid::kUndefined);
85  return result;
86  }
87  AliErrorStream() << "No ESD track" << std::endl;
88  return AliEmcalTrackSelResultPtr(nullptr, kFALSE);
89 }
90 
91 void AliEmcalESDHybridTrackCuts::Init(){
92  switch(fHybridTrackDefinition){
93  case kDef2010: InitHybridTracks2010(); break;
94  case kDef2011: InitHybridTracks2011(); break;
95  default:
96  AliErrorStream() << "No matching initialization found for requested hybrid track definition" <<std::endl;
97  };
98  fLocalInitialized = true;
99 }
100 
101 void AliEmcalESDHybridTrackCuts::InitHybridTracks2010() {
102  std::cout << "Initializing hybrid track cuts based on the 2010 definition" << std::endl;
103  auto baseCutsFactory = [](std::string cutsname) -> AliESDtrackCuts * {
104  auto trackcuts = new AliESDtrackCuts(cutsname.data());
105  auto f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
106  trackcuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
107  trackcuts->SetMinNClustersTPC(70);
108  trackcuts->SetMaxChi2PerClusterTPC(4);
109  trackcuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
110  trackcuts->SetAcceptKinkDaughters(kFALSE);
111  trackcuts->SetRequireTPCRefit(kTRUE);
112  trackcuts->SetMaxFractionSharedTPCClusters(0.4);
113  // ITS
114  trackcuts->SetRequireITSRefit(kTRUE);
115  //accept secondaries
116  trackcuts->SetMaxDCAToVertexXY(2.4);
117  trackcuts->SetMaxDCAToVertexZ(3.2);
118  trackcuts->SetDCAToVertex2D(kTRUE);
119  //reject fakes
120  trackcuts->SetMaxChi2PerClusterITS(36);
121  trackcuts->SetMaxChi2TPCConstrainedGlobal(36);
122 
123  trackcuts->SetRequireSigmaToVertex(kFALSE);
124 
125  trackcuts->SetEtaRange(-0.9,0.9);
126  trackcuts->SetPtRange(0.15, 1E+15);
127 
128  return trackcuts;
129  };
130 
131  fHybridTrackCutsGlobal = baseCutsFactory("JetCuts10001006");
132  fHybridTrackCutsGlobal->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
133 
134  // the complement to the one with SPD requirement: tracks with ITS refit but no SPD hit
135  // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);
136  fHybridTrackCutsConstrained = baseCutsFactory("JetCuts10011006");
137  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
138 
139  if(this->fSelectNonRefitTracks) {
140  // all complementary hybrid tracks: no SPD requirement, no ITS refit requirement
141  // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);
142  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
143  fHybridTrackCutsNoItsRefit = baseCutsFactory("JetCuts10041006");
144  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
145  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
146  }
147 }
148 
149 void AliEmcalESDHybridTrackCuts::InitHybridTracks2011() {
150  std::cout << "Initialiing hybrid tracks based on the 2011 definition" <<std::endl;
151  // first the global tracks we want to take
152  fHybridTrackCutsGlobal = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
153  fHybridTrackCutsGlobal->SetName("Global Hybrid tracks, loose DCA");
154  fHybridTrackCutsGlobal->SetMaxDCAToVertexXY(2.4);
155  fHybridTrackCutsGlobal->SetMaxDCAToVertexZ(3.2);
156  fHybridTrackCutsGlobal->SetDCAToVertex2D(kTRUE);
157  fHybridTrackCutsGlobal->SetMaxChi2TPCConstrainedGlobal(36);
158  fHybridTrackCutsGlobal->SetMaxFractionSharedTPCClusters(0.4);
159 
160  // then the global constrainted tracks
161  fHybridTrackCutsConstrained = new AliESDtrackCuts(*fHybridTrackCutsGlobal);
162  fHybridTrackCutsConstrained->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement");
163  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);
164  fHybridTrackCutsConstrained->SetRequireITSRefit(kTRUE);
165 
166  if(fSelectNonRefitTracks){
167  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
168  fHybridTrackCutsNoItsRefit = new AliESDtrackCuts(*fHybridTrackCutsConstrained);
169  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
170  }
171 }
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.