Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 161 additions & 5 deletions PWGJE/Tasks/jetHadronRecoil.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
std::vector<double> dRBinning = {0.0, 1.0e-9, 0.003, 0.006, 0.009, 0.012, 0.015, 0.018, 0.021, 0.024,
0.027, 0.03, 0.033, 0.036, 0.039, 0.042, 0.045, 0.048, 0.051, 0.054,
0.057, 0.06, 0.063, 0.066, 0.069, 0.072, 0.075, 0.078, 0.081, 0.084,
0.087, 0.09, 0.093, 0.096, 0.099, 0.102, 0.105, 0.108, 0.111, 0.114,

Check failure on line 105 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-mass]

Avoid hard-coded particle masses. Use o2::constants::physics::Mass... instead.
0.117, 0.12, 0.123, 0.126, 0.129, 0.132, 0.135, 0.138, 0.141, 0.144,
0.147, 0.15, 0.153, 0.156, 0.159, 0.162, 0.165, 0.168, 0.171, 0.174,
0.177, 0.18, 0.183, 0.186, 0.189, 0.192, 0.195, 0.198, 0.201, 0.204,
Expand Down Expand Up @@ -140,7 +140,7 @@

registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}, doSumw);

if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted) {
if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) {
registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}, doSumw);
registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}, doSumw);
registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}, doSumw);
Expand Down Expand Up @@ -181,7 +181,7 @@
registry.add("hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}, doSumw);
}

if (doprocessMCP || doprocessMCPWeighted) {
if (doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) {
registry.add("hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw);
registry.add("hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw);
registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw);
Expand Down Expand Up @@ -277,7 +277,7 @@
registry.fill(HIST("hNtrig"), 0.5, weight);
registry.fill(HIST("hRefEventTriggers"), nTT, weight);
registry.fill(HIST("hRhoReference"), rhoReference, weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 280 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hRhoReferenceShift"), rho + shift, shift, weight);
}
registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight);
Expand Down Expand Up @@ -312,31 +312,31 @@
float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT);
double dR = getWTAaxisDifference(jet, tracks);
if (isSigCol) {
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 315 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hDeltaRpTSignal"), jet.pt() - (rho * jet.area()), dR, weight);
registry.fill(HIST("hDeltaRSignal"), dR, weight);
}
registry.fill(HIST("hDeltaRpTDPhiSignal"), jet.pt() - (rho * jet.area()), dphi, dR, weight);
registry.fill(HIST("hSignalPtDPhi"), dphi, jet.pt() - (rho * jet.area()), weight);
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 321 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hSignalPt"), jet.pt() - (rho * jet.area()), weight);
registry.fill(HIST("hSignalPtHard"), jet.pt() - (rho * jet.area()), ptTT / pTHat, weight);
}
}
if (!isSigCol) {
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 327 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hDeltaRpTReference"), jet.pt() - (rhoReference * jet.area()), dR, weight);
registry.fill(HIST("hDeltaRReference"), dR, weight);
}
registry.fill(HIST("hDeltaRpTDPhiReference"), jet.pt() - (rhoReference * jet.area()), dphi, dR, weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 332 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hDeltaRpTDPhiReferenceShifts"), jet.pt() - ((rho + shift) * jet.area()), dphi, dR, shift, weight);
}
registry.fill(HIST("hReferencePtDPhi"), dphi, jet.pt() - (rhoReference * jet.area()), weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 336 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hReferencePtDPhiShifts"), dphi, jet.pt() - ((rho + shift) * jet.area()), shift, weight);
}
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 339 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hReferencePt"), jet.pt() - (rhoReference * jet.area()), weight);
registry.fill(HIST("hReferencePtHard"), jet.pt() - (rhoReference * jet.area()), ptTT / pTHat, weight);
}
Expand Down Expand Up @@ -386,11 +386,139 @@
phiTTAr.push_back(particle.phi());
ptTTAr.push_back(particle.pt());
nTT++;
registry.fill(HIST("hSignalTriggers"), particle.pt(), weight);
}
if (!isSigCol && particle.pt() < ptTTrefMax && particle.pt() > ptTTrefMin) {
phiTTAr.push_back(particle.phi());
ptTTAr.push_back(particle.pt());
nTT++;
registry.fill(HIST("hReferenceTriggers"), particle.pt(), weight);
}
registry.fill(HIST("hPtPart"), particle.pt(), weight);
registry.fill(HIST("hEtaPart"), particle.eta(), weight);
registry.fill(HIST("hPhiPart"), particle.phi(), weight);
registry.fill(HIST("hPart3D"), particle.pt(), particle.eta(), particle.phi(), weight);
registry.fill(HIST("hPtPartPtHard"), particle.pt(), particle.pt() / pTHat, weight);
}

if (nTT > 0) {
trigNumber = rand->Integer(nTT);
phiTT = phiTTAr[trigNumber];
ptTT = ptTTAr[trigNumber];
if (isSigCol) {
registry.fill(HIST("hNtrig"), 1.5, weight);
registry.fill(HIST("hSigEventTriggers"), nTT, weight);
registry.fill(HIST("hSignalTriggersPtHard"), ptTT / pTHat, weight);
}
if (!isSigCol) {
registry.fill(HIST("hNtrig"), 0.5, weight);
registry.fill(HIST("hRefEventTriggers"), nTT, weight);
registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight);
}
}

