From cb4d35ccb4b622f83beeaa5c575d59074c27f640 Mon Sep 17 00:00:00 2001 From: nburmaso Date: Mon, 18 Oct 2021 11:52:30 +0300 Subject: [PATCH 1/7] Add ZDC table to the AOD producer --- Detectors/AOD/CMakeLists.txt | 24 ++-- .../AODProducerWorkflowSpec.h | 6 + Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 126 +++++++++++++----- Detectors/AOD/src/aod-producer-workflow.cxx | 2 +- 4 files changed, 113 insertions(+), 45 deletions(-) diff --git a/Detectors/AOD/CMakeLists.txt b/Detectors/AOD/CMakeLists.txt index 7174760a64e6b..0568b2d41a8d0 100644 --- a/Detectors/AOD/CMakeLists.txt +++ b/Detectors/AOD/CMakeLists.txt @@ -29,6 +29,7 @@ o2_add_library( O2::SimulationDataFormat O2::Steer O2::TPCWorkflow + O2::ZDCBase ) o2_add_executable( workflow @@ -47,15 +48,16 @@ o2_add_executable( O2::DataFormatsFT0 O2::DataFormatsFDD O2::DataFormatsFV0 - O2::DataFormatsTOF - O2::ITSReconstruction - O2::FT0Reconstruction - O2::TPCFastTransformation - O2::TPCBase - O2::TPCReconstruction - O2::TOFBase - O2::TOFCalibration - O2::SimConfig - O2::DataFormatsFT0 - O2::Steer + O2::DataFormatsTOF + O2::ITSReconstruction + O2::FT0Reconstruction + O2::TPCFastTransformation + O2::TPCBase + O2::TPCReconstruction + O2::TOFBase + O2::TOFCalibration + O2::SimConfig + O2::DataFormatsFT0 + O2::Steer + O2::ZDCBase ) diff --git a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h index 9a36c4bb3b657..2fc1e6e3f2fcd 100644 --- a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h +++ b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h @@ -24,6 +24,7 @@ #include "DataFormatsMCH/TrackMCH.h" #include "DataFormatsTPC/TrackTPC.h" #include "DataFormatsTRD/TrackTRD.h" +#include "DataFormatsZDC/BCRecData.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisHelpers.h" #include "Framework/DataProcessorSpec.h" @@ -211,6 +212,10 @@ class AODProducerWorkflowDPL : public Task std::unordered_map mGIDToTableID; int mTableTrID{0}; + // zdc helper maps to avoid a number of "if" statements + map mZDCEnergyMap; + map mZDCTDCMap; + TripletsMap_t mToStore; std::shared_ptr mDataRequest; @@ -287,6 +292,7 @@ class AODProducerWorkflowDPL : public Task void collectBCs(gsl::span& fddRecPoints, gsl::span& ft0RecPoints, gsl::span& fv0RecPoints, + gsl::span& zdcBCRecData, gsl::span& primVertices, const std::vector& mcRecords, std::map& bcsMap); diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index e436f2b6f9363..304a332a4be5c 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -20,6 +20,8 @@ #include "DataFormatsMCH/TrackMCH.h" #include "DataFormatsMFT/TrackMFT.h" #include "DataFormatsTPC/TrackTPC.h" +#include "DataFormatsZDC/ZDCEnergy.h" +#include "DataFormatsZDC/ZDCTDCData.h" #include "DetectorsRaw/HBFUtils.h" #include "DetectorsBase/GeometryManager.h" #include "CCDB/BasicCCDBManager.h" @@ -52,12 +54,14 @@ #include "SimulationDataFormat/MCEventLabel.h" #include "SimulationDataFormat/MCTrack.h" #include "SimulationDataFormat/MCTruthContainer.h" +#include "ZDCBase/Constants.h" #include "TMath.h" #include "MathUtils/Utils.h" #include "Math/SMatrix.h" -#include +#include "TMatrixD.h" #include #include +#include #include using namespace o2::framework; @@ -90,6 +94,7 @@ uint64_t relativeTime_to_LocalBC(double relativeTimeStampInNS) void AODProducerWorkflowDPL::collectBCs(gsl::span& fddRecPoints, gsl::span& ft0RecPoints, gsl::span& fv0RecPoints, + gsl::span& zdcBCRecData, gsl::span& primVertices, const std::vector& mcRecords, std::map& bcsMap) @@ -115,6 +120,11 @@ void AODProducerWorkflowDPL::collectBCs(gsl::span& fddR bcsMap[globalBC] = 1; } + for (auto zdcRecData : zdcBCRecData) { + uint64_t globalBC = zdcRecData.ir.toLong(); + bcsMap[globalBC] = 1; + } + for (auto& vertex : primVertices) { auto& timeStamp = vertex.getTimeStamp(); double tsTimeStamp = timeStamp.getTimeStamp() * 1E3; // mus to ns @@ -889,6 +899,14 @@ void AODProducerWorkflowDPL::init(InitContext& ic) // Needed by MCH track extrapolation o2::base::GeometryManager::loadGeometry(); + // initialize zdc helper maps + for (auto& ChannelName : o2::zdc::ChannelNames) { + mZDCEnergyMap[(string)ChannelName] = 0; + } + for (int i = 0; i < o2::zdc::NTDCChannels; i++) { + mZDCTDCMap[o2::zdc::TDCSignal[i]] = 999; + } + mTimer.Reset(); } @@ -914,6 +932,10 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto fv0ChData = recoData.getFV0ChannelsData(); auto fv0RecPoints = recoData.getFV0RecPoints(); + auto zdcEnergies = recoData.getZDCEnergy(); + auto zdcBCRecData = recoData.getZDCBCRecData(); + auto zdcTDCData = recoData.getZDCTDCData(); + LOG(DEBUG) << "FOUND " << primVertices.size() << " primary vertices"; LOG(DEBUG) << "FOUND " << ft0RecPoints.size() << " FT0 rec. points"; LOG(DEBUG) << "FOUND " << fv0RecPoints.size() << " FV0 rec. points"; @@ -972,7 +994,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) LOG(DEBUG) << "FOUND " << mcParts.size() << " parts"; std::map bcsMap; - collectBCs(fddRecPoints, ft0RecPoints, fv0RecPoints, primVertices, mcRecords, bcsMap); + collectBCs(fddRecPoints, ft0RecPoints, fv0RecPoints, zdcBCRecData, primVertices, mcRecords, bcsMap); const auto* dh = o2::header::get(pc.inputs().getFirstValid(true).header); o2::InteractionRecord startIR = {0, dh->firstTForbit}; @@ -1022,34 +1044,73 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) dummyFV0AmplC, dummyTime); - float dummyEnergyZEM1 = 0; - float dummyEnergyZEM2 = 0; - float dummyEnergyCommonZNA = 0; - float dummyEnergyCommonZNC = 0; - float dummyEnergyCommonZPA = 0; - float dummyEnergyCommonZPC = 0; - float dummyEnergySectorZNA[4] = {0.}; - float dummyEnergySectorZNC[4] = {0.}; - float dummyEnergySectorZPA[4] = {0.}; - float dummyEnergySectorZPC[4] = {0.}; - zdcCursor(0, - dummyBC, - dummyEnergyZEM1, - dummyEnergyZEM2, - dummyEnergyCommonZNA, - dummyEnergyCommonZNC, - dummyEnergyCommonZPA, - dummyEnergyCommonZPC, - dummyEnergySectorZNA, - dummyEnergySectorZNC, - dummyEnergySectorZPA, - dummyEnergySectorZPC, - dummyTime, - dummyTime, - dummyTime, - dummyTime, - dummyTime, - dummyTime); + for (auto zdcRecData : zdcBCRecData) { + uint64_t bc = zdcRecData.ir.toLong(); + auto item = bcsMap.find(bc); + int bcID = -1; + if (item != bcsMap.end()) { + bcID = item->second; + } else { + LOG(FATAL) << "Error: could not find a corresponding BC ID for a ZDC rec. point; BC = " << bc; + } + float energyZEM1 = 0; + float energyZEM2 = 0; + float energyCommonZNA = 0; + float energyCommonZNC = 0; + float energyCommonZPA = 0; + float energyCommonZPC = 0; + float energySectorZNA[4] = {0.}; + float energySectorZNC[4] = {0.}; + float energySectorZPA[4] = {0.}; + float energySectorZPC[4] = {0.}; + int fe, ne, ft, nt, fi, ni; + zdcRecData.getRef(fe, ne, ft, nt, fi, ni); + for (int ie = 0; ie < ne; ie++) { + auto& zdcEnergyData = zdcEnergies[fe + ie]; + float energy = zdcEnergyData.energy(); + string chName = o2::zdc::channelName(zdcEnergyData.ch()); + mZDCEnergyMap.at(chName) = energy; + } + for (int it = 0; it < nt; it++) { + auto& tdc = zdcTDCData[ft + it]; + float tdcValue = tdc.value(); + mZDCTDCMap.at(tdc.ch()) = tdcValue; + } + energySectorZNA[0] = mZDCEnergyMap.at("ZNA1"); + energySectorZNA[1] = mZDCEnergyMap.at("ZNA2"); + energySectorZNA[2] = mZDCEnergyMap.at("ZNA3"); + energySectorZNA[3] = mZDCEnergyMap.at("ZNA4"); + energySectorZNC[0] = mZDCEnergyMap.at("ZNC1"); + energySectorZNC[1] = mZDCEnergyMap.at("ZNC2"); + energySectorZNC[2] = mZDCEnergyMap.at("ZNC3"); + energySectorZNC[3] = mZDCEnergyMap.at("ZNC4"); + energySectorZPA[0] = mZDCEnergyMap.at("ZPA1"); + energySectorZPA[1] = mZDCEnergyMap.at("ZPA2"); + energySectorZPA[2] = mZDCEnergyMap.at("ZPA3"); + energySectorZPA[3] = mZDCEnergyMap.at("ZPA4"); + energySectorZPC[0] = mZDCEnergyMap.at("ZPC1"); + energySectorZPC[1] = mZDCEnergyMap.at("ZPC2"); + energySectorZPC[2] = mZDCEnergyMap.at("ZPC3"); + energySectorZPC[3] = mZDCEnergyMap.at("ZPC4"); + zdcCursor(0, + bcID, + mZDCEnergyMap.at("ZEM1"), + mZDCEnergyMap.at("ZEM2"), + mZDCEnergyMap.at("ZNAC"), + mZDCEnergyMap.at("ZNCC"), + mZDCEnergyMap.at("ZPAC"), + mZDCEnergyMap.at("ZPCC"), + energySectorZNA, + energySectorZNC, + energySectorZPA, + energySectorZPC, + mZDCTDCMap.at(o2::zdc::IdZEM1), + mZDCTDCMap.at(o2::zdc::IdZEM2), + mZDCTDCMap.at(o2::zdc::IdZNAC), + mZDCTDCMap.at(o2::zdc::IdZNCC), + mZDCTDCMap.at(o2::zdc::IdZPAC), + mZDCTDCMap.at(o2::zdc::IdZPCC)); + } // TODO: figure out collision weight // keep track event/source id for each mc-collision @@ -1174,9 +1235,6 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) mcColLabelsCursor(0, mcCollisionID, mcMask); } - // hash map for track indices of secondary vertices - std::unordered_map v0sIndices; - // filling unassigned tracks first // so that all unassigned tracks are stored in the beginning of the table together auto& trackRef = primVer2TRefs.back(); // references to unassigned tracks are at the end @@ -1262,6 +1320,8 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) mTableTrID = 0; mGIDToTableID.clear(); + mZDCEnergyMap.clear(); + mZDCTDCMap.clear(); // filling BC table // TODO: get real triggerMask diff --git a/Detectors/AOD/src/aod-producer-workflow.cxx b/Detectors/AOD/src/aod-producer-workflow.cxx index 16c6ac8641ccd..8904a66433072 100644 --- a/Detectors/AOD/src/aod-producer-workflow.cxx +++ b/Detectors/AOD/src/aod-producer-workflow.cxx @@ -43,7 +43,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); auto useMC = !configcontext.options().get("disable-mc"); - GID::mask_t allowedSrc = GID::getSourcesMask("ITS,MFT,MCH,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,MFT-MCH,FT0,FV0,FDD,TPC-TRD,ITS-TPC-TRD,FT0,FV0,FDD,ZDC"); + GID::mask_t allowedSrc = GID::getSourcesMask("ITS,MFT,MCH,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,MFT-MCH,FT0,FV0,FDD,TPC-TRD,ITS-TPC-TRD,FT0,FV0,FDD,ZDC,CTP"); GID::mask_t src = allowedSrc & GID::getSourcesMask(configcontext.options().get("info-sources")); WorkflowSpec specs; From 4517ec8aacd8363b14c5e810c4836d1d30ff4bc6 Mon Sep 17 00:00:00 2001 From: nburmaso Date: Mon, 18 Oct 2021 16:01:53 +0300 Subject: [PATCH 2/7] Fix typo in CMakeLists.txt and add comments for ZDC helper maps --- Detectors/AOD/CMakeLists.txt | 12 ++++++------ .../AODProducerWorkflow/AODProducerWorkflowSpec.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Detectors/AOD/CMakeLists.txt b/Detectors/AOD/CMakeLists.txt index 0568b2d41a8d0..17021dfef291a 100644 --- a/Detectors/AOD/CMakeLists.txt +++ b/Detectors/AOD/CMakeLists.txt @@ -42,12 +42,12 @@ o2_add_executable( COMPONENT_NAME reco SOURCES src/StandaloneAODProducer.cxx PUBLIC_LINK_LIBRARIES - O2::DataFormatsTPC - O2::DataFormatsITSMFT - O2::DataFormatsITS - O2::DataFormatsFT0 - O2::DataFormatsFDD - O2::DataFormatsFV0 + O2::DataFormatsTPC + O2::DataFormatsITSMFT + O2::DataFormatsITS + O2::DataFormatsFT0 + O2::DataFormatsFDD + O2::DataFormatsFV0 O2::DataFormatsTOF O2::ITSReconstruction O2::FT0Reconstruction diff --git a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h index 2fc1e6e3f2fcd..91274c19c98a2 100644 --- a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h +++ b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h @@ -213,8 +213,9 @@ class AODProducerWorkflowDPL : public Task int mTableTrID{0}; // zdc helper maps to avoid a number of "if" statements - map mZDCEnergyMap; - map mZDCTDCMap; + // when filling ZDC table + map mZDCEnergyMap; // mapping detector name to a corresponding energy + map mZDCTDCMap; // mapping TDC channel to a corresponding TDC value TripletsMap_t mToStore; From 6b679674c95efc372bc8379f56e79b9ece4505f5 Mon Sep 17 00:00:00 2001 From: nburmaso Date: Thu, 11 Nov 2021 12:02:39 +0100 Subject: [PATCH 3/7] Merge new code from dev and resolve conflicts --- Detectors/AOD/CMakeLists.txt | 2 +- Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Detectors/AOD/CMakeLists.txt b/Detectors/AOD/CMakeLists.txt index e2d6f835d6e79..e875770329fc6 100644 --- a/Detectors/AOD/CMakeLists.txt +++ b/Detectors/AOD/CMakeLists.txt @@ -30,7 +30,7 @@ target_link_libraries( O2::SimulationDataFormat O2::Steer O2::TPCWorkflow - O2::ZDCBase + O2::ZDCBase ) target_include_directories(AODProducerWorkflow INTERFACE include) diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index e7c3f8ac88e42..b54829bc5b5f6 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -20,6 +20,8 @@ #include "DataFormatsMCH/TrackMCH.h" #include "DataFormatsMFT/TrackMFT.h" #include "DataFormatsTPC/TrackTPC.h" +#include "DataFormatsZDC/ZDCEnergy.h" +#include "DataFormatsZDC/ZDCTDCData.h" #include "DetectorsRaw/HBFUtils.h" #include "DetectorsBase/GeometryManager.h" #include "CCDB/BasicCCDBManager.h" From 096ef666b49a15232d767a174c7a69e51398174a Mon Sep 17 00:00:00 2001 From: nburmaso Date: Thu, 11 Nov 2021 12:10:25 +0100 Subject: [PATCH 4/7] Resolve conflicts #2 --- Detectors/AOD/src/aod-producer-workflow.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/AOD/src/aod-producer-workflow.cxx b/Detectors/AOD/src/aod-producer-workflow.cxx index 439f761359bb0..162b070853756 100644 --- a/Detectors/AOD/src/aod-producer-workflow.cxx +++ b/Detectors/AOD/src/aod-producer-workflow.cxx @@ -48,7 +48,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto useMC = !configcontext.options().get("disable-mc"); auto resFile = configcontext.options().get("aod-writer-resfile"); - GID::mask_t allowedSrc = GID::getSourcesMask("ITS,MFT,MCH,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,MFT-MCH,FT0,FV0,FDD,TPC-TRD,ITS-TPC-TRD,FT0,FV0,FDD,ZDC,CTP"); + GID::mask_t allowedSrc = GID::getSourcesMask("ITS,MFT,MCH,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,MFT-MCH,FT0,FV0,FDD,TPC-TRD,ITS-TPC-TRD,FT0,FV0,FDD,ZDC"); GID::mask_t src = allowedSrc & GID::getSourcesMask(configcontext.options().get("info-sources")); WorkflowSpec specs; From 9b63d544aa4fc1101c3f7bf6d644ae0b3ec6aaae Mon Sep 17 00:00:00 2001 From: nburmaso Date: Thu, 11 Nov 2021 12:12:48 +0100 Subject: [PATCH 5/7] Resolve conflicts no. 3 --- Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index b54829bc5b5f6..496ff34713f84 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -22,7 +22,6 @@ #include "DataFormatsTPC/TrackTPC.h" #include "DataFormatsZDC/ZDCEnergy.h" #include "DataFormatsZDC/ZDCTDCData.h" -#include "DetectorsRaw/HBFUtils.h" #include "DetectorsBase/GeometryManager.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" From 4ccdf27c8055feb02b12760f394a2cc73b23a9b0 Mon Sep 17 00:00:00 2001 From: nburmaso Date: Mon, 29 Nov 2021 16:14:48 +0100 Subject: [PATCH 6/7] Switch to channel names from IDs + clang-format --- .../AODProducerWorkflowSpec.h | 2 +- Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h index 2fde97b127348..89f43dfb665f9 100644 --- a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h +++ b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h @@ -237,7 +237,7 @@ class AODProducerWorkflowDPL : public Task // zdc helper maps to avoid a number of "if" statements // when filling ZDC table map mZDCEnergyMap; // mapping detector name to a corresponding energy - map mZDCTDCMap; // mapping TDC channel to a corresponding TDC value + map mZDCTDCMap; // mapping TDC channel to a corresponding TDC value TripletsMap_t mToStore; diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index e07ed7b64fd7d..bf85a9a50911a 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -79,7 +79,6 @@ using SMatrix55Sym = ROOT::Math::SMatrix& mcRecords, std::map& bcsMap) @@ -90,6 +89,7 @@ void AODProducerWorkflowDPL::collectBCs(o2::globaltracking::RecoContainer& data, const auto& fv0RecPoints = data.getFV0RecPoints(); const auto& caloEMCCellsTRGR = data.getEMCALTriggers(); const auto& ctpDigits = data.getCTPDigits(); + const auto& zdcBCRecData = data.getZDCBCRecData(); // collecting non-empty BCs and enumerating them for (auto& rec : mcRecords) { @@ -112,7 +112,7 @@ void AODProducerWorkflowDPL::collectBCs(o2::globaltracking::RecoContainer& data, bcsMap[globalBC] = 1; } - for (auto zdcRecData : zdcBCRecData) { + for (auto& zdcRecData : zdcBCRecData) { uint64_t globalBC = zdcRecData.ir.toLong(); bcsMap[globalBC] = 1; } @@ -1004,9 +1004,7 @@ void AODProducerWorkflowDPL::init(InitContext& ic) // initialize zdc helper maps for (auto& ChannelName : o2::zdc::ChannelNames) { mZDCEnergyMap[(string)ChannelName] = 0; - } - for (int i = 0; i < o2::zdc::NTDCChannels; i++) { - mZDCTDCMap[o2::zdc::TDCSignal[i]] = 999; + mZDCTDCMap[(string)ChannelName] = 999; } // writing metadata if it's not yet in AOD file @@ -1214,7 +1212,9 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) for (int it = 0; it < nt; it++) { auto& tdc = zdcTDCData[ft + it]; float tdcValue = tdc.value(); - mZDCTDCMap.at(tdc.ch()) = tdcValue; + int channelID = o2::zdc::TDCSignal[tdc.ch()]; + auto channelName = o2::zdc::ChannelNames[channelID]; + mZDCTDCMap.at((string)channelName) = tdcValue; } energySectorZNA[0] = mZDCEnergyMap.at("ZNA1"); energySectorZNA[1] = mZDCEnergyMap.at("ZNA2"); @@ -1244,12 +1244,12 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) energySectorZNC, energySectorZPA, energySectorZPC, - mZDCTDCMap.at(o2::zdc::IdZEM1), - mZDCTDCMap.at(o2::zdc::IdZEM2), - mZDCTDCMap.at(o2::zdc::IdZNAC), - mZDCTDCMap.at(o2::zdc::IdZNCC), - mZDCTDCMap.at(o2::zdc::IdZPAC), - mZDCTDCMap.at(o2::zdc::IdZPCC)); + mZDCTDCMap.at("ZEM1"), + mZDCTDCMap.at("ZEM2"), + mZDCTDCMap.at("ZNAC"), + mZDCTDCMap.at("ZNCC"), + mZDCTDCMap.at("ZPAC"), + mZDCTDCMap.at("ZPCC")); } // keep track event/source id for each mc-collision From fbde66ce251e1d089574ff9faaa83ab8b703cd45 Mon Sep 17 00:00:00 2001 From: nburmaso Date: Tue, 30 Nov 2021 11:31:57 +0100 Subject: [PATCH 7/7] Add forgotten CTP checks from #7763 --- Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index bf85a9a50911a..8c51bb4af027c 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -1470,21 +1470,25 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) // helper map for fast search of a corresponding class mask for a bc std::unordered_map bcToClassMask; - for (auto& ctpDigit : ctpDigits) { - uint64_t bc = ctpDigit.intRecord.toLong(); - uint64_t classMask = ctpDigit.CTPClassMask.to_ulong(); - bcToClassMask[bc] = classMask; + if (mInputSources[GID::CTP]) { + for (auto& ctpDigit : ctpDigits) { + uint64_t bc = ctpDigit.intRecord.toLong(); + uint64_t classMask = ctpDigit.CTPClassMask.to_ulong(); + bcToClassMask[bc] = classMask; + } } // filling BC table - uint64_t triggerMask; + uint64_t triggerMask = 0; for (auto& item : bcsMap) { uint64_t bc = item.first; - auto bcClassPair = bcToClassMask.find(bc); - if (bcClassPair != bcToClassMask.end()) { - triggerMask = bcClassPair->second; - } else { - triggerMask = 0; + if (mInputSources[GID::CTP]) { + auto bcClassPair = bcToClassMask.find(bc); + if (bcClassPair != bcToClassMask.end()) { + triggerMask = bcClassPair->second; + } else { + triggerMask = 0; + } } bcCursor(0, runNumber, @@ -1543,7 +1547,10 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo dataRequest->requestTracks(src, useMC); dataRequest->requestPrimaryVertertices(useMC); - dataRequest->requestCTPDigits(useMC); + if (src[GID::CTP]) { + LOGF(info, "Requesting CTP digits"); + dataRequest->requestCTPDigits(useMC); + } if (enableSV) { dataRequest->requestSecondaryVertertices(useMC); }