Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ class AODProducerWorkflowDPL : public Task
uint8_t fwdLabelMask = 0;
};

void collectBCs(gsl::span<const o2::fdd::RecPoint>& fddRecPoints,
gsl::span<const o2::ft0::RecPoints>& ft0RecPoints,
gsl::span<const o2::fv0::RecPoints>& fv0RecPoints,
gsl::span<const o2::dataformats::PrimaryVertex>& primVertices,
gsl::span<const o2::emcal::TriggerRecord>& caloEMCCellsTRGR,
void collectBCs(o2::globaltracking::RecoContainer& data,
const std::vector<o2::InteractionTimeRecord>& mcRecords,
std::map<uint64_t, int>& bcsMap);

Expand Down
43 changes: 35 additions & 8 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "DataFormatsFT0/RecPoints.h"
#include "DataFormatsFDD/RecPoint.h"
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "DataFormatsCTP/Digits.h"
#include "DataFormatsITS/TrackITS.h"
#include "DataFormatsMCH/ROFRecord.h"
#include "DataFormatsMCH/TrackMCH.h"
Expand Down Expand Up @@ -73,14 +74,17 @@ using SMatrix55Sym = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<dou
namespace o2::aodproducer
{

void AODProducerWorkflowDPL::collectBCs(gsl::span<const o2::fdd::RecPoint>& fddRecPoints,
gsl::span<const o2::ft0::RecPoints>& ft0RecPoints,
gsl::span<const o2::fv0::RecPoints>& fv0RecPoints,
gsl::span<const o2::dataformats::PrimaryVertex>& primVertices,
gsl::span<const o2::emcal::TriggerRecord>& caloEMCCellsTRGR,
void AODProducerWorkflowDPL::collectBCs(o2::globaltracking::RecoContainer& data,
const std::vector<o2::InteractionTimeRecord>& mcRecords,
std::map<uint64_t, int>& bcsMap)
{
const auto& primVertices = data.getPrimaryVertices();
const auto& fddRecPoints = data.getFDDRecPoints();
const auto& ft0RecPoints = data.getFT0RecPoints();
const auto& fv0RecPoints = data.getFV0RecPoints();
const auto& caloEMCCellsTRGR = data.getEMCALTriggers();
const auto& ctpDigits = data.getCTPDigits();

// collecting non-empty BCs and enumerating them
for (auto& rec : mcRecords) {
uint64_t globalBC = rec.toLong();
Expand Down Expand Up @@ -114,6 +118,11 @@ void AODProducerWorkflowDPL::collectBCs(gsl::span<const o2::fdd::RecPoint>& fddR
bcsMap[globalBC] = 1;
}

for (auto& ctpDigit : ctpDigits) {
uint64_t globalBC = ctpDigit.intRecord.toLong();
bcsMap[globalBC] = 1;
}

int bcID = 0;
for (auto& item : bcsMap) {
item.second = bcID;
Expand Down Expand Up @@ -1037,6 +1046,8 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
auto caloEMCCells = recoData.getEMCALCells();
auto caloEMCCellsTRGR = recoData.getEMCALTriggers();

auto ctpDigits = recoData.getCTPDigits();

LOG(debug) << "FOUND " << primVertices.size() << " primary vertices";
LOG(debug) << "FOUND " << ft0RecPoints.size() << " FT0 rec. points";
LOG(debug) << "FOUND " << fv0RecPoints.size() << " FV0 rec. points";
Expand Down Expand Up @@ -1100,7 +1111,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
}

std::map<uint64_t, int> bcsMap;
collectBCs(fddRecPoints, ft0RecPoints, fv0RecPoints, primVertices, caloEMCCellsTRGR, mUseMC ? mcReader->getDigitizationContext()->getEventRecords() : std::vector<o2::InteractionTimeRecord>{}, bcsMap);
collectBCs(recoData, mUseMC ? mcReader->getDigitizationContext()->getEventRecords() : std::vector<o2::InteractionTimeRecord>{}, bcsMap);
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getFirstValid(true).header);

uint64_t tfNumber;
Expand Down Expand Up @@ -1396,17 +1407,32 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
mTableTrID = 0;
mGIDToTableID.clear();

// helper map for fast search of a corresponding class mask for a bc
std::unordered_map<uint64_t, uint64_t> bcToClassMask;
for (auto& ctpDigit : ctpDigits) {
uint64_t bc = ctpDigit.intRecord.toLong();
uint64_t classMask = ctpDigit.CTPClassMask.to_ulong();
bcToClassMask[bc] = classMask;
}

// filling BC table
// TODO: get real triggerMask
uint64_t triggerMask = 1;
uint64_t triggerMask;
for (auto& item : bcsMap) {
uint64_t bc = item.first;
auto bcClassPair = bcToClassMask.find(bc);
if (bcClassPair != bcToClassMask.end()) {
triggerMask = bcClassPair->second;
} else {
triggerMask = 0;
}
Comment thread
sawenzel marked this conversation as resolved.
bcCursor(0,
runNumber,
bc,
triggerMask);
}

bcToClassMask.clear();

if (mInputSources[GIndex::EMC]) {
// fill EMC cells to tables
// TODO handle MC info
Expand Down Expand Up @@ -1456,6 +1482,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo

dataRequest->requestTracks(src, useMC);
dataRequest->requestPrimaryVertertices(useMC);
dataRequest->requestCTPDigits(useMC);
if (enableSV) {
dataRequest->requestSecondaryVertertices(useMC);
}
Expand Down
2 changes: 1 addition & 1 deletion Detectors/AOD/src/aod-producer-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
auto useMC = !configcontext.options().get<bool>("disable-mc");
auto resFile = configcontext.options().get<std::string>("aod-writer-resfile");
bool enableSV = !configcontext.options().get<bool>("disable-secondary-vertices");
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<std::string>("info-sources"));

WorkflowSpec specs;
Expand Down