Skip to content

Commit 4317780

Browse files
committed
[PWGJE]: smearing of TT candidate due to detector effects
1 parent ca2f2d0 commit 4317780

File tree

1 file changed

+213
-6
lines changed

1 file changed

+213
-6
lines changed

PWGJE/Tasks/recoilJets.cxx

Lines changed: 213 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ using namespace o2::framework::expressions;
5757
using CollDataIt = soa::Filtered<aod::JetCollisions>::iterator;
5858
using CollRhoDataIt = soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator;
5959
using CollRhoOutlierDetIt = soa::Filtered<soa::Join<aod::JetCollisionsMCD, aod::BkgChargedRhos, aod::JCollisionOutliers>>::iterator;
60+
using CollOutlierDetIt = soa::Filtered<soa::Join<aod::JetCollisionsMCD, aod::JCollisionOutliers>>::iterator;
61+
using CollDetIt = soa::Filtered<aod::JetCollisionsMCD>::iterator;
6062
using CollRhoDetIt = soa::Filtered<soa::Join<aod::JetCollisionsMCD, aod::BkgChargedRhos>>::iterator;
6163

6264
using CollPartIt = soa::Filtered<aod::JetMcCollisions>::iterator;
@@ -72,6 +74,7 @@ using EvMultOutlierPartIt = soa::Filtered<soa::Join<aod::JetMcCollisions, aod::J
7274

7375
// --- Tracks / Particles
7476
using TrackTbl = soa::Filtered<aod::JetTracks>;
77+
using TrackMCLbsTbl = soa::Filtered<aod::JetTracksMCD>;
7578
using PartTbl = soa::Filtered<aod::JetParticles>;
7679

7780
// --- Jets (with constituents)
@@ -98,10 +101,11 @@ struct RecoilJets {
98101
triggerMasks{"triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"};
99102

100103
Configurable<float> vertexZCut{"vertexZCut", 10., "Accepted z-vertex range"};
101-
Configurable<bool> skipMBGapEvents{"skipMBGapEvents", false,
102-
"Flag to choose to reject min. bias gap events; jet-level rejection "
103-
"applied at the jet finder level, here rejection is applied for "
104-
"collision and track process functions"};
104+
Configurable<bool> isMCJJProd{"isMCJJProd", false, "Flag to select MC production: MB (false) or JJ(true)"},
105+
skipMBGapEvents{"skipMBGapEvents", false,
106+
"Flag to choose to reject min. bias gap events; jet-level rejection "
107+
"applied at the jet finder level, here rejection is applied for "
108+
"collision and track process functions"};
105109
} ev;
106110

