Skip to content
Merged
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
33 changes: 29 additions & 4 deletions PWGDQ/Tasks/muonGlobalAlignment.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
/// \brief Task to compute and evaluate DCA quantities
/// \author Nicolas Bizé <nicolas.bize@cern.ch>, SUBATECH
//

#include "PWGDQ/Core/VarManager.h"
#include "PWGDQ/DataModel/ReducedInfoTables.h"
// #include "PWGDQ/DataModel/ReducedInfoTables.h"

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/RCTSelectionFlags.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include <CCDB/BasicCCDBManager.h>
#include <CCDB/CcdbApi.h>
Expand Down Expand Up @@ -88,9 +90,9 @@

using namespace o2::aod::rctsel;

using MyReducedMuons = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra, aod::ReducedMuonsCov>;
using MyReducedEvents = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended>;
using MyReducedEventsVtxCov = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended, aod::ReducedEventsVtxCov>;
// using MyReducedMuons = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra, aod::ReducedMuonsCov>;
// using MyReducedEvents = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended>;
// using MyReducedEventsVtxCov = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended, aod::ReducedEventsVtxCov>;

using MyCollisions = aod::Collisions;
using MyBCs = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels>;
Expand All @@ -114,7 +116,22 @@
using o2::dataformats::GlobalFwdTrack;
using o2::track::TrackParCovFwd;

namespace o2::aod
{
DECLARE_SOA_TABLE(CompactMFTTracks, "AOD", "COMPACTMFT", //! standalone table for studying alignment
collision::PosX, collision::PosY, collision::PosZ,
fwdtrack::Signed1Pt, fwdtrack::Tgl, fwdtrack::Phi,
fwdtrack::FwdDcaX, fwdtrack::FwdDcaY, o2::aod::fwdtrack::CXX, o2::aod::fwdtrack::CYY, o2::aod::fwdtrack::CXY,
fwdtrack::NClusters, fwdtrack::Chi2,
fwdtrack::X, fwdtrack::Y, fwdtrack::Z);
using CompactMFTTrack = CompactMFTTracks;
} // namespace o2::aod

struct muonGlobalAlignment {

Produces<aod::CompactMFTTracks> mftTable;
Configurable<bool> cfgProduceMFTTable{"cfgProduceMFTTable", false, "flag to produce MFTsa table"};

//// Variables for selecting MCH and MFT tracks
Configurable<float> fTrackChi2MchUp{"cfgTrackChi2MchUp", 5.f, ""};
Configurable<float> fPtMchLow{"cfgPtMchLow", 0.7f, ""};
Expand Down Expand Up @@ -255,7 +272,7 @@
std::map<uint64_t, CollisionInfo>& collisionInfos)
{
// fill collision information for global muon tracks (MFT-MCH-MID matches)
for (auto muonTrack : muonTracks) {

Check failure on line 275 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (!muonTrack.has_collision())
continue;

Expand Down Expand Up @@ -303,8 +320,8 @@
return (track1.chi2MatchMCHMFT() < track2.chi2MatchMCHMFT());
};

for (auto& [collisionIndex, collisionInfo] : collisionInfos) {

Check failure on line 323 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
for (auto& [mchIndex, globalTracksVector] : collisionInfo.globalMuonTracks) {

Check failure on line 324 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
std::sort(globalTracksVector.begin(), globalTracksVector.end(), compareChi2);
}
}
Expand All @@ -319,7 +336,7 @@
InitCollisions(collisions, bcs, muonTracks, collisionInfos);

// fill collision information for MFT standalone tracks
for (auto mftTrack : mftTracks) {

Check failure on line 339 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (!mftTrack.has_collision())
continue;

Expand Down Expand Up @@ -1077,8 +1094,8 @@
track.setBendingCoor(y + yCorrection);
track.setBendingSlope(ySlope + ySlopeCorrection);
/*
std::cout << std::format("[TOTO] MFT position: pos={:0.3f},{:0.3f}", x, y) << std::endl;

Check failure on line 1097 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
std::cout << std::format("[TOTO] MFT corrections: pos={:0.3f},{:0.3f} slope={:0.12f},{:0.12f} angle={:0.12f},{:0.12f}",

Check failure on line 1098 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
xCorrection, yCorrection, xSlopeCorrection, ySlopeCorrection,
std::atan2(xSlopeCorrection, 1), std::atan2(ySlopeCorrection, 1)) << std::endl;
*/
Expand Down Expand Up @@ -1116,8 +1133,8 @@
template <typename T>
T UpdateTrackMomentum(const T& track, const double p, int sign)
{
double px = p * sin(M_PI / 2 - atan(track.tgl())) * cos(track.phi());

Check failure on line 1136 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

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

Check failure on line 1137 in PWGDQ/Tasks/muonGlobalAlignment.cxx

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));

SMatrix5 tpars = {track.x(), track.y(), track.phi(), track.tgl(), sign / pt};
Expand All @@ -1137,8 +1154,8 @@
template <typename T>
T UpdateTrackMomentum(const T& track, const o2::mch::TrackParam& track4mom)
{
double px = track4mom.p() * sin(M_PI / 2 - atan(track.tgl())) * cos(track.phi());

Check failure on line 1157 in PWGDQ/Tasks/muonGlobalAlignment.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

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

Check failure on line 1158 in PWGDQ/Tasks/muonGlobalAlignment.cxx

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));
double sign = track4mom.getCharge();

Expand Down Expand Up @@ -1452,6 +1469,14 @@
registry.get<THnSparse>(HIST("DCA/MFT/DCA_x"))->Fill(dcax, collision.posZ(), mftTrack.x(), mftTrack.y(), mftNclusters);
registry.get<THnSparse>(HIST("DCA/MFT/DCA_y"))->Fill(dcay, collision.posZ(), mftTrack.x(), mftTrack.y(), mftNclusters);

if (cfgProduceMFTTable) {
mftTable(collision.posX(), collision.posY(), collision.posZ(),
mftTrack.signed1Pt(), mftTrack.tgl(), mftTrack.phi(),
dcax, dcay, mftTrackAtDCA.getSigma2X(), mftTrackAtDCA.getSigma2Y(), mftTrackAtDCA.getSigmaXY(),
mftNclusters, mftTrack.chi2(),
mftTrack.x(), mftTrack.y(), mftTrack.z());
}

if (fEnableMftDcaExtraPlots) {
if (mftNclusters >= 6) {
for (int i = 0; i < nMftLayers; i++) {
Expand Down
Loading