AliPhysics  35e5fca (35e5fca)
 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) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <functional>
16 #include <iostream>
17 #include <vector>
18 
19 #include "AliAODTrack.h"
20 #include "AliESDtrackCuts.h"
21 #include "AliEmcalTrackSelection.h"
26 
28 
33 namespace EMCalTriggerPtAnalysis {
34 
35 AliEmcalTrackSelection *AliEmcalAnalysisFactory::TrackCutsFactory(TString cut, Bool_t aod){
36  AliEmcalTrackSelection *result = NULL;
37  if(!aod){
38  std::vector<AliVCuts *> trackcuts;
39  if(cut.Contains("standard")){
40  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(true, 1);
41  esdcuts->DefineHistograms(kRed);
42  esdcuts->SetName("Standard Track cuts");
43  esdcuts->SetMinNCrossedRowsTPC(120);
44  esdcuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
45  trackcuts.push_back(esdcuts);
46  }
47  if(cut.Contains("hybrid")){
48  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
49  esdcuts->SetName("Global Hybrid tracks, loose DCA");
50  esdcuts->SetMaxDCAToVertexXY(2.4);
51  esdcuts->SetMaxDCAToVertexZ(3.2);
52  esdcuts->SetDCAToVertex2D(kTRUE);
53  esdcuts->SetMaxChi2TPCConstrainedGlobal(36);
54  esdcuts->SetMaxFractionSharedTPCClusters(0.4);
55  trackcuts.push_back(esdcuts);
56  }
57  if(cut.Contains("ITSchi2")){
58  // Definition: ITSchi2XXXX
59  // - 3 Digits before . (to be filled with 0)
60  // - 1 Digit after .
61  int strmin = cut.Index("ITSchi2") + 7;
62  int cutvalue = TString(cut(strmin , strmin+4)).Atoi();
63  float itscut = static_cast<float>(cutvalue)/10.;
64 
65  std::cout << "Using ITS chi2 cut variation: " << itscut << std::endl;
66 
67  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(false, 1);
68  esdcuts->DefineHistograms(kRed);
69  esdcuts->SetName("Standard Track cuts");
70  esdcuts->SetMinNCrossedRowsTPC(120);
71  esdcuts->SetMaxDCAToVertexXY(2.4);
72  esdcuts->SetMaxDCAToVertexZ(3.2);
73  esdcuts->SetDCAToVertex2D(kTRUE);
74  esdcuts->SetMaxChi2PerClusterITS(itscut);
75  // Set cut on the TPC global constrained chi2 to very loose
76  esdcuts->SetMaxChi2TPCConstrainedGlobal(100);
77  }
78  if(cut.Contains("TPCchi2Constrained")){
79  // Definition: TPCchi2ConstrainedXXXX
80  // - 3 Digits before . (to be filled with 0)
81  // - 1 Digit after .
82  int strmin = cut.Index("TPCchi2Constrained") + 18;
83  int cutvalue = TString(cut(strmin , strmin+4)).Atoi();
84  float tpcconstrainedcut = static_cast<float>(cutvalue) / 10.;
85 
86  std::cout << "Using TOC chi2 constrained cut variation: " << tpcconstrainedcut << std::endl;
87 
88  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(false, 1);
89  esdcuts->DefineHistograms(kRed);
90  esdcuts->SetName("Standard Track cuts");
91  esdcuts->SetMinNCrossedRowsTPC(120);
92  esdcuts->SetMaxDCAToVertexXY(2.4);
93  esdcuts->SetMaxDCAToVertexZ(3.2);
94  esdcuts->SetDCAToVertex2D(kTRUE);
95  esdcuts->SetMaxChi2TPCConstrainedGlobal(tpcconstrainedcut);
96  // Set ITS chi2 cut to very loose
97  esdcuts->SetMaxChi2PerClusterITS(100);
98  }
99  if(cut.Contains("geo")){
101  geocuts->SetMinTPCTrackLengthCut();
102  trackcuts.push_back(geocuts);
103  }
104  result = new AliEmcalTrackSelectionESD;
105  for(std::vector<AliVCuts *>::iterator it = trackcuts.begin(); it != trackcuts.end(); ++it)
106  result->AddTrackCuts(*it);
107  } else {
109  result = aodsel;
110  std::vector<AliVCuts *> trackcuts;
111  // C++11 Lambda: Do not create multiple extra cut objects in case of AODs. If extra cut object does already exist -
112  // specify new cut in the same object.
113  std::function<AliEMCalTriggerExtraCuts *(const std::vector<AliVCuts *> &)> FindTrackCuts = [] (const std::vector<AliVCuts *> &cuts) -> AliEMCalTriggerExtraCuts * {
114  AliEMCalTriggerExtraCuts *found = nullptr;
115  for(std::vector<AliVCuts *>::const_iterator cutiter = cuts.begin(); cutiter != cuts.end(); ++cutiter){
116  if((*cutiter)->IsA() == AliEMCalTriggerExtraCuts::Class()){
117  found = static_cast<AliEMCalTriggerExtraCuts *>(*cutiter);
118  break;
119  }
120  }
121  return found;
122  };
123  if(cut.Contains("standard")){
124  aodsel->AddFilterBit(AliAODTrack::kTrkGlobal);
125  AliEMCalTriggerExtraCuts *extracuts = FindTrackCuts(trackcuts);
126  if(!extracuts){
127  extracuts = new AliEMCalTriggerExtraCuts;
128  trackcuts.push_back(extracuts);
129  }
130  extracuts->SetMinTPCCrossedRows(120);
131  }
132  if(cut.Contains("hybrid")){
133  aodsel->AddFilterBit(256);
134  aodsel->AddFilterBit(512);
135  }
136  if(cut.Contains("geo")){
137  AliEMCalTriggerExtraCuts *extracuts = FindTrackCuts(trackcuts);
138  if(!extracuts){
139  extracuts = new AliEMCalTriggerExtraCuts;
140  trackcuts.push_back(extracuts);
141  }
142  extracuts->SetMinTPCTrackLengthCut();
143  }
144  for(std::vector<AliVCuts *>::iterator it = trackcuts.begin(); it != trackcuts.end(); ++it)
145  result->AddTrackCuts(*it);
146  }
147 
148  return result;
149 }
150 
151 AliEmcalTriggerOfflineSelection *AliEmcalAnalysisFactory::TriggerSelectionFactory(Double_t el0, Double_t eg1, Double_t eg2, Double_t ej1, Double_t ej2, AliEmcalTriggerOfflineSelection::EmcalEnergyDefinition_t endef){
153  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEL0, el0);
154  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEG1, eg1);
155  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEG2, eg2);
156  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEJ1, ej1);
157  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEJ2, ej2);
158  result->SetEnergyDefinition(endef);
159  return result;
160 }
161 
162 TString AliEmcalAnalysisFactory::ClusterContainerNameFactory(Bool_t isAOD){
163  return isAOD ? "caloClusters" : "CaloClusters";
164 }
165 
166 } /* namespace EMCalTriggerPtAnalysis */
Interface for virtual track selection.
double Double_t
Definition: External.C:58
Helper class selecting events on the presence of a trigger patch for the given type above threshold...
void AddFilterBit(UInt_t filterbits)
Extra track selection cuts for the high- track analysis.
Collection of helper functions used to configure the analysis.
void SetOfflineEnergyThreshold(EmcalTriggerClass trgcls, double threshold)
Specify threshold for a given offline trigger class.
void AddTrackCuts(AliVCuts *cuts)
Implement virtual track selection for AOD analysis.
Declaration of class AliEMCalTriggerExtraCuts.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
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.