Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide MCH clusters via global-track-cluster-reader and RecoContainer #8642

Merged
merged 1 commit into from
Apr 25, 2022
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 @@ -211,6 +211,8 @@ struct DataRequest {
void requestTPCClusters(bool mc);
void requestTOFClusters(bool mc);
void requestTRDTracklets(bool mc);
void requestMCHClusters(bool mc);
void requestMIDClusters(bool mc);

void requestCTPDigits(bool mc);

Expand Down Expand Up @@ -292,9 +294,11 @@ struct RecoContainer {
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcITSClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcTOFClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcCPVClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcMCHClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::phos::MCLabel>> mcPHSCells;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::emcal::MCLabel>> mcEMCCells;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>> mcMIDTrackClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>> mcMIDClusters;

gsl::span<const unsigned char> clusterShMapTPC; ///< externally set TPC clusters sharing map

Expand Down Expand Up @@ -329,6 +333,8 @@ struct RecoContainer {
void addTPCClusters(o2::framework::ProcessingContext& pc, bool mc, bool shmap);
void addTOFClusters(o2::framework::ProcessingContext& pc, bool mc);
void addTRDTracklets(o2::framework::ProcessingContext& pc, bool mc);
void addMCHClusters(o2::framework::ProcessingContext& pc, bool mc);
void addMIDClusters(o2::framework::ProcessingContext& pc, bool mc);

void addFT0RecPoints(o2::framework::ProcessingContext& pc, bool mc);
void addFV0RecPoints(o2::framework::ProcessingContext& pc, bool mc);
Expand Down Expand Up @@ -457,18 +463,28 @@ struct RecoContainer {
const o2::mch::TrackMCH& getMCHTrack(GTrackID gid) const { return getTrack<o2::mch::TrackMCH>(gid); }
auto getMCHTracks() const { return getTracks<o2::mch::TrackMCH>(GTrackID::MCH); }
auto getMCHTracksROFRecords() const { return getSpan<o2::mch::ROFRecord>(GTrackID::MCH, TRACKREFS); }
auto getMCHTrackClusters() const { return getSpan<o2::mch::Cluster>(GTrackID::MCH, CLUSREFS); }
auto getMCHTrackClusters() const { return getSpan<o2::mch::Cluster>(GTrackID::MCH, INDICES); }
auto getMCHTracksMCLabels() const { return getSpan<o2::MCCompLabel>(GTrackID::MCH, MCLABELS); }

// MCH clusters
auto getMCHClusterROFRecords() const { return getSpan<o2::mch::ROFRecord>(GTrackID::MCH, CLUSREFS); }
auto getMCHClusters() const { return getSpan<o2::mch::Cluster>(GTrackID::MCH, CLUSTERS); }
auto getMCHClustersMCLabels() const { return mcMCHClusters.get(); }

// MID
const o2::mid::Track& getMIDTrack(GTrackID gid) const { return getTrack<o2::mid::Track>(gid); }
auto getMIDTracks() const { return getTracks<o2::mid::Track>(GTrackID::MID); }
auto getMIDTracksROFRecords() const { return getSpan<o2::mid::ROFRecord>(GTrackID::MID, TRACKREFS); }
auto getMIDTrackClusters() const { return getSpan<o2::mid::Cluster>(GTrackID::MID, CLUSREFS); }
auto getMIDTrackClusters() const { return getSpan<o2::mid::Cluster>(GTrackID::MID, INDICES); }
auto getMIDTrackClustersROFRecords() const { return getSpan<o2::mid::ROFRecord>(GTrackID::MID, MATCHES); }
auto getMIDTracksMCLabels() const { return getSpan<o2::MCCompLabel>(GTrackID::MID, MCLABELS); }
const o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>* getMIDTracksClusterMCLabels() const;

// MID clusters
auto getMIDClusterROFRecords() const { return getSpan<o2::mid::ROFRecord>(GTrackID::MID, CLUSREFS); }
auto getMIDClusters() const { return getSpan<o2::mid::Cluster>(GTrackID::MID, CLUSTERS); }
const o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>* getMIDClustersMCLabels() const;

// TPC
const o2::tpc::TrackTPC& getTPCTrack(GTrackID id) const { return getTrack<o2::tpc::TrackTPC>(id); }
auto getTPCTracks() const { return getTracks<o2::tpc::TrackTPC>(GTrackID::TPC); }
Expand Down
64 changes: 62 additions & 2 deletions DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ void DataRequest::requestTOFClusters(bool mc)
requestMap["clusTOF"] = mc;
}

void DataRequest::requestMCHClusters(bool mc)
{
addInput({"clusMCH", "MCH", "GLOBALCLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusMCHROF", "MCH", "CLUSTERROFS", 0, Lifetime::Timeframe});
if (mc) {
addInput({"clusMCHMC", "MCH", "CLUSTERLABELS", 0, Lifetime::Timeframe});
}
requestMap["clusMCH"] = mc;
}

void DataRequest::requestMIDClusters(bool mc)
{
addInput({"clusMID", "MID", "CLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusMIDROF", "MID", "CLUSTERSROF", 0, Lifetime::Timeframe});
if (mc) {
addInput({"clusMIDMC", "MID", "CLUSTERSLABELS", 0, Lifetime::Timeframe});
}
requestMap["clusMID"] = mc;
}

void DataRequest::requestTRDTracklets(bool mc)
{
addInput({"trdtracklets", o2::header::gDataOriginTRD, "TRACKLETS", 0, Lifetime::Timeframe});
Expand Down Expand Up @@ -476,6 +496,9 @@ void DataRequest::requestClusters(GTrackID::mask_t src, bool useMC)
if (GTrackID::includesDet(DetID::EMC, src)) {
requestEMCALCells(useMC);
}
if (GTrackID::includesDet(DetID::MCH, src)) {
requestMCHClusters(useMC);
}
}

//__________________________________________________________________
Expand Down Expand Up @@ -601,6 +624,16 @@ void RecoContainer::collectData(ProcessingContext& pc, const DataRequest& reques
addEMCALCells(pc, req->second);
}

req = reqMap.find("clusMCH");
if (req != reqMap.end()) {
addMCHClusters(pc, req->second);
}

req = reqMap.find("clusMID");
if (req != reqMap.end()) {
addMIDClusters(pc, req->second);
}

req = reqMap.find("FT0");
if (req != reqMap.end()) {
addFT0RecPoints(pc, req->second);
Expand Down Expand Up @@ -732,7 +765,7 @@ void RecoContainer::addMCHTracks(ProcessingContext& pc, bool mc)
{
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::mch::TrackMCH>>("trackMCH"), TRACKS);
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::mch::ROFRecord>>("trackMCHROF"), TRACKREFS);
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::mch::Cluster>>("trackMCHTRACKCLUSTERS"), CLUSREFS);
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::mch::Cluster>>("trackMCHTRACKCLUSTERS"), INDICES);
if (mc) {
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackMCHMCTR"), MCLABELS);
}
Expand All @@ -743,7 +776,7 @@ void RecoContainer::addMIDTracks(ProcessingContext& pc, bool mc)
{
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::Track>>("trackMID"), TRACKS);
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::ROFRecord>>("trackMIDROF"), TRACKREFS);
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::Cluster>>("trackMIDTRACKCLUSTERS"), CLUSREFS);
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::Cluster>>("trackMIDTRACKCLUSTERS"), INDICES);
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::ROFRecord>>("trackClMIDROF"), MATCHES);
if (mc) {
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackMIDMCTR"), MCLABELS);
Expand All @@ -757,6 +790,12 @@ const o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>* RecoContainer:
return mcMIDTrackClusters.get();
}

