Skip to content

Commit c62d772

Browse files
author
Nima Zardoshti
committed
PWGJE: fixing bugs with templating in jet QA task
1 parent 86bbcf9 commit c62d772

3 files changed

Lines changed: 97 additions & 30 deletions

File tree

PWGJE/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ o2physics_add_dpl_workflow(jet-finder-d0-data-charged
2121
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
2222
COMPONENT_NAME Analysis)
2323

24+
o2physics_add_dpl_workflow(jet-finder-lc-data-charged
25+
SOURCES jetfinderLcDataCharged.cxx
26+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
27+
COMPONENT_NAME Analysis)
28+
2429
o2physics_add_dpl_workflow(jet-skimmer
2530
SOURCES jetskimming.cxx
2631
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
// jet finder lc data charged task
13+
//
14+
// Authors: Nima Zardoshti
15+
16+
#include "PWGJE/TableProducer/jetfinderhf.cxx"
17+
18+
using JetFinderLcDataCharged = JetFinderHFTask<o2::aod::LcChargedJets, o2::aod::LcChargedJetConstituents, o2::aod::LcChargedJetConstituentsSub>;
19+
20+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
21+
{
22+
std::vector<o2::framework::DataProcessorSpec> tasks;
23+
24+
tasks.emplace_back(adaptAnalysisTask<JetFinderLcDataCharged>(cfgc,
25+
SetDefaultProcesses{},
26+
TaskName{"jet-finder-lc-data-charged"}));
27+
28+
return WorkflowSpec{tasks};
29+
}

PWGJE/Tasks/jetfinderhfQA.cxx

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ struct JetFinderHFQATask {
5656
Configurable<std::string> trackSelections{"trackSelections", "globalTracks", "set track selections"};
5757
Configurable<int> selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"};
5858
Configurable<int> selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"};
59+
Configurable<int> selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for Lc->PKPi"};
60+
Configurable<int> selectionFlagLcToPiPK{"selectionFlagLcToPiPK", 1, "Selection Flag for Lc->PiPK"};
61+
Configurable<int> selectionFlagBplus{"selectionFlagBplus", 1, "Selection Flag for B+"};
5962
std::string trackSelection;
6063
std::vector<bool> filledJetR;
6164
std::vector<double> jetRadiiValues;
@@ -166,15 +169,15 @@ struct JetFinderHFQATask {
166169
}
167170

168171
using JetTracks = soa::Join<aod::Tracks, aod::TrackSelection>;
169-
using JetTableDataJoined = soa::Join<typename JetTableData, typename JetConstituentTableData>;
170-
using JetTableMCDJoined = soa::Join<typename JetTableMCD, typename JetConstituentTableMCD>;
171-
using JetTableMCDWeightedJoined = soa::Join<typename JetTableMCD, typename JetConstituentTableMCD, typename JetTableMCDWeighted>;
172-
using JetTableMCDMatchedJoined = soa::Join<typename JetTableMCD, typename JetConstituentTableMCD, typename JetMatchingTableMCDMCP>;
173-
using JetTableMCDMatcheWeightedJoined = soa::Join<typename JetTableMCD, typename JetConstituentTableMCD, typename JetMatchingTableMCDMCP, typename JetTableMCDWeighted>;
174-
using JetTableMCPJoined = soa::Join<typename JetTableMCP, typename JetConstituentTableMCP>;
175-
using JetTableMCPWeightedJoined = soa::Join<typename JetTableMCP, typename JetConstituentTableMCP, typename JetTableMCPWeighted>;
176-
using JetTableMCPMatchedJoined = soa::Join<typename JetTableMCP, typename JetConstituentTableMCP, typename JetMatchingTableMCPMCD>;
177-
using JetTableMCPMatcheWeightedJoined = soa::Join<typename JetTableMCD, typename JetConstituentTableMCP, typename JetMatchingTableMCPMCD, typename JetTableMCPWeighted>;
172+
using JetTableDataJoined = soa::Join<JetTableData,JetConstituentTableData>;
173+
using JetTableMCDJoined = soa::Join<JetTableMCD, JetConstituentTableMCD>;
174+
using JetTableMCDWeightedJoined = soa::Join< JetTableMCD, JetConstituentTableMCD, JetTableMCDWeighted>;
175+
using JetTableMCDMatchedJoined = soa::Join< JetTableMCD, JetConstituentTableMCD, JetMatchingTableMCDMCP>;
176+
using JetTableMCDMatchedWeightedJoined = soa::Join< JetTableMCD, JetConstituentTableMCD, JetMatchingTableMCDMCP, JetTableMCDWeighted>;
177+
using JetTableMCPJoined = soa::Join< JetTableMCP, JetConstituentTableMCP>;
178+
using JetTableMCPWeightedJoined = soa::Join< JetTableMCP, JetConstituentTableMCP, JetTableMCPWeighted>;
179+
using JetTableMCPMatchedJoined = soa::Join< JetTableMCP, JetConstituentTableMCP, JetMatchingTableMCPMCD>;
180+
using JetTableMCPMatchedWeightedJoined = soa::Join< JetTableMCD, JetConstituentTableMCP, JetMatchingTableMCPMCD, JetTableMCPWeighted>;
178181

179182
template <typename T>
180183
bool selectTrack(T const& track)
@@ -229,12 +232,31 @@ struct JetFinderHFQATask {
229232
registry.fill(HIST("h3_jet_r_jet_pt_candidate_y"), jet.r() / 100.0, jet.pt(), hfcandidate.y(RecoDecay::getMassPDG(421)), weight);
230233

231234
if (jet.r() == round(selectedJetsRadius * 100.0f)) {
235+
if constexpr (std::is_same_v<std::decay_t<U>, soa::Join<aod::HfCand2Prong, aod::HfSelD0>> || std::is_same_v<std::decay_t<U>, soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngMcRec>>){
232236
if (hfcandidate.isSelD0() >= selectionFlagD0) {
233237
registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), invMassD0ToPiK(hfcandidate), jet.pt(), hfcandidate.pt(), weight);
234238
}
235239
if (hfcandidate.isSelD0bar() >= selectionFlagD0bar) {
236240
registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), invMassD0barToKPi(hfcandidate), jet.pt(), hfcandidate.pt(), weight);
237241
}
242+
}
243+
244+
if constexpr (std::is_same_v<std::decay_t<U>, soa::Join<aod::HfCand3Prong, aod::HfSelLc>> || std::is_same_v<std::decay_t<U>, soa::Join<aod::HfCand3Prong, aod::HfSelLc, aod::HfCand3ProngMcRec>>){
245+
if (hfcandidate.isSelLcToPKPi() >= selectionFlagLcToPKPi) {
246+
registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), invMassLcToPKPi(hfcandidate), jet.pt(), hfcandidate.pt(), weight);
247+
}
248+
if (hfcandidate.isSelLcToPiKP() >= selectionFlagLcToPiPK) {
249+
registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), invMassLcToPiKP(hfcandidate), jet.pt(), hfcandidate.pt(), weight);
250+
}
251+
}
252+
253+
if constexpr (std::is_same_v<std::decay_t<U>, soa::Join<aod::HfCandBplus, aod::HfSelBplusToD0Pi>> || std::is_same_v<std::decay_t<U>, soa::Join<aod::HfCandBplus, aod::HfSelBplusToD0Pi, aod::HfCandBplusMcRec>>){
254+
if (hfcandidate.isSelBplusToD0Pi() >= selectionFlagBplus) {
255+
registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), invMassBplusToD0Pi(hfcandidate), jet.pt(), hfcandidate.pt(), weight);
256+
registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), invMassBplusToD0Pi(hfcandidate), jet.pt(), hfcandidate.pt(), weight);
257+
}
258+
}
259+
238260
}
239261
}
240262
}
@@ -324,15 +346,15 @@ struct JetFinderHFQATask {
324346
}
325347
}
326348