for (const auto& jet : jets) {
if (jet.pt() > leadingJetPt) {
leadingJetPt = jet.pt();
}
if (jet.pt() > pTHatMaxMCP * pTHat) {
if (outlierRejectEvent) {
return;
} else {
continue;
}
}
for (const auto& constituent : jet.template tracks_as<U>()) {
registry.fill(HIST("hConstituents3D"), constituent.pt(), constituent.eta(), constituent.phi());
}
registry.fill(HIST("hJetPt"), jet.pt(), weight);
registry.fill(HIST("hJetEta"), jet.eta(), weight);
registry.fill(HIST("hJetPhi"), jet.phi(), weight);
registry.fill(HIST("hJet3D"), jet.pt(), jet.eta(), jet.phi(), weight);

if (nTT > 0) {
float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT);
double dR = getWTAaxisDifference(jet, particles);
if (isSigCol) {
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 443 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
registry.fill(HIST("hDeltaRpTSignalPart"), jet.pt(), dR, weight);
registry.fill(HIST("hDeltaRSignalPart"), dR, weight);
}
registry.fill(HIST("hDeltaRpTDPhiSignalPart"), jet.pt(), dphi, dR, weight);
registry.fill(HIST("hSignalPtDPhi"), dphi, jet.pt(), weight);
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {
registry.fill(HIST("hSignalPt"), jet.pt(), weight);
registry.fill(HIST("hSignalPtHard"), jet.pt(), ptTT / pTHat, weight);
}
}
if (!isSigCol) {
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {
registry.fill(HIST("hDeltaRpTPartReference"), jet.pt(), dR, weight);
registry.fill(HIST("hDeltaRPartReference"), dR, weight);
}
registry.fill(HIST("hDeltaRpTDPhiReferencePart"), jet.pt(), dphi, dR, weight);
registry.fill(HIST("hReferencePtDPhi"), dphi, jet.pt(), weight);
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {
registry.fill(HIST("hReferencePt"), jet.pt(), weight);
registry.fill(HIST("hReferencePtHard"), jet.pt(), ptTT / pTHat, weight);
}
}
}
}
registry.fill(HIST("hPartvsJets"), leadingPartPt, leadingJetPt, pTHat, weight);
}

template <typename T, typename U, typename V>
void fillMCPHistogramsWithMatchedTracks(T const& jets, U const& particles, V const& tracks, float weight = 1.0, float pTHat = 999.0)
{
bool isSigCol;
std::vector<double> phiTTAr;
std::vector<double> ptTTAr;
double phiTT = 0;
double ptTT = 0;
int trigNumber = 0;
int nTT = 0;
double leadingPartPt = 0;
double leadingJetPt = 0;
float dice = rand->Rndm();
if (dice < fracSig)
isSigCol = true;
else
isSigCol = false;

for (const auto& track : tracks) {
if (!track.has_mcParticle()) {
continue;
}
auto particle = track.template mcParticle_as<U>();
if (particle.pt() > leadingPartPt) {
leadingPartPt = particle.pt();
}
if (particle.pt() > pTHatTrackMaxMCD * pTHat) {
if (outlierRejectEvent) {
return;
} else {
continue;
}
}
auto pdgParticle = pdg->GetParticle(particle.pdgCode());
if (!pdgParticle) {
continue;
}
if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) {
continue;
}
if (isSigCol && particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin && track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) {
phiTTAr.push_back(particle.phi());
ptTTAr.push_back(particle.pt());
nTT++;
registry.fill(HIST("hSignalTriggers"), particle.pt(), weight);
}
if (!isSigCol && particle.pt() < ptTTrefMax && particle.pt() > ptTTrefMin && track.pt() < ptTTrefMax && track.pt() > ptTTrefMin) {
phiTTAr.push_back(particle.phi());
ptTTAr.push_back(particle.pt());
nTT++;
registry.fill(HIST("hReferenceTriggers"), particle.pt(), weight);
}
registry.fill(HIST("hPtPart"), particle.pt(), weight);
registry.fill(HIST("hEtaPart"), particle.eta(), weight);
Expand Down Expand Up @@ -534,10 +662,19 @@
}
}
if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) {
phiTTAr.push_back(track.phi());
nTT++;
auto particle = track.template mcParticle_as<Y>();
phiTTArPart.push_back(particle.phi());
auto pdgParticle = pdg->GetParticle(particle.pdgCode());
if (!pdgParticle) {
continue;
}
if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) {
continue;
}
if (particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin) {
nTT++;
phiTTAr.push_back(track.phi());
phiTTArPart.push_back(particle.phi());
}
}
}

Expand Down Expand Up @@ -758,6 +895,25 @@
}
PROCESS_SWITCH(JetHadronRecoil, processMCPWeighted, "process MC particle level with event weights", false);

void processMCPWeightedWithMatchedTracks(aod::JetMcCollision const& collision,
soa::Filtered<soa::Join<aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents>> const& jets,
soa::Filtered<aod::JetParticles> const& particles,
soa::Filtered<aod::JetTracksMCD> const& tracks)
{
if (std::abs(collision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
return;
}
if (collision.ptHard() < pTHatMinEvent) {
return;
}
registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.weight());
fillMCPHistogramsWithMatchedTracks(jets, particles, tracks, collision.weight(), collision.ptHard());
}
PROCESS_SWITCH(JetHadronRecoil, processMCPWeightedWithMatchedTracks, "process MC particle level with event weights - only triggers matched with detector level tracks", false);

void processJetsMCPMCDMatched(soa::Filtered<soa::Join<aod::JetCollisionsMCD, aod::JMcCollisionLbs>>::iterator const& collision,
soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents, aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets>> const& mcdjets,
aod::JetTracks const& tracks,
Expand Down Expand Up @@ -933,7 +1089,7 @@
double deltaY = -1;
double dR = -1;
jetConstituents.clear();
for (auto& jetConstituent : jet.template tracks_as<X>()) {

Check failure on line 1092 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex());
}
jetReclustered.clear();
Expand Down
Loading