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
14 changes: 4 additions & 10 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "Common/CCDB/TriggerAliases.h"
#include "Common/Core/CollisionTypeHelper.h"
#include "Common/Core/EventPlaneHelper.h"
#include "Common/Core/trackUtilities.h"
#include "Common/Core/fwdtrackUtilities.h"
#include "Common/Core/trackUtilities.h"

#include "CommonConstants/LHCConstants.h"
#include "CommonConstants/PhysicsConstants.h"
Expand Down Expand Up @@ -65,14 +65,14 @@
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>

Check failure on line 68 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <map>
#include <utility>
#include <vector>

using std::complex;

Check failure on line 73 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[import-std-name]

Do not import names from the std namespace in headers.
using std::cout;

Check failure on line 74 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[import-std-name]

Do not import names from the std namespace in headers.
using std::endl;

Check failure on line 75 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[import-std-name]

Do not import names from the std namespace in headers.

using SMatrix55 = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<double, 5>>;
using SMatrix5 = ROOT::Math::SVector<double, 5>;
Expand Down Expand Up @@ -1466,9 +1466,9 @@
}
if constexpr ((fillMap & MuonCov) > 0 || (fillMap & ReducedMuonCov) > 0) {
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
double px = propmuon.getP() * sin(M_PI / 2 - atan(mfttrack.tgl())) * cos(mfttrack.phi());

Check failure on line 1469 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
double py = propmuon.getP() * sin(M_PI / 2 - atan(mfttrack.tgl())) * sin(mfttrack.phi());

Check failure on line 1470 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
double pz = propmuon.getP() * cos(M_PI / 2 - atan(mfttrack.tgl()));

Check failure on line 1471 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
values[kX] = mfttrack.x();
values[kY] = mfttrack.y();
Expand All @@ -1481,12 +1481,6 @@
}
}







template <uint32_t MuonfillMap, uint32_t MFTfillMap, typename T1, typename T2, typename C, typename C2>
void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack, const C& collision, C2 const& mftcov, float* values)
{
Expand All @@ -1498,12 +1492,12 @@
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
SMatrix5 tpars(mfttrack.x(), mfttrack.y(), mfttrack.phi(), mfttrack.tgl(), mfttrack.signed1Pt());
std::vector<double> v1{mftcov.cXX(), mftcov.cXY(), mftcov.cYY(), mftcov.cPhiX(), mftcov.cPhiY(),
mftcov.cPhiPhi(), mftcov.cTglX(), mftcov.cTglY(), mftcov.cTglPhi(), mftcov.cTglTgl(),
mftcov.c1PtX(), mftcov.c1PtY(), mftcov.c1PtPhi(), mftcov.c1PtTgl(), mftcov.c1Pt21Pt2()};
mftcov.cPhiPhi(), mftcov.cTglX(), mftcov.cTglY(), mftcov.cTglPhi(), mftcov.cTglTgl(),
mftcov.c1PtX(), mftcov.c1PtY(), mftcov.c1PtPhi(), mftcov.c1PtTgl(), mftcov.c1Pt21Pt2()};
SMatrix55 tcovs(v1.begin(), v1.end());
o2::track::TrackParCovFwd mft{mfttrack.z(), tpars, tcovs, mfttrack.chi2()};

o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon,mft);
o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft);
values[kX] = globalRefit.getX();
values[kY] = globalRefit.getY();
values[kZ] = globalRefit.getZ();
Expand Down Expand Up @@ -2014,7 +2008,7 @@
trackPar.propagateParamToDCA({collision.posX(), collision.posY(), collision.posZ()}, fgMagField, &dca);

