Skip to content

Commit

Permalink
prototype for the CTP inputs storage in AOD (AliceO2Group#10400)
Browse files Browse the repository at this point in the history
* prototype of CTP inputs storage in AOD

* Add DECLARE_EQUIVALENT for BCs_001

* Update AnalysisDataModel.h

* Update StandaloneAODProducerSpec.cxx

* Update StandaloneAODProducerSpec.cxx

* Update AODProducerWorkflowSpec.cxx

Co-authored-by: shahoian <[email protected]>
Co-authored-by: ddobrigk <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2022
1 parent 87ed312 commit ad35a0c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
15 changes: 8 additions & 7 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
LOG(debug) << "FOUND " << cpvTrigRecs.size() << " CPV trigger records";

LOG(info) << "FOUND " << primVertices.size() << " primary vertices";
auto& bcBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "BC"});
auto& bcBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "BC_001"});
auto& cascadesBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "CASCADE_001"});
auto& collisionsBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "COLLISION"});
auto& decay3BodyBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "DECAY3BODY"});
Expand Down Expand Up @@ -1821,27 +1821,28 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
fillSecondaryVertices(recoData, v0sCursor, cascadesCursor, decay3BodyCursor);

// helper map for fast search of a corresponding class mask for a bc
std::unordered_map<uint64_t, uint64_t> bcToClassMask;
std::unordered_map<uint64_t, std::pair<uint64_t, uint64_t>> bcToClassMask;
if (mInputSources[GID::CTP]) {
LOG(debug) << "CTP input available";
for (auto& ctpDigit : ctpDigits) {
uint64_t bc = ctpDigit.intRecord.toLong();
uint64_t classMask = ctpDigit.CTPClassMask.to_ulong();
bcToClassMask[bc] = classMask;
bcToClassMask[bc] = {ctpDigit.CTPClassMask.to_ulong(), ctpDigit.CTPInputMask.to_ulong()};
// LOG(debug) << Form("classmask:0x%llx", classMask);
}
}

// filling BC table
uint64_t triggerMask = 0;
uint64_t triggerMask = 0, triggerInputs = 0;
for (auto& item : bcsMap) {
uint64_t bc = item.first;
if (mInputSources[GID::CTP]) {
auto bcClassPair = bcToClassMask.find(bc);
if (bcClassPair != bcToClassMask.end()) {
triggerMask = bcClassPair->second;
triggerMask = bcClassPair->second.first;
triggerInputs = bcClassPair->second.second;
} else {
triggerMask = 0;
triggerInputs = 0;
}
}
bcCursor(0,
Expand Down Expand Up @@ -2346,7 +2347,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
dataRequest->inputs,
true); // query only once all objects except mag.field

outputs.emplace_back(OutputLabel{"O2bc"}, "AOD", "BC", 0, Lifetime::Timeframe);
outputs.emplace_back(OutputLabel{"O2bc_001"}, "AOD", "BC_001", 0, Lifetime::Timeframe);
outputs.emplace_back(OutputLabel{"O2cascade_001"}, "AOD", "CASCADE_001", 0, Lifetime::Timeframe);
outputs.emplace_back(OutputLabel{"O2collision"}, "AOD", "COLLISION", 0, Lifetime::Timeframe);
outputs.emplace_back(OutputLabel{"O2decay3body"}, "AOD", "DECAY3BODY", 0, Lifetime::Timeframe);
Expand Down
4 changes: 2 additions & 2 deletions Detectors/EMCAL/workflow/src/StandaloneAODProducerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
LOG(info) << "FOUND " << cellsIn.size() << " EMC cells in CTF";
LOG(info) << "FOUND " << triggersIn.size() << " EMC tiggers in CTF";

auto& bcBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "BC"});
auto& bcBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "BC_001"});
auto& collisionsBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "COLLISION"});
auto& caloCellsBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "CALO"});
auto& caloCellsTRGTableBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "CALOTRIGGER"});
Expand All @@ -78,7 +78,7 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
mCaloEventHandler->reset();
mCaloEventHandler->setCellData(cellsIn, triggersIn);