107111
// ---------- RCT / flag-based selections ----------
@@ -882,8 +886,56 @@ struct RecoilJets {
882886
kTH2F, {{eaAxis.axis}, {400, -40., 60., "#delta#it{p}_{T} (GeV/#it{c})"}}, hist.sumw2);
883887
}
884888
}
885-
spectra.add("hResponseLoopDet", "", kTH2F, {{100, 0., 100., "det. level"}, {100, 0., 100., "part. level"}});
886-
spectra.add("hResponseLoopPart", "", kTH2F, {{100, 0., 100., "det. level"}, {100, 0., 100., "part. level"}});
889+
890+
if (doprocessTTSmearingPtPhi || doprocessTTSmearingPtPhiWeighted) {
891+
AxisSpec relPtSmearTT{120, -5., 1., "(#it{p}_{T, part} - #it{p}_{T, det}) / #it{p}_{T, part}"};
892+
AxisSpec smearPhi{80, -0.2, 0.2, "#it{#varphi}_{part} - #it{#varphi}_{det}"};
893+
AxisSpec smearEta{80, -0.2, 0.2, "#it{#eta}_{part} - #it{#eta}_{det}"};
894+
895+
int nBinsPtTTSig = static_cast<int>(tt.sigPtRange->at(1) - tt.sigPtRange->at(0)) * 5;
896+
int nBinsPtTTRef = static_cast<int>(tt.refPtRange->at(1) - tt.refPtRange->at(0)) * 5;
897+
AxisSpec partPtTTSig{nBinsPtTTSig, tt.sigPtRange->at(0), tt.sigPtRange->at(1), "#it{p}_{T, part}^{TT_{Sig}}"};
898+
AxisSpec partPtTTRef{nBinsPtTTRef, tt.refPtRange->at(0), tt.refPtRange->at(1), "#it{p}_{T, part}^{TT_{Ref}}"};
899+
900+
//====================================================================================
901+
// Signal TT
902+
for (const auto& eaAxis : arrAxisSpecScaledEA) {
903+
spectra.add(Form("hScaleMult%s_PtSmearingTTSig", eaAxis.label),
904+
Form("#it{p}_{T} smearing of TT_{Sig} vs %s", eaAxis.label),
905+
kTH3F, {{eaAxis.axis}, {relPtSmearTT}, {partPtTTSig}}, hist.sumw2);
906+
907+
spectra.add(Form("hScaleMult%s_PhiSmearingTTSig", eaAxis.label),
908+
Form("#it{#varphi} smearing of TT_{Sig} vs %s", eaAxis.label),
909+
kTH3F, {{eaAxis.axis}, {smearPhi}, {partPtTTSig}}, hist.sumw2);
910+
911+
spectra.add(Form("hScaleMult%s_EtaSmearingTTSig", eaAxis.label),
912+
Form("#it{#eta} smearing of TT_{Sig} vs %s", eaAxis.label),
913+
kTH3F, {{eaAxis.axis}, {smearEta}, {partPtTTSig}}, hist.sumw2);
914+
915+
auto tmpHistPointer = spectra.add<TH3>(Form("hScaled%s_FractionOfPartTTSigSatisfCond", eaAxis.label),
916+
"Check associat. part. level also satisf. TT_{Sig} conditions",
917+
kTH3F, {{eaAxis.axis}, {2, 0.0, 2.0}, {2, 0.0, 2.0}});
918+
tmpHistPointer->GetYaxis()->SetBinLabel(1, "#in |#it{#eta}| < 0.9");
919+
tmpHistPointer->GetYaxis()->SetBinLabel(2, "#notin |#it{#eta}| < 0.9");
920+
tmpHistPointer->GetZaxis()->SetBinLabel(1, "#it{p}_{T} #in TT_{Sig}");
921+
tmpHistPointer->GetZaxis()->SetBinLabel(2, "#it{p}_{T} #notin TT_{Sig}");
922+
}
923+
924+
// Reference TT
925+
for (const auto& eaAxis : arrAxisSpecScaledEA) {
926+
spectra.add(Form("hScaleMult%s_PtSmearingTTRef", eaAxis.label),
927+
Form("#it{p}_{T} smearing of TT_{Ref} vs %s", eaAxis.label),
928+
kTH3F, {{eaAxis.axis}, {relPtSmearTT}, {partPtTTRef}}, hist.sumw2);
929+
930+
spectra.add(Form("hScaleMult%s_PhiSmearingTTRef", eaAxis.label),
931+
Form("#it{#varphi} smearing of TT_{Ref} vs %s", eaAxis.label),
932+
kTH3F, {{eaAxis.axis}, {smearPhi}, {partPtTTRef}}, hist.sumw2);
933+
934+
spectra.add(Form("hScaleMult%s_EtaSmearingTTRef", eaAxis.label),
935+
Form("#it{#eta} smearing of TT_{Ref} vs %s", eaAxis.label),
936+
kTH3F, {{eaAxis.axis}, {smearEta}, {partPtTTRef}}, hist.sumw2);
937+
}
938+
}
887939
}
888940

889941
//=============================================================================
@@ -2083,6 +2135,128 @@ struct RecoilJets {
20832135
}
20842136
}
20852137

