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

Adding MFT covariances in AOD associated with global muon tracks #13780

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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 @@ -521,8 +521,8 @@ class AODProducerWorkflowDPL : public Task
GIndex trackID, const o2::globaltracking::RecoContainer& data, int collisionID,
std::uint64_t collisionBC, const std::map<uint64_t, int>& bcsMap);

template <typename fwdTracksCursorType, typename fwdTracksCovCursorType, typename AmbigFwdTracksCursorType>
void addToFwdTracksTable(fwdTracksCursorType& fwdTracksCursor, fwdTracksCovCursorType& fwdTracksCovCursor, AmbigFwdTracksCursorType& ambigFwdTracksCursor,
template <typename fwdTracksCursorType, typename fwdTracksCovCursorType, typename AmbigFwdTracksCursorType, typename mftTracksCovCursorType>
void addToFwdTracksTable(fwdTracksCursorType& fwdTracksCursor, fwdTracksCovCursorType& fwdTracksCovCursor, AmbigFwdTracksCursorType& ambigFwdTracksCursor, mftTracksCovCursorType& mftTracksCovCursor,
GIndex trackID, const o2::globaltracking::RecoContainer& data, int collisionID, std::uint64_t collisionBC, const std::map<uint64_t, int>& bcsMap);

TrackExtraInfo processBarrelTrack(int collisionID, std::uint64_t collisionBC, GIndex trackIndex, const o2::globaltracking::RecoContainer& data, const std::map<uint64_t, int>& bcsMap);
Expand All @@ -536,7 +536,7 @@ class AODProducerWorkflowDPL : public Task
// * fills tables collision by collision
// * interaction time is for TOF information
template <typename TracksCursorType, typename TracksCovCursorType, typename TracksExtraCursorType, typename TracksQACursorType, typename AmbigTracksCursorType,
typename MFTTracksCursorType, typename AmbigMFTTracksCursorType,
typename MFTTracksCursorType, typename MFTTracksCovCursorType, typename AmbigMFTTracksCursorType,
typename FwdTracksCursorType, typename FwdTracksCovCursorType, typename AmbigFwdTracksCursorType, typename FwdTrkClsCursorType>
void fillTrackTablesPerCollision(int collisionID,
std::uint64_t collisionBC,
Expand All @@ -549,6 +549,7 @@ class AODProducerWorkflowDPL : public Task
TracksQACursorType& tracksQACursor,
AmbigTracksCursorType& ambigTracksCursor,
MFTTracksCursorType& mftTracksCursor,
MFTTracksCovCursorType& mftTracksCovCursor,
AmbigMFTTracksCursorType& ambigMFTTracksCursor,
FwdTracksCursorType& fwdTracksCursor,
FwdTracksCovCursorType& fwdTracksCovCursor,
Expand Down
40 changes: 34 additions & 6 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void AODProducerWorkflowDPL::addToMFTTracksTable(mftTracksCursorType& mftTracksC
}

template <typename TracksCursorType, typename TracksCovCursorType, typename TracksExtraCursorType, typename TracksQACursorType, typename AmbigTracksCursorType,
typename MFTTracksCursorType, typename AmbigMFTTracksCursorType,
typename MFTTracksCursorType, typename MFTTracksCovCursorType, typename AmbigMFTTracksCursorType,
typename FwdTracksCursorType, typename FwdTracksCovCursorType, typename AmbigFwdTracksCursorType, typename FwdTrkClsCursorType>
void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
std::uint64_t collisionBC,
Expand All @@ -439,6 +439,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
TracksQACursorType& tracksQACursor,
AmbigTracksCursorType& ambigTracksCursor,
MFTTracksCursorType& mftTracksCursor,
MFTTracksCovCursorType& mftTracksCovCursor,
AmbigMFTTracksCursorType& ambigMFTTracksCursor,
FwdTracksCursorType& fwdTracksCursor,
FwdTracksCovCursorType& fwdTracksCovCursor,
Expand All @@ -458,6 +459,9 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
} else if (src == GIndex::Source::MCH || src == GIndex::Source::MFTMCH || src == GIndex::Source::MCHMID) {
fwdTracksCursor.reserve(nToReserve + fwdTracksCursor.lastIndex());
fwdTracksCovCursor.reserve(nToReserve + fwdTracksCovCursor.lastIndex());
if (src == GIndex::Source::MFTMCH) {
mftTracksCovCursor.reserve(nToReserve + mftTracksCovCursor.lastIndex());
}
} else {
tracksCursor.reserve(nToReserve + tracksCursor.lastIndex());
tracksCovCursor.reserve(nToReserve + tracksCovCursor.lastIndex());
Expand All @@ -477,7 +481,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
if (trackIndex.isAmbiguous() && mGIDToTableFwdID.find(trackIndex) != mGIDToTableFwdID.end()) { // was it already stored ?
continue;
}
addToFwdTracksTable(fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, trackIndex, data, collisionID, collisionBC, bcsMap);
addToFwdTracksTable(fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, mftTracksCovCursor, trackIndex, data, collisionID, collisionBC, bcsMap);
mGIDToTableFwdID.emplace(trackIndex, mTableTrFwdID);
addClustersToFwdTrkClsTable(data, fwdTrkClsCursor, trackIndex, mTableTrFwdID);
mTableTrFwdID++;
Expand Down Expand Up @@ -598,9 +602,9 @@ void AODProducerWorkflowDPL::fillIndexTablesPerCollision(const o2::dataformats::
}
}

template <typename FwdTracksCursorType, typename FwdTracksCovCursorType, typename AmbigFwdTracksCursorType>
template <typename FwdTracksCursorType, typename FwdTracksCovCursorType, typename AmbigFwdTracksCursorType, typename mftTracksCovCursorType>
void AODProducerWorkflowDPL::addToFwdTracksTable(FwdTracksCursorType& fwdTracksCursor, FwdTracksCovCursorType& fwdTracksCovCursor,
AmbigFwdTracksCursorType& ambigFwdTracksCursor, GIndex trackID,
AmbigFwdTracksCursorType& ambigFwdTracksCursor, mftTracksCovCursorType& mftTracksCovCursor, GIndex trackID,
const o2::globaltracking::RecoContainer& data, int collisionID, std::uint64_t collisionBC,
const std::map<uint64_t, int>& bcsMap)
{
Expand Down Expand Up @@ -742,6 +746,8 @@ void AODProducerWorkflowDPL::addToFwdTracksTable(FwdTracksCursorType& fwdTracksC
fwdInfo.trackTimeRes = time.getTimeStampError() * 1.e3;
} else { // This is a GlobalMuonTrack or a GlobalForwardTrack
const auto& track = data.getGlobalFwdTrack(trackID);
const auto& mftTracks = data.getMFTTracks();
const auto& mfttrack = mftTracks[track.getMFTTrackID()];
if (!extrapMCHTrack(track.getMCHTrackID())) {
LOGF(warn, "Unable to extrapolate MCH track with ID %d! Dummy parameters will be used", track.getMCHTrackID());
}
Expand Down Expand Up @@ -781,6 +787,26 @@ void AODProducerWorkflowDPL::addToFwdTracksTable(FwdTracksCursorType& fwdTracksC
fwdCovInfo.rho1PtTgl = (Char_t)(128. * track.getCovariances()(3, 4) / (fwdCovInfo.sig1Pt * fwdCovInfo.sigTgl));

fwdInfo.trackTypeId = (fwdInfo.chi2matchmchmid >= 0) ? o2::aod::fwdtrack::GlobalMuonTrack : o2::aod::fwdtrack::GlobalForwardTrack;

float sX = TMath::Sqrt(mfttrack.getSigma2X()), sY = TMath::Sqrt(mfttrack.getSigma2Y()), sPhi = TMath::Sqrt(mfttrack.getSigma2Phi()),
sTgl = TMath::Sqrt(mfttrack.getSigma2Tanl()), sQ2Pt = TMath::Sqrt(mfttrack.getSigma2InvQPt());

mftTracksCovCursor(fwdInfo.matchmfttrackid,
truncateFloatFraction(sX, mTrackCovDiag),
truncateFloatFraction(sY, mTrackCovDiag),
truncateFloatFraction(sPhi, mTrackCovDiag),
truncateFloatFraction(sTgl, mTrackCovDiag),
truncateFloatFraction(sQ2Pt, mTrackCovDiag),
(Char_t)(128. * mfttrack.getCovariances()(0, 1) / (sX * sY)),
(Char_t)(128. * mfttrack.getCovariances()(0, 2) / (sPhi * sX)),
(Char_t)(128. * mfttrack.getCovariances()(1, 2) / (sPhi * sY)),
(Char_t)(128. * mfttrack.getCovariances()(0, 3) / (sTgl * sX)),
(Char_t)(128. * mfttrack.getCovariances()(1, 3) / (sTgl * sY)),
(Char_t)(128. * mfttrack.getCovariances()(2, 3) / (sTgl * sPhi)),
(Char_t)(128. * mfttrack.getCovariances()(0, 4) / (sQ2Pt * sX)),
(Char_t)(128. * mfttrack.getCovariances()(1, 4) / (sQ2Pt * sY)),
(Char_t)(128. * mfttrack.getCovariances()(2, 4) / (sQ2Pt * sPhi)),
(Char_t)(128. * mfttrack.getCovariances()(3, 4) / (sQ2Pt * sTgl)));
}

std::uint64_t bcOfTimeRef;
Expand Down Expand Up @@ -1834,6 +1860,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
auto fwdTracksCovCursor = createTableCursor<o2::aod::StoredFwdTracksCov>(pc);
auto fwdTrkClsCursor = createTableCursor<o2::aod::FwdTrkCls>(pc);
auto mftTracksCursor = createTableCursor<o2::aod::StoredMFTTracks>(pc);
auto mftTracksCovCursor = createTableCursor<o2::aod::StoredMFTTracksCov>(pc);
auto tracksCursor = createTableCursor<o2::aod::StoredTracksIU>(pc);
auto tracksCovCursor = createTableCursor<o2::aod::StoredTracksCovIU>(pc);
auto tracksExtraCursor = createTableCursor<o2::aod::StoredTracksExtra>(pc);
Expand Down Expand Up @@ -2168,7 +2195,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
auto& trackRef = primVer2TRefs.back(); // references to unassigned tracks are at the end
// fixme: interaction time is undefined for unassigned tracks (?)
fillTrackTablesPerCollision(-1, std::uint64_t(-1), trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, tracksQACursor,
ambigTracksCursor, mftTracksCursor, ambigMFTTracksCursor,
ambigTracksCursor, mftTracksCursor, mftTracksCovCursor, ambigMFTTracksCursor,
fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, fwdTrkClsCursor, bcsMap);

// filling collisions and tracks into tables
Expand Down Expand Up @@ -2210,7 +2237,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
auto& trackRef = primVer2TRefs[collisionID];
// passing interaction time in [ps]
fillTrackTablesPerCollision(collisionID, globalBC, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, tracksQACursor, ambigTracksCursor,
mftTracksCursor, ambigMFTTracksCursor,
mftTracksCursor, mftTracksCovCursor, ambigMFTTracksCursor,
fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, fwdTrkClsCursor, bcsMap);
collisionID++;
}
Expand Down Expand Up @@ -3123,6 +3150,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
OutputForTable<StoredFwdTracks>::spec(),
OutputForTable<StoredFwdTracksCov>::spec(),
OutputForTable<StoredMFTTracks>::spec(),
OutputForTable<StoredMFTTracksCov>::spec(),
OutputForTable<StoredTracksIU>::spec(),
OutputForTable<StoredTracksCovIU>::spec(),
OutputForTable<StoredTracksExtra>::spec(),
Expand Down
26 changes: 26 additions & 0 deletions Framework/Core/include/Framework/AnalysisDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,32 @@ DECLARE_SOA_EXTENDED_TABLE(FwdTracksCov, StoredFwdTracksCov, "EXFWDTRACKCOV", 0,
using FwdTrack = FwdTracks::iterator;
using FwdTrackCovFwd = FwdTracksCov::iterator;

DECLARE_SOA_TABLE_FULL(StoredMFTTracksCov, "MFTTracksCov", "AOD", "MFTTRACKCOV", //!
o2::soa::Index<>, fwdtrack::MFTTrackId,
fwdtrack::SigmaX, fwdtrack::SigmaY, fwdtrack::SigmaPhi, fwdtrack::SigmaTgl, fwdtrack::Sigma1Pt,
fwdtrack::RhoXY, fwdtrack::RhoPhiX, fwdtrack::RhoPhiY, fwdtrack::RhoTglX, fwdtrack::RhoTglY,
fwdtrack::RhoTglPhi, fwdtrack::Rho1PtX, fwdtrack::Rho1PtY, fwdtrack::Rho1PtPhi, fwdtrack::Rho1PtTgl);

DECLARE_SOA_EXTENDED_TABLE(MFTTracksCov, StoredMFTTracksCov, "EXMFTTRACKCOV", 0, //!
aod::fwdtrack::CXX,
aod::fwdtrack::CXY,
aod::fwdtrack::CYY,
aod::fwdtrack::CPhiX,
aod::fwdtrack::CPhiY,
aod::fwdtrack::CPhiPhi,
aod::fwdtrack::CTglX,
aod::fwdtrack::CTglY,
aod::fwdtrack::CTglPhi,
aod::fwdtrack::CTglTgl,
aod::fwdtrack::C1PtX,
aod::fwdtrack::C1PtY,
aod::fwdtrack::C1PtPhi,
aod::fwdtrack::C1PtTgl,
aod::fwdtrack::C1Pt21Pt2);

using MFTTrack = MFTTracks::iterator;
using MFTTrackCovFwd = MFTTracksCov::iterator;

} // namespace aod
namespace soa
{
Expand Down
Loading