From 2d5b544d00880611cda4808e2df47b7c7296b819 Mon Sep 17 00:00:00 2001 From: romainschotter Date: Tue, 14 Jul 2026 21:52:43 +0200 Subject: [PATCH 1/9] Add event preselections in strangeness builder and strangeness derived data producer --- Common/TableProducer/propagationService.cxx | 3 +- .../TableProducer/propagationServiceRun2.cxx | 3 +- Common/TableProducer/propagationServiceV2.cxx | 3 +- PWGLF/DataModel/LFStrangenessPIDTables.h | 12 +- PWGLF/DataModel/LFStrangenessTables.h | 14 +- .../Strangeness/Converters/CMakeLists.txt | 14 +- .../stradautrackstofpidconverter4.cxx | 58 +++ .../Strangeness/strangederivedbuilder.cxx | 172 ++++++- .../Strangeness/strangenesstofpid.cxx | 52 +- .../derivedlambdakzeroanalysis.cxx | 144 ++++-- PWGLF/Utils/strangenessBuilderModule.h | 446 +++++++++++++----- 11 files changed, 699 insertions(+), 222 deletions(-) create mode 100644 PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx diff --git a/Common/TableProducer/propagationService.cxx b/Common/TableProducer/propagationService.cxx index 25c951ef396..0c144bb43f9 100644 --- a/Common/TableProducer/propagationService.cxx +++ b/Common/TableProducer/propagationService.cxx @@ -77,6 +77,7 @@ struct propagationService { o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::eventSelectOpts eventSelectOpts; o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) @@ -99,7 +100,7 @@ struct propagationService { // task-specific trackPropagation.init(trackPropagationConfigurables, trackTunerObj, histos, initContext); - strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); + strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, eventSelectOpts, histos, initContext); } void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIU const& tracks, aod::BCsWithTimestamps const& bcs) diff --git a/Common/TableProducer/propagationServiceRun2.cxx b/Common/TableProducer/propagationServiceRun2.cxx index 85dd2d0942b..4266acaaa0d 100644 --- a/Common/TableProducer/propagationServiceRun2.cxx +++ b/Common/TableProducer/propagationServiceRun2.cxx @@ -75,6 +75,7 @@ struct propagationServiceRun2 { o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::eventSelectOpts eventSelectOpts; o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; // registry @@ -89,7 +90,7 @@ struct propagationServiceRun2 { ccdb->setFatalWhenNull(false); // task-specific - strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); + strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, eventSelectOpts, histos, initContext); } void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, FullTracksExt const& tracks, aod::BCsWithTimestamps const& bcs) diff --git a/Common/TableProducer/propagationServiceV2.cxx b/Common/TableProducer/propagationServiceV2.cxx index 364d27101e6..14f47a4c96d 100644 --- a/Common/TableProducer/propagationServiceV2.cxx +++ b/Common/TableProducer/propagationServiceV2.cxx @@ -82,6 +82,7 @@ struct propagationServiceV2 { o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::eventSelectOpts eventSelectOpts; o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) @@ -106,7 +107,7 @@ struct propagationServiceV2 { // task-specific trackPropagation.init(trackPropagationConfigurables, trackTunerObj, histos, initContext); - strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); + strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, eventSelectOpts, histos, initContext); } // Load MatLUT once (needs rectifyPtrFromFile, kept manual), set B-field and mean vertex diff --git a/PWGLF/DataModel/LFStrangenessPIDTables.h b/PWGLF/DataModel/LFStrangenessPIDTables.h index 852be92347d..067966859ed 100644 --- a/PWGLF/DataModel/LFStrangenessPIDTables.h +++ b/PWGLF/DataModel/LFStrangenessPIDTables.h @@ -182,7 +182,17 @@ DECLARE_SOA_TABLE_VERSIONED(DauTrackTOFPIDs_002, "AOD", "DAUTRACKTOFPID", 2, // dautrack::TOFExpTimeKa, dautrack::TOFExpTimePr); -using DauTrackTOFPIDs = DauTrackTOFPIDs_002; // second gen: with collision Id, with TOFExpMom +DECLARE_SOA_TABLE_VERSIONED(DauTrackTOFPIDs_003, "AOD", "DAUTRACKTOFPID", 3, // raw table (for posterior TOF calculation) + o2::soa::Index<>, + bc::GlobalBC, dautrack::DauTrackExtraId, + dautrack::TOFSignal, dautrack::TOFEvTime, dautrack::TOFEvTimeErr, + dautrack::Length, dautrack::TOFExpMom, + dautrack::TOFExpTimeEl, + dautrack::TOFExpTimePi, + dautrack::TOFExpTimeKa, + dautrack::TOFExpTimePr); + +using DauTrackTOFPIDs = DauTrackTOFPIDs_003; // second gen: with collision Id, with TOFExpMom namespace v0data { diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 4eb92b3d43a..b59c5564deb 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -44,6 +44,16 @@ DECLARE_SOA_COLUMN(DataframeID, dataframeID, uint64_t); //! Data frame ID (what DECLARE_SOA_TABLE(StraOrigins, "AOD", "STRAORIGIN", //! Table which contains the IDs of all dataframes merged into this dataframe o2::soa::Index<>, straorigin::DataframeID); +// for keeping track of the number of selected collisions +namespace straselections +{ +DECLARE_SOA_COLUMN(TotalNbrOfCollisions, totalNbrOfCollisions, int); //! total number of analysed collisions +DECLARE_SOA_COLUMN(TotalNbrOfSelCollisions, totalNbrOfSelCollisions, int); //! total number of selected collisions +} // namespace straselections + +DECLARE_SOA_TABLE(StraSelections, "AOD", "STRASELECTIONS", //! keep track of the number of analysed collisions in this DF + o2::soa::Index<>, straselections::TotalNbrOfCollisions, straselections::TotalNbrOfSelCollisions); + namespace stracollision { DECLARE_SOA_DYNAMIC_COLUMN(IsUPC, isUPC, //! check whether this is a UPC or hadronic collision @@ -410,8 +420,10 @@ DECLARE_SOA_TABLE(StraMCCollMults_000, "AOD", "STRAMCCOLLMULTS", //! MC collisio mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, o2::soa::Marker<2>); DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_001, "AOD", "STRAMCCOLLMULTS", 1, //! MC collision multiplicities mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles); +DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_002, "AOD", "STRAMCCOLLMULTS", 2, //! MC collision multiplicities + mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCFV0A, mult::MultMCFDDA, mult::MultMCFDDC, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles); -using StraMCCollMults = StraMCCollMults_001; +using StraMCCollMults = StraMCCollMults_002; namespace dautrack { diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index 2cd12ee97b1..e1d42ea534a 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -34,6 +34,11 @@ o2physics_add_dpl_workflow(stradautrackstofpidconverter3 PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(stradautrackstofpidconverter4 + SOURCES stradautrackstofpidconverter4.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(stradautracksextraconverter SOURCES stradautracksextraconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -134,6 +139,11 @@ o2physics_add_dpl_workflow(stramccollisionconverter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(stramccollisionconverter2 + SOURCES stramccollisionconverter2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(strastampsconverter SOURCES strastampsconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -154,8 +164,8 @@ o2physics_add_dpl_workflow(stramccollmultconverter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(stramccollisionconverter2 - SOURCES stramccollisionconverter2.cxx +o2physics_add_dpl_workflow(stramccollmultconverter2 + SOURCES stramccollmultconverter2.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx new file mode 100644 index 00000000000..0d2bede238b --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx @@ -0,0 +1,58 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \file stradautrackstofpidconverter4.cxx +/// \brief Converts DauTrackTOFPID_002 into DauTrackTOFPID_003 +/// +/// \author David Dobrigkeit Chinellato , Austrian Academy of Sciences & MBI +/// \author Romain Schotter , Austrian Academy of Sciences & MBI + +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; + +// converts DauTrackTOFPIDs_002 to _003 +struct stradautrackstofpidconverter4 { + Produces dautracktofpids; + + void process(aod::DauTrackTOFPIDs_002 const& dauTracks, soa::Join const& collisions) + { + // create new TOFPIDs + dautracktofpids.reserve(dauTracks.size()); + for (const auto& dauTrack : dauTracks) { + uint64_t bc = 0; + if (dauTrack.straCollisionId() >= 0) { + auto collision = collisions.rawIteratorAt(dauTrack.straCollisionId()); + bc = collision.globalBC(); + } + dautracktofpids( + bc, + dauTrack.dauTrackExtraId(), + dauTrack.tofSignal(), + dauTrack.tofEvTime(), + dauTrack.tofEvTimeErr(), + dauTrack.length(), + dauTrack.tofExpMom()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 45992de95e8..beedb3c3873 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -33,6 +33,8 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -153,6 +155,10 @@ struct strangederivedbuilder { //__________________________________________________ // Debug Produces straOrigin; + + //__________________________________________________ + // Keep track of analysed collisions + Produces straSelection; } products; // histogram registry for bookkeeping @@ -184,6 +190,24 @@ struct strangederivedbuilder { Configurable fillEmptyCollisions{"fillEmptyCollisions", false, "fill collision entries without candidates"}; + // Configurable options for event selections + // --> configuration inherited from the strangenessBuilderModule in the propagationService + Configurable inheritEvtSelFromTask{"inheritEvtSelFromTask", "propagation-service", "Inherit event selection parameters from which task?"}; + Configurable inheritEvtSelFromTaskCfgGroup{"inheritEvtSelFromTaskCfgGroup", "eventSelectOpts", "What is the configurable group prefix? If none, put nothing"}; + Configurable inheritEvtSelFromTaskVerbose{"inheritEvtSelFromTaskVerbose", false, "Enable verbose mode on the getTaskOption utility"}; + bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? + bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) + bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) + bool rejectTFBorder = false; // reject events at TF border (Run 3 only) + bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) + float maxZVtxPosition = 10.; // max Z vtx position (cm) + bool cfgApplyRCTrequirement = false; // Apply RCT requirement? + std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) + bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) + bool cfgTreatLimitedAcceptanceAsBad = false; // reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance + + o2::aod::rctsel::RCTFlagsChecker rctFlagsChecker; + // round Nsigma variables up to a certain level of precision if requested // useful to keep derived data sizes under control // variables that are rounded include the DCAs but not the CosPA (precision needed) @@ -220,6 +244,7 @@ struct strangederivedbuilder { } axisDetectors; // For manual sliceBy + Preslice TrackperCollision = o2::aod::track::collisionId; Preslice V0perCollision = o2::aod::v0data::collisionId; Preslice CascperCollision = o2::aod::cascdata::collisionId; Preslice KFCascperCollision = o2::aod::cascdata::collisionId; @@ -237,6 +262,13 @@ struct strangederivedbuilder { std::vector genOmegaMinus; std::vector genOmegaPlus; + // create collision indices beforehand + std::vector TrackCollIndices; // index -1: no collision + std::vector V0CollIndices; // index -1: no collision + std::vector CascadeCollIndices; // index -1: no collision + std::vector KFCascadeCollIndices; // index -1: no collision + std::vector TraCascadeCollIndices; // index -1: no collision + float roundToPrecision(float number, float step = 0.01) { // this function rounds a certain number in an axis that is quantized by @@ -246,7 +278,46 @@ struct strangederivedbuilder { return step * static_cast(static_cast((number) / step)) + TMath::Sign(1.0f, number) * (0.5f) * step; } - void init(InitContext&) + template + void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + { + if (!o2::common::core::getTaskOptionValue(initContext, task, name, v, inheritEvtSelFromTaskVerbose)) { + LOG(fatal) << "Could not get " << name << " from " << task << " task"; + } + } + + template + bool isCollisionAccepted(TCollision collision) + // check whether the collision passes our collision selections + { + if (requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + + if (std::abs(collision.posZ()) > maxZVtxPosition) { + return false; + } + + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + + if (!cfgApplyRCTrequirement && !rctFlagsChecker(collision)) { + return false; + } + + return true; + } + + void init(InitContext& initContext) { LOGF(info, "Initializing now: cross-checking correctness..."); if (doprocessCollisionsRun3 + @@ -384,7 +455,35 @@ struct strangederivedbuilder { } else { LOGF(info, "Process strange mothers...........: no"); } - LOGF(info, "=================================================================="); + LOGF(info, "====] Event selection information processing [===================="); + std::string eventSelectOptsPrefix = inheritEvtSelFromTaskCfgGroup.value; + if (!inheritEvtSelFromTaskCfgGroup.value.empty()) { + eventSelectOptsPrefix += "."; + } + + + getCfg(initContext, eventSelectOptsPrefix + "fillOnlySelectedCollisions", fillOnlySelectedCollisions, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "requireTriggerTVX", requireTriggerTVX, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "rejectITSROFBorder", rejectITSROFBorder, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "rejectTFBorder", rejectTFBorder, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "rejectSameBunchPileup", rejectSameBunchPileup, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "maxZVtxPosition", maxZVtxPosition, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "cfgApplyRCTrequirement", cfgApplyRCTrequirement, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "cfgRCTLabel", cfgRCTLabel, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "cfgCheckZDC", cfgCheckZDC, inheritEvtSelFromTask); + getCfg(initContext, eventSelectOptsPrefix + "cfgTreatLimitedAcceptanceAsBad", cfgTreatLimitedAcceptanceAsBad, inheritEvtSelFromTask); + + LOG(info) << "Inherit event selections from : " << inheritEvtSelFromTask; + LOG(info) << "Fill only selected position........: " << (fillOnlySelectedCollisions ? "yes" : "no"); + LOG(info) << "Require TriggerTVX.................: " << (requireTriggerTVX ? "yes" : "no"); + LOG(info) << "Reject ITS ROF border..............: " << (rejectITSROFBorder ? "yes" : "no"); + LOG(info) << "Reject TF border...................: " << (rejectTFBorder ? "yes" : "no"); + LOG(info) << "Reject same bunch pile-up..........: " << (rejectSameBunchPileup ? "yes" : "no"); + LOG(info) << "Apply RCT requirement..............: " << (cfgApplyRCTrequirement ? "yes" : "no"); + LOG(info) << "RCT requirement....................: " << cfgRCTLabel; + LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC? "yes" : "no"); + LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC? "yes" : "no"); + LOG(info) << "================================================================="; // setup map for fast checking if enabled static_for<0, nSpecies - 1>([&](auto i) { @@ -417,6 +516,11 @@ struct strangederivedbuilder { auto hZNATimeVsZNAUD = histos.add("hZNATimeVsZNAUD", "hZNAMultVsZNAUD; ZNA time; ZNA UD", kTH2F, {axisDetectors.axisZNAtime, axisDetectors.axisZNAtime}); auto hZNCTimeVsZNCUD = histos.add("hZNCTimeVsZNCUD", "hZNCMultVsZNCUD; ZNC time; ZNC UD", kTH2F, {axisDetectors.axisZNCtime, axisDetectors.axisZNCtime}); + // Initialise the RCTFlagsChecker + if (cfgApplyRCTrequirement) { + rctFlagsChecker.init(cfgRCTLabel, cfgCheckZDC, cfgTreatLimitedAcceptanceAsBad); + } + for (int ii = 1; ii < 101; ii++) { float value = 100.5f - static_cast(ii); hRawCentrality->SetBinContent(ii, value); @@ -438,19 +542,30 @@ struct strangederivedbuilder { } // master function to process a collision - template - void populateCollisionTables(coll const& collisions, udcoll const& udCollisions, v0d const& V0s, cad const& Cascades, kfcad const& KFCascades, tracad const& TraCascades, bcType const& /*bcs*/) + template + void populateCollisionTables(coll const& collisions, udcoll const& udCollisions, tracks const& Tracks, v0d const& V0s, cad const& Cascades, kfcad const& KFCascades, tracad const& TraCascades, bcType const& /*bcs*/) { // create collision indices beforehand - std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision - std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision - std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision - std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision + TrackCollIndices.clear(); + V0CollIndices.clear(); + CascadeCollIndices.clear(); + KFCascadeCollIndices.clear(); + TraCascadeCollIndices.clear(); + + TrackCollIndices.resize(Tracks.size(), 0); // index -1: no collision + V0CollIndices.resize(V0s.size(), -1); // index -1: no collision + CascadeCollIndices.resize(Cascades.size(), -1); // index -1: no collision + KFCascadeCollIndices.resize(KFCascades.size(), -1); // index -1: no collision + TraCascadeCollIndices.resize(TraCascades.size(), -1); // index -1: no collision + + int totalNbrCollisions = collisions.size(); + int totalNbrSelectedCollisions = 0; // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ for (const auto& collision : collisions) { const uint64_t collIdx = collision.globalIndex(); + auto TrackTable_thisColl = Tracks.sliceBy(TrackperCollision, collIdx); auto V0Table_thisColl = V0s.sliceBy(V0perCollision, collIdx); auto CascTable_thisColl = Cascades.sliceBy(CascperCollision, collIdx); auto KFCascTable_thisColl = KFCascades.sliceBy(KFCascperCollision, collIdx); @@ -522,6 +637,13 @@ struct strangederivedbuilder { } } + for (const auto& track : TrackTable_thisColl) + TrackCollIndices[track.globalIndex()] = bc.globalBC(); + + if (fillOnlySelectedCollisions && !isCollisionAccepted(collision)) { + continue; + } + // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ // fill collision tables if (strange || fillEmptyCollisions) { @@ -624,6 +746,7 @@ struct strangederivedbuilder { collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), collision.alias_raw()); } + totalNbrSelectedCollisions++; } for (const auto& v0 : V0Table_thisColl) V0CollIndices[v0.globalIndex()] = products.strangeColl.lastIndex(); @@ -649,6 +772,7 @@ struct strangederivedbuilder { for (const auto& casc : TraCascades) { products.tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); } + products.straSelection(totalNbrCollisions, totalNbrSelectedCollisions); } // helper function to estimate collision time @@ -674,6 +798,9 @@ struct strangederivedbuilder { collisionEventTime[collision.globalIndex()] = -1e+6; // undefined collisionEventTimeErr[collision.globalIndex()] = -1e-6; // undefined } + if (fillOnlySelectedCollisions && !isCollisionAccepted(collision)) { + continue; + } histos.fill(HIST("h2dCollisionTimesVsNTracks"), collisionNtracks[collision.globalIndex()], collisionEventTime[collision.globalIndex()]); products.straEvTimes(collisionEventTime[collision.globalIndex()], collisionEventTimeErr[collision.globalIndex()]); } @@ -712,6 +839,7 @@ struct strangederivedbuilder { products.strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), mccollision.impactParameter(), mccollision.eventPlaneAngle(), mccollision.generatorsID()); products.strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(), + mccollision.multMCFV0A(), mccollision.multMCFDDA(), mccollision.multMCFDDC(), mccollision.multMCNParticlesEta05(), mccollision.multMCNParticlesEta08(), mccollision.multMCNParticlesEta10(), @@ -719,37 +847,37 @@ struct strangederivedbuilder { } } - void processCollisionsRun3(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&) + void processCollisionsRun3(soa::Join const& collisions, aod::Tracks const& tracks, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&) { - populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades, bcs); + populateCollisionTables(collisions, collisions, tracks, V0s, Cascades, KFCascades, TraCascades, bcs); } - void processCollisionsRun3WithUD(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&, UDCollisionsFull const& udCollisions) + void processCollisionsRun3WithUD(soa::Join const& collisions, aod::Tracks const& tracks, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&, UDCollisionsFull const& udCollisions) { - populateCollisionTables(collisions, udCollisions, V0s, Cascades, KFCascades, TraCascades, bcs); + populateCollisionTables(collisions, udCollisions, tracks, V0s, Cascades, KFCascades, TraCascades, bcs); } - void processCollisionsRun3WithMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&, soa::Join const& mcCollisions, aod::McParticles const& mcParticles) + void processCollisionsRun3WithMC(soa::Join const& collisions, aod::Tracks const& tracks, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&, soa::Join const& mcCollisions, aod::McParticles const& mcParticles) { populateMCCollisionTable(mcCollisions, mcParticles); - populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades, bcs); + populateCollisionTables(collisions, collisions, tracks, V0s, Cascades, KFCascades, TraCascades, bcs); } - void processCollisionsRun3WithUDWithMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&, UDCollisionsFull const& udCollisions, soa::Join const& mcCollisions, aod::McParticles const& mcParticles) + void processCollisionsRun3WithUDWithMC(soa::Join const& collisions, aod::Tracks const& tracks, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&, UDCollisionsFull const& udCollisions, soa::Join const& mcCollisions, aod::McParticles const& mcParticles) { populateMCCollisionTable(mcCollisions, mcParticles); - populateCollisionTables(collisions, udCollisions, V0s, Cascades, KFCascades, TraCascades, bcs); + populateCollisionTables(collisions, udCollisions, tracks, V0s, Cascades, KFCascades, TraCascades, bcs); } - void processCollisionsRun2(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, BCsWithTimestampsAndRun2Infos const& bcs) + void processCollisionsRun2(soa::Join const& collisions, aod::Tracks const& tracks, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, BCsWithTimestampsAndRun2Infos const& bcs) { - populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades, bcs); + populateCollisionTables(collisions, collisions, tracks, V0s, Cascades, KFCascades, TraCascades, bcs); } - void processCollisionsRun2WithMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, BCsWithTimestampsAndRun2Infos const& bcs, soa::Join const& mcCollisions, aod::McParticles const& mcParticles) + void processCollisionsRun2WithMC(soa::Join const& collisions, aod::Tracks const& tracks, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, BCsWithTimestampsAndRun2Infos const& bcs, soa::Join const& mcCollisions, aod::McParticles const& mcParticles) { populateMCCollisionTable(mcCollisions, mcParticles); - populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades, bcs); + populateCollisionTables(collisions, collisions, tracks, V0s, Cascades, KFCascades, TraCascades, bcs); } void processTrackExtrasV0sOnly(aod::V0Datas const& V0s, TracksWithExtra const& tracksExtra) @@ -905,7 +1033,7 @@ struct strangederivedbuilder { aod::dautrack::packing::packInInt8(tr.tpcNSigmaPr())); // populate daughter-level TOF information if (tr.hasTOF()) { - products.dauTrackTOFPIDs(tr.collisionId(), products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.tofEvTimeErr(), tr.length(), tr.tofExpMom()); + products.dauTrackTOFPIDs(TrackCollIndices[tr.globalIndex()], products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.tofEvTimeErr(), tr.length(), tr.tofExpMom()); } } else { // populate with empty fully-compatible Nsigmas if no corresponding table available @@ -916,7 +1044,7 @@ struct strangederivedbuilder { // done! } - void processPopulateEventTimes(aod::Collisions const& collisions, soa::Join const& tracks) + void processPopulateEventTimes(soa::Join const& collisions, soa::Join const& tracks) { populateEventTimes(collisions, tracks); } diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index a1145093ae0..241f682b7b2 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -1784,6 +1784,7 @@ struct strangenesstofpid { v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.collisionId(), V0, pTof, nTof); if (doNSigmas) { + LOG(info) << collisionV0.bcId() << " " << collisionV0.globalIndex() << " " << collisionV0.posX() << " " << collisionV0.posY() << " " << collisionV0.posZ() << " ; TOF K0s pos: " << v0tof.nSigmaPositiveK0ShortPi << " = " << v0tof.deltaTimePositiveK0ShortPi << " - " << hMeanPosK0Pi->Interpolate(V0.p()) << " / " << hSigmaPosK0Pi->Interpolate(V0.p()) << " ; TOF K0s neg: " << v0tof.nSigmaNegativeK0ShortPi << " = " << v0tof.deltaTimeNegativeK0ShortPi << " - " << hMeanNegK0Pi->Interpolate(V0.p()) << " / " << hSigmaNegK0Pi->Interpolate(V0.p()) << " ; " << pTof.tofSignal << " - " << pTof.tofEvTime << " - " << v0tof.timeK0Short << " + " << v0tof.timePositivePi; v0tofnsigmas( v0tof.nSigmaPositiveLambdaPr, v0tof.nSigmaNegativeLambdaPi, v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, @@ -1993,23 +1994,23 @@ struct strangenesstofpid { if (tofIndices[V0.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); - if (pTofExt.straCollisionId() >= 0) { + // if (pTofExt.straCollisionId() >= 0) { // extract BC for BC time shift - auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); - const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + // auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); + const int64_t deltaBc = pTofExt.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hV0PositiveBCShift"), deltaTimeBc); deltaTimeBcPos = deltaTimeBc; // assign variables - pTof.collisionId = pTofExt.straCollisionId(); + // pTof.collisionId = pTofExt.straCollisionId(); pTof.tofExpMom = pTofExt.tofExpMom(); pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); // pTof.tofEvTimeErr = pTofExt.tofEvTimeErr(); pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); pTof.length = pTofExt.length(); - } + // } } nTof.hasITS = nTra.hasITS(); @@ -2020,23 +2021,23 @@ struct strangenesstofpid { if (tofIndices[V0.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); - if (nTofExt.straCollisionId() >= 0) { + // if (nTofExt.straCollisionId() >= 0) { // extract BC for BC time shift - auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); - const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + // auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); + const int64_t deltaBc = nTofExt.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hV0NegativeBCShift"), deltaTimeBc); deltaTimeBcNeg = deltaTimeBc; // assign variables - nTof.collisionId = nTofExt.straCollisionId(); + // nTof.collisionId = nTofExt.straCollisionId(); nTof.tofExpMom = nTofExt.tofExpMom(); nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); nTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : nTofExt.tofEvTimeErr(); // nTof.tofEvTimeErr = nTofExt.tofEvTimeErr(); nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); nTof.length = nTofExt.length(); - } + // } } if (pTof.hasTOF) { histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); @@ -2051,6 +2052,7 @@ struct strangenesstofpid { v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.straCollisionId(), V0, pTof, nTof); if (doNSigmas) { + LOG(info) << collision.eventTime() << " " << collision.globalIndex() << " " << collision.posX() << " " << collision.posY() << " " << collision.posZ() << " ; TOF K0s pos: " << v0tof.nSigmaPositiveK0ShortPi << " = " << v0tof.deltaTimePositiveK0ShortPi << " - " << hMeanPosK0Pi->Interpolate(V0.p()) << " / " << hSigmaPosK0Pi->Interpolate(V0.p()) << " ; TOF K0s neg: " << v0tof.nSigmaNegativeK0ShortPi << " = " << v0tof.deltaTimeNegativeK0ShortPi << " - " << hMeanNegK0Pi->Interpolate(V0.p()) << " / " << hSigmaNegK0Pi->Interpolate(V0.p()) << " ; " << pTof.tofSignal << " ( " << (pTof.collisionId >= 0 ? (dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]).tofSignal()) : 0 ) << " + " << deltaTimeBcPos << " " << pTof.collisionId << " " << (pTof.collisionId >= 0 ? collisions.rawIteratorAt(pTof.collisionId).globalBC() : -1 ) << " - " << collision.globalBC()<< " " << V0.posTrackExtraId() << " ) " << " - " << pTof.tofEvTime << " - " << v0tof.timeK0Short << " + " << v0tof.timePositivePi; v0tofnsigmas( v0tof.nSigmaPositiveLambdaPr, v0tof.nSigmaNegativeLambdaPi, v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, @@ -2090,22 +2092,22 @@ struct strangenesstofpid { if (tofIndices[cascade.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); - if (pTofExt.straCollisionId() >= 0) { + // if (pTofExt.straCollisionId() >= 0) { // extract BC for BC time shift - auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); - const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + // auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); + const int64_t deltaBc = pTofExt.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); histos.fill(HIST("h2dTOFSignalCascadePositive"), pTof.tofSignal, deltaTimeBc); - pTof.collisionId = pTofExt.straCollisionId(); + // pTof.collisionId = pTofExt.straCollisionId(); pTof.tofExpMom = pTofExt.tofExpMom(); pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); // pTof.tofEvTimeErr = pTofExt.tofEvTimeErr(); pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); pTof.length = pTofExt.length(); - } + // } } nTof.hasITS = nTra.hasITS(); @@ -2116,22 +2118,22 @@ struct strangenesstofpid { if (tofIndices[cascade.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); - if (nTofExt.straCollisionId() >= 0) { + // if (nTofExt.straCollisionId() >= 0) { // extract BC for BC time shift - auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); - const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + // auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); + const int64_t deltaBc = nTofExt.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); histos.fill(HIST("h2dTOFSignalCascadeNegative"), nTof.tofSignal, deltaTimeBc); - nTof.collisionId = nTofExt.straCollisionId(); + // nTof.collisionId = nTofExt.straCollisionId(); nTof.tofExpMom = nTofExt.tofExpMom(); nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); nTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTimeErr(); // nTof.tofEvTimeErr = nTofExt.tofEvTimeErr(); nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); nTof.length = nTofExt.length(); - } + // } } bTof.hasITS = bTra.hasITS(); @@ -2142,22 +2144,22 @@ struct strangenesstofpid { if (tofIndices[cascade.bachTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); - if (bTofExt.straCollisionId() >= 0) { + // if (bTofExt.straCollisionId() >= 0) { // extract BC for BC time shift - auto collisionTrack = collisions.rawIteratorAt(bTofExt.straCollisionId()); - const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + // auto collisionTrack = collisions.rawIteratorAt(bTofExt.straCollisionId()); + const int64_t deltaBc = bTofExt.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); histos.fill(HIST("h2dTOFSignalCascadeBachelor"), bTof.tofSignal, deltaTimeBc); - bTof.collisionId = bTofExt.straCollisionId(); + // bTof.collisionId = bTofExt.straCollisionId(); bTof.tofExpMom = bTofExt.tofExpMom(); bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); bTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : bTofExt.tofEvTimeErr(); // bTof.tofEvTimeErr = bTofExt.tofEvTimeErr(); bTof.tofSignal = bTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); bTof.length = bTofExt.length(); - } + // } } cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.straCollisionId(), cascade, pTof, nTof, bTof); diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 1d293c9c620..dc4fa33acac 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -31,6 +31,7 @@ #include "PWGLF/DataModel/LFStrangenessMLTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "PWGUD/Core/SGSelector.h" #include "Common/CCDB/EventSelectionParams.h" @@ -114,6 +115,7 @@ struct derivedlambdakzeroanalysis { Configurable irSource{"irSource", "", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 2:CentFT0CVariant1, 3:CentMFT, 4:CentNGlobal, 5:CentFV0A)"}; Configurable doUPCanalysis{"doUPCanalysis", true, "Study V0s in hadronic and UPC collisions"}; + Configurable useMcCentrality{"useMcCentrality", false, "Use MC centrality?"}; Configurable doEventQA{"doEventQA", false, "do event QA histograms"}; Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; @@ -324,6 +326,7 @@ struct derivedlambdakzeroanalysis { ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, ""}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""}; ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality"}; + ConfigurableAxis axisCentralityFine{"axisCentralityFine", {101, 0.0f, 101.0f}, "Centrality"}; ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; ConfigurableAxis axisIRBinning{"axisIRBinning", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; ConfigurableAxis axisMultFT0M{"axisMultFT0M", {500, 0.0f, +100000.0f}, "Multiplicity FT0M"}; @@ -670,6 +673,13 @@ struct derivedlambdakzeroanalysis { // Initialise the RCTFlagsChecker rctFlagsChecker.init(rctConfigurations.cfgRCTLabel.value, rctConfigurations.cfgCheckZDC, rctConfigurations.cfgTreatLimitedAcceptanceAsBad); + // + if (doprocessAnalysedCollisions) { + histos.add("hEventPreSelection", "hEventPreSelection", kTH1D, {{2, -0.5f, +1.5f}}); + histos.get(HIST("hEventPreSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + histos.get(HIST("hEventPreSelection"))->GetXaxis()->SetBinLabel(2, "Preselected collisions"); + } + // Event Counters histos.add("hEventSelection", "hEventSelection", kTH1D, {{21, -0.5f, +20.5f}}); if (isRun3) { @@ -722,11 +732,14 @@ struct derivedlambdakzeroanalysis { } } - histos.add("hEventCentrality", "hEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); - histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); + histos.add("hEventCentrality", "hEventCentrality", kTH1D, {axisConfigurations.axisCentralityFine}); + if (useMcCentrality) { + histos.add("hEventVsGenCentrality", "hEventVsGenCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisCentralityFine}); + } + histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisNch}); if (doEventQA) { if (isRun3) { - histos.add("hEventSelectionVsCentrality", "hEventSelectionVsCentrality", kTH2D, {{21, -0.5f, +20.5f}, {101, 0.0f, 101.0f}}); + histos.add("hEventSelectionVsCentrality", "hEventSelectionVsCentrality", kTH2D, {{21, -0.5f, +20.5f}, axisConfigurations.axisCentralityFine}); histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(1, "All collisions"); histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); @@ -754,11 +767,11 @@ struct derivedlambdakzeroanalysis { histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(20, "Above max IR"); histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(21, "RCT flags"); - histos.add("hCentralityVsNGlobal", "hCentralityVsNGlobal", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); - histos.add("hEventCentVsMultFT0M", "hEventCentVsMultFT0M", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFT0M}); - histos.add("hEventCentVsMultFT0C", "hEventCentVsMultFT0C", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFT0C}); - histos.add("hEventCentVsMultNGlobal", "hEventCentVsMultNGlobal", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); - histos.add("hEventCentVsMultFV0A", "hEventCentVsMultFV0A", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFV0A}); + histos.add("hCentralityVsNGlobal", "hCentralityVsNGlobal", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisNch}); + histos.add("hEventCentVsMultFT0M", "hEventCentVsMultFT0M", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisMultFT0M}); + histos.add("hEventCentVsMultFT0C", "hEventCentVsMultFT0C", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisMultFT0C}); + histos.add("hEventCentVsMultNGlobal", "hEventCentVsMultNGlobal", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisNch}); + histos.add("hEventCentVsMultFV0A", "hEventCentVsMultFV0A", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisMultFV0A}); histos.add("hEventMultFT0MvsMultNGlobal", "hEventMultFT0MvsMultNGlobal", kTH2D, {axisConfigurations.axisMultFT0M, axisConfigurations.axisNch}); histos.add("hEventMultFT0CvsMultNGlobal", "hEventMultFT0CvsMultNGlobal", kTH2D, {axisConfigurations.axisMultFT0C, axisConfigurations.axisNch}); histos.add("hEventMultFV0AvsMultNGlobal", "hEventMultFV0AvsMultNGlobal", kTH2D, {axisConfigurations.axisMultFV0A, axisConfigurations.axisNch}); @@ -768,23 +781,23 @@ struct derivedlambdakzeroanalysis { } histos.add("hEventPVz", "hEventPVz", kTH1D, {{100, -20.0f, +20.0f}}); - histos.add("hCentralityVsPVz", "hCentralityVsPVz", kTH2D, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}}); + histos.add("hCentralityVsPVz", "hCentralityVsPVz", kTH2D, {axisConfigurations.axisCentralityFine, {100, -20.0f, +20.0f}}); if (doprocessGeneratedRun3 || doprocessGeneratedRun2) { histos.add("hEventPVzMC", "hEventPVzMC", kTH1D, {{100, -20.0f, +20.0f}}); - histos.add("hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2D, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}}); + histos.add("hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2D, {axisConfigurations.axisCentralityFine, {100, -20.0f, +20.0f}}); } histos.add("hEventOccupancy", "hEventOccupancy", kTH1D, {axisConfigurations.axisOccupancy}); - histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisOccupancy}); + histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisOccupancy}); if (doUPCanalysis) { histos.add("hGapSide", "Gap side; Entries", kTH1D, {{5, -0.5, 4.5}}); histos.add("hSelGapSide", "Selected gap side; Entries", kTH1D, {axisConfigurations.axisSelGap}); - histos.add("hEventCentralityVsSelGapSide", ";Centrality (%); Selected gap side", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisSelGap}); + histos.add("hEventCentralityVsSelGapSide", ";Centrality (%); Selected gap side", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisSelGap}); } histos.add("hInteractionRate", "hInteractionRate", kTH1D, {axisConfigurations.axisIRBinning}); - histos.add("hCentralityVsInteractionRate", "hCentralityVsInteractionRate", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisIRBinning}); + histos.add("hCentralityVsInteractionRate", "hCentralityVsInteractionRate", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisIRBinning}); histos.add("hInteractionRateVsOccupancy", "hInteractionRateVsOccupancy", kTH2D, {axisConfigurations.axisIRBinning, axisConfigurations.axisOccupancy}); @@ -847,6 +860,11 @@ struct derivedlambdakzeroanalysis { hSelectionV0s->GetXaxis()->SetBinLabel(selPhysPrimAntiLambda + 2, "Phys. prim. #bar{#Lambda}"); hSelectionV0s->GetXaxis()->SetBinLabel(selPhysPrimAntiLambda + 3, "Cand. selected"); + if (doTOFQA) { + histos.add("hCollisionTimes", "hCollisionTimes", kTH1F, {{2000, -1000.0f, 1000.0f}}); + histos.add("hCollisionTimesError", "hCollisionTimesError", kTH1F, {{2000, -1000.0f, 1000.0f}}); + } + // histograms versus mass if (analyseK0Short) { histos.add("h2dNbrOfK0ShortVsCentrality", "h2dNbrOfK0ShortVsCentrality", kTH2D, {axisConfigurations.axisCentrality, {10, -0.5f, 9.5f}}); @@ -874,6 +892,8 @@ struct derivedlambdakzeroanalysis { histos.add("K0Short/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); } if (doTOFQA) { + histos.add("K0Short/h1dPosNsigmaTOF", "h1dPosNsigmaTOF", kTH1D, {axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h1dNegNsigmaTOF", "h1dNegNsigmaTOF", kTH1D, {axisConfigurations.axisNsigmaTOF}); histos.add("K0Short/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); histos.add("K0Short/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); histos.add("K0Short/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); @@ -1245,24 +1265,40 @@ struct derivedlambdakzeroanalysis { } // ______________________________________________________ - // Return slicing output + // Return centrality estimate for a given collision. + // If takeMcCentrality is enabled, the centrality is taken from the MC collision; otherwise it is taken + // from the reconstructed collision. Returns -1 if no corresponding centrality estimator is found or if no MC collision is associated to the recoed collision. template - auto getCentralityRun3(TCollision const& collision) + auto getCentralityRun3(TCollision const& collision, bool takeMcCentrality) { - if (centralityEstimator == kCentFT0C) - return collision.centFT0C(); - else if (centralityEstimator == kCentFT0M) - return collision.centFT0M(); - else if (centralityEstimator == kCentFT0CVariant1) - return collision.centFT0CVariant1(); - else if (centralityEstimator == kCentMFT) - return collision.centMFT(); - else if (centralityEstimator == kCentNGlobal) - return collision.centNGlobal(); - else if (centralityEstimator == kCentFV0A) - return collision.centFV0A(); - - return -1.f; + // Helper lambda to extract centrality from any object exposing the cent* columns + auto extractCentrality = [this](auto const& coll) -> float { + switch (centralityEstimator) { + case kCentFT0C: return coll.centFT0C(); + case kCentFT0M: return coll.centFT0M(); + case kCentFT0CVariant1: return coll.centFT0CVariant1(); + // case kCentMFT: return coll.centMFT(); + case kCentNGlobal: return coll.centNGlobal(); + case kCentFV0A: return coll.centFV0A(); + default: return -1.f; + } + }; + + // check if we are in MC + if constexpr (requires { collision.straMCCollisionId(); }) { + if (takeMcCentrality) { // check if we need to extract centrality from recoed or generated collision + // if recoed collision has a MC collision, de-reference it and extract centrality from it + // otherwise return -1.f + if (collision.has_straMCCollision()) { + auto mcCollision = collision.template straMCCollision_as>(); + return extractCentrality(mcCollision); + } else { + return -1.f; + } + } + } + + return extractCentrality(collision); } // ______________________________________________________ @@ -1881,6 +1917,7 @@ struct derivedlambdakzeroanalysis { // __________________________________________ // main analysis if (passK0ShortSelections && analyseK0Short) { + LOG(info) << centrality << " " << v0.globalIndex(); histos.fill(HIST("GeneralQA/hSelectionV0s"), selPhysPrimAntiLambda + 2); // histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), v0.alpha(), v0.qtarm()); // cross-check histos.fill(HIST("h3dMassK0Short"), centrality, pt, invMassK0Short); @@ -1946,6 +1983,8 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h3dNegTPCsignalVsTrackPt"), centrality, v0.negativept(), negTrackExtra.tpcSignal()); } if (doTOFQA) { + histos.fill(HIST("K0Short/h1dPosNsigmaTOF"), v0.tofNSigmaK0PiPlus()); + histos.fill(HIST("K0Short/h1dNegNsigmaTOF"), v0.tofNSigmaK0PiMinus()); histos.fill(HIST("K0Short/h3dPosNsigmaTOF"), centrality, pt, v0.tofNSigmaK0PiPlus()); histos.fill(HIST("K0Short/h3dNegNsigmaTOF"), centrality, pt, v0.tofNSigmaK0PiMinus()); histos.fill(HIST("K0Short/h3dPosTOFdeltaT"), centrality, pt, v0.posTOFDeltaTK0Pi()); @@ -2264,7 +2303,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hEventSelection"), 0. /* all collisions */); if (doEventQA) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } histos.fill(HIST("hEventSelectionVsCentrality"), 0. /* all collisions */, centrality); } @@ -2649,7 +2688,7 @@ struct derivedlambdakzeroanalysis { void fillReconstructedEventProperties(TCollision const& collision, float& centrality, float& collisionOccupancy, double& interactionRate, int& gapSide, int& selGapSide) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // Fetch interaction rate only if required (in order to limit ccdb calls) interactionRate = !irSource.value.empty() ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource) * 1.e-3 : -1; @@ -2659,6 +2698,10 @@ struct derivedlambdakzeroanalysis { centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(doPPAnalysis ? collision.multFT0A() + collision.multFT0C() : collision.multFT0C())); } + if (useMcCentrality) { + histos.fill(HIST("hEventVsGenCentrality"), getCentralityRun3(collision, false), getCentralityRun3(collision, true)); + } + if (doUPCanalysis) { // gap side gapSide = collision.gapSide(); @@ -2672,6 +2715,10 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hSelGapSide"), selGapSide); histos.fill(HIST("hEventCentralityVsSelGapSide"), centrality, selGapSide <= 2 ? selGapSide : -1); } + if (doTOFQA) { + histos.fill(HIST("hCollisionTimes"), collision.eventTime()); + histos.fill(HIST("hCollisionTimesError"), collision.eventTimeErr()); + } } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -2747,7 +2794,7 @@ struct derivedlambdakzeroanalysis { if constexpr (run3) { // check if we are in Run 3 if (biggestNContribs < collision.multPVTotalContributors()) { biggestNContribs = collision.multPVTotalContributors(); - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } } else { // we are in Run 2: there should be only one collision in groupedCollisions centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); @@ -2922,7 +2969,7 @@ struct derivedlambdakzeroanalysis { bool correctCollision = false; int mcNch = -1; if (collision.has_straMCCollision()) { - auto mcCollision = collision.template straMCCollision_as>(); + auto mcCollision = collision.template straMCCollision_as>(); mcNch = mcCollision.multMCNParticlesEta05(); correctCollision = (v0MC.straMCCollisionId() == mcCollision.globalIndex()); } @@ -2967,7 +3014,7 @@ struct derivedlambdakzeroanalysis { if (std::abs(ymc) > v0Selections.rapidityCut) continue; - auto mcCollision = v0MC.template straMCCollision_as>(); + auto mcCollision = v0MC.template straMCCollision_as>(); if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { continue; } @@ -2985,7 +3032,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -3032,7 +3079,7 @@ struct derivedlambdakzeroanalysis { if (std::abs(ymc) > v0Selections.rapidityCut) continue; - auto mcCollision = cascMC.template straMCCollision_as>(); + auto mcCollision = cascMC.template straMCCollision_as>(); if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { continue; } @@ -3050,7 +3097,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -3138,44 +3185,54 @@ struct derivedlambdakzeroanalysis { } } + // ______________________________________________________ + // Simulated processing in Run 2 (subscribes to MC information too) + void processAnalysedCollisions(aod::StraSelections const& straSelections) + { + for (auto const& straSelection : straSelections) { + histos.get(HIST("hEventPreSelection"))->AddBinContent(1, straSelection.totalNbrOfCollisions() /* all collisions */); + histos.get(HIST("hEventPreSelection"))->AddBinContent(2, straSelection.totalNbrOfSelCollisions() /* preselected collisions */); + } + } + // ______________________________________________________ // Real data processing in Run 3 - no MC subscription - void processRealDataRun3(soa::Join::iterator const& collision, V0Candidates const& fullV0s, DauTracks const&) + void processRealDataRun3(soa::Join::iterator const& collision, V0Candidates const& fullV0s, DauTracks const&) { analyzeRecoedV0sInRealData(collision, fullV0s); } // ______________________________________________________ // Real data processing in Run 2 - no MC subscription - void processRealDataRun2(soa::Join::iterator const& collision, V0Candidates const& fullV0s, DauTracks const&) + void processRealDataRun2(soa::Join::iterator const& collision, V0Candidates const& fullV0s, DauTracks const&) { analyzeRecoedV0sInRealData(collision, fullV0s); } // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) { analyzeRecoedV0sInMonteCarlo(collision, fullV0s); } // ______________________________________________________ // Simulated processing in Run 2 (subscribes to MC information too) - void processMonteCarloRun2(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarloRun2(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) { analyzeRecoedV0sInMonteCarlo(collision, fullV0s); } // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) + void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) { analyzeGeneratedV0s(mcCollisions, V0MCCores, CascMCCores, collisions); } // ______________________________________________________ // Simulated processing in Run 2 (subscribes to MC information too) - void processGeneratedRun2(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) + void processGeneratedRun2(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) { analyzeGeneratedV0s(mcCollisions, V0MCCores, CascMCCores, collisions); } @@ -3245,6 +3302,7 @@ struct derivedlambdakzeroanalysis { } } + PROCESS_SWITCH(derivedlambdakzeroanalysis, processAnalysedCollisions, "process filtered events for bookkeeping", false); PROCESS_SWITCH(derivedlambdakzeroanalysis, processRealDataRun3, "process as if real data in Run 3", true); PROCESS_SWITCH(derivedlambdakzeroanalysis, processRealDataRun2, "process as if real data in Run 2", false); PROCESS_SWITCH(derivedlambdakzeroanalysis, processMonteCarloRun3, "process as if MC in Run 3", false); diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index 3079cab56f1..8b3897d29a6 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -32,6 +32,8 @@ #include #include #include +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -182,15 +184,51 @@ enum tableIndex { kV0Indices = 0, kCascFoundTags, nTables }; +// statics necessary for the configurables in this namespace +static constexpr int nPreselectParameters = 1; +static const std::vector preselectParticleNames{ + "Photon", + "K0s", + "Lambda", + "AntiLambda", + "XiMinus", + "XiPlus", + "OmegaMinus", + "OmegaPlus"}; + +static constexpr int nPreselectParticles = 8; +static const int defaultPreselectParameters[nPreselectParticles][nPreselectParameters]{ + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}}; + +// table index : match order above +enum preselectParticleIndex { kGamma = 0, + kK0Short, + kLambda, + kAntiLambda, + kXiMinus, + kXiPlus, + kOmegaMinus, + kOmegaPlus, + nPartTypes}; + enum V0PreSelection : uint8_t { selGamma = 0, selK0Short, selLambda, - selAntiLambda }; + selAntiLambda, + nSelV0Types}; enum CascPreSelection : uint8_t { selXiMinus = 0, selXiPlus, selOmegaMinus, - selOmegaPlus }; + selOmegaPlus, + nSelCascTypes}; static constexpr float defaultK0MassWindowParameters[1][4] = {{2.81882e-03, 1.14057e-03, 1.72138e-03, 5.00262e-01}}; static constexpr float defaultLambdaWindowParameters[1][4] = {{1.17518e-03, 1.24099e-04, 5.47937e-03, 3.08009e-01}}; @@ -357,9 +395,11 @@ struct cascadeConfigurables : o2::framework::ConfigurableGroup { // preselection options struct preSelectOpts : o2::framework::ConfigurableGroup { std::string prefix = "preSelectOpts"; - o2::framework::Configurable preselectOnlyDesiredV0s{"preselectOnlyDesiredV0s", false, "preselect only V0s with compatible TPC PID and mass info"}; - o2::framework::Configurable preselectOnlyDesiredCascades{"preselectOnlyDesiredCascades", false, "preselect only Cascades with compatible TPC PID and mass info"}; + o2::framework::Configurable> preselectedSpecies{"preselectedSpecies", + {defaultPreselectParameters[0], nPreselectParticles, nPreselectParameters, preselectParticleNames, parameterNames}, + "Preselect this species with compatible TPC PID and mass info: 0/1 is false/true"}; + std::vector mEnabledPreselectedSpecies; // Vector of enabled preselected particle species // lifetime preselection options // apply lifetime cuts to V0 and cascade candidates // unit of measurement: centimeters @@ -382,6 +422,22 @@ struct preSelectOpts : o2::framework::ConfigurableGroup { o2::framework::Configurable maxTPCpidNsigma{"maxTPCpidNsigma", 5.0, "Maximum TPC PID N sigma (in abs value)"}; }; +// collision preselection options +struct eventSelectOpts : o2::framework::ConfigurableGroup { + std::string prefix = "eventSelectOpts"; // JSON group name + o2::framework::Configurable fillOnlySelectedCollisions{"fillOnlySelectedCollisions", false, "Fill only tables for selected collisions"}; + o2::framework::Configurable requireTriggerTVX{"requireTriggerTVX", false, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only)"}; + o2::framework::Configurable rejectITSROFBorder{"rejectITSROFBorder", false, "reject events at ITS ROF border (Run 3 only)"}; + o2::framework::Configurable rejectTFBorder{"rejectTFBorder", false, "reject events at TF border (Run 3 only)"}; + o2::framework::Configurable rejectSameBunchPileup{"rejectSameBunchPileup", false, "reject collisions in case of pileup with another collision in the same foundBC (Run 3 only)"}; + o2::framework::Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + + o2::framework::Configurable cfgApplyRCTrequirement{"cfgApplyRCTrequirement", false, "Apply RCT requirement?"}; + o2::framework::Configurable cfgRCTLabel{"cfgRCTLabel", "", "Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo)"}; + o2::framework::Configurable cfgCheckZDC{"cfgCheckZDC", false, "Include ZDC flags in the bit selection (for Pb-Pb only)"}; + o2::framework::Configurable cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"}; +}; + class BuilderModule { public: @@ -390,6 +446,37 @@ class BuilderModule // constructor } + template + bool isCollisionAccepted(TCollision collision) + // check whether the collision passes our collision selections + { + if (eventSelectOpts.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + + if (eventSelectOpts.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + + if (eventSelectOpts.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + + if (std::abs(collision.posZ()) > eventSelectOpts.maxZVtxPosition) { + return false; + } + + if (eventSelectOpts.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + + if (!eventSelectOpts.cfgApplyRCTrequirement && !rctFlagsChecker(collision)) { + return false; + } + + return true; + } + // mass windows float getMassSigmaK0Short(float pt) { @@ -521,9 +608,12 @@ class BuilderModule o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::eventSelectOpts eventSelectOpts; - template - void init(TBaseConfigurables const& inputBaseOpts, TV0Configurables const& inputV0BuilderOpts, TCascadeConfigurables const& inputCascadeBuilderOpts, TPreSelOpts const& inputPreSelectOpts, THistoRegistry& histos, TInitContext& context) + o2::aod::rctsel::RCTFlagsChecker rctFlagsChecker; + + template + void init(TBaseConfigurables const& inputBaseOpts, TV0Configurables const& inputV0BuilderOpts, TCascadeConfigurables const& inputCascadeBuilderOpts, TPreSelOpts const& inputPreSelectOpts, TPreEventSelOpts const& inputEventSelectOpts, THistoRegistry& histos, TInitContext& context) { // read in configurations from the task where it's used // could be grouped even further, but should work @@ -531,6 +621,7 @@ class BuilderModule v0BuilderOpts = inputV0BuilderOpts; cascadeBuilderOpts = inputCascadeBuilderOpts; preSelectOpts = inputPreSelectOpts; + eventSelectOpts = inputEventSelectOpts; baseOpts.mEnabledTables.resize(nTables, 0); @@ -546,6 +637,7 @@ class BuilderModule if (f == 1) { baseOpts.mEnabledTables[i] = 1; listOfRequestors[i] = "manual enabling"; + nEnabledTables++; } if (f == -1) { // autodetect this table in other devices @@ -559,6 +651,8 @@ class BuilderModule tableNameWithVersion += Form("_%03d", version); } if (input.matcher.binding == tableNameWithVersion) { + if (device.name == "strangenesstofpid") + continue; LOGF(info, "Device %s has subscribed to %s (version %i)", device.name, tableNames[i], version); listOfRequestors[i].Append(Form("%s ", device.name.c_str())); baseOpts.mEnabledTables[i] = 1; @@ -586,7 +680,16 @@ class BuilderModule hDeduplicationStatistics->GetXaxis()->SetBinLabel(2, "Deduplicated V0s"); } - if (preSelectOpts.preselectOnlyDesiredV0s.value == true) { + preSelectOpts.mEnabledPreselectedSpecies.resize(nPreselectParticles, 0); + LOGF(info, "Checking if preselections on V0s and cascades are required"); + for (int i = 0; i < nPreselectParticles; i++) { + if (preSelectOpts.preselectedSpecies->get(preselectParticleNames[i].c_str(), "enable")) { + preSelectOpts.mEnabledPreselectedSpecies[i] = 1; + LOGF(info, " ---> Preselection of %s enabled", preselectParticleNames[i]); + } + } + + if (preSelectOpts.mEnabledPreselectedSpecies[kGamma] || preSelectOpts.mEnabledPreselectedSpecies[kK0Short] || preSelectOpts.mEnabledPreselectedSpecies[kLambda] || preSelectOpts.mEnabledPreselectedSpecies[kAntiLambda]) { auto hPreselectionV0s = histos.template add("hPreselectionV0s", "hPreselectionV0s", o2::framework::HistType::kTH1D, {{16, -0.5f, 15.5f}}); hPreselectionV0s->GetXaxis()->SetBinLabel(1, "Not preselected"); hPreselectionV0s->GetXaxis()->SetBinLabel(2, "#gamma"); @@ -606,7 +709,7 @@ class BuilderModule hPreselectionV0s->GetXaxis()->SetBinLabel(16, "#gamma, K^{0}_{S}, #Lambda, #bar{#Lambda}"); } - if (preSelectOpts.preselectOnlyDesiredCascades.value == true) { + if (preSelectOpts.mEnabledPreselectedSpecies[kXiMinus] || preSelectOpts.mEnabledPreselectedSpecies[kXiPlus] || preSelectOpts.mEnabledPreselectedSpecies[kOmegaMinus] || preSelectOpts.mEnabledPreselectedSpecies[kOmegaPlus]) { auto hPreselectionCascades = histos.template add("hPreselectionCascades", "hPreselectionCascades", o2::framework::HistType::kTH1D, {{16, -0.5f, 15.5f}}); hPreselectionCascades->GetXaxis()->SetBinLabel(1, "Not preselected"); hPreselectionCascades->GetXaxis()->SetBinLabel(2, "#Xi^{-}"); @@ -712,6 +815,11 @@ class BuilderModule // Set option to refit with material corrections straHelper.fitter.setRefitWithMatCorr(baseOpts.refitWithMaterialCorrection.value); + + // Initialise the RCTFlagsChecker + if (eventSelectOpts.cfgApplyRCTrequirement) { + rctFlagsChecker.init(eventSelectOpts.cfgRCTLabel.value, eventSelectOpts.cfgCheckZDC, eventSelectOpts.cfgTreatLimitedAcceptanceAsBad); + } } // for sorting @@ -1378,6 +1486,9 @@ class BuilderModule pvX = collision.posX(); pvY = collision.posY(); pvZ = collision.posZ(); + if (eventSelectOpts.fillOnlySelectedCollisions && !isCollisionAccepted(collision)) { + continue; + } if (v0BuilderOpts.generatePhotonCandidates && v0BuilderOpts.moveTPCOnlyTracks && collision.has_bc()) { mVDriftMgr.update(collision.template bc_as().timestamp()); } @@ -1419,65 +1530,102 @@ class BuilderModule } } - if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, baseOpts.mEnabledTables[kV0Covs], v0BuilderOpts.generatePhotonCandidates)) { - products.v0dataLink(-1, -1); - continue; - } - if constexpr (requires { posTrack.tpcNSigmaEl(); }) { - if (preSelectOpts.preselectOnlyDesiredV0s) { - float lPt = RecoDecay::sqrtSumOfSquares( - straHelper.v0.positiveMomentum[0] + straHelper.v0.negativeMomentum[0], - straHelper.v0.positiveMomentum[1] + straHelper.v0.negativeMomentum[1]); - - float lPtot = RecoDecay::sqrtSumOfSquares( - straHelper.v0.positiveMomentum[0] + straHelper.v0.negativeMomentum[0], - straHelper.v0.positiveMomentum[1] + straHelper.v0.negativeMomentum[1], - straHelper.v0.positiveMomentum[2] + straHelper.v0.negativeMomentum[2]); - - float lLengthTraveled = RecoDecay::sqrtSumOfSquares( - straHelper.v0.position[0] - pvX, - straHelper.v0.position[1] - pvY, - straHelper.v0.position[2] - pvZ); - - uint8_t maskV0Preselection = 0; - - if ( // photon PID, mass, lifetime selection + std::vector preSelectedPIDV0s; + if (preSelectOpts.mEnabledPreselectedSpecies[kGamma] || preSelectOpts.mEnabledPreselectedSpecies[kK0Short] || preSelectOpts.mEnabledPreselectedSpecies[kLambda] || preSelectOpts.mEnabledPreselectedSpecies[kAntiLambda]) { + if constexpr (requires { posTrack.tpcNSigmaEl(); }) { // check PID for each particle species and mark which one passes the check + preSelectedPIDV0s.resize(nSelV0Types, 0); + if ( // photon PID selection + preSelectOpts.mEnabledPreselectedSpecies[kGamma] && std::abs(posTrack.tpcNSigmaEl()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaEl()) < preSelectOpts.maxTPCpidNsigma && - std::abs(straHelper.v0.massGamma) < preSelectOpts.massCutPhoton) { - BITSET(maskV0Preselection, selGamma); + std::abs(negTrack.tpcNSigmaEl()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDV0s[kGamma] = 1; } - if ( // K0Short PID, mass, lifetime selection + if ( // K0Short PID selection + preSelectOpts.mEnabledPreselectedSpecies[kK0Short] && std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassKaonNeutral * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutK0S") && - std::abs(straHelper.v0.massK0Short - o2::constants::physics::MassKaonNeutral) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaK0Short(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskV0Preselection, selK0Short); + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDV0s[kK0Short] = 1; } - if ( // Lambda PID, mass, lifetime selection + if ( // Lambda PID selection + preSelectOpts.mEnabledPreselectedSpecies[kLambda] && std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassLambda * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && - std::abs(straHelper.v0.massLambda - o2::constants::physics::MassLambda) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaLambda(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskV0Preselection, selLambda); + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDV0s[kLambda] = 1; } if ( // antiLambda PID, mass, lifetime selection + preSelectOpts.mEnabledPreselectedSpecies[kAntiLambda] && std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassLambda * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && - std::abs(straHelper.v0.massAntiLambda - o2::constants::physics::MassLambda) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaLambda(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskV0Preselection, selAntiLambda); + std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDV0s[kAntiLambda] = 1; } - histos.fill(HIST("hPreselectionV0s"), maskV0Preselection); - - if (maskV0Preselection == 0) { + // if particle species pass the PID selections, move onto the next candidates + if (!preSelectedPIDV0s[kGamma] && !preSelectedPIDV0s[kK0Short] && !preSelectedPIDV0s[kLambda] && !preSelectedPIDV0s[kAntiLambda]) { + histos.fill(HIST("hPreselectionV0s"), 0); products.v0dataLink(-1, -1); continue; } + } else { // if no PID information is available, do not cut on it and mark all PID checks as true + preSelectedPIDV0s.resize(nSelV0Types, 1); + } + } + + if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, baseOpts.mEnabledTables[kV0Covs], v0BuilderOpts.generatePhotonCandidates)) { + products.v0dataLink(-1, -1); + continue; + } + if (preSelectOpts.mEnabledPreselectedSpecies[kGamma] || preSelectOpts.mEnabledPreselectedSpecies[kK0Short] || preSelectOpts.mEnabledPreselectedSpecies[kLambda] || preSelectOpts.mEnabledPreselectedSpecies[kAntiLambda]) { + float lPt = RecoDecay::sqrtSumOfSquares( + straHelper.v0.positiveMomentum[0] + straHelper.v0.negativeMomentum[0], + straHelper.v0.positiveMomentum[1] + straHelper.v0.negativeMomentum[1]); + + float lPtot = RecoDecay::sqrtSumOfSquares( + straHelper.v0.positiveMomentum[0] + straHelper.v0.negativeMomentum[0], + straHelper.v0.positiveMomentum[1] + straHelper.v0.negativeMomentum[1], + straHelper.v0.positiveMomentum[2] + straHelper.v0.negativeMomentum[2]); + + float lLengthTraveled = RecoDecay::sqrtSumOfSquares( + straHelper.v0.position[0] - pvX, + straHelper.v0.position[1] - pvY, + straHelper.v0.position[2] - pvZ); + + uint8_t maskV0Preselection = 0; + + if ( // photon PID, mass, lifetime selection + preSelectOpts.mEnabledPreselectedSpecies[kGamma] && preSelectedPIDV0s[kGamma] && + std::abs(straHelper.v0.massGamma) < preSelectOpts.massCutPhoton) { + BITSET(maskV0Preselection, selGamma); + } + + if ( // K0Short PID, mass, lifetime selection + preSelectOpts.mEnabledPreselectedSpecies[kK0Short] && preSelectedPIDV0s[kK0Short] && + o2::constants::physics::MassKaonNeutral * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutK0S") && + std::abs(straHelper.v0.massK0Short - o2::constants::physics::MassKaonNeutral) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaK0Short(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskV0Preselection, selK0Short); + } + + if ( // Lambda PID, mass, lifetime selection + preSelectOpts.mEnabledPreselectedSpecies[kLambda] && preSelectedPIDV0s[kLambda] && + o2::constants::physics::MassLambda * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + std::abs(straHelper.v0.massLambda - o2::constants::physics::MassLambda) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaLambda(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskV0Preselection, selLambda); + } + + if ( // antiLambda PID, mass, lifetime selection + preSelectOpts.mEnabledPreselectedSpecies[kAntiLambda] && preSelectedPIDV0s[kAntiLambda] && + o2::constants::physics::MassLambda * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + std::abs(straHelper.v0.massAntiLambda - o2::constants::physics::MassLambda) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaLambda(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskV0Preselection, selAntiLambda); + } + + histos.fill(HIST("hPreselectionV0s"), maskV0Preselection); + + if (maskV0Preselection == 0) { + products.v0dataLink(-1, -1); + continue; } } if (v0Map[iv0] == -1 && baseOpts.useV0BufferForCascades) { @@ -1915,10 +2063,64 @@ class BuilderModule pvX = collision.posX(); pvY = collision.posY(); pvZ = collision.posZ(); + if (eventSelectOpts.fillOnlySelectedCollisions && !isCollisionAccepted(collision)) { + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; + } } auto const& posTrack = tracks.rawIteratorAt(cascade.posTrackId); auto const& negTrack = tracks.rawIteratorAt(cascade.negTrackId); auto const& bachTrack = tracks.rawIteratorAt(cascade.bachTrackId); + + std::vector preSelectedPIDCascades; + if (preSelectOpts.mEnabledPreselectedSpecies[kXiMinus] || preSelectOpts.mEnabledPreselectedSpecies[kXiPlus] || preSelectOpts.mEnabledPreselectedSpecies[kOmegaMinus] || preSelectOpts.mEnabledPreselectedSpecies[kOmegaPlus]) { + if constexpr (requires { posTrack.tpcNSigmaEl(); }) { // check PID for each particle species and mark which one passes the check + preSelectedPIDCascades.resize(nPartTypes, 0); + if ( // XiMinus PID selection + preSelectOpts.mEnabledPreselectedSpecies[kXiMinus] && + std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDCascades[kXiMinus] = 1; + } + + if ( // XiPlus PID selection + preSelectOpts.mEnabledPreselectedSpecies[kXiPlus] && + std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDCascades[kXiPlus] = 1; + } + + if ( // OmegaMinus PID selection + preSelectOpts.mEnabledPreselectedSpecies[kOmegaMinus] && + std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaKa()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDCascades[kOmegaMinus] = 1; + } + + if ( // OmegaPlus PID selection + preSelectOpts.mEnabledPreselectedSpecies[kOmegaPlus] && + std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaKa()) < preSelectOpts.maxTPCpidNsigma) { + preSelectedPIDCascades[kOmegaPlus] = 1; + } + + // if particle species pass the PID selections, move onto the next candidates + if (!preSelectedPIDCascades[kXiMinus] && !preSelectedPIDCascades[kXiPlus] && !preSelectedPIDCascades[kOmegaMinus] && !preSelectedPIDCascades[kOmegaPlus]) { + histos.fill(HIST("hPreselectionCascades"), 0); + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; + } + } else { // if no PID information is available, do not cut on it and mark all PID checks as true + preSelectedPIDCascades.resize(nPartTypes, 1); + } + } + if (baseOpts.useV0BufferForCascades) { // this processing path uses a buffer of V0s so that no // additional minimization step is redone. It consumes less @@ -1962,85 +2164,71 @@ class BuilderModule } nCascades++; - if constexpr (requires { posTrack.tpcNSigmaEl(); }) { - if (preSelectOpts.preselectOnlyDesiredCascades) { - float lPt = RecoDecay::sqrtSumOfSquares( - straHelper.cascade.bachelorMomentum[0] + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], - straHelper.cascade.bachelorMomentum[1] + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1]); - - float lPtot = RecoDecay::sqrtSumOfSquares( - straHelper.cascade.bachelorMomentum[0] + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], - straHelper.cascade.bachelorMomentum[1] + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1], - straHelper.cascade.bachelorMomentum[2] + straHelper.cascade.positiveMomentum[2] + straHelper.cascade.negativeMomentum[2]); - - float lV0Ptot = RecoDecay::sqrtSumOfSquares( - straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], - straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1], - straHelper.cascade.positiveMomentum[2] + straHelper.cascade.negativeMomentum[2]); - - float lLengthTraveled = RecoDecay::sqrtSumOfSquares( - straHelper.cascade.cascadePosition[0] - pvX, - straHelper.cascade.cascadePosition[1] - pvY, - straHelper.cascade.cascadePosition[2] - pvZ); - - float lV0LengthTraveled = RecoDecay::sqrtSumOfSquares( - straHelper.cascade.v0Position[0] - straHelper.cascade.cascadePosition[0], - straHelper.cascade.v0Position[1] - straHelper.cascade.cascadePosition[1], - straHelper.cascade.v0Position[2] - straHelper.cascade.cascadePosition[2]); - - uint8_t maskCascadePreselection = 0; - - if ( // XiMinus PID and mass selection - straHelper.cascade.charge < 0 && - std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - std::abs(bachTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && - o2::constants::physics::MassXiMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutXi") && - std::abs(straHelper.cascade.massXi - o2::constants::physics::MassXiMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaXi(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskCascadePreselection, selXiMinus); - } + if (preSelectOpts.mEnabledPreselectedSpecies[kXiMinus] || preSelectOpts.mEnabledPreselectedSpecies[kXiPlus] || preSelectOpts.mEnabledPreselectedSpecies[kOmegaMinus] || preSelectOpts.mEnabledPreselectedSpecies[kOmegaPlus]) { + float lPt = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.bachelorMomentum[0] + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], + straHelper.cascade.bachelorMomentum[1] + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1]); + + float lPtot = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.bachelorMomentum[0] + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], + straHelper.cascade.bachelorMomentum[1] + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1], + straHelper.cascade.bachelorMomentum[2] + straHelper.cascade.positiveMomentum[2] + straHelper.cascade.negativeMomentum[2]); + + float lV0Ptot = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1], + straHelper.cascade.positiveMomentum[2] + straHelper.cascade.negativeMomentum[2]); + + float lLengthTraveled = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.cascadePosition[0] - pvX, + straHelper.cascade.cascadePosition[1] - pvY, + straHelper.cascade.cascadePosition[2] - pvZ); + + float lV0LengthTraveled = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.v0Position[0] - straHelper.cascade.cascadePosition[0], + straHelper.cascade.v0Position[1] - straHelper.cascade.cascadePosition[1], + straHelper.cascade.v0Position[2] - straHelper.cascade.cascadePosition[2]); + + uint8_t maskCascadePreselection = 0; + + if ( // XiMinus PID and mass selection + preSelectOpts.mEnabledPreselectedSpecies[kXiMinus] && straHelper.cascade.charge < 0 && preSelectedPIDCascades[kXiMinus] && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassXiMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutXi") && + std::abs(straHelper.cascade.massXi - o2::constants::physics::MassXiMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaXi(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selXiMinus); + } - if ( // XiPlus PID and mass selection - straHelper.cascade.charge > 0 && - std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && - std::abs(bachTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && - o2::constants::physics::MassXiMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutXi") && - std::abs(straHelper.cascade.massXi - o2::constants::physics::MassXiMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaXi(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskCascadePreselection, selXiPlus); - } + if ( // XiPlus PID and mass selection + preSelectOpts.mEnabledPreselectedSpecies[kXiPlus] && straHelper.cascade.charge > 0 && preSelectedPIDCascades[kXiPlus] && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassXiMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutXi") && + std::abs(straHelper.cascade.massXi - o2::constants::physics::MassXiMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaXi(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selXiPlus); + } - if ( // OmegaMinus PID and mass selection - straHelper.cascade.charge < 0 && - std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - std::abs(bachTrack.tpcNSigmaKa()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && - o2::constants::physics::MassOmegaMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutOmega") && - std::abs(straHelper.cascade.massOmega - o2::constants::physics::MassOmegaMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaOmega(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskCascadePreselection, selOmegaMinus); - } + if ( // OmegaMinus PID and mass selection + preSelectOpts.mEnabledPreselectedSpecies[kOmegaMinus] && straHelper.cascade.charge < 0 && preSelectedPIDCascades[kOmegaMinus] && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassOmegaMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutOmega") && + std::abs(straHelper.cascade.massOmega - o2::constants::physics::MassOmegaMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaOmega(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selOmegaMinus); + } - if ( // OmegaPlus PID and mass selection - straHelper.cascade.charge > 0 && - std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && - std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && - std::abs(bachTrack.tpcNSigmaKa()) < preSelectOpts.maxTPCpidNsigma && - o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && - o2::constants::physics::MassOmegaMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutOmega") && - std::abs(straHelper.cascade.massOmega - o2::constants::physics::MassOmegaMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaOmega(lPt) + preSelectOpts.massWindowSafetyMargin) { - BITSET(maskCascadePreselection, selOmegaPlus); - } + if ( // OmegaPlus PID and mass selection + preSelectOpts.mEnabledPreselectedSpecies[kOmegaPlus] && straHelper.cascade.charge > 0 && preSelectedPIDCascades[kOmegaPlus] && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassOmegaMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutOmega") && + std::abs(straHelper.cascade.massOmega - o2::constants::physics::MassOmegaMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaOmega(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selOmegaPlus); + } - histos.fill(HIST("hPreselectionCascades"), maskCascadePreselection); + histos.fill(HIST("hPreselectionCascades"), maskCascadePreselection); - if (maskCascadePreselection == 0) { - products.cascdataLink(-1); - interlinks.cascadeToCascCores.push_back(-1); - continue; - } + if (maskCascadePreselection == 0) { + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; } } @@ -2338,6 +2526,11 @@ class BuilderModule pvX = collision.posX(); pvY = collision.posY(); pvZ = collision.posZ(); + if (eventSelectOpts.fillOnlySelectedCollisions && !isCollisionAccepted(collision)) { + products.kfcascdataLink(-1); + interlinks.cascadeToKFCascCores.push_back(-1); + continue; + } } auto const& posTrack = tracks.rawIteratorAt(cascade.posTrackId); auto const& negTrack = tracks.rawIteratorAt(cascade.negTrackId); @@ -2437,6 +2630,9 @@ class BuilderModule pvX = collision.posX(); pvY = collision.posY(); pvZ = collision.posZ(); + if (eventSelectOpts.fillOnlySelectedCollisions && !isCollisionAccepted(collision)) { + continue; + } } auto const& cascade = cascadeTrack.cascade(); auto const& v0 = cascade.v0(); From 169e8d7e67d3455fc095f062c9f2ecfe73221968 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:13:33 +0200 Subject: [PATCH 2/9] Remove developments on StraMCMults --- PWGLF/DataModel/LFStrangenessTables.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index b59c5564deb..762cddc8eea 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -420,10 +420,8 @@ DECLARE_SOA_TABLE(StraMCCollMults_000, "AOD", "STRAMCCOLLMULTS", //! MC collisio mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, o2::soa::Marker<2>); DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_001, "AOD", "STRAMCCOLLMULTS", 1, //! MC collision multiplicities mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles); -DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_002, "AOD", "STRAMCCOLLMULTS", 2, //! MC collision multiplicities - mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCFV0A, mult::MultMCFDDA, mult::MultMCFDDC, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles); -using StraMCCollMults = StraMCCollMults_002; +using StraMCCollMults = StraMCCollMults_001; namespace dautrack { From 7db48dea2e1ba85dfc14bdf6206e78d6d096cb66 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:15:26 +0200 Subject: [PATCH 3/9] Remove unnecessary converters --- .../Strangeness/Converters/CMakeLists.txt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index e1d42ea534a..4e33d765cb9 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -139,11 +139,6 @@ o2physics_add_dpl_workflow(stramccollisionconverter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(stramccollisionconverter2 - SOURCES stramccollisionconverter2.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(strastampsconverter SOURCES strastampsconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -164,11 +159,6 @@ o2physics_add_dpl_workflow(stramccollmultconverter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(stramccollmultconverter2 - SOURCES stramccollmultconverter2.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(zdcneutronsconverter SOURCES zdcneutronsconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore From 72ba06887cdb6e1fb2cc51416567734ec32bef53 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:16:18 +0200 Subject: [PATCH 4/9] Add stramccollisionconverter2 workflow to CMakeLists --- PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index 4e33d765cb9..484d98f1126 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -159,6 +159,11 @@ o2physics_add_dpl_workflow(stramccollmultconverter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(stramccollisionconverter2 + SOURCES stramccollisionconverter2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(zdcneutronsconverter SOURCES zdcneutronsconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore From e850d6ad6cf751a3c5e56b434cc96c84d635c915 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:21:19 +0200 Subject: [PATCH 5/9] Remove old comments --- .../Strangeness/strangenesstofpid.cxx | 151 +++++++----------- 1 file changed, 62 insertions(+), 89 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 241f682b7b2..4adbab37572 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -1784,7 +1784,6 @@ struct strangenesstofpid { v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.collisionId(), V0, pTof, nTof); if (doNSigmas) { - LOG(info) << collisionV0.bcId() << " " << collisionV0.globalIndex() << " " << collisionV0.posX() << " " << collisionV0.posY() << " " << collisionV0.posZ() << " ; TOF K0s pos: " << v0tof.nSigmaPositiveK0ShortPi << " = " << v0tof.deltaTimePositiveK0ShortPi << " - " << hMeanPosK0Pi->Interpolate(V0.p()) << " / " << hSigmaPosK0Pi->Interpolate(V0.p()) << " ; TOF K0s neg: " << v0tof.nSigmaNegativeK0ShortPi << " = " << v0tof.deltaTimeNegativeK0ShortPi << " - " << hMeanNegK0Pi->Interpolate(V0.p()) << " / " << hSigmaNegK0Pi->Interpolate(V0.p()) << " ; " << pTof.tofSignal << " - " << pTof.tofEvTime << " - " << v0tof.timeK0Short << " + " << v0tof.timePositivePi; v0tofnsigmas( v0tof.nSigmaPositiveLambdaPr, v0tof.nSigmaNegativeLambdaPi, v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, @@ -1993,24 +1992,19 @@ struct strangenesstofpid { pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); if (tofIndices[V0.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); - - // if (pTofExt.straCollisionId() >= 0) { - // extract BC for BC time shift - // auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); - const int64_t deltaBc = pTofExt.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; - histos.fill(HIST("hV0PositiveBCShift"), deltaTimeBc); - deltaTimeBcPos = deltaTimeBc; - - // assign variables - // pTof.collisionId = pTofExt.straCollisionId(); - pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); - pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); - // pTof.tofEvTimeErr = pTofExt.tofEvTimeErr(); - pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); - pTof.length = pTofExt.length(); - // } + // extract BC for BC time shift + const int64_t deltaBc = pTofExt.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hV0PositiveBCShift"), deltaTimeBc); + deltaTimeBcPos = deltaTimeBc; + + // assign variables + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); + pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); + // pTof.tofEvTimeErr = pTofExt.tofEvTimeErr(); + pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + pTof.length = pTofExt.length(); } nTof.hasITS = nTra.hasITS(); @@ -2020,24 +2014,19 @@ struct strangenesstofpid { nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); if (tofIndices[V0.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); - - // if (nTofExt.straCollisionId() >= 0) { - // extract BC for BC time shift - // auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); - const int64_t deltaBc = nTofExt.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; - histos.fill(HIST("hV0NegativeBCShift"), deltaTimeBc); - deltaTimeBcNeg = deltaTimeBc; - - // assign variables - // nTof.collisionId = nTofExt.straCollisionId(); - nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); - nTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : nTofExt.tofEvTimeErr(); - // nTof.tofEvTimeErr = nTofExt.tofEvTimeErr(); - nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); - nTof.length = nTofExt.length(); - // } + // extract BC for BC time shift + const int64_t deltaBc = nTofExt.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hV0NegativeBCShift"), deltaTimeBc); + deltaTimeBcNeg = deltaTimeBc; + + // assign variables + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); + nTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : nTofExt.tofEvTimeErr(); + // nTof.tofEvTimeErr = nTofExt.tofEvTimeErr(); + nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + nTof.length = nTofExt.length(); } if (pTof.hasTOF) { histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); @@ -2052,7 +2041,6 @@ struct strangenesstofpid { v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.straCollisionId(), V0, pTof, nTof); if (doNSigmas) { - LOG(info) << collision.eventTime() << " " << collision.globalIndex() << " " << collision.posX() << " " << collision.posY() << " " << collision.posZ() << " ; TOF K0s pos: " << v0tof.nSigmaPositiveK0ShortPi << " = " << v0tof.deltaTimePositiveK0ShortPi << " - " << hMeanPosK0Pi->Interpolate(V0.p()) << " / " << hSigmaPosK0Pi->Interpolate(V0.p()) << " ; TOF K0s neg: " << v0tof.nSigmaNegativeK0ShortPi << " = " << v0tof.deltaTimeNegativeK0ShortPi << " - " << hMeanNegK0Pi->Interpolate(V0.p()) << " / " << hSigmaNegK0Pi->Interpolate(V0.p()) << " ; " << pTof.tofSignal << " ( " << (pTof.collisionId >= 0 ? (dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]).tofSignal()) : 0 ) << " + " << deltaTimeBcPos << " " << pTof.collisionId << " " << (pTof.collisionId >= 0 ? collisions.rawIteratorAt(pTof.collisionId).globalBC() : -1 ) << " - " << collision.globalBC()<< " " << V0.posTrackExtraId() << " ) " << " - " << pTof.tofEvTime << " - " << v0tof.timeK0Short << " + " << v0tof.timePositivePi; v0tofnsigmas( v0tof.nSigmaPositiveLambdaPr, v0tof.nSigmaNegativeLambdaPi, v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, @@ -2091,23 +2079,18 @@ struct strangenesstofpid { pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); if (tofIndices[cascade.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); - - // if (pTofExt.straCollisionId() >= 0) { - // extract BC for BC time shift - // auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); - const int64_t deltaBc = pTofExt.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; - histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); - histos.fill(HIST("h2dTOFSignalCascadePositive"), pTof.tofSignal, deltaTimeBc); - - // pTof.collisionId = pTofExt.straCollisionId(); - pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); - pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); - // pTof.tofEvTimeErr = pTofExt.tofEvTimeErr(); - pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); - pTof.length = pTofExt.length(); - // } + // extract BC for BC time shift + const int64_t deltaBc = pTofExt.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); + histos.fill(HIST("h2dTOFSignalCascadePositive"), pTof.tofSignal, deltaTimeBc); + + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); + pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); + // pTof.tofEvTimeErr = pTofExt.tofEvTimeErr(); + pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + pTof.length = pTofExt.length(); } nTof.hasITS = nTra.hasITS(); @@ -2117,23 +2100,18 @@ struct strangenesstofpid { nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); if (tofIndices[cascade.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); - - // if (nTofExt.straCollisionId() >= 0) { - // extract BC for BC time shift - // auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); - const int64_t deltaBc = nTofExt.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; - histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); - histos.fill(HIST("h2dTOFSignalCascadeNegative"), nTof.tofSignal, deltaTimeBc); - - // nTof.collisionId = nTofExt.straCollisionId(); - nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); - nTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTimeErr(); - // nTof.tofEvTimeErr = nTofExt.tofEvTimeErr(); - nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); - nTof.length = nTofExt.length(); - // } + // extract BC for BC time shift + const int64_t deltaBc = nTofExt.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); + histos.fill(HIST("h2dTOFSignalCascadeNegative"), nTof.tofSignal, deltaTimeBc); + + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); + nTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTimeErr(); + // nTof.tofEvTimeErr = nTofExt.tofEvTimeErr(); + nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + nTof.length = nTofExt.length(); } bTof.hasITS = bTra.hasITS(); @@ -2143,23 +2121,18 @@ struct strangenesstofpid { bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); if (tofIndices[cascade.bachTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); - - // if (bTofExt.straCollisionId() >= 0) { - // extract BC for BC time shift - // auto collisionTrack = collisions.rawIteratorAt(bTofExt.straCollisionId()); - const int64_t deltaBc = bTofExt.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; - histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); - histos.fill(HIST("h2dTOFSignalCascadeBachelor"), bTof.tofSignal, deltaTimeBc); - - // bTof.collisionId = bTofExt.straCollisionId(); - bTof.tofExpMom = bTofExt.tofExpMom(); - bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); - bTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : bTofExt.tofEvTimeErr(); - // bTof.tofEvTimeErr = bTofExt.tofEvTimeErr(); - bTof.tofSignal = bTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); - bTof.length = bTofExt.length(); - // } + // extract BC for BC time shift + const int64_t deltaBc = bTofExt.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); + histos.fill(HIST("h2dTOFSignalCascadeBachelor"), bTof.tofSignal, deltaTimeBc); + + bTof.tofExpMom = bTofExt.tofExpMom(); + bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); + bTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : bTofExt.tofEvTimeErr(); + // bTof.tofEvTimeErr = bTofExt.tofEvTimeErr(); + bTof.tofSignal = bTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + bTof.length = bTofExt.length(); } cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.straCollisionId(), cascade, pTof, nTof, bTof); From 61f8979c607c590117e618c69bb80fad03f22cd1 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:27:40 +0200 Subject: [PATCH 6/9] Remove old code --- PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index beedb3c3873..16f3a406d30 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -839,7 +839,6 @@ struct strangederivedbuilder { products.strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), mccollision.impactParameter(), mccollision.eventPlaneAngle(), mccollision.generatorsID()); products.strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(), - mccollision.multMCFV0A(), mccollision.multMCFDDA(), mccollision.multMCFDDC(), mccollision.multMCNParticlesEta05(), mccollision.multMCNParticlesEta08(), mccollision.multMCNParticlesEta10(), From a81ddb49c658df8b42cdaca77ee1779b083949c0 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:36:53 +0200 Subject: [PATCH 7/9] Remove other developments --- .../derivedlambdakzeroanalysis.cxx | 74 +++++++------------ 1 file changed, 25 insertions(+), 49 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index dc4fa33acac..bf716b92d1e 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -31,7 +31,6 @@ #include "PWGLF/DataModel/LFStrangenessMLTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" #include "PWGUD/Core/SGSelector.h" #include "Common/CCDB/EventSelectionParams.h" @@ -115,7 +114,6 @@ struct derivedlambdakzeroanalysis { Configurable irSource{"irSource", "", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 2:CentFT0CVariant1, 3:CentMFT, 4:CentNGlobal, 5:CentFV0A)"}; Configurable doUPCanalysis{"doUPCanalysis", true, "Study V0s in hadronic and UPC collisions"}; - Configurable useMcCentrality{"useMcCentrality", false, "Use MC centrality?"}; Configurable doEventQA{"doEventQA", false, "do event QA histograms"}; Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; @@ -733,9 +731,6 @@ struct derivedlambdakzeroanalysis { } histos.add("hEventCentrality", "hEventCentrality", kTH1D, {axisConfigurations.axisCentralityFine}); - if (useMcCentrality) { - histos.add("hEventVsGenCentrality", "hEventVsGenCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisCentralityFine}); - } histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisNch}); if (doEventQA) { if (isRun3) { @@ -1269,36 +1264,22 @@ struct derivedlambdakzeroanalysis { // If takeMcCentrality is enabled, the centrality is taken from the MC collision; otherwise it is taken // from the reconstructed collision. Returns -1 if no corresponding centrality estimator is found or if no MC collision is associated to the recoed collision. template - auto getCentralityRun3(TCollision const& collision, bool takeMcCentrality) + auto getCentralityRun3(TCollision const& collision) { - // Helper lambda to extract centrality from any object exposing the cent* columns - auto extractCentrality = [this](auto const& coll) -> float { - switch (centralityEstimator) { - case kCentFT0C: return coll.centFT0C(); - case kCentFT0M: return coll.centFT0M(); - case kCentFT0CVariant1: return coll.centFT0CVariant1(); - // case kCentMFT: return coll.centMFT(); - case kCentNGlobal: return coll.centNGlobal(); - case kCentFV0A: return coll.centFV0A(); - default: return -1.f; - } - }; - - // check if we are in MC - if constexpr (requires { collision.straMCCollisionId(); }) { - if (takeMcCentrality) { // check if we need to extract centrality from recoed or generated collision - // if recoed collision has a MC collision, de-reference it and extract centrality from it - // otherwise return -1.f - if (collision.has_straMCCollision()) { - auto mcCollision = collision.template straMCCollision_as>(); - return extractCentrality(mcCollision); - } else { - return -1.f; - } - } - } - - return extractCentrality(collision); + if (centralityEstimator == kCentFT0C) + return collision.centFT0C(); + else if (centralityEstimator == kCentFT0M) + return collision.centFT0M(); + else if (centralityEstimator == kCentFT0CVariant1) + return collision.centFT0CVariant1(); + else if (centralityEstimator == kCentMFT) + return collision.centMFT(); + else if (centralityEstimator == kCentNGlobal) + return collision.centNGlobal(); + else if (centralityEstimator == kCentFV0A) + return collision.centFV0A(); + + return -1.f; } // ______________________________________________________ @@ -1917,7 +1898,6 @@ struct derivedlambdakzeroanalysis { // __________________________________________ // main analysis if (passK0ShortSelections && analyseK0Short) { - LOG(info) << centrality << " " << v0.globalIndex(); histos.fill(HIST("GeneralQA/hSelectionV0s"), selPhysPrimAntiLambda + 2); // histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), v0.alpha(), v0.qtarm()); // cross-check histos.fill(HIST("h3dMassK0Short"), centrality, pt, invMassK0Short); @@ -2303,7 +2283,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hEventSelection"), 0. /* all collisions */); if (doEventQA) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision, useMcCentrality); + centrality = getCentralityRun3(collision); } histos.fill(HIST("hEventSelectionVsCentrality"), 0. /* all collisions */, centrality); } @@ -2688,7 +2668,7 @@ struct derivedlambdakzeroanalysis { void fillReconstructedEventProperties(TCollision const& collision, float& centrality, float& collisionOccupancy, double& interactionRate, int& gapSide, int& selGapSide) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision, useMcCentrality); + centrality = getCentralityRun3(collision); collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // Fetch interaction rate only if required (in order to limit ccdb calls) interactionRate = !irSource.value.empty() ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource) * 1.e-3 : -1; @@ -2698,10 +2678,6 @@ struct derivedlambdakzeroanalysis { centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(doPPAnalysis ? collision.multFT0A() + collision.multFT0C() : collision.multFT0C())); } - if (useMcCentrality) { - histos.fill(HIST("hEventVsGenCentrality"), getCentralityRun3(collision, false), getCentralityRun3(collision, true)); - } - if (doUPCanalysis) { // gap side gapSide = collision.gapSide(); @@ -2794,7 +2770,7 @@ struct derivedlambdakzeroanalysis { if constexpr (run3) { // check if we are in Run 3 if (biggestNContribs < collision.multPVTotalContributors()) { biggestNContribs = collision.multPVTotalContributors(); - centrality = getCentralityRun3(collision, useMcCentrality); + centrality = getCentralityRun3(collision); } } else { // we are in Run 2: there should be only one collision in groupedCollisions centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); @@ -2969,7 +2945,7 @@ struct derivedlambdakzeroanalysis { bool correctCollision = false; int mcNch = -1; if (collision.has_straMCCollision()) { - auto mcCollision = collision.template straMCCollision_as>(); + auto mcCollision = collision.template straMCCollision_as>(); mcNch = mcCollision.multMCNParticlesEta05(); correctCollision = (v0MC.straMCCollisionId() == mcCollision.globalIndex()); } @@ -3014,7 +2990,7 @@ struct derivedlambdakzeroanalysis { if (std::abs(ymc) > v0Selections.rapidityCut) continue; - auto mcCollision = v0MC.template straMCCollision_as>(); + auto mcCollision = v0MC.template straMCCollision_as>(); if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { continue; } @@ -3032,7 +3008,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision, useMcCentrality); + centrality = getCentralityRun3(collision); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -3079,7 +3055,7 @@ struct derivedlambdakzeroanalysis { if (std::abs(ymc) > v0Selections.rapidityCut) continue; - auto mcCollision = cascMC.template straMCCollision_as>(); + auto mcCollision = cascMC.template straMCCollision_as>(); if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { continue; } @@ -3097,7 +3073,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision, useMcCentrality); + centrality = getCentralityRun3(collision); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -3211,7 +3187,7 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) { analyzeRecoedV0sInMonteCarlo(collision, fullV0s); } @@ -3225,7 +3201,7 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) + void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) { analyzeGeneratedV0s(mcCollisions, V0MCCores, CascMCCores, collisions); } From 2e76908acbbe03e22aeff6e3f39f55d783da6143 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 14 Jul 2026 20:37:26 +0000 Subject: [PATCH 8/9] Please consider the following formatting changes --- PWGLF/DataModel/LFStrangenessTables.h | 2 +- .../stradautrackstofpidconverter4.cxx | 6 ++-- .../Strangeness/strangederivedbuilder.cxx | 29 +++++++++---------- .../Strangeness/strangenesstofpid.cxx | 2 +- .../derivedlambdakzeroanalysis.cxx | 2 +- PWGLF/Utils/strangenessBuilderModule.h | 16 +++++----- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 762cddc8eea..37fa6facf54 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -47,7 +47,7 @@ DECLARE_SOA_TABLE(StraOrigins, "AOD", "STRAORIGIN", //! Table which contains the // for keeping track of the number of selected collisions namespace straselections { -DECLARE_SOA_COLUMN(TotalNbrOfCollisions, totalNbrOfCollisions, int); //! total number of analysed collisions +DECLARE_SOA_COLUMN(TotalNbrOfCollisions, totalNbrOfCollisions, int); //! total number of analysed collisions DECLARE_SOA_COLUMN(TotalNbrOfSelCollisions, totalNbrOfSelCollisions, int); //! total number of selected collisions } // namespace straselections diff --git a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx index 0d2bede238b..b94dd91714d 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter4.cxx @@ -18,9 +18,9 @@ #include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 16f3a406d30..e59dc55fbf8 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -25,6 +25,8 @@ #include "PWGLF/DataModel/SPCalibrationTables.h" #include "PWGUD/DataModel/UDTables.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/McCollisionExtra.h" @@ -33,8 +35,6 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -195,15 +195,15 @@ struct strangederivedbuilder { Configurable inheritEvtSelFromTask{"inheritEvtSelFromTask", "propagation-service", "Inherit event selection parameters from which task?"}; Configurable inheritEvtSelFromTaskCfgGroup{"inheritEvtSelFromTaskCfgGroup", "eventSelectOpts", "What is the configurable group prefix? If none, put nothing"}; Configurable inheritEvtSelFromTaskVerbose{"inheritEvtSelFromTaskVerbose", false, "Enable verbose mode on the getTaskOption utility"}; - bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? - bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) - bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) - bool rejectTFBorder = false; // reject events at TF border (Run 3 only) - bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) - float maxZVtxPosition = 10.; // max Z vtx position (cm) - bool cfgApplyRCTrequirement = false; // Apply RCT requirement? - std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) - bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) + bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? + bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) + bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) + bool rejectTFBorder = false; // reject events at TF border (Run 3 only) + bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) + float maxZVtxPosition = 10.; // max Z vtx position (cm) + bool cfgApplyRCTrequirement = false; // Apply RCT requirement? + std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) + bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) bool cfgTreatLimitedAcceptanceAsBad = false; // reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance o2::aod::rctsel::RCTFlagsChecker rctFlagsChecker; @@ -461,7 +461,6 @@ struct strangederivedbuilder { eventSelectOptsPrefix += "."; } - getCfg(initContext, eventSelectOptsPrefix + "fillOnlySelectedCollisions", fillOnlySelectedCollisions, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "requireTriggerTVX", requireTriggerTVX, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "rejectITSROFBorder", rejectITSROFBorder, inheritEvtSelFromTask); @@ -481,8 +480,8 @@ struct strangederivedbuilder { LOG(info) << "Reject same bunch pile-up..........: " << (rejectSameBunchPileup ? "yes" : "no"); LOG(info) << "Apply RCT requirement..............: " << (cfgApplyRCTrequirement ? "yes" : "no"); LOG(info) << "RCT requirement....................: " << cfgRCTLabel; - LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC? "yes" : "no"); - LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC? "yes" : "no"); + LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC ? "yes" : "no"); + LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC ? "yes" : "no"); LOG(info) << "================================================================="; // setup map for fast checking if enabled @@ -552,7 +551,7 @@ struct strangederivedbuilder { KFCascadeCollIndices.clear(); TraCascadeCollIndices.clear(); - TrackCollIndices.resize(Tracks.size(), 0); // index -1: no collision + TrackCollIndices.resize(Tracks.size(), 0); // index -1: no collision V0CollIndices.resize(V0s.size(), -1); // index -1: no collision CascadeCollIndices.resize(Cascades.size(), -1); // index -1: no collision KFCascadeCollIndices.resize(KFCascades.size(), -1); // index -1: no collision diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 4adbab37572..fe7750010d9 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -2084,7 +2084,7 @@ struct strangenesstofpid { const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); histos.fill(HIST("h2dTOFSignalCascadePositive"), pTof.tofSignal, deltaTimeBc); - + pTof.tofExpMom = pTofExt.tofExpMom(); pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); pTof.tofEvTimeErr = reassociateTracks.value ? collision.eventTimeErr() : pTofExt.tofEvTimeErr(); diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index bf716b92d1e..5f0b744fd3b 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -671,7 +671,7 @@ struct derivedlambdakzeroanalysis { // Initialise the RCTFlagsChecker rctFlagsChecker.init(rctConfigurations.cfgRCTLabel.value, rctConfigurations.cfgCheckZDC, rctConfigurations.cfgTreatLimitedAcceptanceAsBad); - // + // if (doprocessAnalysedCollisions) { histos.add("hEventPreSelection", "hEventPreSelection", kTH1D, {{2, -0.5f, +1.5f}}); histos.get(HIST("hEventPreSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index 8b3897d29a6..efabc1dd452 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -19,6 +19,8 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" // IWYU pragma: keep #include "PWGLF/Utils/strangenessBuilderHelper.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/Core/TPCVDriftManager.h" #include @@ -32,8 +34,6 @@ #include #include #include -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -216,19 +216,19 @@ enum preselectParticleIndex { kGamma = 0, kXiPlus, kOmegaMinus, kOmegaPlus, - nPartTypes}; + nPartTypes }; enum V0PreSelection : uint8_t { selGamma = 0, selK0Short, selLambda, selAntiLambda, - nSelV0Types}; + nSelV0Types }; enum CascPreSelection : uint8_t { selXiMinus = 0, selXiPlus, selOmegaMinus, selOmegaPlus, - nSelCascTypes}; + nSelCascTypes }; static constexpr float defaultK0MassWindowParameters[1][4] = {{2.81882e-03, 1.14057e-03, 1.72138e-03, 5.00262e-01}}; static constexpr float defaultLambdaWindowParameters[1][4] = {{1.17518e-03, 1.24099e-04, 5.47937e-03, 3.08009e-01}}; @@ -396,10 +396,10 @@ struct cascadeConfigurables : o2::framework::ConfigurableGroup { struct preSelectOpts : o2::framework::ConfigurableGroup { std::string prefix = "preSelectOpts"; o2::framework::Configurable> preselectedSpecies{"preselectedSpecies", - {defaultPreselectParameters[0], nPreselectParticles, nPreselectParameters, preselectParticleNames, parameterNames}, - "Preselect this species with compatible TPC PID and mass info: 0/1 is false/true"}; + {defaultPreselectParameters[0], nPreselectParticles, nPreselectParameters, preselectParticleNames, parameterNames}, + "Preselect this species with compatible TPC PID and mass info: 0/1 is false/true"}; - std::vector mEnabledPreselectedSpecies; // Vector of enabled preselected particle species + std::vector mEnabledPreselectedSpecies; // Vector of enabled preselected particle species // lifetime preselection options // apply lifetime cuts to V0 and cascade candidates // unit of measurement: centimeters From ed5da69b3d4b74098a89b89dc901fc6b8a012f30 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:57:27 +0200 Subject: [PATCH 9/9] Fix reference for string name parameter in getCfg --- PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index e59dc55fbf8..4c90b25caaf 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -279,7 +279,7 @@ struct strangederivedbuilder { } template - void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string& task) { if (!o2::common::core::getTaskOptionValue(initContext, task, name, v, inheritEvtSelFromTaskVerbose)) { LOG(fatal) << "Could not get " << name << " from " << task << " task";