Skip to content

Commit 9c73715

Browse files
committed
Table idx fixes in jetCorrelationD0 task
1 parent bd2e3c3 commit 9c73715

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

PWGJE/Tasks/jetCorrelationD0.cxx

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ struct JetCorrelationD0 {
152152
// Configurables
153153
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
154154
// Configurable<std::string> triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"};
155+
Configurable<float> jetPtCutMin{"jetPtCutMin", 5.0, "minimum value of jet pt"};
156+
Configurable<float> d0PtCutMin{"d0PtCutMin", 3.0, "minimum value of d0 pt"};
155157
Configurable<bool> doSumw{"doSumw", false, "enable sumw2 for weighted histograms"};
156158
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
157159
Configurable<float> pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"};
@@ -201,7 +203,7 @@ struct JetCorrelationD0 {
201203
}
202204

203205
template <typename T, typename U>
204-
// Jetbase is the jet we take, i.e. an MCD jet. We then loop through jettag, i.e. MCP jets to test if they match
206+
// Jetbase is an MCD jet. We then loop through jettagv(MCP jets) to test if they match
205207
// void fillMatchedHistograms(T const& jetBase, float weight = 1.0) // float leadingTrackPtBase,
206208
void fillMatchedHistograms(T const& jetsBase, U const&, float weight = 1.0, float rho = 0.0)
207209
{
@@ -211,7 +213,7 @@ struct JetCorrelationD0 {
211213
return;
212214
}
213215
if (jetBase.has_matchedJetGeo()) { // geometric matching
214-
for (auto& jetTag : jetBase.template matchedJetGeo_as<std::decay_t<U>>()) { // this tests if jet base does have a matched jettag jet
216+
for (auto& jetTag : jetBase.template matchedJetGeo_as<std::decay_t<U>>()) {
215217
if (jetTag.pt() > pTHatMaxMCP * pTHat) { // cuts overly hard jets from jettag (mcp) sample
216218
continue;
217219
}
@@ -268,34 +270,41 @@ struct JetCorrelationD0 {
268270
}
269271

270272
void processData(soa::Filtered<aod::JetCollisions>::iterator const& collision,
271-
aod::CandidatesD0Data const& d0DataCandidates,
273+
aod::CandidatesD0Data const& d0Candidates,
272274
soa::Join<aod::ChargedJets, aod::ChargedJetConstituents> const& jets)
273275
{
274276
applyCollisionSelections(collision, eventSelectionBits);
275277
tableCollision(collision.posZ());
276278

277-
for (const auto& d0DataCandidate : d0DataCandidates) {
278-
const auto scores = d0DataCandidate.mlScores();
279-
fillD0Histograms(d0DataCandidate, scores);
279+
for (const auto& d0Candidate : d0Candidates) {
280+
const auto scores = d0Candidate.mlScores();
281+
if(d0Candidate.pt() < d0PtCutMin) {
282+
return;
283+
}
284+
fillD0Histograms(d0Candidate, scores);
280285
tableD0(tableCollision.lastIndex(),
281286
scores[2],
282287
scores[1],
283288
scores[0],
284-
d0DataCandidate.m(),
285-
d0DataCandidate.pt(),
286-
d0DataCandidate.eta(),
287-
d0DataCandidate.phi());
288-
// LOGF(info, "table row %i d0_mass %.2f d0_pt %.2f d0_eta %.2f d0_phi %.2f", tableD0.lastIndex(), d0.m(), d0.pt(), d0.eta(), d0.phi());
289+
d0Candidate.m(),
290+
d0Candidate.pt(),
291+
d0Candidate.eta(),
292+
d0Candidate.phi());
289293
for (const auto& jet : jets) {
290-
float dphi = RecoDecay::constrainAngle(jet.phi() - d0DataCandidate.phi());
294+
if(jet.pt() < jetPtCutMin) {
295+
return;
296+
}
297+
float dphi = RecoDecay::constrainAngle(jet.phi() - d0Candidate.phi());
298+
if (abs(dphi - M_PI) > (M_PI /2)) {
299+
return;
300+
}
291301
fillJetHistograms(jet, dphi);
292302
tableJet(tableCollision.lastIndex(),
293303
tableD0.lastIndex(),
294304
jet.pt(),
295305
jet.eta(),
296306
jet.phi(),
297307
dphi);
298-
// LOGF(info, "table row %i D0_index %i jet_pt %.2f jet_eta %.2f jet_phi %.2f dphi %.2f" ,tableJet.lastIndex(), tableD0.lastIndex(), jet.pt(), jet.eta(), jet.phi(), dphi);
299308
}
300309
}
301310
}
@@ -305,25 +314,27 @@ struct JetCorrelationD0 {
305314
aod::CandidatesD0MCP const& d0MCPCandidates,
306315
soa::Filtered<soa::Join<aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents>> const& jets)
307316
{
308-
registry.fill(HIST("hCollisions"), 0.5); // All collisions
309-
if (std::abs(collision.posZ()) > vertexZCut) {
310-
return;
311-
}
312-
registry.fill(HIST("hCollisions"), 1.5); // Selected collisions
313-
registry.fill(HIST("hZvtxSelected"), collision.posZ());
314-
315317
applyCollisionSelections(collision, eventSelectionBits);
316318
tableCollision(collision.posZ());
317319

318320
for (const auto& d0MCPCandidate : d0MCPCandidates) {
321+
if(d0MCPCandidate.pt() < d0PtCutMin) {
322+
return;
323+
}
319324
tableD0MCParticle(tableCollision.lastIndex(),
320325
d0MCPCandidate.originMcGen(),
321326
d0MCPCandidate.pt(),
322327
d0MCPCandidate.eta(),
323328
d0MCPCandidate.phi());
324329

325330
for (const auto& jet : jets) {
331+
if(jet.pt() < jetPtCutMin) {
332+
return;
333+
}
326334
float dphi = RecoDecay::constrainAngle(jet.phi() - d0MCPCandidate.phi());
335+
if (abs(dphi - M_PI) > (M_PI /2)) {
336+
return;
337+
}
327338
fillJetHistograms(jet, dphi);
328339
tableJetMCParticle(tableCollision.lastIndex(),
329340
tableD0MCParticle.lastIndex(),
@@ -350,8 +361,6 @@ struct JetCorrelationD0 {
350361
const auto CollIdx = collision.mcCollisionId();
351362

352363
for (const auto& d0MCDCandidate : d0MCDCandidates) {
353-
// Loop over d0 detector level candidates, apply d0 matching logic, fill d0 particle level that has been matched;
354-
// Loop over jet detector level, apply jet matching logic (similar to jet finder QA task), fill jet particle level that has been matched.
355364

356365
// D or D bar?
357366
int matchedFrom = 0;
@@ -397,7 +406,7 @@ struct JetCorrelationD0 {
397406
LOGF(info, "Collision ID %i, D0 pt %.2f, D0 eta %.2f, D0 phi %.2f, MCP origin %hhd, Reflection %i", CollIdx, particleMother.pt(), particleMother.eta(), particleMother.phi(), particleMother.originMcGen(), reflection);
398407

399408
// Jet matching
400-
fillMatchedHistograms(mcdJets, mcpJets);
409+
fillMatchedHistograms(mcdJets, mcpJets); // Do I need to include pthat cuts in loop rather than this function to actually do jet matching?
401410

402411
for (const auto& mcpJet : mcpJets) {
403412
float dphi = RecoDecay::constrainAngle(mcpJet.phi() - d0MCDCandidate.phi());

0 commit comments

Comments
 (0)