2138+
//=============================================================================
2139+
// Pt and Phi smearing of TT
2140+
//=============================================================================
2141+
2142+
template <typename JColl, typename JTracks, typename JParticles>
2143+
void fillTTSmearingPtPhi(JColl const& collision,
2144+
JTracks const& tracks,
2145+
JParticles const&,
2146+
float weight = 1.)
2147+
{
2148+
float scaledFT0C = getScaledFT0(collision.multFT0C(), ft0c.mean);
2149+
float scaledFT0M = getScaledFT0M(getScaledFT0(collision.multFT0A(), ft0a.mean), scaledFT0C);
2150+
2151+
bool bSigEv = false;
2152+
auto dice = randGen->Rndm();
2153+
if (dice < tt.fracSig)
2154+
bSigEv = true;
2155+
2156+
float ptTTMin = 0.0, ptTTMax = 0.0;
2157+
if (bSigEv) {
2158+
ptTTMin = tt.sigPtRange->at(0);
2159+
ptTTMax = tt.sigPtRange->at(1);
2160+
} else {
2161+
ptTTMin = tt.refPtRange->at(0);
2162+
ptTTMax = tt.refPtRange->at(1);
2163+
}
2164+
2165+
//=============================================================================
2166+
// Search for TT
2167+
int nCand = 0;
2168+
int32_t index = 0;
2169+
int32_t chosenTTPos = -1;
2170+
2171+
for (const auto& track : tracks) {
2172+
if (skipTrack(track)) {
2173+
++index;
2174+
continue;
2175+
}
2176+
2177+
// Search for TT candidate
2178+
float trackPt = track.pt();
2179+
if (trackPt > ptTTMin && trackPt < ptTTMax) {
2180+
2181+
++nCand;
2182+
// Random selection of TT
2183+
if (randGen->Integer(nCand) == 0) {
2184+
chosenTTPos = index;
2185+
}
2186+
}
2187+
++index;
2188+
}
2189+
2190+
// Skip if no TT
2191+
if (chosenTTPos < 0)
2192+
return;
2193+
2194+
bool bHasAssocMcPart = tracks.iteratorAt(chosenTTPos).has_mcParticle();
2195+
if (!bHasAssocMcPart)
2196+
return;
2197+
2198+
// No filter on Particles, it can be outside of |eta| acceptance
2199+
auto particle = tracks.iteratorAt(chosenTTPos).mcParticle();
2200+
float particleEta = particle.eta();
2201+
bool bPartWithinEta = std::fabs(particleEta) < trk.etaCut;
2202+
2203+
if (bSigEv) {
2204+
float particlePt = particle.pt();
2205+
bool bPartWithinPtOfTT = (particlePt > ptTTMin) && (particlePt < ptTTMax);
2206+
2207+
if (bPartWithinEta && bPartWithinPtOfTT) {
2208+
spectra.fill(HIST("hScaledFT0C_FractionOfPartTTSigSatisfCond"), scaledFT0C, 0.5, 0.5, weight);
2209+
spectra.fill(HIST("hScaledFT0M_FractionOfPartTTSigSatisfCond"), scaledFT0M, 0.5, 0.5, weight);
2210+
}
2211+
2212+
if (!bPartWithinEta && bPartWithinPtOfTT) {
2213+
spectra.fill(HIST("hScaledFT0C_FractionOfPartTTSigSatisfCond"), scaledFT0C, 1.5, 0.5, weight);
2214+
spectra.fill(HIST("hScaledFT0C_FractionOfPartTTSigSatisfCond"), scaledFT0M, 1.5, 0.5, weight);
2215+
}
2216+
2217+
if (bPartWithinEta && !bPartWithinPtOfTT) {
2218+
spectra.fill(HIST("hScaledFT0C_FractionOfPartTTSigSatisfCond"), scaledFT0C, 0.5, 1.5, weight);
2219+
spectra.fill(HIST("hScaledFT0M_FractionOfPartTTSigSatisfCond"), scaledFT0M, 0.5, 1.5, weight);
2220+
}
2221+
2222+
if (!bPartWithinEta && !bPartWithinPtOfTT) {
2223+
spectra.fill(HIST("hScaledFT0C_FractionOfPartTTSigSatisfCond"), scaledFT0C, 1.5, 1.5, weight);
2224+
spectra.fill(HIST("hScaledFT0M_FractionOfPartTTSigSatisfCond"), scaledFT0M, 1.5, 1.5, weight);
2225+
}
2226+
}
2227+
if (!bPartWithinEta)
2228+
return;
2229+
2230+
//=============================================================================
2231+
// Fill histograms
2232+
float particlePt = particle.pt();
2233+
float particlePhi = particle.phi();
2234+
2235+
float relPtSmearing = (particlePt - tracks.iteratorAt(chosenTTPos).pt()) / particlePt;
2236+
float phiSmearing = particlePhi - tracks.iteratorAt(chosenTTPos).phi();
2237+
float etaSmearing = particleEta - tracks.iteratorAt(chosenTTPos).eta();
2238+
2239+
if (bSigEv) {
2240+
spectra.fill(HIST("hScaleMultFT0C_PtSmearingTTSig"), scaledFT0C, relPtSmearing, particlePt, weight);
2241+
spectra.fill(HIST("hScaleMultFT0M_PtSmearingTTSig"), scaledFT0M, relPtSmearing, particlePt, weight);
2242+
2243+
spectra.fill(HIST("hScaleMultFT0C_PhiSmearingTTSig"), scaledFT0C, phiSmearing, particlePt, weight);
2244+
spectra.fill(HIST("hScaleMultFT0M_PhiSmearingTTSig"), scaledFT0M, phiSmearing, particlePt, weight);
2245+
2246+
spectra.fill(HIST("hScaleMultFT0C_EtaSmearingTTSig"), scaledFT0C, etaSmearing, particlePt, weight);
2247+
spectra.fill(HIST("hScaleMultFT0M_EtaSmearingTTSig"), scaledFT0M, etaSmearing, particlePt, weight);
2248+
} else {
2249+
spectra.fill(HIST("hScaleMultFT0C_PtSmearingTTRef"), scaledFT0C, relPtSmearing, particlePt, weight);
2250+
spectra.fill(HIST("hScaleMultFT0M_PtSmearingTTRef"), scaledFT0M, relPtSmearing, particlePt, weight);
2251+
2252+
spectra.fill(HIST("hScaleMultFT0C_PhiSmearingTTRef"), scaledFT0C, phiSmearing, particlePt, weight);
2253+
spectra.fill(HIST("hScaleMultFT0M_PhiSmearingTTRef"), scaledFT0M, phiSmearing, particlePt, weight);
2254+
2255+
spectra.fill(HIST("hScaleMultFT0C_EtaSmearingTTRef"), scaledFT0C, etaSmearing, particlePt, weight);
2256+
spectra.fill(HIST("hScaleMultFT0M_EtaSmearingTTRef"), scaledFT0M, etaSmearing, particlePt, weight);
2257+
}
2258+
}
2259+
20862260
//-----------------------------------------------------------------------------
20872261
// Block of Process Functions
20882262