327-
void processDummy(Collisions const& collision)
349+
void processDummy(aod::Collisions const& collision)
328350
{
329351
}
330352
PROCESS_SWITCH(JetFinderHFQATask, processDummy, "dummy task", true);
331353

332-
void processJetsData(JetTableDataJoined::iterator const& jet, typename CandidateTableData const& candidates, JetTracks const& tracks)
354+
void processJetsData(typename JetTableDataJoined::iterator const& jet, CandidateTableData const& candidates, JetTracks const& tracks)
333355
{
334356

335-
fillHistograms<JetTableDataJoined::iterator, typename CandidateTableData>(jet);
357+
fillHistograms<typename JetTableDataJoined::iterator, CandidateTableData>(jet);
336358
auto leadingTrackpT = -1.0;
337359
for (auto const& track : tracks) {
338360
if (!selectTrack(track)) {
@@ -342,7 +364,7 @@ struct JetFinderHFQATask {
342364
leadingTrackpT = track.pt();
343365
}
344366

345-
for (auto& hfcandidate : jet.template hfcandidates_as<typename CandidateTableData>()) {
367+
for (auto& hfcandidate : jet.template hfcandidates_as<CandidateTableData>()) {
346368
if (hfcandidate.pt() > leadingTrackpT) {
347369
leadingTrackpT = hfcandidate.pt();
348370
}
@@ -352,54 +374,54 @@ struct JetFinderHFQATask {
352374
}
353375
PROCESS_SWITCH(JetFinderHFQATask, processJetsData, "jet finder HF QA data", false);
354376

355-
void processJetsMCD(JetTableMCDJoined::iterator const& jet, typename CandidateTableMCD const& candidates, JetTracks const& tracks)
377+
void processJetsMCD(typename JetTableMCDJoined::iterator const& jet, CandidateTableMCD const& candidates, JetTracks const& tracks)
356378
{
357-
fillHistograms<JetTableMCDJoined::iterator, typename CandidateTableMCD>(jet);
379+
fillHistograms<typename JetTableMCDJoined::iterator, CandidateTableMCD>(jet);
358380
}
359381
PROCESS_SWITCH(JetFinderHFQATask, processJetsMCD, "jet finder HF QA mcd", false);
360382

361-
void processJetsMCDWeighted(JetTableMCDWeightedJoined::iterator const& jet, typename CandidateTableMCD const& candidates, JetTracks const& tracks)
383+
void processJetsMCDWeighted(typename JetTableMCDWeightedJoined::iterator const& jet, CandidateTableMCD const& candidates, JetTracks const& tracks)
362384
{
363-
fillHistograms<JetTableMCDWeightedJoined::iterator, typename CandidateTableMCD>(jet, jet.eventWeight());
385+
fillHistograms<typename JetTableMCDWeightedJoined::iterator, CandidateTableMCD>(jet, jet.eventWeight());
364386
}
365387
PROCESS_SWITCH(JetFinderHFQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false);
366388

367-
void processJetsMCP(JetTableMCPJoined::iterator const& jet, typename ParticleTableMCP const& particles)
389+
void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, ParticleTableMCP const& particles)
368390
{
369-
fillMCPHistograms<JetTableMCPJoined::iterator, typename ParticleTableMCP>(jet);
391+
fillMCPHistograms<typename JetTableMCPJoined::iterator, ParticleTableMCP>(jet);
370392
}
371393
PROCESS_SWITCH(JetFinderHFQATask, processJetsMCP, "jet finder HF QA mcp", false);
372394

373-
void processJetsMCPWeighted(JetTableMCDWeightedJoined::iterator const& jet, typename ParticleTableMCP const& particles)
395+
void processJetsMCPWeighted(typename JetTableMCDWeightedJoined::iterator const& jet, ParticleTableMCP const& particles)
374396
{
375-
fillMCPHistograms<JetTableMCDWeightedJoined::iterator, typename ParticleTableMCP>(jet, jet.eventWeight());
397+
fillMCPHistograms<typename JetTableMCDWeightedJoined::iterator, ParticleTableMCP>(jet, jet.eventWeight());
376398
}
377399
PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPWeighted, "jet finder HF QA mcp on weighted events", false);
378400

379401
void processJetsMCPMCDMatched(aod::Collisions::iterator const& collision,
380402
JetTableMCDMatchedJoined const& mcdjets,
381403
JetTableMCPMatchedJoined const& mcpjets,
382-
typename CandidateTableMCD const& candidates,
383-
JetTracks const& tracks, typename ParticleTableMCP const& particles)
404+
CandidateTableMCD const& candidates,
405+
JetTracks const& tracks, ParticleTableMCP const& particles)
384406
{
385407

386408
for (const auto& mcdjet : mcdjets) {
387409

388-
fillMCMatchedHistograms<JetTableMCDMatchedJoined::iterator, JetTableMCPMatchedJoined, typename CandidateTableMCD, typename ParticleTableMCP>(mcdjet);
410+
fillMCMatchedHistograms<typename JetTableMCDMatchedJoined::iterator, JetTableMCPMatchedJoined, CandidateTableMCD, ParticleTableMCP>(mcdjet);
389411
}
390412
}
391413
PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPMCDMatched, "jet finder HF QA matched mcp and mcd", false);
392414

393415
void processJetsMCPMCDMatchedWeighted(aod::Collisions::iterator const& collision,
394416
JetTableMCDMatchedWeightedJoined const& mcdjets,
395417
JetTableMCPMatchedWeightedJoined const& mcpjets,
396-
typename CandidateTableMCD const& candidates,
397-
JetTracks const& tracks, typename ParticleTableMCP const& particles)
418+
CandidateTableMCD const& candidates,
419+
JetTracks const& tracks, ParticleTableMCP const& particles)
398420
{
399421

400422
for (const auto& mcdjet : mcdjets) {
401423

402-
fillMCMatchedHistograms<JetTableMCDMatchedWeightedJoined::iterator, JetTableMCPMatchedWeightedJoined, typename CandidateTableMCD, typename ParticleTableMCP>(mcdjet, mcdjet.eventWeight());
424+
fillMCMatchedHistograms<typename JetTableMCDMatchedWeightedJoined::iterator, JetTableMCPMatchedWeightedJoined, CandidateTableMCD, ParticleTableMCP>(mcdjet, mcdjet.eventWeight());
403425
}
404426
}
405427
PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPMCDMatchedWeighted, "jet finder HF QA matched mcp and mcd on weighted events", false);
@@ -413,7 +435,7 @@ struct JetFinderHFQATask {
413435

414436
void processTriggeredData(soa::Join<aod::Collisions, aod::EvSels, aod::JetFilters>::iterator const& collision,
415437
JetTableDataJoined const& jets,
416-
typename CandidateTableData const& candidates,
438+
CandidateTableData const& candidates,
417439
JetTracks const& tracks)
418440
{
419441
registry.fill(HIST("h_collision_trigger_events"), 0.5); // all events
@@ -457,7 +479,7 @@ struct JetFinderHFQATask {
457479
registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered"), jet.r() / 100.0, jet.pt(), constituent.phi());
458480
}
459481
}
460-
for (auto& hfcandidate : jet.template hfcandidates_as<typename CandidateTableData>()) {
482+
for (auto& hfcandidate : jet.template hfcandidates_as<CandidateTableData>()) {
461483

462484
registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.pt());
463485
registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.eta());
@@ -491,14 +513,25 @@ struct JetFinderHFQATask {
491513
};
492514

493515
using JetFinderD0QATask = JetFinderHFQATask<aod::D0ChargedJets, aod::D0ChargedJetConstituents, soa::Join<aod::HfCand2Prong, aod::HfSelD0>, aod::D0ChargedMCDetectorLevelJets, aod::D0ChargedMCDetectorLevelJetConstituents, aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, aod::D0ChargedMCDetectorLevelJetEventWeights, soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngMcRec>, aod::D0ChargedMCParticleLevelJets, aod::D0ChargedMCParticleLevelJetConstituents, aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, aod::D0ChargedMCParticleLevelJetEventWeights, soa::Join<aod::McParticles, aod::HfCand2ProngMcGen>>;
516+
using JetFinderLcQATask = JetFinderHFQATask<aod::LcChargedJets, aod::LcChargedJetConstituents, soa::Join<aod::HfCand3Prong, aod::HfSelLc>, aod::LcChargedMCDetectorLevelJets, aod::LcChargedMCDetectorLevelJetConstituents, aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, aod::LcChargedMCDetectorLevelJetEventWeights, soa::Join<aod::HfCand3Prong, aod::HfSelLc, aod::HfCand3ProngMcRec>, aod::LcChargedMCParticleLevelJets, aod::LcChargedMCParticleLevelJetConstituents, aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, aod::LcChargedMCParticleLevelJetEventWeights, soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>;
517+
using JetFinderBplusQATask = JetFinderHFQATask<aod::BplusChargedJets, aod::BplusChargedJetConstituents, soa::Join<aod::HfCandBplus, aod::HfSelBplusToD0Pi>, aod::BplusChargedMCDetectorLevelJets, aod::BplusChargedMCDetectorLevelJetConstituents, aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, aod::BplusChargedMCDetectorLevelJetEventWeights, soa::Join<aod::HfCandBplus, aod::HfSelBplusToD0Pi, aod::HfCandBplusMcRec>, aod::BplusChargedMCParticleLevelJets, aod::BplusChargedMCParticleLevelJetConstituents, aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, aod::BplusChargedMCParticleLevelJetEventWeights, soa::Join<aod::McParticles, aod::HfCandBplusMcGen>>;
494518

495519
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
496520
{
497521
std::vector<o2::framework::DataProcessorSpec> tasks;
498522

499523
tasks.emplace_back(adaptAnalysisTask<JetFinderD0QATask>(cfgc,
500524
SetDefaultProcesses{},
501-
TaskName{"jet-finder-d0-qa"}));
525+
TaskName{"jet-finder-charged-d0-qa"}));
526+
527+
tasks.emplace_back(adaptAnalysisTask<JetFinderBplusQATask>(cfgc,
528+
SetDefaultProcesses{},
529+
TaskName{"jet-finder-charged-bplus-qa"}));
530+
531+
tasks.emplace_back(adaptAnalysisTask<JetFinderLcQATask>(cfgc,
532+
SetDefaultProcesses{},
533+
TaskName{"jet-finder-charged-lc-qa"}));
534+
502535

503536
return WorkflowSpec{tasks};
504537
}

0 commit comments

Comments
 (0)