// if it is a displaced track longitudinally, add it to the track vector
if (abs(dca[0]) < 3.0 && abs(dca[1]) > 4.0) {

Check failure on line 2011 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
if (track.tgl() > 0.1) {
tracksP.push_back(track.z());
}
Expand Down Expand Up @@ -3752,10 +3746,10 @@
values[kVertexingLxyErr] = (KFPV.GetCovariance(0) + KFGeoTwoProng.GetCovariance(0)) * dxPair2PV * dxPair2PV + (KFPV.GetCovariance(2) + KFGeoTwoProng.GetCovariance(2)) * dyPair2PV * dyPair2PV + 2 * ((KFPV.GetCovariance(1) + KFGeoTwoProng.GetCovariance(1)) * dxPair2PV * dyPair2PV);
values[kVertexingLzErr] = (KFPV.GetCovariance(5) + KFGeoTwoProng.GetCovariance(5)) * dzPair2PV * dzPair2PV;
values[kVertexingLxyzErr] = (KFPV.GetCovariance(0) + KFGeoTwoProng.GetCovariance(0)) * dxPair2PV * dxPair2PV + (KFPV.GetCovariance(2) + KFGeoTwoProng.GetCovariance(2)) * dyPair2PV * dyPair2PV + (KFPV.GetCovariance(5) + KFGeoTwoProng.GetCovariance(5)) * dzPair2PV * dzPair2PV + 2 * ((KFPV.GetCovariance(1) + KFGeoTwoProng.GetCovariance(1)) * dxPair2PV * dyPair2PV + (KFPV.GetCovariance(3) + KFGeoTwoProng.GetCovariance(3)) * dxPair2PV * dzPair2PV + (KFPV.GetCovariance(4) + KFGeoTwoProng.GetCovariance(4)) * dyPair2PV * dzPair2PV);
if (fabs(values[kVertexingLxy]) < 1.e-8f)

Check failure on line 3749 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[kVertexingLxy] = 1.e-8f;
values[kVertexingLxyErr] = values[kVertexingLxyErr] < 0. ? 1.e8f : std::sqrt(values[kVertexingLxyErr]) / values[kVertexingLxy];
if (fabs(values[kVertexingLz]) < 1.e-8f)

Check failure on line 3752 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[kVertexingLz] = 1.e-8f;
values[kVertexingLzErr] = values[kVertexingLzErr] < 0. ? 1.e8f : std::sqrt(values[kVertexingLzErr]) / values[kVertexingLz];
if (fabs(values[kVertexingLxyz]) < 1.e-8f)
Expand Down
34 changes: 17 additions & 17 deletions PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@ struct TableMakerMC {
std::map<uint32_t, uint32_t> fMftIndexMap; // key: MFT tracklet global index, value: new MFT tracklet global index

std::map<uint32_t, bool> fBestMatch;
std::unordered_map<int64_t,int32_t> map_mfttrackcovs;
std::unordered_map<int64_t, int32_t> map_mfttrackcovs;

void init(o2::framework::InitContext& context)
{
// Check whether barrel or muon are enabled
bool isProcessBCenabled = context.mOptions.get<bool>("processPP");
bool isBarrelEnabled = (context.mOptions.get<bool>("processPP") || context.mOptions.get<bool>("processPPBarrelOnly") || context.mOptions.get<bool>("processPbPbBarrelOnly") || context.mOptions.get<bool>("processPbPbWithFilterBarrelOnly"));
bool isMuonEnabled = (context.mOptions.get<bool>("processPP") || context.mOptions.get<bool>("processPPMuonOnlyBasic") || context.mOptions.get<bool>("processPPMuonOnly") || context.mOptions.get<bool>("processPPRealignedMuonOnly") || context.mOptions.get<bool>("processPbPbMuonOnly") || context.mOptions.get<bool>("processPbPbRealignedMuonOnly")) ||context.mOptions.get<bool>("processPPMuonRefit");
bool isMuonEnabled = (context.mOptions.get<bool>("processPP") || context.mOptions.get<bool>("processPPMuonOnlyBasic") || context.mOptions.get<bool>("processPPMuonOnly") || context.mOptions.get<bool>("processPPRealignedMuonOnly") || context.mOptions.get<bool>("processPbPbMuonOnly") || context.mOptions.get<bool>("processPbPbRealignedMuonOnly")) || context.mOptions.get<bool>("processPPMuonRefit");
// Make sure at least one process function is enabled
if (!(isProcessBCenabled || isBarrelEnabled || isMuonEnabled)) {
LOG(fatal) << "No process function was enabled for TableMakerMC. Check it out!!!";
Expand Down Expand Up @@ -944,12 +944,12 @@ struct TableMakerMC {
}
auto mfttrack = muon.template matchMFTTrack_as<TMFTTracks>();
VarManager::FillTrackCollision<TMuonFillMap>(muontrack, collision);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
VarManager::FillGlobalMuonRefitCov<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision, mfttrackcov);
}else{
} else {
VarManager::FillGlobalMuonRefit<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision);
}
}
} else {
VarManager::FillTrackCollision<TMuonFillMap>(muon, collision);
}
Expand Down Expand Up @@ -1072,12 +1072,12 @@ struct TableMakerMC {
auto mfttrack = muon.template matchMFTTrack_as<TMFTTracks>();
globalClusters += mfttrack.nClusters();
VarManager::FillTrackCollision<TMuonFillMap>(muontrack, collision);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
VarManager::FillGlobalMuonRefitCov<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision, mfttrackcov);
}else{
} else {
VarManager::FillGlobalMuonRefit<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision);
}
}
} else {
VarManager::FillTrackCollision<TMuonFillMap>(muon, collision);
}
Expand Down Expand Up @@ -1189,7 +1189,7 @@ struct TableMakerMC {
}

