AliPhysics  fffcdf3 (fffcdf3)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalAnalysisFactory.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 <cstring>
28 #include <cfloat>
29 #include <functional>
30 #include <iostream>
31 #include <vector>
32 
33 #include "AliAODTrack.h"
34 #include "AliESDtrackCuts.h"
35 #include "AliEmcalTrackSelection.h"
40 #include "AliTrackContainer.h"
41 
43 
44 namespace EMCalTriggerPtAnalysis {
45 
47  AliEmcalTrackSelection *result = NULL;
48  if(!aod){
49  std::vector<AliVCuts *> trackcuts;
50  if(cut.Contains("standard")){
51  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
52  esdcuts->SetName("standardRAA");
53  esdcuts->SetTitle("Standard Track cuts");
54  trackcuts.push_back(esdcuts);
55  }
56  if(cut.Contains("standardcrossedrows")){
57  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(true, 1);
58  esdcuts->DefineHistograms(kRed);
59  esdcuts->SetName("standardRAA");
60  esdcuts->SetTitle("Standard Track cuts");
61  esdcuts->SetMinNCrossedRowsTPC(120);
62  esdcuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
63  trackcuts.push_back(esdcuts);
64  }
65  if(cut.Contains("hybrid")){
66  AliESDtrackCuts *esdcuts = GenerateLooseDCACutsESD();
67  esdcuts->SetTitle("hybridglobal");
68  esdcuts->SetTitle("Global Hybrid tracks, loose DCA");
69  trackcuts.push_back(esdcuts);
70  }
76  if(cut.Contains("VarITSchi2")){
77  double cutvalue = ValueDecoder(cut, "VarITSchi2");
78  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
79  esdcuts->SetName(TString::Format("VarITSchi2Cut%04d", static_cast<int>(cutvalue * 10.)));
80  esdcuts->SetTitle(TString::Format("Default cuts - variation ITS chi2 cut at %f", cutvalue));
81  esdcuts->SetMaxChi2PerClusterITS(cutvalue);
82  trackcuts.push_back(esdcuts);
83  }
84  if(cut.Contains("VarTPCchi2") && !cut.Contains("Constrained")){
85  double cutvalue = ValueDecoder(cut, "VarTPCchi2");
86  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
87  esdcuts->SetName(TString::Format("VarTPCchi2Cut%04d", static_cast<int>(cutvalue * 10.)));
88  esdcuts->SetTitle(TString::Format("Default cuts - variation TPC chi2 cut at %f", cutvalue));
89  esdcuts->SetMaxChi2PerClusterTPC(cutvalue);
90  trackcuts.push_back(esdcuts);
91  }
92  if(cut.Contains("VarTPCchi2Constrained")){
93  double cutvalue = ValueDecoder(cut, "VarTPCchi2Constrained"); // in number of sigmas
94  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
95  esdcuts->SetName(TString::Format("VarTPCchi2ConstrainedCut%04d", static_cast<int>(cutvalue * 10.)));
96  esdcuts->SetTitle(TString::Format("Default cuts - variation TPC chi2 constrained cut at %f", cutvalue));
97  esdcuts->SetMaxChi2TPCConstrainedGlobal(cutvalue);
98  trackcuts.push_back(esdcuts);
99  }
100  if(cut.Contains("VarDCAz")){
101  double cutvalue = ValueDecoder(cut, "VarDCAz");
102  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
103  esdcuts->SetName(TString::Format("VarDCAzCut%04d", static_cast<int>(cutvalue * 10.)));
104  esdcuts->SetTitle(TString::Format("Default cuts - variation DCAz cut at %f", cutvalue));
105  esdcuts->SetMaxDCAToVertexZ(cutvalue);
106  trackcuts.push_back(esdcuts);
107  }
108  if(cut.Contains("VarDCAr")){
109  double cutvalue = ValueDecoder(cut, "VarDCAr");
110  double p1 = cutvalue * 0.0026, p2 = cutvalue * 0.005;
111  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
112  esdcuts->SetName(TString::Format("VarDCArCut%04d", static_cast<int>(cutvalue * 10.)));
113  esdcuts->SetTitle(TString::Format("Default cuts - variation DCAr cut at %f sigma", cutvalue));
114  esdcuts->SetMaxDCAToVertexXYPtDep(TString::Format("%f + %f/pt^1.01", p1, p2));
115  trackcuts.push_back(esdcuts);
116  }
117  if(cut.Contains("VarRatioCrossedRowsFindable")){
118  double cutvalue = ValueDecoder(cut, "VarRatioCrossedRowsFindable");
119  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
120  esdcuts->SetName(TString::Format("VarRatioCRFindableCut%04d", static_cast<int>(cutvalue * 10.)));
121  esdcuts->SetTitle(TString::Format("Default cuts - variation ratio crossed rows over findable cut at %f", cutvalue));
122  esdcuts->SetMinRatioCrossedRowsOverFindableClustersTPC(cutvalue);
123  trackcuts.push_back(esdcuts);
124  }
125  if(cut.Contains("VarFractionTPCshared")){
126  double cutvalue = ValueDecoder(cut, "VarFractionTPCshared");
127  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
128  esdcuts->SetName(TString::Format("VarFractionTPCShared%04d", static_cast<int>(cutvalue * 10.)));
129  esdcuts->SetTitle(TString::Format("Default cuts - variation fraction TPC shared clusters %f", cutvalue));
130  esdcuts->SetMaxFractionSharedTPCClusters(cutvalue);
131  trackcuts.push_back(esdcuts);
132  }
133  if(cut.Contains("VarTrackLengthDeadArea")){
134  double cutvalue = ValueDecoder(cut, "VarTrackLengthDeadArea");
135  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
136  esdcuts->SetName(TString::Format("VarTLDeadAreaCut%04d", static_cast<int>(cutvalue * 10.)));
137  esdcuts->SetTitle(TString::Format("Default cuts - variation track length dead area cut at %f", cutvalue));
138  esdcuts->SetCutGeoNcrNcl(cutvalue, 130., 1.5, 0.0, 0.0);
139  trackcuts.push_back(esdcuts);
140  }
141  if(cut.Contains("VarTrackLengthTPCLength")){
142  double cutvalue = ValueDecoder(cut, "VarTrackLengthTPCLength");
143  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
144  esdcuts->SetName(TString::Format("VarTLTPCLengthCut%04d", static_cast<int>(cutvalue * 10.)));
145  esdcuts->SetTitle(TString::Format("Default cuts - variation track length TPC length cut at %f", cutvalue));
146  esdcuts->SetCutGeoNcrNcl(3., cutvalue, 1.5, 0.0, 0.0);
147  trackcuts.push_back(esdcuts);
148  }
149  if(cut.Contains("VarSPDhit")){
150  double cutvalue = ValueDecoder(cut, "VarSPDhit");
151  AliESDtrackCuts *esdcuts = GenerateDefaultCutsESD();
152  if(TMath::Abs(cutvalue) > DBL_EPSILON){
153  esdcuts->SetName("VarSPDhitOn");
154  esdcuts->SetTitle("Default cuts - variation SPD hit requirement on");
155  } else {
156  esdcuts->SetName("VarSPDhitOff");
157  esdcuts->SetTitle("Default cuts - variation SPD hit requirement off");
158  esdcuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
159  }
160  trackcuts.push_back(esdcuts);
161  }
167  if(cut.Contains("TestITSchi2")){
168  double itscut = ValueDecoder(cut, "TestITSchi2");
169  std::cout << "Using ITS chi2 cut variation: " << itscut << std::endl;
170 
171  AliESDtrackCuts *esdcuts = GenerateLooseDCACutsESD();
172  esdcuts->SetName(Form("TestITSchi2%d", int(itscut*10.)));
173  esdcuts->SetTitle(Form("Loose track cuts, ITS chi2 var %.1f", itscut));
174 
175  // Do the variation
176  esdcuts->SetMaxChi2PerClusterITS(itscut);
177  // Set cut on the TPC global constrained chi2 to very loose
178  esdcuts->SetMaxChi2TPCConstrainedGlobal(100);
179  trackcuts.push_back(esdcuts);
180  }
181  if(cut.Contains("TestTPCchi2")){
182  double tpccut = ValueDecoder(cut,"TestTPCchi2");
183  std::cout << "Using TPC chi2 cut variation: " << tpccut << std::endl;
184 
185  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(false, 1);
186  esdcuts->SetName(Form("VarTPCchi2%d", int(tpccut * 10.)));
187  esdcuts->SetTitle(Form("Loose track cuts, TPC chi2 var %.1f", tpccut));
188 
189  // Do the variation
190  esdcuts->SetMaxChi2PerClusterTPC(tpccut);
191  trackcuts.push_back(esdcuts);
192  }
193  if(cut.Contains("TestTPCchi2Constrained")){
194  double tpcconstrainedcut = ValueDecoder(cut, "TestTPCchi2Constrained");
195  std::cout << "Using TPC chi2 constrained cut variation: " << tpcconstrainedcut << std::endl;
196 
197  AliESDtrackCuts *esdcuts = GenerateLooseDCACutsESD();
198  esdcuts->SetName(Form("VarTPCchi2constrained%d", int(tpcconstrainedcut * 10.)));
199  esdcuts->SetTitle(Form("Loose track cuts, TPC constrained chi2 variation %f", tpcconstrainedcut));
200 
201  // Do the variation
202  esdcuts->SetMaxChi2TPCConstrainedGlobal(tpcconstrainedcut);
203  // Set ITS chi2 cut to very loose
204  esdcuts->SetMaxChi2PerClusterITS(100);
205  trackcuts.push_back(esdcuts);
206  }
207  if(cut.Contains("geo")){
209  geocuts->SetName("geocuts");
210  geocuts->SetTitle("TPC track length cut");
211  geocuts->SetMinTPCTrackLengthCut();
212  trackcuts.push_back(geocuts);
213  }
214  result = new AliEmcalTrackSelectionESD;
215  for(std::vector<AliVCuts *>::iterator it = trackcuts.begin(); it != trackcuts.end(); ++it)
216  result->AddTrackCuts(*it);
217  } else {
219  result = aodsel;
220  std::vector<AliVCuts *> trackcuts;
221  // C++11 Lambda: Do not create multiple extra cut objects in case of AODs. If extra cut object does already exist -
222  // specify new cut in the same object.
223  std::function<AliEMCalTriggerExtraCuts *(const std::vector<AliVCuts *> &)> FindTrackCuts = [] (const std::vector<AliVCuts *> &cuts) -> AliEMCalTriggerExtraCuts * {
224  AliEMCalTriggerExtraCuts *found = nullptr;
225  for(std::vector<AliVCuts *>::const_iterator cutiter = cuts.begin(); cutiter != cuts.end(); ++cutiter){
226  if((*cutiter)->IsA() == AliEMCalTriggerExtraCuts::Class()){
227  found = static_cast<AliEMCalTriggerExtraCuts *>(*cutiter);
228  break;
229  }
230  }
231  return found;
232  };
233  if(cut.Contains("standard")){
234  aodsel->AddFilterBit(AliAODTrack::kTrkGlobal);
235  AliEMCalTriggerExtraCuts *extracuts = FindTrackCuts(trackcuts);
236  if(!extracuts){
237  extracuts = new AliEMCalTriggerExtraCuts;
238  trackcuts.push_back(extracuts);
239  }
240  extracuts->SetMinTPCCrossedRows(120);
241  }
242  if(cut.Contains("hybrid")){
244  }
245  if(cut.Contains("geo")){
246  AliEMCalTriggerExtraCuts *extracuts = FindTrackCuts(trackcuts);
247  if(!extracuts){
248  extracuts = new AliEMCalTriggerExtraCuts;
249  trackcuts.push_back(extracuts);
250  }
251  extracuts->SetMinTPCTrackLengthCut();
252  }
253  for(std::vector<AliVCuts *>::iterator it = trackcuts.begin(); it != trackcuts.end(); ++it)
254  result->AddTrackCuts(*it);
255  }
256 
257  return result;
258 }
259 
267  result->SetEnergyDefinition(endef);
268  return result;
269 }
270 
272  return isAOD ? "caloClusters" : "CaloClusters";
273 }
274 
276  return isAOD ? "tracks" : "Tracks";
277 }
278 
280  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(true, 1);
281  esdcuts->DefineHistograms(kRed);
282  esdcuts->SetCutGeoNcrNcl(3., 130., 1.5, 0.0, 0.0);
283  esdcuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
284  esdcuts->SetMaxFractionSharedTPCClusters(0.4);
285  // esdcuts->SetMinNCrossedRowsTPC(0.); // Replaced by geometrical cut
286  return esdcuts;
287 
288 }
289 
291  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
292  esdcuts->SetMaxDCAToVertexXY(2.4);
293  esdcuts->SetMaxDCAToVertexZ(3.2);
294  esdcuts->SetDCAToVertex2D(kTRUE);
295  esdcuts->SetMaxChi2TPCConstrainedGlobal(36);
296  esdcuts->SetMaxFractionSharedTPCClusters(0.4);
297  return esdcuts;
298 }
299 
300 double AliEmcalAnalysisFactory::ValueDecoder(const char *cutstring, const char *tag) {
301  TString cuttstring(cutstring);
302  Int_t position(cuttstring.Index(tag) + strlen(tag));
303  TString valuestring = cuttstring(position, 4);
304  Int_t value = valuestring.Atoi();
305  return static_cast<double>(value) / 10.;
306 }
307 
308 } /* namespace EMCalTriggerPtAnalysis */
Interface for virtual track selection.
double Double_t
Definition: External.C:58
static double ValueDecoder(const char *string, const char *tag)
Helper class selecting events on the presence of a trigger patch for the given type above threshold...
void AddFilterBit(UInt_t filterbits)
Add a new filter bit to the track selection.
Extra track selection cuts for the high- track analysis.
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
Fully-configure EMCAL track selection independent of the data type.
int Int_t
Definition: External.C:63
static TString GetDefTrackCutsPeriod()
void SetOfflineEnergyThreshold(EmcalTriggerClass trgcls, double threshold)
Specify threshold for a given offline trigger class.
void AddTrackCuts(AliVCuts *cuts)
Add new track cuts to the list of cuts.
Implement virtual track selection for AOD analysis.
Declaration of class AliEMCalTriggerExtraCuts.
virtual void GenerateTrackCuts(ETrackFilterType_t type, const char *="")
Automatically generates track cuts depending on the requested type of filtering.
EmcalEnergyDefinition_t
Definition of EMCAL patch energy measurements.
void SetEnergyDefinition(EmcalEnergyDefinition_t endef)
Define according to which energy measurement a patch is selected as trigger patch.
bool Bool_t
Definition: External.C:53
Implementation of virtual track selection for ESDs.
static AliEmcalTriggerOfflineSelection * TriggerSelectionFactory(Double_t el0, Double_t eg1, Double_t eg2, Double_t ej1, Double_t ej2, AliEmcalTriggerOfflineSelection::EmcalEnergyDefinition_t endef=AliEmcalTriggerOfflineSelection::kFEEEnergy)
Configures EMCAL trigger offline selection used to restrict EMCAL triggered sample.
static TString TrackContainerNameFactory(Bool_t isAOD)
Get name of the default track container.
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.