@@ -2421,6 +2595,39 @@ struct RecoilJets {
24212595
}
24222596
PROCESS_SWITCH(RecoilJets, processBkgdFluctuationsMCPartLevelWeighted, "process MC part. level (weighted JJ) data to estimate bkgd fluctuations", false);
24232597

2598+
//=============================================================================
2599+
// Pt and Phi smearing of TT
2600+
//=============================================================================
2601+
void processTTSmearingPtPhi(CollDetIt const& collision,
2602+
aod::JetMcCollisions const&,
2603+
TrackMCLbsTbl const& tracksPerColl,
2604+
aod::JetParticles const& particles)
2605+
{
2606+
2607+
// Skip detector level collisions
2608+
if (skipEvent(collision) || !collision.has_mcCollision())
2609+
return;
2610+
2611+
fillTTSmearingPtPhi(collision, tracksPerColl, particles);
2612+
}
2613+
PROCESS_SWITCH(RecoilJets, processTTSmearingPtPhi, "process MC data (no weight; MB events) to estimate pT and phi smearing of TT", false);
2614+
2615+
//_________________________________
2616+
void processTTSmearingPtPhiWeighted(CollOutlierDetIt const& collision,
2617+
aod::JetMcCollisions const&,
2618+
TrackMCLbsTbl const& tracksPerColl,
2619+
aod::JetParticles const& particles)
2620+
{
2621+
2622+
// Skip detector level collisions
2623+
if (skipEvent(collision) || collision.isOutlier() || !collision.has_mcCollision())
2624+
return;
2625+
2626+
auto weight = collision.mcCollision().weight();
2627+
fillTTSmearingPtPhi(collision, tracksPerColl, particles, weight);
2628+
}
2629+
PROCESS_SWITCH(RecoilJets, processTTSmearingPtPhiWeighted, "process MC data (weighted JJ) to estimate pT and phi smearing of TT", false);
2630+
24242631
//------------------------------------------------------------------------------
24252632
// Auxiliary functions
24262633
template <typename Collision>

0 commit comments

Comments
 (0)