From d32c1e217c77bc79d5e38831f3a77c4c99b83546 Mon Sep 17 00:00:00 2001 From: Lucamicheletti93 Date: Tue, 2 Sep 2025 11:40:13 +0200 Subject: [PATCH 1/3] fixing minitree filling --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index b3ef5cf769a..a3c434cee21 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -879,13 +879,14 @@ struct AnalysisMuonSelection { void runMuonSelection(ReducedMuonsAssoc const& assocs, TEvents const& events, TMuons const& muons, ReducedMCEvents const& /*eventsMC*/, ReducedMCTracks const& muonsMC) { if (events.size() > 0 && fCurrentRun != events.begin().runNumber()) { - o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(grpmagPath, events.begin().timestamp()); + /*o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(grpmagPath, events.begin().timestamp()); if (grpmag != nullptr) { o2::base::Propagator::initFieldFromGRP(grpmag); VarManager::SetMagneticField(grpmag->getNominalL3Field()); } else { LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); - } + }*/ + VarManager::SetMagneticField(5.0); fCurrentRun = events.begin().runNumber(); } @@ -2173,9 +2174,12 @@ struct AnalysisSameEventPairing { PresliceUnsorted perReducedMcGenEvent = aod::reducedtrackMC::reducedMCeventId; - void processMCGen(soa::Filtered const& events, ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks) + void processMCGen(soa::Filtered const& events, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { // Fill Generated histograms taking into account all generated tracks + uint32_t mcDecision = 0; + int isig = 0; + for (auto& mctrack : mcTracks) { VarManager::FillTrackMC(mcTracks, mctrack); // NOTE: Signals are checked here mostly based on the skimmed MC stack, so depending on the requested signal, the stack could be incomplete. @@ -2209,9 +2213,15 @@ struct AnalysisSameEventPairing { // auto track_raw = groupedMCTracks.rawIteratorAt(track.globalIndex()); for (auto& sig : fGenMCSignals) { if (sig->CheckSignal(true, track_raw)) { + mcDecision |= (static_cast(1) << isig); fHistMan->FillHistClass(Form("MCTruthGenSel_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + auto mcEvent = mcEvents.rawIteratorAt(track_raw.reducedMCeventId()); + dileptonMiniTreeGen(mcDecision, mcEvent.impactParameter(), track_raw.pt(), track_raw.eta(), track_raw.phi(), -999, -999, -999); + } } } + isig++; } } // end loop over reconstructed events if (fHasTwoProngGenMCsignals) { @@ -2224,12 +2234,17 @@ struct AnalysisSameEventPairing { continue; } if (sig->CheckSignal(true, t1_raw, t2_raw)) { - // mcDecision |= (static_cast(1) << isig); + mcDecision |= (static_cast(1) << isig); VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + // WARNING! To be checked + dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); + } } } } + isig++; } } } From 446b3bf3f90f3752a9a0fb362be03a3026b8560f Mon Sep 17 00:00:00 2001 From: Lucamicheletti93 Date: Tue, 2 Sep 2025 11:45:12 +0200 Subject: [PATCH 2/3] Setting manually magnetic field in AnalysisMuonSelection if not available in ccdb --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index a3c434cee21..af2943a46a2 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -768,6 +768,7 @@ struct AnalysisMuonSelection { Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable fConfigMCSignals{"cfgMuonMCSignals", "", "Comma separated list of MC signals"}; @@ -879,14 +880,15 @@ struct AnalysisMuonSelection { void runMuonSelection(ReducedMuonsAssoc const& assocs, TEvents const& events, TMuons const& muons, ReducedMCEvents const& /*eventsMC*/, ReducedMCTracks const& muonsMC) { if (events.size() > 0 && fCurrentRun != events.begin().runNumber()) { - /*o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(grpmagPath, events.begin().timestamp()); + o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(grpmagPath, events.begin().timestamp()); if (grpmag != nullptr) { o2::base::Propagator::initFieldFromGRP(grpmag); VarManager::SetMagneticField(grpmag->getNominalL3Field()); } else { - LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); - }*/ - VarManager::SetMagneticField(5.0); + //LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); + // If the magnetic field is not found it is configured by had by the user + VarManager::SetMagneticField(fConfigMagField.value); + } fCurrentRun = events.begin().runNumber(); } From 601b5f87f8276ab5e56a18a25d76a8512d321743 Mon Sep 17 00:00:00 2001 From: Lucamicheletti93 Date: Tue, 2 Sep 2025 11:48:15 +0200 Subject: [PATCH 3/3] fix clang --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index af2943a46a2..ceec3753c28 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -885,8 +885,8 @@ struct AnalysisMuonSelection { o2::base::Propagator::initFieldFromGRP(grpmag); VarManager::SetMagneticField(grpmag->getNominalL3Field()); } else { - //LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); - // If the magnetic field is not found it is configured by had by the user + // LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); + // If the magnetic field is not found it is configured by had by the user VarManager::SetMagneticField(fConfigMagField.value); } fCurrentRun = events.begin().runNumber();