AliPhysics  31210d0 (31210d0)
AliAnalysisTaskJetUE.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2017, 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 
16 #include <TFile.h>
17 #include <TF1.h>
18 #include <TH1F.h>
19 #include <TH2F.h>
20 #include <TClonesArray.h>
21 #include <TGrid.h>
22 
23 #include <AliLog.h>
24 #include <AliVEventHandler.h>
25 #include <AliAnalysisManager.h>
26 
27 #include "AliRhoParameter.h"
28 #include "AliEmcalJet.h"
29 #include "AliParticleContainer.h"
30 #include "AliClusterContainer.h"
31 #include "AliJetContainer.h"
32 
33 #include "AliAnalysisTaskJetUE.h"
34 
36 ClassImp(AliAnalysisTaskJetUE);
38 
44  fBackToBackJetPtFraction(0.6),
45  fMaxMomentumThridJet(12),
46  fPtBinWidth(0.5),
47  fMaxPt(250),
48  fNtracks(0),
49  fNclusters(0),
50  fNjets(),
51  fTotJetArea(),
52  fLeadingParticle(0),
53  fLeadingCluster(0),
54  fLeadingJet(),
55  fSortedJets()
56 {
57 }
58 
66  AliAnalysisTaskEmcalJetLight(name, histo),
69  fPtBinWidth(0.5),
70  fMaxPt(250),
71  fNtracks(0),
72  fNclusters(0),
73  fNjets(),
74  fTotJetArea(),
76  fLeadingCluster(0),
77  fLeadingJet(),
78  fSortedJets()
79 {
81 }
82 
83 
88 {
89  fNtracks = 0;
90  fNclusters = 0;
91  fLeadingParticle = nullptr;
92  fLeadingCluster = nullptr;
93 
94  // Loop over all possible containers
95  for (auto partCont : fParticleCollArray) {
96  for (auto track : partCont.second->accepted()) {
97  if (!fLeadingParticle || track->Pt() > fLeadingParticle->Pt()) fLeadingParticle = track;
98  fNtracks++;
99  }
100  }
101 
102  // Loop over all possible containers
103  for (auto clusCont : fClusterCollArray) {
104  for (auto clus : clusCont.second->accepted()) {
105  if (!fLeadingCluster || clus->E() > fLeadingCluster->E()) fLeadingCluster = clus;
106  fNclusters++;
107  }
108  }
109 
110  SortJets();
111 }
112 
117 {
118  for (auto jetCont : fJetCollArray) {
119  fLeadingJet[jetCont.first] = nullptr;
120  fNjets[jetCont.first] = 0;
121  fTotJetArea[jetCont.first] = 0;
122  auto itSortedJets = fSortedJets.find(jetCont.first);
123  if (itSortedJets == fSortedJets.end()) {
124  auto res = fSortedJets.emplace(jetCont.first, std::list<AliEmcalJet*>());
125  if (res.second) {
126  itSortedJets = res.first;
127  }
128  else {
129  AliError(Form("Error while trying to insert in the map fSortedJets for jet collection %s", jetCont.first.c_str()));
130  continue;
131  }
132  }
133  else {
134  itSortedJets->second.clear();
135  }
136  for (auto jet1 : jetCont.second->accepted()) {
137  if (!jet1->IsGhost()) {
138  fNjets[jetCont.first]++;
139  fTotJetArea[jetCont.first] += jet1->Area();
140  }
141  std::list<AliEmcalJet*>::iterator itJet2 = itSortedJets->second.begin();
142  while (itJet2 != itSortedJets->second.end()) {
143  AliEmcalJet* jet2 = *itJet2;
144  if (jet1->Pt() > jet2->Pt()) break;
145  itJet2++;
146  }
147  itSortedJets->second.insert(itJet2, jet1);
148  }
149  if (!itSortedJets->second.empty()) fLeadingJet[jetCont.first] = *(itSortedJets->second.begin());
150  }
151 }
152 
162 Bool_t AliAnalysisTaskJetUE::IsB2BEvent(std::string jetCollName)
163 {
164  static Float_t minPhi = (5.0/6.0) * TMath::Pi();
165 
166  Bool_t b2bJet = kFALSE;
167  Bool_t thirdJetOverThreshold = kFALSE;
168 
169  auto itJet = fSortedJets[jetCollName].begin();
170  if (itJet == fSortedJets[jetCollName].end()) return kFALSE;
171  AliEmcalJet* leadingJet = *itJet;
172  Double_t minB2Bpt = leadingJet->Pt() * fBackToBackJetPtFraction;
173  itJet++;
174  while (itJet != fSortedJets[jetCollName].end()) {
175  auto jet = *itJet;
176  Double_t phidiff = TMath::Abs(AliEmcalContainer::RelativePhi(jet->Phi(), leadingJet->Phi()));
177  if (phidiff > minPhi) {
178  if (jet->Pt() > minB2Bpt) b2bJet = kTRUE;
179  }
180  else if (jet->Pt() > fMaxMomentumThridJet) {
181  thirdJetOverThreshold = kTRUE;
182  break;
183  }
184  if (jet->Pt() < fMaxMomentumThridJet && (b2bJet || jet->Pt() < minB2Bpt)) break;
185  itJet++;
186  }
187  return b2bJet && !thirdJetOverThreshold;
188 }
189 
197 {
198  for (Int_t i = 0; i < jet1->GetNumberOfTracks(); ++i) {
199  Int_t jet1Track = jet1->TrackAt(i);
200  for (Int_t j = 0; j < jet2->GetNumberOfTracks(); ++j) {
201  Int_t jet2Track = jet2->TrackAt(j);
202  if (jet1Track == jet2Track) return kTRUE;
203  }
204  }
205  return kFALSE;
206 }
std::map< std::string, Int_t > fNjets
!number of jets
Bool_t AreJetsOverlapping(AliEmcalJet *jet1, AliEmcalJet *jet2)
double Double_t
Definition: External.C:58
AliVCluster * fLeadingCluster
!leading cluster
Double_t Phi() const
Definition: AliEmcalJet.h:117
Int_t fNtracks
!number of tracks
Bool_t IsB2BEvent(std::string jetCollName="Signal")
Int_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:160
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:139
Double_t fBackToBackJetPtFraction
Minimum pt fraction of the back-to-back jet.
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Float_t fMaxPt
Histogram pt limit.
Base task in the EMCAL jet framework (lighter version of AliAnalysisTaskEmcalJet) ...
Double_t Pt() const
Definition: AliEmcalJet.h:109
Base class for a task that studies the UE.
Float_t fPtBinWidth
Histogram pt bin width.
Int_t fNclusters
!number of clusters
AliVParticle * fLeadingParticle
!leading particle
std::map< std::string, AliParticleContainer * > fParticleCollArray
particle/track collection array
virtual void CalculateEventProperties()
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Declaration of class AliAnalysisTaskJetUE.
std::map< std::string, AliEmcalJet * > fLeadingJet
!leading jet
Double_t fMaxMomentumThridJet
Maximum pt of any additional jet in the event (other than the back-to-back fraction.
std::map< std::string, AliJetContainer * > fJetCollArray
jet collection array
bool Bool_t
Definition: External.C:53
std::map< std::string, AliClusterContainer * > fClusterCollArray
cluster collection array
std::map< std::string, Double_t > fTotJetArea
!total area covered by jets
std::map< std::string, std::list< AliEmcalJet * > > fSortedJets
!jets sorted by momentum