Skip to content

Commit 40a494d

Browse files
authored
[PWGJE] PWGJE Change scheme for outlier removal (#11577)
1 parent 04295d7 commit 40a494d

File tree

1 file changed

+67
-50
lines changed

1 file changed

+67
-50
lines changed

PWGJE/Tasks/recoilJets.cxx

Lines changed: 67 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,33 @@
1313
/// \file recoilJets.cxx
1414
/// \brief hadron-jet correlation analysis
1515

16-
#include <string>
17-
#include <tuple>
18-
#include <vector>
16+
#include "PWGJE/Core/FastJetUtilities.h"
17+
#include "PWGJE/Core/JetDerivedDataUtilities.h"
18+
#include "PWGJE/Core/JetFinder.h"
19+
#include "PWGJE/Core/JetFindingUtilities.h"
20+
#include "PWGJE/DataModel/Jet.h"
1921

20-
#include "TRandom3.h"
21-
#include "TVector2.h"
22+
#include "Common/Core/RecoDecay.h"
23+
#include "Common/Core/TrackSelection.h"
24+
#include "Common/Core/TrackSelectionDefaults.h"
25+
#include "Common/DataModel/EventSelection.h"
26+
#include "Common/DataModel/TrackSelectionTables.h"
27+
#include "EventFiltering/filterTables.h"
2228

29+
#include "CommonConstants/MathConstants.h"
2330
#include "Framework/ASoA.h"
2431
#include "Framework/AnalysisDataModel.h"
2532
#include "Framework/AnalysisTask.h"
26-
#include "Framework/O2DatabasePDGPlugin.h"
2733
#include "Framework/HistogramRegistry.h"
34+
#include "Framework/O2DatabasePDGPlugin.h"
2835
#include "Framework/runDataProcessing.h"
2936

30-
#include "CommonConstants/MathConstants.h"
31-
#include "Common/Core/TrackSelection.h"
32-
#include "Common/Core/TrackSelectionDefaults.h"
33-
#include "Common/Core/RecoDecay.h"
34-
#include "Common/DataModel/EventSelection.h"
35-
#include "Common/DataModel/TrackSelectionTables.h"
36-
37-
#include "PWGJE/Core/FastJetUtilities.h"
38-
#include "PWGJE/Core/JetFinder.h"
39-
#include "PWGJE/Core/JetFindingUtilities.h"
40-
#include "PWGJE/DataModel/Jet.h"
41-
42-
#include "PWGJE/Core/JetDerivedDataUtilities.h"
37+
#include "TRandom3.h"
38+
#include "TVector2.h"
4339

44-
#include "EventFiltering/filterTables.h"
40+
#include <string>
41+
#include <tuple>
42+
#include <vector>
4543

4644
using namespace o2;
4745
using namespace o2::framework;
@@ -82,7 +80,6 @@ struct RecoilJets {
8280
// List of configurable parameters for MC
8381
Configurable<float> pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"};
8482
Configurable<float> pTHatMax{"pTHatMax", 999.0, "Maximum fraction of hard scattering for jet acceptance in MC"};
85-
Configurable<float> pTHatMaxTrack{"pTHatMaxTrack", 999.0, "Maximum fraction of hard scattering for track acceptance in MC"};
8683

8784
// Parameters for recoil jet selection
8885
Configurable<float> ptTTrefMin{"ptTTrefMin", 5., "Minimum pT of reference TT"};
@@ -130,17 +127,29 @@ struct RecoilJets {
130127

131128
void init(InitContext const&)
132129
{
133-
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(evSel));
134-
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trkSel));
130+
std::string evSelToString = static_cast<std::string>(evSel);
131+
std::string trkSelToString = static_cast<std::string>(trkSel);
132+
133+
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(evSelToString);
134+
trackSelection = jetderiveddatautilities::initialiseTrackSelection(trkSelToString);
135135
triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks);
136136

