From 8105cadfd7db1dd003bd7373dd41575e42f514e0 Mon Sep 17 00:00:00 2001 From: ffionda Date: Sun, 1 Feb 2026 13:31:50 +0100 Subject: [PATCH 1/3] add PV recomputation via PVertexer + add table-reader direct task --- PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx index 3a9c27cb956..c6fb090cc32 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx @@ -23,6 +23,9 @@ #include "PWGDQ/Core/MixingLibrary.h" #include "PWGDQ/Core/VarManager.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" +#include +#include +#include #include "Common/Core/PID/PIDTOFParamService.h" #include "Common/Core/TableHelper.h" @@ -1508,6 +1511,7 @@ struct AnalysisSameEventPairing { cout << "AnalysisSameEventPairing::init() completed" << endl; } + void initParamsFromCCDB(uint64_t timestamp, bool withTwoProngFitter = true) { cout << "AnalysisSameEventPairing::initParamsFromCCDB() called for timestamp " << timestamp << endl; From 96327f9422d243823670e3a50bb2be49a78e7d4f Mon Sep 17 00:00:00 2001 From: ffionda Date: Sun, 22 Feb 2026 09:11:39 +0100 Subject: [PATCH 2/3] Fix for tableReader_withAss_direct task (Zorro and CCDB paths) + minor fix in dqEff-direct task --- PWGDQ/Tasks/CMakeLists.txt | 2 +- PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx | 8 +- PWGDQ/Tasks/tableReader_withAssoc_direct.cxx | 174 ++++++++++++++++-- 3 files changed, 169 insertions(+), 15 deletions(-) diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index 086bb63bca0..cc660b53202 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -21,7 +21,7 @@ o2physics_add_dpl_workflow(table-reader-with-assoc o2physics_add_dpl_workflow(table-reader-with-assoc-direct SOURCES tableReader_withAssoc_direct.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::MLCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2::DetectorsVertexing + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::MLCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2::DetectorsVertexing O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(efficiency diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx index c6fb090cc32..532c0c58204 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx @@ -736,7 +736,11 @@ struct AnalysisTrackSelection { trackSel(0); continue; } - + /// + auto track = tracks.rawIteratorAt(assoc.trackId()); + auto evFromTrack = events.rawIteratorAt(track.collisionId()); + if (!evFromTrack.isEventSelected_bit(0)) { trackSel(0); continue;} + // cout << "Processing association: event global index " << event.globalIndex() << endl; VarManager::ResetValues(VarManager::kNTFWiseVariables, VarManager::kNBarrelTrackVariables); // fill event information which might be needed in histograms/cuts that combine track and event properties @@ -746,9 +750,9 @@ struct AnalysisTrackSelection { } // cout << "Filled event observables for association" << endl; - auto track = tracks.rawIteratorAt(assoc.trackId()); VarManager::FillTrack(track); // compute quantities which depend on the associated collision, such as DCA + if(track.collisionId() != event.globalIndex()) VarManager::FillTrackCollision(track, event); // cout << "Filled track observables for association" << endl; diff --git a/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx b/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx index 34ce76c8971..d25bf7f4d51 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx @@ -31,6 +31,11 @@ #include "Common/DataModel/TrackSelectionTables.h" #include +#include "Common/CCDB/TriggerAliases.h" +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/Zorro.h" + + #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" @@ -70,6 +75,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod; +Zorro zorro; + // Some definitions namespace o2::aod { @@ -233,10 +240,17 @@ void PrintBitMap(TMap map, int nbits) } } +// Enum containing the ordering of statistics histograms to be written in the QA file +enum ZorroStatHist { + kStatsZorroInfo=0, + kStatsZorroSel +}; + struct AnalysisEventSelection { Produces eventSel; Produces hash; OutputObj fOutputList{"output"}; + OutputObj fStatsList{"Statistics"}; Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; Configurable fConfigEventCutsJSON{"cfgEventCutsJSON", "", "Additional event cuts specified in JSON format"}; @@ -248,14 +262,55 @@ struct AnalysisEventSelection { Configurable fConfigSplitCollisionsDeltaBC{"cfgSplitCollisionsDeltaBC", 100, "maximum delta-BC between two collisions to consider them as split candidates; do not apply if value is negative"}; Configurable fConfigCheckSplitCollisions{"cfgCheckSplitCollisions", false, "If true, run the split collision check and fill histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + // Zorro selection + struct : ConfigurableGroup { + Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro"}; + Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; + Configurable fConfigRunZorroSel{"cfgRunZorroSel", false, "Select events with trigger mask"}; + Configurable fBcTolerance{"cfgBcTolerance", 100, "Number of BCs of margin for software triggers"}; + Configurable fConfigCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/Chunked/", "base path to the ccdb object for zorro"}; + } fConfigZorro; + + // RCT selection + struct : ConfigurableGroup { + Configurable fConfigUseRCT{"cfgUseRCT", false, "Enable event selection with RCT flags"}; + Configurable fConfigRCTLabel{"cfgRCTLabel", "CBT", "RCT flag labels : CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo"}; + } fConfigRCT; + + // CCDB connection configurables + struct : ConfigurableGroup { + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to forward tracks"}; + Configurable fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; + } fConfigCCDB; + + // TPC postcalibration related options + struct : ConfigurableGroup { + Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"}; + Configurable fConfigTPCpostCalibType{"cfgTPCpostCalibType", 1, "1: (TPCncls,pIN,eta) calibration typically for pp, 2: (eta,nPV,nLong,tLong) calibration typically for PbPb"}; + Configurable fConfigTPCuseInterpolatedCalib{"cfgTPCpostCalibUseInterpolation", true, "If true, use interpolated calibration values (default: true)"}; + Configurable fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"}; + Configurable fConfigIsOnlyforMaps{"cfgIsforMaps", false, "If true, run for postcalibration maps only"}; + Configurable fConfigSaveElectronSample{"cfgSaveElectronSample", false, "If true, only save electron sample"}; + } fConfigPostCalibTPC; + + Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; + + // RCT flag checker + o2::aod::rctsel::RCTFlagsChecker rctChecker{"CBT"}; HistogramManager* fHistMan = nullptr; MixingHandler* fMixHandler = nullptr; AnalysisCompositeCut* fEventCut; + o2::parameters::GRPObject* fGrpMagRun2 = nullptr; // for run 2, we access the GRPObject from GLO/GRP/GRP + o2::parameters::GRPMagField* fGrpMag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField + Service fCCDB; o2::ccdb::CcdbApi fCCDBApi; @@ -304,6 +359,16 @@ struct AnalysisEventSelection { fOutputList.setObject(fHistMan->GetMainHistogramList()); } + // Zorro information: kStatsZorroInfo + // Zorro trigger selection: kStatsZorroSel + fStatsList.setObject(new TList()); + fStatsList->SetOwner(kTRUE); + TH2D* histZorroInfo = new TH2D("ZorroInfo", "Zorro information", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->AddAt(histZorroInfo, kStatsZorroInfo); + + TH2D* histZorroSel = new TH2D("ZorroSel", "trigger of interested", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->AddAt(histZorroSel, kStatsZorroSel); + TString mixVarsString = fConfigMixingVariables.value; std::unique_ptr objArray(mixVarsString.Tokenize(",")); if (objArray->GetEntries() > 0) { @@ -315,11 +380,20 @@ struct AnalysisEventSelection { } fCurrentRun = -1; - fCCDB->setURL(fConfigCcdbUrl.value); + fCCDB->setURL(fConfigCCDB.fConfigCcdbUrl.value); fCCDB->setCaching(true); fCCDB->setLocalObjectValidityChecking(); - fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); - fCCDBApi.init(fConfigCcdbUrl.value); + fCCDB->setCreatedNotAfter(fConfigCCDB.fConfigNoLaterThan.value); + fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value); + + if (!o2::base::GeometryManager::isGeometryLoaded()) { + fCCDB->get(fConfigCCDB.fConfigGeoPath.value); + } + + if (fConfigRCT.fConfigUseRCT.value) { + rctChecker.init(fConfigRCT.fConfigRCTLabel); + } + cout << "AnalysisEventSelection::init() completed" << endl; } @@ -327,13 +401,57 @@ struct AnalysisEventSelection { void runEventSelection(TEvents const& events, BCsWithTimestamps const& bcs) { cout << "AnalysisEventSelection::runEventSelection() called with " << events.size() << " events and " << bcs.size() << " BCs" << endl; - if (bcs.size() > 0 && bcs.begin().runNumber() != fCurrentRun) { + + if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalib) { + auto calibList = fCCDB->getForTimeStamp(fConfigCCDB.fConfigCcdbPathTPC.value, bcs.begin().timestamp()); + VarManager::SetCalibrationObject(VarManager::kTPCElectronMean, calibList->FindObject("mean_map_electron")); + VarManager::SetCalibrationObject(VarManager::kTPCElectronSigma, calibList->FindObject("sigma_map_electron")); + VarManager::SetCalibrationObject(VarManager::kTPCPionMean, calibList->FindObject("mean_map_pion")); + VarManager::SetCalibrationObject(VarManager::kTPCPionSigma, calibList->FindObject("sigma_map_pion")); + VarManager::SetCalibrationObject(VarManager::kTPCProtonMean, calibList->FindObject("mean_map_proton")); + VarManager::SetCalibrationObject(VarManager::kTPCProtonSigma, calibList->FindObject("sigma_map_proton")); + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalibKaon) { + VarManager::SetCalibrationObject(VarManager::kTPCKaonMean, calibList->FindObject("mean_map_kaon")); + VarManager::SetCalibrationObject(VarManager::kTPCKaonSigma, calibList->FindObject("sigma_map_kaon")); + } + if (fConfigPostCalibTPC.fConfigTPCpostCalibType == 2) { + VarManager::SetCalibrationObject(VarManager::kTPCElectronStatus, calibList->FindObject("status_map_electron")); + VarManager::SetCalibrationObject(VarManager::kTPCPionStatus, calibList->FindObject("status_map_pion")); + VarManager::SetCalibrationObject(VarManager::kTPCProtonStatus, calibList->FindObject("status_map_proton")); + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalibKaon) { + VarManager::SetCalibrationObject(VarManager::kTPCKaonStatus, calibList->FindObject("status_map_kaon")); + } + } + VarManager::SetCalibrationType(fConfigPostCalibTPC.fConfigTPCpostCalibType, fConfigPostCalibTPC.fConfigTPCuseInterpolatedCalib); + } + if (fIsRun2 == true) { + fGrpMagRun2 = fCCDB->getForTimeStamp(fConfigCCDB.fConfigGrpMagPathRun2, bcs.begin().timestamp()); + if (fGrpMagRun2 != nullptr) { + o2::base::Propagator::initFieldFromGRP(fGrpMagRun2); + } + } else { + fGrpMag = fCCDB->getForTimeStamp(fConfigCCDB.fConfigGrpMagPath, bcs.begin().timestamp()); + auto* fZShift = fCCDB->getForTimeStamp>(fConfigCCDB.fZShiftPath, bcs.begin().timestamp()); + if (fGrpMag != nullptr) { + o2::base::Propagator::initFieldFromGRP(fGrpMag); + VarManager::SetMagneticField(fGrpMag->getNominalL3Field()); + } + if (fZShift != nullptr && !fZShift->empty()) { + VarManager::SetZShift((*fZShift)[0]); + } + /*if (fConfigVariousOptions.fPropMuon) { + VarManager::SetupMuonMagField(); + }*/ + } std::map metadataRCT, header; header = fCCDBApi.retrieveHeaders(Form("RCT/Info/RunInformation/%i", bcs.begin().runNumber()), metadataRCT, -1); uint64_t sor = std::atol(header["SOR"].c_str()); uint64_t eor = std::atol(header["EOR"].c_str()); VarManager::SetSORandEOR(sor, eor); - } + + fCurrentRun = bcs.begin().runNumber(); + } // end updating the CCDB quantities at change of run cout << "Filling TimeFrame statistics histograms" << endl; VarManager::ResetValues(0, VarManager::kNEventWiseVariables); @@ -358,12 +476,33 @@ struct AnalysisEventSelection { if (fConfigQA) { fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); } - if (fEventCut->IsSelected(VarManager::fgValues)) { - if (fConfigQA) { - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + + if (fConfigZorro.fConfigRunZorro) { + zorro.setBaseCCDBPath(fConfigZorro.fConfigCcdbPathZorro.value); + zorro.setBCtolerance(fConfigZorro.fBcTolerance); + zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorro.fConfigZorroTrigMask.value); + zorro.populateExternalHists(fCurrentRun, reinterpret_cast(fStatsList->At(kStatsZorroInfo)), reinterpret_cast(fStatsList->At(kStatsZorroSel))); + + if (!fEventCut->IsSelected(VarManager::fgValues) || (fConfigRCT.fConfigUseRCT.value && !rctChecker(event))) { + continue; } - decision = true; + + bool zorroSel = zorro.isSelected(bc.globalBC(), fConfigZorro.fBcTolerance, reinterpret_cast(fStatsList->At(kStatsZorroSel))); + if (fConfigZorro.fConfigRunZorroSel && (!zorroSel)) { + continue; + } + } else { + + if (!fEventCut->IsSelected(VarManager::fgValues) || (fConfigRCT.fConfigUseRCT.value && !rctChecker(event))) { + continue; + } + } + + decision = true; + if (fConfigQA) { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); } + fSelMap[event.globalIndex()] = decision; if (fBCCollMap.find(bc.globalBC()) == fBCCollMap.end()) { std::vector evIndices = {event.globalIndex()}; @@ -616,13 +755,19 @@ struct AnalysisTrackSelection { continue; } + /// + auto track = tracks.rawIteratorAt(assoc.trackId()); + auto evFromTrack = events.rawIteratorAt(track.collisionId()); + if (!evFromTrack.isEventSelected_bit(0)) { trackSel(0); continue;} + + VarManager::ResetValues(VarManager::kNTFWiseVariables, VarManager::kNBarrelTrackVariables); // fill event information which might be needed in histograms/cuts that combine track and event properties VarManager::FillEvent(event); - auto track = tracks.rawIteratorAt(assoc.trackId()); VarManager::FillTrack(track); // compute quantities which depend on the associated collision, such as DCA + if(track.collisionId() != event.globalIndex()) VarManager::FillTrackCollision(track, event); if (fConfigQA) @@ -946,6 +1091,7 @@ struct AnalysisSameEventPairing { Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"}; + Configurable collSplitting{"cfgRemoveCollSplittingCandidates", false, "If true, remove collision splitting candidates as determined by the event selection task upstream"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; @@ -1356,6 +1502,10 @@ struct AnalysisSameEventPairing { if (!event.isEventSelected_bit(0)) continue; + if (fConfigOptions.collSplitting && event.isEventSelected_bit(2)) { + continue; + } + VarManager::ResetValues(0, VarManager::kNVars); VarManager::FillEvent(event, VarManager::fgValues); From c619284968155910900f5b8ca3c918d0f9701c7e Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Sun, 22 Feb 2026 08:18:09 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx | 15 +++-- PWGDQ/Tasks/tableReader_withAssoc_direct.cxx | 56 +++++++++---------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx index 532c0c58204..7b11c0f6d2c 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx @@ -23,9 +23,6 @@ #include "PWGDQ/Core/MixingLibrary.h" #include "PWGDQ/Core/VarManager.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" -#include -#include -#include #include "Common/Core/PID/PIDTOFParamService.h" #include "Common/Core/TableHelper.h" @@ -739,8 +736,11 @@ struct AnalysisTrackSelection { /// auto track = tracks.rawIteratorAt(assoc.trackId()); auto evFromTrack = events.rawIteratorAt(track.collisionId()); - if (!evFromTrack.isEventSelected_bit(0)) { trackSel(0); continue;} - + if (!evFromTrack.isEventSelected_bit(0)) { + trackSel(0); + continue; + } + // cout << "Processing association: event global index " << event.globalIndex() << endl; VarManager::ResetValues(VarManager::kNTFWiseVariables, VarManager::kNBarrelTrackVariables); // fill event information which might be needed in histograms/cuts that combine track and event properties @@ -752,8 +752,8 @@ struct AnalysisTrackSelection { VarManager::FillTrack(track); // compute quantities which depend on the associated collision, such as DCA - if(track.collisionId() != event.globalIndex()) - VarManager::FillTrackCollision(track, event); + if (track.collisionId() != event.globalIndex()) + VarManager::FillTrackCollision(track, event); // cout << "Filled track observables for association" << endl; bool isCorrectAssoc = false; @@ -1515,7 +1515,6 @@ struct AnalysisSameEventPairing { cout << "AnalysisSameEventPairing::init() completed" << endl; } - void initParamsFromCCDB(uint64_t timestamp, bool withTwoProngFitter = true) { cout << "AnalysisSameEventPairing::initParamsFromCCDB() called for timestamp " << timestamp << endl; diff --git a/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx b/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx index d25bf7f4d51..49e0d596d50 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc_direct.cxx @@ -22,8 +22,11 @@ #include "PWGDQ/Core/VarManager.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/PID/PIDTOFParamService.h" #include "Common/Core/TableHelper.h" +#include "Common/Core/Zorro.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/McCollisionExtra.h" @@ -31,11 +34,6 @@ #include "Common/DataModel/TrackSelectionTables.h" #include -#include "Common/CCDB/TriggerAliases.h" -#include "Common/CCDB/ctpRateFetcher.h" -#include "Common/Core/Zorro.h" - - #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" @@ -242,7 +240,7 @@ void PrintBitMap(TMap map, int nbits) // Enum containing the ordering of statistics histograms to be written in the QA file enum ZorroStatHist { - kStatsZorroInfo=0, + kStatsZorroInfo = 0, kStatsZorroSel }; @@ -270,14 +268,14 @@ struct AnalysisEventSelection { Configurable fBcTolerance{"cfgBcTolerance", 100, "Number of BCs of margin for software triggers"}; Configurable fConfigCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/Chunked/", "base path to the ccdb object for zorro"}; } fConfigZorro; - - // RCT selection + + // RCT selection struct : ConfigurableGroup { Configurable fConfigUseRCT{"cfgUseRCT", false, "Enable event selection with RCT flags"}; Configurable fConfigRCTLabel{"cfgRCTLabel", "CBT", "RCT flag labels : CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo"}; } fConfigRCT; - // CCDB connection configurables + // CCDB connection configurables struct : ConfigurableGroup { Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; @@ -287,7 +285,7 @@ struct AnalysisEventSelection { Configurable fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to forward tracks"}; Configurable fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; } fConfigCCDB; - + // TPC postcalibration related options struct : ConfigurableGroup { Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"}; @@ -298,7 +296,7 @@ struct AnalysisEventSelection { Configurable fConfigSaveElectronSample{"cfgSaveElectronSample", false, "If true, only save electron sample"}; } fConfigPostCalibTPC; - Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; + Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; // RCT flag checker o2::aod::rctsel::RCTFlagsChecker rctChecker{"CBT"}; @@ -365,7 +363,7 @@ struct AnalysisEventSelection { fStatsList->SetOwner(kTRUE); TH2D* histZorroInfo = new TH2D("ZorroInfo", "Zorro information", 1, -0.5, 0.5, 1, -0.5, 0.5); fStatsList->AddAt(histZorroInfo, kStatsZorroInfo); - + TH2D* histZorroSel = new TH2D("ZorroSel", "trigger of interested", 1, -0.5, 0.5, 1, -0.5, 0.5); fStatsList->AddAt(histZorroSel, kStatsZorroSel); @@ -385,7 +383,7 @@ struct AnalysisEventSelection { fCCDB->setLocalObjectValidityChecking(); fCCDB->setCreatedNotAfter(fConfigCCDB.fConfigNoLaterThan.value); fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value); - + if (!o2::base::GeometryManager::isGeometryLoaded()) { fCCDB->get(fConfigCCDB.fConfigGeoPath.value); } @@ -401,8 +399,8 @@ struct AnalysisEventSelection { void runEventSelection(TEvents const& events, BCsWithTimestamps const& bcs) { cout << "AnalysisEventSelection::runEventSelection() called with " << events.size() << " events and " << bcs.size() << " BCs" << endl; - - if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { + + if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { if (fConfigPostCalibTPC.fConfigComputeTPCpostCalib) { auto calibList = fCCDB->getForTimeStamp(fConfigCCDB.fConfigCcdbPathTPC.value, bcs.begin().timestamp()); VarManager::SetCalibrationObject(VarManager::kTPCElectronMean, calibList->FindObject("mean_map_electron")); @@ -476,7 +474,7 @@ struct AnalysisEventSelection { if (fConfigQA) { fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); } - + if (fConfigZorro.fConfigRunZorro) { zorro.setBaseCCDBPath(fConfigZorro.fConfigCcdbPathZorro.value); zorro.setBCtolerance(fConfigZorro.fBcTolerance); @@ -490,17 +488,17 @@ struct AnalysisEventSelection { bool zorroSel = zorro.isSelected(bc.globalBC(), fConfigZorro.fBcTolerance, reinterpret_cast(fStatsList->At(kStatsZorroSel))); if (fConfigZorro.fConfigRunZorroSel && (!zorroSel)) { continue; - } - } else { - - if (!fEventCut->IsSelected(VarManager::fgValues) || (fConfigRCT.fConfigUseRCT.value && !rctChecker(event))) { + } + } else { + + if (!fEventCut->IsSelected(VarManager::fgValues) || (fConfigRCT.fConfigUseRCT.value && !rctChecker(event))) { continue; - } - } - + } + } + decision = true; if (fConfigQA) { - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); } fSelMap[event.globalIndex()] = decision; @@ -758,8 +756,10 @@ struct AnalysisTrackSelection { /// auto track = tracks.rawIteratorAt(assoc.trackId()); auto evFromTrack = events.rawIteratorAt(track.collisionId()); - if (!evFromTrack.isEventSelected_bit(0)) { trackSel(0); continue;} - + if (!evFromTrack.isEventSelected_bit(0)) { + trackSel(0); + continue; + } VarManager::ResetValues(VarManager::kNTFWiseVariables, VarManager::kNBarrelTrackVariables); // fill event information which might be needed in histograms/cuts that combine track and event properties @@ -767,8 +767,8 @@ struct AnalysisTrackSelection { VarManager::FillTrack(track); // compute quantities which depend on the associated collision, such as DCA - if(track.collisionId() != event.globalIndex()) - VarManager::FillTrackCollision(track, event); + if (track.collisionId() != event.globalIndex()) + VarManager::FillTrackCollision(track, event); if (fConfigQA) fHistMan->FillHistClass("AssocsBarrel_BeforeCuts", VarManager::fgValues);