if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
for (auto &mfttrackConv : mftCovs) {
for (auto& mfttrackConv : mftCovs) {
map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex();
}
}
Expand All @@ -1213,11 +1213,11 @@ struct TableMakerMC {
if (fConfigVariousOptions.fKeepBestMatch) {
skimBestMuonMatches(muons);
}
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
skimMuons<TMuonFillMap, TMFTFillMap>(collision, muons, groupedMuonIndices, mcParticles, mftTracks, mftCovs);
}else{
} else {
skimMuons<TMuonFillMap, TMFTFillMap>(collision, muons, groupedMuonIndices, mcParticles, mftTracks, nullptr);
}
}
} else {
auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx);
skimMuons<TMuonFillMap, 0u>(collision, muons, groupedMuonIndices, mcParticles, nullptr, nullptr);
Expand Down Expand Up @@ -1396,9 +1396,9 @@ struct TableMakerMC {
}

void processPPMuonRefit(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs,
MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks,
aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs,
aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, aod::MFTTracksCov const& mftCovs)
MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks,
aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs,
aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, aod::MFTTracksCov const& mftCovs)
{
fullSkimming<gkEventFillMapWithMults, 0u, gkMuonFillMapWithCov, gkMFTCovFillMap>(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, mftCovs);
}
Expand Down
36 changes: 18 additions & 18 deletions PWGDQ/TableProducer/tableMaker_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ struct TableMaker {
std::map<uint32_t, uint32_t> fMftIndexMap; // key: MFT tracklet global index, value: new MFT tracklet global index

std::map<uint32_t, bool> fBestMatch;
std::unordered_map<int64_t,int32_t> map_mfttrackcovs;
std::unordered_map<int64_t, int32_t> map_mfttrackcovs;
// FIXME: For now, the skimming is done using the Common track-collision association task, which does not allow to use
// our own Filtered tracks. If the filter is very selective, then it may be worth to run the association in this workflow
// using the Common/CollisionAssociation class
Expand Down Expand Up @@ -1209,12 +1209,12 @@ struct TableMaker {
VarManager::FillTrackCollision<TMuonFillMap>(muontrack, collision);
// NOTE: the MFT track originally associated to the MUON track is currently used in the global muon refit
// Should MUON - MFT time ambiguities be taken into account ?
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
VarManager::FillGlobalMuonRefitCov<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision, mfttrackcov);
}else{
} else {
VarManager::FillGlobalMuonRefit<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision);
}
}
} else {
VarManager::FillTrackCollision<TMuonFillMap>(muon, collision);
}
Expand Down Expand Up @@ -1301,12 +1301,12 @@ struct TableMaker {
auto mfttrack = muon.template matchMFTTrack_as<MFTTracks>();
globalClusters += mfttrack.nClusters();
VarManager::FillTrackCollision<TMuonFillMap>(muontrack, collision);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
VarManager::FillGlobalMuonRefitCov<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision, mfttrackcov);
}else{
} else {
VarManager::FillGlobalMuonRefit<TMuonFillMap, TMFTFillMap>(muontrack, mfttrack, collision);
}
}
} else {
VarManager::FillTrackCollision<TMuonFillMap>(muon, collision);
}
Expand Down Expand Up @@ -1422,7 +1422,7 @@ struct TableMaker {
}

if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
for (auto &mfttrackConv : mftCovs) {
for (auto& mfttrackConv : mftCovs) {
map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex();
}
}
Expand All @@ -1444,14 +1444,14 @@ struct TableMaker {
if constexpr (static_cast<bool>(TMuonFillMap)) {
if constexpr (static_cast<bool>(TMFTFillMap)) {
auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx);
if (fConfigVariousOptions.fKeepBestMatch) {
skimBestMuonMatches(muons);
}
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
skimMuons<TMuonFillMap, TMFTFillMap>(collision, bcs, muons, groupedMuonIndices, mftTracks, mftCovs);
}else{
skimMuons<TMuonFillMap, TMFTFillMap>(collision, bcs, muons, groupedMuonIndices, mftTracks, nullptr);
}
if (fConfigVariousOptions.fKeepBestMatch) {
skimBestMuonMatches(muons);
}
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
skimMuons<TMuonFillMap, TMFTFillMap>(collision, bcs, muons, groupedMuonIndices, mftTracks, mftCovs);
} else {
skimMuons<TMuonFillMap, TMFTFillMap>(collision, bcs, muons, groupedMuonIndices, mftTracks, nullptr);
}
} else {
auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx);
skimMuons<TMuonFillMap, 0u>(collision, bcs, muons, groupedMuonIndices, nullptr, nullptr);
Expand Down
Loading