uint64_t triggerMask = 1;
uint64_t triggerMask = 1, triggerInputs = 0;
// loop over events
for (int iev = 0; iev < mCaloEventHandler->getNumberOfEvents(); iev++) {
o2::emcal::EventData inputEvent = mCaloEventHandler->buildEvent(iev);
Expand Down
4 changes: 2 additions & 2 deletions Detectors/PHOS/workflow/src/StandaloneAODProducerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
LOG(debug) << "FOUND " << cells.size() << " PHOS cells in CTF";
LOG(debug) << "FOUND " << ctr.size() << " PHOS tiggers in CTF";

auto& bcBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "BC"});
auto& bcBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "BC_001"});
auto& collisionsBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "COLLISION"});
auto& caloCellsBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "CALO"});
auto& caloCellsTRGTableBuilder = pc.outputs().make<TableBuilder>(Output{"AOD", "CALOTRIGGER"});
Expand All @@ -74,7 +74,7 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
auto caloCellsCursor = caloCellsBuilder.cursor<o2::aod::Calos>();
auto caloCellsTRGTableCursor = caloCellsTRGTableBuilder.cursor<o2::aod::CaloTriggers>();

uint64_t triggerMask = 1;
uint64_t triggerMask = 1, triggerInputs = 0;
// loop over events
int indexBC = -1;
for (const auto& tr : ctr) {
Expand Down
16 changes: 12 additions & 4 deletions Framework/Core/include/Framework/AnalysisDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ DECLARE_SOA_STORE();

namespace bc
{
DECLARE_SOA_COLUMN(RunNumber, runNumber, int); //! Run number
DECLARE_SOA_COLUMN(GlobalBC, globalBC, uint64_t); //! Bunch crossing number (globally unique in this run)
DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint64_t); //! CTP trigger mask
DECLARE_SOA_COLUMN(RunNumber, runNumber, int); //! Run number
DECLARE_SOA_COLUMN(GlobalBC, globalBC, uint64_t); //! Bunch crossing number (globally unique in this run)
DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint64_t); //! CTP trigger mask
DECLARE_SOA_COLUMN(TriggerInputs, triggerInputs, uint64_t); //! CTP inputs
} // namespace bc

DECLARE_SOA_TABLE(BCs, "AOD", "BC", o2::soa::Index<>, //! Root of data model for tables pointing to a bunch crossing
DECLARE_SOA_TABLE(BCs_000, "AOD", "BC", o2::soa::Index<>, //! Root of data model for tables pointing to a bunch crossing, version 000
bc::RunNumber, bc::GlobalBC,
bc::TriggerMask);

DECLARE_SOA_TABLE_VERSIONED(BCs_001, "AOD", "BC", 1, o2::soa::Index<>, //! Root of data model for tables pointing to a bunch crossing, version 001
bc::RunNumber, bc::GlobalBC,
bc::TriggerMask, bc::TriggerInputs);

using BCs = BCs_000; //! this defines the current default version
using BC = BCs::iterator;

namespace timestamp
Expand Down Expand Up @@ -1019,6 +1026,7 @@ namespace soa
DECLARE_EQUIVALENT_FOR_INDEX(aod::Collisions_000, aod::Collisions_001);
DECLARE_EQUIVALENT_FOR_INDEX(aod::StoredMcParticles_000, aod::StoredMcParticles_001);
DECLARE_EQUIVALENT_FOR_INDEX(aod::StoredTracks, aod::StoredTracksIU);
DECLARE_EQUIVALENT_FOR_INDEX(aod::BCs_001, aod::BCs_000);
} // namespace soa

namespace aod
Expand Down

0 comments on commit ad35a0c

Please sign in to comment.