AliPhysics  e59a9ba (e59a9ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalAnalysisFactory.cxx
Go to the documentation of this file.
1 /*
2  * AliEmcalAnalysisFactory.cxx
3  *
4  * Created on: Feb 23, 2016
5  * Author: markus
6  */
7 #include <functional>
8 #include <vector>
9 
10 #include "AliAODTrack.h"
11 #include "AliESDtrackCuts.h"
12 #include "AliEmcalTrackSelection.h"
17 
19 
21 
22 namespace EMCalTriggerPtAnalysis {
23 
24 AliEmcalTrackSelection *AliEmcalAnalysisFactory::TrackCutsFactory(TString cut, Bool_t aod){
25  AliEmcalTrackSelection *result = NULL;
26  if(!aod){
27  std::vector<AliVCuts *> trackcuts;
28  if(cut.Contains("standard")){
29  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(true, 1);
30  esdcuts->DefineHistograms(kRed);
31  esdcuts->SetName("Standard Track cuts");
32  esdcuts->SetMinNCrossedRowsTPC(120);
33  esdcuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
34  trackcuts.push_back(esdcuts);
35  }
36  if(cut.Contains("hybrid")){
37  AliESDtrackCuts *esdcuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
38  esdcuts->SetName("Global Hybrid tracks, loose DCA");
39  esdcuts->SetMaxDCAToVertexXY(2.4);
40  esdcuts->SetMaxDCAToVertexZ(3.2);
41  esdcuts->SetDCAToVertex2D(kTRUE);
42  esdcuts->SetMaxChi2TPCConstrainedGlobal(36);
43  esdcuts->SetMaxFractionSharedTPCClusters(0.4);
44  trackcuts.push_back(esdcuts);
45  }
46  if(cut.Contains("geo")){
47  AliEMCalTriggerExtraCuts *geocuts = new AliEMCalTriggerExtraCuts();
48  geocuts->SetMinTPCTrackLengthCut();
49  trackcuts.push_back(geocuts);
50  }
51  result = new AliEmcalTrackSelectionESD;
52  for(std::vector<AliVCuts *>::iterator it = trackcuts.begin(); it != trackcuts.end(); ++it)
53  result->AddTrackCuts(*it);
54  } else {
56  result = aodsel;
57  std::vector<AliVCuts *> trackcuts;
58  // C++11 Lambda: Do not create multiple extra cut objects in case of AODs. If extra cut object does already exist -
59  // specify new cut in the same object.
60  std::function<AliEMCalTriggerExtraCuts *(const std::vector<AliVCuts *> &)> FindTrackCuts = [] (const std::vector<AliVCuts *> &cuts) -> AliEMCalTriggerExtraCuts * {
61  AliEMCalTriggerExtraCuts *found = nullptr;
62  for(std::vector<AliVCuts *>::const_iterator cutiter = cuts.begin(); cutiter != cuts.end(); ++cutiter){
63  if((*cutiter)->IsA() == AliEMCalTriggerExtraCuts::Class()){
64  found = static_cast<AliEMCalTriggerExtraCuts *>(*cutiter);
65  break;
66  }
67  }
68  return found;
69  };
70  if(cut.Contains("standard")){
71  aodsel->AddFilterBit(AliAODTrack::kTrkGlobal);
72  AliEMCalTriggerExtraCuts *extracuts = FindTrackCuts(trackcuts);
73  if(!extracuts){
74  extracuts = new AliEMCalTriggerExtraCuts;
75  trackcuts.push_back(extracuts);
76  }
77  extracuts->SetMinTPCCrossedRows(120);
78  }
79  if(cut.Contains("hybrid")){
80  aodsel->AddFilterBit(256);
81  aodsel->AddFilterBit(512);
82  }
83  if(cut.Contains("geo")){
84  AliEMCalTriggerExtraCuts *extracuts = FindTrackCuts(trackcuts);
85  if(!extracuts){
86  extracuts = new AliEMCalTriggerExtraCuts;
87  trackcuts.push_back(extracuts);
88  }
89  extracuts->SetMinTPCTrackLengthCut();
90  }
91  for(std::vector<AliVCuts *>::iterator it = trackcuts.begin(); it != trackcuts.end(); ++it)
92  result->AddTrackCuts(*it);
93  }
94 
95  return result;
96 }
97 
98 AliEmcalTriggerOfflineSelection *AliEmcalAnalysisFactory::TriggerSelectionFactory(Double_t el0, Double_t eg1, Double_t eg2, Double_t ej1, Double_t ej2){
99  AliEmcalTriggerOfflineSelection *result = new AliEmcalTriggerOfflineSelection;
100  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEL0, el0);
101  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEG1, eg1);
102  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEG2, eg1);
103  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEJ1, ej1);
104  result->SetOfflineEnergyThreshold(AliEmcalTriggerOfflineSelection::kTrgEJ2, ej2);
105  return result;
106 }
107 
108 } /* namespace EMCalTriggerPtAnalysis */
Interface for virtual track selection.
void AddFilterBit(UInt_t filterbits)
ClassImp(EMCalTriggerPtAnalysis::AliEmcalAnalysisFactory) namespace EMCalTriggerPtAnalysis
void AddTrackCuts(AliVCuts *cuts)
Implement virtual track selection for AOD analysis.
Declaration of class AliEMCalTriggerExtraCuts.
Implementation of virtual track selection for ESDs.