137137
// List of raw and MC det. distributions
138138
if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) {
139+
spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{3, 0.0, 3.}});
140+
spectra.get<TH1>(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of events");
141+
spectra.get<TH1>(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of events after sel. %s", evSelToString.data()));
142+
spectra.get<TH1>(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(3, "# of events w. outlier");
143+
139144
spectra.add("vertexZ", "Z vertex of collisions", kTH1F, {{60, -12., 12.}});
140145
spectra.add("hHasAssocMcCollision", "Has det. level coll. associat. MC coll.", kTH1F, {{2, 0.0, 2.}});
141146
spectra.get<TH1>(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(1, "Yes");
142147
spectra.get<TH1>(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(2, "No");
143148

149+
spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", kTH1F, {{2, 0.0, 2.}});
150+
spectra.get<TH1>(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of tracks");
151+
spectra.get<TH1>(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of tracks after sel. %s", trkSelToString.data()));
152+
144153
spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle});
145154

146155
spectra.add("hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, {{40, 10., 50.}}); // needed to distinguish merged data from diff. wagons
@@ -228,28 +237,33 @@ struct RecoilJets {
228237

229238
// Fill histograms with raw or MC det. level data
230239
template <typename Collision, typename Jets, typename Tracks>
231-
void fillHistograms(Collision const& collision, Jets const& jets, Tracks const& tracks, bool bIsMC = false, float weight = 1.)
240+
void fillHistograms(Collision const& collision, Jets const& jets, Tracks const& tracks, float weight = 1.)
232241
{
233-
234242
bool bSigEv = false;
235243
std::vector<double> vPhiOfTT;
236244
double phiTT = 0.;
237245
int nTT = 0;
238-
float pTHat = 0.;
239-
if (bIsMC)
240-
pTHat = getPtHat(weight);
246+
float pTHat = getPtHat(weight);
241247

242248
auto dice = rand->Rndm();
243249
if (dice < fracSig)
244250
bSigEv = true;
245251

252+
// Remove whole event if jet passes the outlier removal condition
253+
for (const auto& jet : jets) {
254+
if (jet.pt() > pTHatMax * pTHat) {
255+
spectra.fill(HIST("hEventSelectionCount"), 2.5);
256+
return;
257+
}
258+
}
259+
246260
for (const auto& track : tracks) {
247-
if (skipTrack(track))
248-
continue;
261+
spectra.fill(HIST("hTrackSelectionCount"), 0.5);
249262

250-
if (bIsMC && (track.pt() > pTHatMaxTrack * pTHat))
263+
if (skipTrack(track))
251264
continue;
252265

266+
spectra.fill(HIST("hTrackSelectionCount"), 1.5);
253267
spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), weight);
254268

255269
// Search for TT candidate
@@ -279,10 +293,6 @@ struct RecoilJets {
279293
}
280294

281295
for (const auto& jet : jets) {
282-
283-
if (bIsMC && (jet.pt() > pTHatMax * pTHat))
284-
continue;
285-
286296
spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight);
287297

288298
if (nTT > 0) {
@@ -327,6 +337,11 @@ struct RecoilJets {
327337
if (dice < fracSig)
328338
bSigEv = true;
329339

340+
for (const auto& jet : jets) {
341+
if (jet.pt() > pTHatMax * pTHat)
342+
return;
343+
}
344+
330345
for (const auto& particle : particles) {
331346
auto pdgParticle = pdg->GetParticle(particle.pdgCode());
332347
if (!pdgParticle)
@@ -337,9 +352,6 @@ struct RecoilJets {
337352
if (bParticleNeutral || !particle.isPhysicalPrimary())
338353
continue;
339354

340-
if (particle.pt() > pTHatMaxTrack * pTHat)
341-
continue;
342-
343355
spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), particle.phi(), weight);
344356

345357
if (bSigEv && (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) {
@@ -367,10 +379,6 @@ struct RecoilJets {
367379
}
368380

369381
for (const auto& jet : jets) {
370-
371-
if (jet.pt() > pTHatMax * pTHat)
372-
continue;
373-
374382
spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight);
375383

376384
if (nTT > 0) {
@@ -410,13 +418,15 @@ struct RecoilJets {
410418
double phiTTSig = 0.;
411419
float pTHat = getPtHat(weight);
412420

421+
for (const auto& jetBase : jetsBase) {
422+
if (jetBase.pt() > pTHatMax * pTHat)
423+
return;
424+
}
425+
413426
for (const auto& track : tracks) {
414427
if (skipTrack(track))
415428
continue;
416429

417-
if (track.pt() > pTHatMaxTrack * pTHat)
418-
continue;
419-
420430
if (track.pt() > ptTTsigMin && track.pt() < ptTTsigMax) {
421431
vPhiOfTT.push_back(track.phi());
422432
}
@@ -428,9 +438,6 @@ struct RecoilJets {
428438
phiTTSig = getPhiTT(vPhiOfTT);
429439

430440
for (const auto& jetBase : jetsBase) {
431-
if (jetBase.pt() > pTHatMax * pTHat)
432-
continue;
433-
434441
bool bIsBaseJetRecoil = get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig;
435442
dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight);
436443
}
@@ -440,9 +447,13 @@ struct RecoilJets {
440447
FilteredTracks const& tracks,
441448
FilteredJets const& jets)
442449
{
450+
spectra.fill(HIST("hEventSelectionCount"), 0.5);
451+
443452
if (skipEvent(collision))
444453
return;
445454

455+
spectra.fill(HIST("hEventSelectionCount"), 1.5);
456+
446457
spectra.fill(HIST("vertexZ"), collision.posZ());
447458
fillHistograms(collision, jets, tracks);
448459
}
@@ -452,11 +463,14 @@ struct RecoilJets {
452463
FilteredTracks const& tracks,
453464
FilteredJetsDetLevel const& jets)
454465
{
466+
spectra.fill(HIST("hEventSelectionCount"), 0.5);
455467
if (skipEvent(collision) || skipMBGapEvent(collision))
456468
return;
457469

470+
spectra.fill(HIST("hEventSelectionCount"), 1.5);
471+
458472
spectra.fill(HIST("vertexZ"), collision.posZ());
459-
fillHistograms(collision, jets, tracks, true);
473+
fillHistograms(collision, jets, tracks);
460474
}
461475
PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", false);
462476

@@ -465,9 +479,12 @@ struct RecoilJets {
465479
FilteredTracks const& tracks,
466480
FilteredJetsDetLevel const& jets)
467481
{
482+
spectra.fill(HIST("hEventSelectionCount"), 0.5);
468483
if (skipEvent(collision) || skipMBGapEvent(collision))
469484
return;
470485

486+
spectra.fill(HIST("hEventSelectionCount"), 1.5);
487+
471488
auto weight = collision.mcCollision().weight();
472489
spectra.fill(HIST("vertexZ"), collision.posZ(), weight);
473490

@@ -477,7 +494,7 @@ struct RecoilJets {
477494
spectra.fill(HIST("hHasAssocMcCollision"), 1.5, weight);
478495
}
479496

480-
fillHistograms(collision, jets, tracks, true, weight);
497+
fillHistograms(collision, jets, tracks, weight);
481498
}
482499
PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, "process MC detector level with event weight", false);
483500

0 commit comments

Comments
 (0)