//________________________________________________________
const o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>* RecoContainer::getMIDClustersMCLabels() const
{
return mcMIDClusters.get();
}

//____________________________________________________________
void RecoContainer::addTPCTracks(ProcessingContext& pc, bool mc)
{
Expand Down Expand Up @@ -856,6 +895,7 @@ void RecoContainer::addTOFMatchesITSTPCTRD(ProcessingContext& pc, bool mc)
commonPool[GTrackID::ITSTPCTRDTOF].registerContainer(pc.inputs().get<gsl::span<o2::MCCompLabel>>("clsTOF_GLO3_MCTR"), MCLABELS);
}
}

//__________________________________________________________
void RecoContainer::addITSClusters(ProcessingContext& pc, bool mc)
{
Expand Down Expand Up @@ -901,6 +941,26 @@ void RecoContainer::addTOFClusters(ProcessingContext& pc, bool mc)
}
}

//__________________________________________________________
void RecoContainer::addMCHClusters(ProcessingContext& pc, bool mc)
{
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::mch::ROFRecord>>("clusMCHROF"), CLUSREFS);
commonPool[GTrackID::MCH].registerContainer(pc.inputs().get<gsl::span<o2::mch::Cluster>>("clusMCH"), CLUSTERS);
if (mc) {
mcMCHClusters = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusMCHMC");
}
}

//__________________________________________________________
void RecoContainer::addMIDClusters(ProcessingContext& pc, bool mc)
{
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::ROFRecord>>("clusMIDROF"), CLUSREFS);
commonPool[GTrackID::MID].registerContainer(pc.inputs().get<gsl::span<o2::mid::Cluster>>("clusMID"), CLUSTERS);
if (mc) {
mcMIDClusters = pc.inputs().get<const dataformats::MCTruthContainer<o2::mid::MCClusterLabel>*>("clusMIDMC");
}
}

//__________________________________________________________
void RecoContainer::addCTPDigits(ProcessingContext& pc, bool mc)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "TRDWorkflowIO/TRDTrackReaderSpec.h"
#include "CTPWorkflowIO/DigitReaderSpec.h"
#include "MCHWorkflow/TrackReaderSpec.h"
#include "MCHWorkflow/ClusterReaderSpec.h"
#include "MIDWorkflow/TrackReaderSpec.h"
#include "PHOSWorkflow/ReaderSpec.h"
#include "CPVWorkflow/ReaderSpec.h"
Expand Down Expand Up @@ -155,6 +156,10 @@ int InputHelper::addInputSpecs(const ConfigContext& configcontext, WorkflowSpec&
specs.emplace_back(o2::emcal::getCellReaderSpec(maskTracksMC[GID::EMC] || maskClustersMC[GID::EMC]));
}

if (maskClusters[GID::MCH]) {
specs.emplace_back(o2::mch::getClusterReaderSpec(maskClustersMC[GID::MCH], "mch-global-cluster-reader", true, false));
}

return 0;
}

Expand Down