2 // General task to match two sets of jets
4 // This task takes two TClonesArray's as input:
5 // [1] fSourceJets - e.g. pythia jets
6 // [2] fTargetJets - e.g. a samle containing pythia jets embedded in a pbpb event
7 // the task will try to match jets from the source array to the target array, and
8 // save the found TARGET jets in a new array 'fMatchedJets'
10 // matching is done in three steps
11 // [1] geometric matching, where jets are matched by R = sqrt(dphi*dphi-deta*deta) or directly via dphi and deta
12 // [2] optional injection / bijection check
13 // in this check, it is made sure that fSourceJets -> fMatchedJets is either an injective non-surjective
14 // or bijective map, depending on the matching resolution which is chosen for step [1]
15 // so that each source jet has a unique target and vice-versa.
16 // if R (or dphi, deta) are proportional to, or larger than, the jet radius, matching tends to be
17 // bijective (each source has a target), if R is chosen to be very small, source jets might be lost
18 // as no target can be found.
19 // the mapping is done in such a way that each target is matched to its closest source and each source
20 // is mapped to its closest target
21 // [3] constituent matching
22 // - how many constituents of the source jet are present in the matched jet?
23 // a cut on the constituent fraction can be performed (not recommended)
24 // - how much of the original pt is recovered in the matched jet?
25 // a cut on the fraction of recovered / original pt can be performed (recommended)
27 // Author: Redmer Alexander Bertens, Utrecht Univeristy, Utrecht, Netherlands
28 // rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl
31 #include <TClonesArray.h>
40 #include <AliAnalysisTask.h>
41 #include <AliAnalysisManager.h>
43 #include <AliVEvent.h>
44 #include <AliVParticle.h>
45 // emcal jet framework includes
46 #include <AliEmcalJet.h>
47 #include <AliAnalysisTaskJetMatching.h>
48 #include <AliLocalRhoParameter.h>
50 class AliAnalysisTaskJetMatching;
53 ClassImp(AliAnalysisTaskJetMatching)
55 AliAnalysisTaskJetMatching::AliAnalysisTaskJetMatching() : AliAnalysisTaskEmcalJetDev("AliAnalysisTaskJetMatching", kTRUE),
56 fDebug(0), fSourceJets(0), fSourceJetsName(0), fTargetJets(0), fTargetJetsName(0), fMatchedJets(0), fMatchedJetsName(GetName()), fSourceRho(0), fSourceRhoName(0), fTargetRho(0), fTargetRhoName(0), fUseScaledRho(0), fSourceRadius(0.3), fTargetRadius(0.3), fMatchingScheme(kGeoEtaPhi), fUseEmcalBaseJetCuts(kFALSE), fSourceBKG(kNoSourceBKG), fTargetBKG(kNoTargetBKG), fOutputList(0), fHistUnsortedCorrelation(0), fHistMatchedCorrelation(0), fHistSourceJetPt(0), fHistTargetJetPt(0), fHistMatchedJetPt(0), fHistNoConstSourceJet(0), fHistNoConstTargetJet(0), fHistNoConstMatchJet(0), fProfFracPtMatched(0), fProfFracPtJets(0), fProfFracNoMatched(0), fProfFracNoJets(0), fHistAnalysisSummary(0), fProfQAMatched(0), fProfQA(0), fNoMatchedJets(100), fMatchEta(.3), fMatchPhi(.3), fMatchR(.08), fMatchConstituents(kTRUE), fMinFracRecoveredConstituents(.5), fMinFracRecoveredConstituentPt(0.5), fGetBijection(kTRUE) {
57 // default constructor
58 ClearMatchedJetsCache();
60 //_____________________________________________________________________________
61 AliAnalysisTaskJetMatching::AliAnalysisTaskJetMatching(const char* name) : AliAnalysisTaskEmcalJetDev(name, kTRUE),
62 fDebug(0), fSourceJets(0), fSourceJetsName(0), fTargetJets(0), fTargetJetsName(0), fMatchedJets(0), fMatchedJetsName(GetName()), fSourceRho(0), fSourceRhoName(0), fTargetRho(0), fTargetRhoName(0), fUseScaledRho(0), fSourceRadius(0.3), fTargetRadius(0.3), fMatchingScheme(kGeoEtaPhi), fUseEmcalBaseJetCuts(kFALSE), fSourceBKG(kNoSourceBKG), fTargetBKG(kNoTargetBKG), fOutputList(0), fHistUnsortedCorrelation(0), fHistMatchedCorrelation(0), fHistSourceJetPt(0), fHistTargetJetPt(0), fHistMatchedJetPt(0), fHistNoConstSourceJet(0), fHistNoConstTargetJet(0), fHistNoConstMatchJet(0), fProfFracPtMatched(0), fProfFracPtJets(0), fProfFracNoMatched(0), fProfFracNoJets(0), fHistAnalysisSummary(0), fProfQAMatched(0), fProfQA(0), fNoMatchedJets(100), fMatchEta(.3), fMatchPhi(.3), fMatchR(.08), fMatchConstituents(kTRUE), fMinFracRecoveredConstituents(0.5), fMinFracRecoveredConstituentPt(0.5), fGetBijection(kTRUE) {
64 ClearMatchedJetsCache();
65 DefineInput(0, TChain::Class());
66 DefineOutput(1, TList::Class());
68 //_____________________________________________________________________________
69 AliAnalysisTaskJetMatching::~AliAnalysisTaskJetMatching()
72 if(fOutputList) delete fOutputList;
74 //_____________________________________________________________________________
75 void AliAnalysisTaskJetMatching::ExecOnce()
77 // initialize the anaysis
78 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
79 // get the stand alone jets from the input event
80 fSourceJets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fSourceJetsName.Data()));
81 if(!fSourceJets) AliFatal(Form("%s: Container with name %s not found. Aborting", GetName(), fSourceJetsName.Data()));
82 fTargetJets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTargetJetsName.Data()));
83 if(!fTargetJets) AliFatal(Form("%s: Container with name %s not found. Aborting", GetName(), fSourceJetsName.Data()));
84 // append the list of matched jets to the event
85 fMatchedJets->Delete();
86 if (!(InputEvent()->FindListObject(fMatchedJetsName))) InputEvent()->AddObject(fMatchedJets);
87 else AliFatal(Form("%s: Object with name %s already in event! Aborting", GetName(), fMatchedJetsName.Data()));
88 FillAnalysisSummaryHistogram();
90 case kSourceLocalRho : {
91 fSourceRho = dynamic_cast<AliLocalRhoParameter*>(InputEvent()->FindListObject(fSourceRhoName));
92 if(!fSourceRho) AliFatal(Form("%s: Object with name %s requested but not found! Aborting", GetName(), fSourceRhoName.Data()));
97 case kTargetLocalRho : {
98 fTargetRho = dynamic_cast<AliLocalRhoParameter*>(InputEvent()->FindListObject(fTargetRhoName));
99 if(!fTargetRho) AliFatal(Form("%s: Object with name %s requested but not found! Aborting", GetName(), fTargetRhoName.Data()));
103 AliAnalysisTaskEmcalJetDev::ExecOnce(); // init base class
105 //_____________________________________________________________________________
106 void AliAnalysisTaskJetMatching::UserCreateOutputObjects()
108 // create output objects
109 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
110 // add the matched jets array to the event
111 fMatchedJets = new TClonesArray("AliEmcalJet");
112 fMatchedJets->SetName(fMatchedJetsName);
113 fOutputList = new TList();
114 fOutputList->SetOwner(kTRUE);
115 // add analysis histograms
116 fHistUnsortedCorrelation = BookTH1F("fHistUnsortedCorrelation", "#Delta #varphi unsorted", 50, 0, TMath::Pi());
117 fHistMatchedCorrelation = BookTH1F("fHistMatchedCorrelation", "#Delta #varphi matched", 50, 0, TMath::Pi());
118 fHistSourceJetPt = BookTH1F("fHistSourceJetPt", "p_{t} [GeV/c]", 50, 0, 150);
119 fHistTargetJetPt = BookTH1F("fHistTargetJetPt", "p_{t} [GeV/c]", 50, 0, 150);
120 fHistMatchedJetPt = BookTH1F("fHistMatchedJetPt", "p_{t} [GeV/c]", 50, 0, 150);
121 fHistNoConstSourceJet = BookTH1F("fHistNoConstSourceJet", "number of constituents", 50, 0, 50);
122 fHistNoConstTargetJet = BookTH1F("fHistNoConstTargetJet", "number of constituents", 50, 0, 50);
123 fHistNoConstMatchJet = BookTH1F("fHistNoConstMatchJet", "number of constituents", 50, 0, 50);
124 // the analysis summary histo which stores all the analysis flags is always written to file
125 fHistAnalysisSummary = BookTH1F("fHistAnalysisSummary", "flag", 51, -0.5, 15.5);
126 fProfQAMatched = new TProfile("fProfQAMatched", "fProfQAMatched", 3, 0, 3);
127 fProfQAMatched->GetXaxis()->SetBinLabel(1, "<#delta p_{t} >");
128 fProfQAMatched->GetXaxis()->SetBinLabel(2, "<#delta #eta>");
129 fProfQAMatched->GetXaxis()->SetBinLabel(3, "<#delta #varphi>");
130 fOutputList->Add(fProfQAMatched);
131 fProfQA = new TProfile("fProfQA", "fProfQA", 3, 0, 3);
132 fProfQA->GetXaxis()->SetBinLabel(1, "<#delta p_{t} >");
133 fProfQA->GetXaxis()->SetBinLabel(2, "<#delta #eta>");
134 fProfQA->GetXaxis()->SetBinLabel(3, "<#delta #varphi>");
135 fOutputList->Add(fProfQA);
136 fProfFracPtMatched = new TProfile("fProfFracPtMatched", "fProfFracPtMatched", 10, 0, 200);
137 fOutputList->Add(fProfFracPtMatched);
138 fProfFracPtJets = new TProfile("fProfFracPtJets", "fProfFracPtJets", 10, 0, 200);
139 fOutputList->Add(fProfFracPtJets);
140 fProfFracNoMatched = new TProfile("fProfFracNoMatched", "fProfFracNoMatched", 10, 0, 200);
141 fOutputList->Add(fProfFracNoMatched);
142 fProfFracNoJets = new TProfile("fProfFracNoJets", "fProfFracNoJets", 10, 0, 200);
143 fOutputList->Add(fProfFracNoJets);
145 PostData(1, fOutputList);
147 //_____________________________________________________________________________
148 TH1F* AliAnalysisTaskJetMatching::BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Bool_t append)
150 // book a TH1F and connect it to the output container
151 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
152 if(!fOutputList) return 0x0;
154 title += Form(";%s;[counts]", x);
155 TH1F* histogram = new TH1F(name, title.Data(), bins, min, max);
157 if(append) fOutputList->Add(histogram);
160 //_____________________________________________________________________________
161 TH2F* AliAnalysisTaskJetMatching::BookTH2F(const char* name, const char* x, const char*y, Int_t binsx, Double_t minx, Double_t maxx, Int_t binsy, Double_t miny, Double_t maxy, Bool_t append)
163 // book a TH2F and connect it to the output container
164 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
165 if(!fOutputList) return 0x0;
167 title += Form(";%s;%s", x, y);
168 TH2F* histogram = new TH2F(name, title.Data(), binsx, minx, maxx, binsy, miny, maxy);
170 if(append) fOutputList->Add(histogram);
173 //_____________________________________________________________________________
174 Bool_t AliAnalysisTaskJetMatching::Run()
176 // execute once for each event
177 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
178 if(!(InputEvent() && fSourceJetsName && fTargetJets && IsEventSelected())) return kFALSE;
179 // step one: do geometric matching
180 switch (fMatchingScheme) {
182 DoGeometricMatchingEtaPhi();
185 DoGeometricMatchingR();
189 // break if no jet was matched
190 if(!fMatchedJetContainer[1][0]) return kTRUE;
191 // optional step two: get a bijection (avoid duplicate matches)
192 if(fGetBijection) GetBijection();
193 // optional step three: match constituents within matched jets
194 if(fMatchConstituents) DoConstituentMatching();
195 // stream data to output
197 FillMatchedJetHistograms();
198 if(fDebug > 0) PrintInfo();
199 PostData(1, fOutputList);
202 //_____________________________________________________________________________
203 void AliAnalysisTaskJetMatching::DoGeometricMatchingEtaPhi()
205 // do geometric matching based on eta phi distance between jet centers
206 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
207 fNoMatchedJets = 0; // reset the matched jet counter
208 Int_t iSource(fSourceJets->GetEntriesFast()), iTarget(fTargetJets->GetEntriesFast());
209 for(Int_t i(0); i < iSource; i++) {
210 AliEmcalJet* sourceJet(static_cast<AliEmcalJet*>(fSourceJets->At(i)));
211 if(!PassesCuts(sourceJet)) continue;
212 if(fUseEmcalBaseJetCuts && !AcceptJet(sourceJet, 0)) continue;
213 for(Int_t j(0); j < iTarget; j++) {
214 AliEmcalJet* targetJet(static_cast<AliEmcalJet*>(fTargetJets->At(j)));
215 if(!PassesCuts(targetJet)) continue;
216 if (fUseEmcalBaseJetCuts && !AcceptJet(targetJet, 1)) continue;
217 if((TMath::Abs(sourceJet->Eta() - targetJet->Eta()) < fMatchEta )) {
218 Double_t sourcePhi(sourceJet->Phi()), targetPhi(targetJet->Phi());
219 if(TMath::Abs(sourcePhi-targetPhi) > TMath::Abs(sourcePhi-targetPhi+TMath::TwoPi())) sourcePhi+=TMath::TwoPi();
220 if(TMath::Abs(sourcePhi-targetPhi) > TMath::Abs(sourcePhi-targetPhi-TMath::TwoPi())) sourcePhi-=TMath::TwoPi();
221 if(TMath::Abs(sourcePhi-targetPhi) < fMatchPhi) { // accept the jets as matching
222 Bool_t isBestMatch(kTRUE);
223 if(fGetBijection) { // match has been found, for bijection only store it if there's no better match
224 if(fDebug > 0) printf(" > Entering first bbijection test \n");
225 for(Int_t k(i); k < iSource; k++) {
226 AliEmcalJet* candidateSourceJet(static_cast<AliEmcalJet*>(fSourceJets->At(k)));
227 if(!PassesCuts(candidateSourceJet)) continue;
228 if(fUseEmcalBaseJetCuts && !AcceptJet(candidateSourceJet, 0)) continue;
229 if(fDebug > 0) printf("source distance %.2f \t candidate distance %.2f \n", GetR(sourceJet, targetJet),GetR(candidateSourceJet, targetJet));
230 if(GetR(sourceJet, targetJet) > GetR(candidateSourceJet, targetJet)) {
231 isBestMatch = kFALSE;
235 if(fDebug > 0) (isBestMatch) ? printf(" kept source \n ") : printf(" we can do better (rejected source) \n");
238 fMatchedJetContainer[fNoMatchedJets][0] = sourceJet;
239 fMatchedJetContainer[fNoMatchedJets][1] = targetJet;
242 if(fNoMatchedJets > 99) { // maximum to keep the cache at reasonable size
243 AliError(Form("%s: Found too many matched jets (> 100). Adjust matching criteria !", GetName()));
251 //_____________________________________________________________________________
252 void AliAnalysisTaskJetMatching::DoGeometricMatchingR()
254 // do geometric matching based on shortest path between jet centers
255 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
256 fNoMatchedJets = 0; // reset the matched jet counter
257 Int_t iSource(fSourceJets->GetEntriesFast()), iTarget(fTargetJets->GetEntriesFast());
258 for(Int_t i(0); i < iSource; i++) {
259 AliEmcalJet* sourceJet(static_cast<AliEmcalJet*>(fSourceJets->At(i)));
260 if(!PassesCuts(sourceJet)) continue;
261 else if (fUseEmcalBaseJetCuts && !AcceptJet(sourceJet, 0)) continue;
262 for(Int_t j(0); j < iTarget; j++) {
263 AliEmcalJet* targetJet(static_cast<AliEmcalJet*>(fTargetJets->At(j)));
264 if(!PassesCuts(targetJet)) continue;
265 else if (fUseEmcalBaseJetCuts && !AcceptJet(targetJet, 1)) continue;
266 if(GetR(sourceJet, targetJet) <= fMatchR) {
267 Bool_t isBestMatch(kTRUE);
268 if(fGetBijection) { // match has been found, for bijection only store it if there's no better match
269 if(fDebug > 0) printf(" > Entering first bijection test \n");
270 for(Int_t k(i); k < iSource; k++) {
271 AliEmcalJet* candidateSourceJet(static_cast<AliEmcalJet*>(fSourceJets->At(k)));
272 if(!PassesCuts(candidateSourceJet)) continue;
273 if(fUseEmcalBaseJetCuts && !AcceptJet(candidateSourceJet, 0)) continue;
274 if(fDebug > 0) printf("source distance %.2f \t candidate distance %.2f \n", GetR(sourceJet, targetJet),GetR(candidateSourceJet, targetJet));
275 if(GetR(sourceJet, targetJet) > GetR(candidateSourceJet, targetJet)) {
276 isBestMatch = kFALSE;
280 if(fDebug > 0) (isBestMatch) ? printf(" kept source \n ") : printf(" we can do better (rejected source) \n");
283 fMatchedJetContainer[fNoMatchedJets][0] = sourceJet;
284 fMatchedJetContainer[fNoMatchedJets][1] = targetJet;
287 if(fNoMatchedJets > 99) {
288 AliError(Form("%s: Found too many matched jets (> 100). Adjust matching criteria !", GetName()));
295 //_____________________________________________________________________________
296 void AliAnalysisTaskJetMatching::DoConstituentMatching()
298 // match constituents within matched jets
299 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
301 AliFatal(Form("%s Fatal error! To do deep matching, supply jet constituents ! \n", GetName()));
302 return; // coverity ...
304 for(Int_t i(0); i < fNoMatchedJets; i++) {
305 AliEmcalJet* sourceJet = fMatchedJetContainer[i][0];
306 AliEmcalJet* targetJet = fMatchedJetContainer[i][1];
307 if(sourceJet && targetJet) { // duplicate check: slot migth be NULL
308 Double_t targetPt(0);
309 Int_t iSJ(sourceJet->GetNumberOfTracks());
310 Int_t iTJ(targetJet->GetNumberOfTracks());
311 Int_t overlap(0), alreadyFound(0);
312 for(Int_t j(0); j < iSJ; j++) {
314 Int_t idSource((Int_t)sourceJet->TrackAt(j));
315 for(Int_t k(0); k < iTJ; k++) { // compare all target tracks to the source track
316 if(idSource == targetJet->TrackAt(k) && alreadyFound == 0) {
318 alreadyFound++; // avoid possible duplicate matching
319 AliVParticle* vp(static_cast<AliVParticle*>(targetJet->TrackAt(k, fTracks)));
320 if(vp) targetPt += vp->Pt();
325 if((float)overlap/(float)iSJ < fMinFracRecoveredConstituents || targetPt/sourceJet->Pt() < fMinFracRecoveredConstituentPt) {
326 if(fDebug > 0) printf(" \n > Purging jet, recovered constituents ratio %i / %i = %.2f < or pt ratio %.2f / %.2f = %.2f < %.2f",
327 overlap, iSJ, (float)overlap/(float)iSJ, targetPt, sourceJet->Pt(), targetPt/sourceJet->Pt(), fMinFracRecoveredConstituentPt);
328 fMatchedJetContainer[i][0] = 0x0;
329 fMatchedJetContainer[i][1] = 0x0;
332 if(sourceJet->Pt() > 0) {
333 Double_t sourceRho(0), targetRho(0);
334 if(fSourceRho) sourceRho = fSourceRho->GetLocalVal(sourceJet->Phi(), fSourceRadius)*sourceJet->Area();
335 if(fTargetRho) targetRho = fTargetRho->GetLocalVal(targetJet->Phi(), fTargetRadius)*targetJet->Area();
336 fProfFracPtMatched->Fill(sourceJet->Pt()-sourceRho, (targetPt-targetRho) / (sourceJet->Pt()-sourceRho));
337 fProfFracPtJets->Fill(sourceJet->Pt()-sourceRho, (targetJet->Pt()-targetRho) / (sourceJet->Pt()-sourceRho));
338 fProfFracNoMatched->Fill(sourceJet->Pt()-sourceRho, (double)overlap / (double)sourceJet->GetNumberOfTracks());
339 fProfFracNoJets->Fill(sourceJet->Pt()-sourceRho, (double)targetJet->GetNumberOfTracks() / (double)sourceJet->GetNumberOfTracks());
342 printf("\n > Jet A: %i const\t", iSJ);
343 printf(" > Jet B %i const\t", iTJ);
344 printf(" -> OVERLAP: %i tracks <- \n", overlap);
349 //_____________________________________________________________________________
350 void AliAnalysisTaskJetMatching::GetBijection()
352 // bijection of source and matched jets, based on closest distance between jets
353 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
354 for(Int_t i(0); i < fNoMatchedJets; i++) {
355 for(Int_t j(i+1); j < fNoMatchedJets; j++) {
356 if(fMatchedJetContainer[i][0] == fMatchedJetContainer[j][0]) {
357 // found source with two targets, now see which target is closer to the source
358 if(!(fMatchedJetContainer[i][0] && fMatchedJetContainer[i][1] && fMatchedJetContainer[j][0] && fMatchedJetContainer[j][1] )) continue;
359 Double_t rA(GetR(fMatchedJetContainer[i][0], fMatchedJetContainer[i][1])); // distance between connection A = i
360 Double_t rB(GetR(fMatchedJetContainer[j][0], fMatchedJetContainer[j][1])); // distance between connection B = j
361 if (rB > rA) { // jet two is far away, clear it from both target and source list
362 fMatchedJetContainer[j][0] = 0x0;
363 fMatchedJetContainer[j][1] = 0x0;
364 } else { // jet one is far away, clear it from both target and source list
365 fMatchedJetContainer[i][0] = fMatchedJetContainer[j][0]; // switch to avoid breaking loop
366 fMatchedJetContainer[i][1] = fMatchedJetContainer[j][1];
367 fMatchedJetContainer[j][0] = 0x0; // clear duplicate jet from cache
368 fMatchedJetContainer[j][1] = 0x0;
370 if(fDebug > 0) printf(" found duplicate jet, chose %.2f over %.2f \n" , (rB > rA) ? rA : rB, (rB > rA) ? rB : rA);
375 //_____________________________________________________________________________
376 void AliAnalysisTaskJetMatching::PostMatchedJets()
379 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
380 for(Int_t i(0), p(0); i < fNoMatchedJets; i++) {
381 if(fMatchedJetContainer[i][1]) { // duplicate jets will have NULL value here and are skipped
382 new((*fMatchedJets)[p]) AliEmcalJet(*fMatchedJetContainer[i][1]);
387 //_____________________________________________________________________________
388 void AliAnalysisTaskJetMatching::FillAnalysisSummaryHistogram() const
390 // fill the analysis summary histrogram, saves all relevant analysis settigns
391 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
392 fHistAnalysisSummary->GetXaxis()->SetBinLabel(1, "fUseScaledRho");
393 fHistAnalysisSummary->SetBinContent(1, (int)fUseScaledRho);
394 fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fMatchingScheme");
395 fHistAnalysisSummary->SetBinContent(2, (int)fMatchingScheme);
396 fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fSourceBKG");
397 fHistAnalysisSummary->SetBinContent(3, (int)fSourceBKG);
398 fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "fTargetBKG");
399 fHistAnalysisSummary->SetBinContent(4, (int)fTargetBKG);
400 fHistAnalysisSummary->GetXaxis()->SetBinLabel(5, "fMatchEta");
401 fHistAnalysisSummary->SetBinContent(5, fMatchEta);
402 fHistAnalysisSummary->GetXaxis()->SetBinLabel(6, "fMatchPhi");
403 fHistAnalysisSummary->SetBinContent(6, fMatchPhi);
404 fHistAnalysisSummary->GetXaxis()->SetBinLabel(7, "fMatchR");
405 fHistAnalysisSummary->SetBinContent(7, fMatchR);
406 fHistAnalysisSummary->GetXaxis()->SetBinLabel(8, "iter");
407 fHistAnalysisSummary->SetBinContent(8, 1.);
409 //_____________________________________________________________________________
410 void AliAnalysisTaskJetMatching::FillMatchedJetHistograms() const
412 // fill matched jet histograms
413 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
414 for(Int_t i(0); i < fSourceJets->GetEntriesFast(); i++) {
415 AliEmcalJet* source = static_cast<AliEmcalJet*>(fSourceJets->At(i));
416 if(!source) continue;
417 Double_t sourceRho(0), targetRho(0);
418 if(fSourceRho) sourceRho = fSourceRho->GetLocalVal(source->Phi(), fSourceRadius)*source->Area();
419 fHistSourceJetPt->Fill(source->Pt()-sourceRho);
420 fHistNoConstSourceJet->Fill(source->GetNumberOfConstituents());
421 for(Int_t j(0); j < fTargetJets->GetEntriesFast(); j++) {
422 AliEmcalJet* target = static_cast<AliEmcalJet*>(fTargetJets->At(j));
424 if(fTargetRho) targetRho = fTargetRho->GetLocalVal(target->Phi(), fTargetRadius)*target->Area();
425 fProfQA->Fill(0.5, TMath::Abs((source->Pt()-sourceRho)-(target->Pt()-targetRho)));
426 fProfQA->Fill(1.5, TMath::Abs(source->Eta()-target->Eta()));
427 fProfQA->Fill(2.5, TMath::Abs(source->Phi()-target->Phi()));
428 fHistUnsortedCorrelation->Fill(PhaseShift(source->Phi()-target->Phi(), 2));
430 fHistTargetJetPt->Fill(target->Pt()-targetRho);
431 fHistNoConstTargetJet->Fill(target->GetNumberOfConstituents());
436 for(Int_t i(0); i < fNoMatchedJets; i++) {
437 if(fMatchedJetContainer[i][0] && fMatchedJetContainer[i][1]) {
438 Double_t sourceRho(0), targetRho(0);
439 if(fSourceRho) sourceRho = fSourceRho->GetLocalVal(fMatchedJetContainer[i][0]->Phi(), fSourceRadius)*fMatchedJetContainer[i][0]->Area();
440 if(fTargetRho) targetRho = fTargetRho->GetLocalVal(fMatchedJetContainer[i][1]->Phi(), fTargetRadius)*fMatchedJetContainer[i][1]->Area();
441 fHistMatchedCorrelation->Fill(PhaseShift(fMatchedJetContainer[i][0]->Phi()-fMatchedJetContainer[i][1]->Phi(), 2));
442 fHistMatchedJetPt->Fill(fMatchedJetContainer[i][1]->Pt()-targetRho);
443 fHistNoConstMatchJet->Fill(fMatchedJetContainer[i][1]->Pt()-targetRho);
444 fProfQAMatched->Fill(0.5, TMath::Abs((fMatchedJetContainer[i][0]->Pt()-sourceRho)-(fMatchedJetContainer[i][1]->Pt()-targetRho)));
445 fProfQAMatched->Fill(1.5, TMath::Abs(fMatchedJetContainer[i][0]->Eta()-fMatchedJetContainer[i][1]->Eta()));
446 fProfQAMatched->Fill(2.5, TMath::Abs(fMatchedJetContainer[i][0]->Phi()-fMatchedJetContainer[i][1]->Phi()));
450 //_____________________________________________________________________________
451 void AliAnalysisTaskJetMatching::PrintInfo() const
454 printf("\n > No. of source jets from %s \n \t %i \n ", fSourceJetsName.Data(), fSourceJets->GetEntriesFast());
455 printf(" > No. of target jets from %s \n \t %i \n ", fTargetJetsName.Data(), fTargetJets->GetEntriesFast());
456 printf(" > No. of matched jets from %s \n \t %i \n ", fMatchedJetsName.Data(), fMatchedJets->GetEntriesFast());
457 if(fDebug > 3) InputEvent()->GetList()->ls();
459 //_____________________________________________________________________________
460 void AliAnalysisTaskJetMatching::Terminate(Option_t *)
464 //_____________________________________________________________________________