AliPhysics  58f3d52 (58f3d52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
36 #include "AliLog.h"
37 
38 using namespace PWG::EMCAL;
39 
40 AliEmcalESDHybridTrackCuts::AliEmcalESDHybridTrackCuts():
41  AliVCuts(),
42  fLocalInitialized(kFALSE),
43  fHybridTrackDefinition(kDef2010),
44  fHybridTrackCutsGlobal(nullptr),
45  fHybridTrackCutsConstrained(nullptr),
46  fHybridTrackCutsNoItsRefit(nullptr)
47 {
48 
49 }
50 
51 AliEmcalESDHybridTrackCuts::AliEmcalESDHybridTrackCuts(const char *name, HybridDefinition_t hybriddef):
52  AliVCuts(name, ""),
53  fLocalInitialized(kFALSE),
54  fHybridTrackDefinition(hybriddef),
55  fHybridTrackCutsGlobal(nullptr),
56  fHybridTrackCutsConstrained(nullptr),
57  fHybridTrackCutsNoItsRefit(nullptr)
58 {
59 
60 }
61 
62 AliEmcalESDHybridTrackCuts::~AliEmcalESDHybridTrackCuts(){
63  if(fHybridTrackCutsGlobal) delete fHybridTrackCutsGlobal;
64  if(fHybridTrackCutsConstrained) delete fHybridTrackCutsConstrained;
65  if(fHybridTrackCutsNoItsRefit) delete fHybridTrackCutsNoItsRefit;
66 }
67 
68 bool AliEmcalESDHybridTrackCuts::IsSelected(TObject *o){
69  AliDebugStream(1) << "AliEmcalESDHybridTrackCuts::IsSelected(): Called" << std::endl;
70  if(!fLocalInitialized) Init();
71  if(auto esdtrack = dynamic_cast<AliESDtrack *>(o)) {
72  bool selected[3] = {false, false, false};
73  if(fHybridTrackCutsGlobal && fHybridTrackCutsGlobal->AcceptTrack(esdtrack)) selected[0] = true;
74  if(fHybridTrackCutsConstrained && fHybridTrackCutsConstrained->AcceptTrack(esdtrack)) selected[1] = true;
75  if(fHybridTrackCutsNoItsRefit && fHybridTrackCutsNoItsRefit->AcceptTrack(esdtrack)) selected[2]= true;
76  return selected[0] || selected[1] || selected[2];
77  }
78  AliErrorStream() << "No ESD track" << std::endl;
79  return false;
80 }
81 
82 void AliEmcalESDHybridTrackCuts::Init(){
83  switch(fHybridTrackDefinition){
84  case kDef2010: InitHybridTracks2010(); break;
85  case kDef2011: InitHybridTracks2011(); break;
86  default:
87  AliErrorStream() << "No matching initialization found for requested hybrid track definition" <<std::endl;
88  };
89  fLocalInitialized = true;
90 }
91 
92 void AliEmcalESDHybridTrackCuts::InitHybridTracks2010() {
93  std::cout << "Initializing hybrid track cuts based on the 2010 definition" << std::endl;
94  auto baseCutsFactory = [](std::string cutsname) -> AliESDtrackCuts * {
95  auto trackcuts = new AliESDtrackCuts(cutsname.data());
96  auto f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
97  trackcuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
98  trackcuts->SetMinNClustersTPC(70);
99  trackcuts->SetMaxChi2PerClusterTPC(4);
100  trackcuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
101  trackcuts->SetAcceptKinkDaughters(kFALSE);
102  trackcuts->SetRequireTPCRefit(kTRUE);
103  trackcuts->SetMaxFractionSharedTPCClusters(0.4);
104  // ITS
105  trackcuts->SetRequireITSRefit(kTRUE);
106  //accept secondaries
107  trackcuts->SetMaxDCAToVertexXY(2.4);
108  trackcuts->SetMaxDCAToVertexZ(3.2);
109  trackcuts->SetDCAToVertex2D(kTRUE);
110  //reject fakes
111  trackcuts->SetMaxChi2PerClusterITS(36);
112  trackcuts->SetMaxChi2TPCConstrainedGlobal(36);
113 
114  trackcuts->SetRequireSigmaToVertex(kFALSE);
115 
116  trackcuts->SetEtaRange(-0.9,0.9);
117  trackcuts->SetPtRange(0.15, 1E+15);
118 
119  return trackcuts;
120  };
121 
122  fHybridTrackCutsGlobal = baseCutsFactory("JetCuts10001006");
123  fHybridTrackCutsGlobal->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
124 
125  // the complement to the one with SPD requirement: tracks with ITS refit but no SPD hit
126  // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);
127  fHybridTrackCutsConstrained = baseCutsFactory("JetCuts10011006");
128  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
129 
130  if(this->fSelectNonRefitTracks) {
131  // all complementary hybrid tracks: no SPD requirement, no ITS refit requirement
132  // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);
133  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
134  fHybridTrackCutsNoItsRefit = baseCutsFactory("JetCuts10041006");
135  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
136  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
137  }
138 }
139 
140 void AliEmcalESDHybridTrackCuts::InitHybridTracks2011() {
141  std::cout << "Initialiing hybrid tracks based on the 2011 definition" <<std::endl;
142  // first the global tracks we want to take
143  fHybridTrackCutsGlobal = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
144  fHybridTrackCutsGlobal->SetName("Global Hybrid tracks, loose DCA");
145  fHybridTrackCutsGlobal->SetMaxDCAToVertexXY(2.4);
146  fHybridTrackCutsGlobal->SetMaxDCAToVertexZ(3.2);
147  fHybridTrackCutsGlobal->SetDCAToVertex2D(kTRUE);
148  fHybridTrackCutsGlobal->SetMaxChi2TPCConstrainedGlobal(36);
149  fHybridTrackCutsGlobal->SetMaxFractionSharedTPCClusters(0.4);
150 
151  // then the global constrainted tracks
152  fHybridTrackCutsConstrained = new AliESDtrackCuts(*fHybridTrackCutsGlobal);
153  fHybridTrackCutsConstrained->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement");
154  fHybridTrackCutsConstrained->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);
155  fHybridTrackCutsConstrained->SetRequireITSRefit(kTRUE);
156 
157  if(fSelectNonRefitTracks){
158  AliInfoStream() << "Create selection for non-refit tracks" << std::endl;
159  fHybridTrackCutsNoItsRefit = new AliESDtrackCuts(*fHybridTrackCutsConstrained);
160  fHybridTrackCutsNoItsRefit->SetRequireITSRefit(kFALSE);
161  }
162 }