AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalNeutralJets.cxx
Go to the documentation of this file.
1 #include <array>
2 
3 #include <THistManager.h>
4 #include <TLorentzVector.h>
5 
7 #include "AliAnalysisUtils.h"
8 #include "AliClusterContainer.h"
9 #include "AliEmcalJet.h"
10 #include "AliInputEventHandler.h"
11 #include "AliJetContainer.h"
12 #include "AliVCluster.h"
13 #include "AliVEvent.h"
14 #include "AliVVertex.h"
15 
19 
22  fHistos(),
23  fTriggerBits(0),
24  fTriggerString(""),
25  fNameR02jets(""),
26  fNameR04jets(""),
27  fNameClusters(""),
28  fR02jets(nullptr),
29  fR04jets(nullptr),
30  fClusters(nullptr)
31 {
32 
33 }
34 
36  AliAnalysisTaskEmcalJet(name, true),
37  fHistos(),
38  fTriggerBits(0),
39  fTriggerString(""),
40  fNameR02jets(""),
41  fNameR04jets(""),
42  fNameClusters(""),
43  fR02jets(nullptr),
44  fR04jets(nullptr),
45  fClusters(nullptr)
46 {
47 
48 }
49 
51 }
52 
55 
56  fAliAnalysisUtils = new AliAnalysisUtils;
57 
58  fHistos = new THistManager("CaloJetHistos");
59 
60  fHistos->CreateTH1("hEvents", "Number of events", 1, 0.5, 1.5);
61  const std::array<double, 2> kJetRadii = {0.2, 0.4};
62  for(auto r : kJetRadii){
63  fHistos->CreateTH1(Form("hJetPtRawR%02d", static_cast<Int_t>(10.*r)), Form("Raw jet pt spectrum for R=%.1f jets", r), 20, 0., 200 );
64  fHistos->CreateTH1(Form("hJetPtRecR%02d", static_cast<Int_t>(10.*r)), Form("Rec jet pt spectrum for R=%.1f jets", r), 20, 0., 200 );
65 
66  for(int i = 10; i < 200; i += 10)
67  fHistos->CreateTH1(Form("hR%02dJet%d%dPtRel", static_cast<int>(10.*r), i, i + 10), Form("Pt rel of electron candidates for neutral jets with "), 100, 0., 1.);
68  }
69 
70  for(auto h : *(fHistos->GetListOfHistograms())) fOutput->Add(h);
71  PostData(1, fOutput);
72 }
73 
75  // Data set requires a reduced event selection - no tracking info
76  if(!(fInputHandler->IsEventSelected() & fTriggerBits)) return false;
77  if(fTriggerString){
78  if(!fInputEvent->GetFiredTriggerClasses().Contains(fTriggerString)) return false;
79  }
80  if(fAliAnalysisUtils->IsPileUpEvent(fInputEvent)) return false;
81  if(TMath::Abs(fVertexSPD[2]) > 10.) return false;
82  return true;
83 }
84 
86  if(!fR02jets) fR02jets = this->GetJetContainer(fNameR02jets.Data());
87  if(!fR04jets) fR04jets = this->GetJetContainer(fNameR04jets.Data());
89  return true;
90 }
91 
93  // Loop over all jets in EMCAL surface
94  for(auto j : fR02jets->accepted()){
95  if(!IsTrackInEmcalAcceptance(j, 0.2)) continue; // select only jets fully contained inside EMCAL acceptance
96  if(TMath::Abs(j->Eta()) > 0.5) continue;
97  if(j->Pt() < 20.) continue;
98  fHistos->FillTH1("hJetPtRawR02", j->Pt());
99 
100  int jetptmin = static_cast<int>(j->Pt()/10.) * 10;
101  TLorentzVector jetvec(j->Px(), j->Py(), j->Pz(), j->E());
102  for(int i = 0; j->Nn(); i++){
103  AliVCluster *clust = j->ClusterAt(i, fClusters->GetArray());
104  if(clust->E() < 1.) continue;
105  TLorentzVector clustvec;
106  clust->GetMomentum(clustvec, fVertexSPD);
107  Double_t ptrel = clustvec.Perp(jetvec.Vect());
108  fHistos->FillTH1(Form("hR02Jet%d%dPtRel", jetptmin, jetptmin+10), ptrel);
109  }
110  }
111 
112  for(auto j : fR04jets->accepted()){
113  if(!IsTrackInEmcalAcceptance(j, 0.4)) continue; // select only jets fully contained inside EMCAL acceptance
114  if(TMath::Abs(j->Eta())) continue;
115  if(j->Pt() < 20) continue;
116  fHistos->FillTH1("hJetPtRawR02", j->Pt());
117 
118  int jetptmin = static_cast<int>(j->Pt()/10.) * 10;
119  TLorentzVector jetvec(j->Px(), j->Py(), j->Pz(), j->E());
120  for(int i = 0; j->Nn(); i++){
121  AliVCluster *clust = j->ClusterAt(i, fClusters->GetArray());
122  if(clust->E() < 1.) continue;
123  TLorentzVector clustvec;
124  clust->GetMomentum(clustvec, fVertexSPD);
125  Double_t ptrel = clustvec.Perp(jetvec.Vect());
126  fHistos->FillTH1(Form("hR04Jet%d%dPtRel", jetptmin, jetptmin+10), ptrel);
127  }
128  }
129 }
TString fNameR04jets
Name of the jet container for R=0.4 jets.
double Double_t
Definition: External.C:58
TString fTriggerString
Trigger string (distinguish EGA triggers)
AliJetContainer * GetJetContainer(Int_t i=0) const
Double_t fVertexSPD[3]
!event Svertex
AliJetContainer * fR02jets
! Link to jet container for R=0.2 jets
AliClusterContainer * fClusters
! Link to cluster container;
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
TString fNameClusters
Name of the cluster container.
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
TString fNameR02jets
Name of the jet container for R=0.2 jets.
THistManager * fHistos
! Histogram handler
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
AliClusterContainer * GetClusterContainer(Int_t i=0) const
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
AliJetContainer * fR04jets
! Link to jet container for R=0.4 jets
AliEmcalList * fOutput
!output list
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Base task in the EMCAL jet framework.
Container class for histograms.
Definition: THistManager.h:43
const AliJetIterableContainer accepted() const