Skip to content
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
1 change: 1 addition & 0 deletions PWGDQ/Core/VarManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Tools/KFparticle/KFUtilities.h"

#include <cmath>
#include <iostream>

Check failure on line 16 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

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

Expand All @@ -30,6 +30,7 @@
bool VarManager::fgUsedKF = false;
float VarManager::fgMagField = 0.5;
float VarManager::fgzMatching = -77.5;
float VarManager::fgzShiftFwd = 0.0;
float VarManager::fgValues[VarManager::kNVars] = {0.0f};
float VarManager::fgTPCInterSectorBoundary = 1.0; // cm
int VarManager::fgITSROFbias = 0;
Expand Down Expand Up @@ -167,8 +168,8 @@
// TO Do: add more systems

// set the beam 4-momentum vectors
float beamAEnergy = energy / 2.0 * sqrt(NumberOfProtonsA * NumberOfProtonsC / NumberOfProtonsC / NumberOfProtonsA); // GeV

Check failure on line 171 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float beamCEnergy = energy / 2.0 * sqrt(NumberOfProtonsC * NumberOfProtonsA / NumberOfProtonsA / NumberOfProtonsC); // GeV

Check failure on line 172 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float beamAMomentum = std::sqrt(beamAEnergy * beamAEnergy - NumberOfNucleonsA * NumberOfNucleonsA * MassProton * MassProton);
float beamCMomentum = std::sqrt(beamCEnergy * beamCEnergy - NumberOfNucleonsC * NumberOfNucleonsC * MassProton * MassProton);
fgBeamA.SetPxPyPzE(0, 0, beamAMomentum, beamAEnergy);
Expand Down Expand Up @@ -267,7 +268,7 @@
double mean = calibMeanHist->GetBinContent(binTPCncls, binPin, binEta);
double sigma = calibSigmaHist->GetBinContent(binTPCncls, binPin, binEta);
return (nSigmaValue - mean) / sigma; // Return the calibrated nSigma value
} else if (fgCalibrationType == 2) {

Check failure on line 271 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// get the calibration histograms
CalibObjects calibMean, calibSigma, calibStatus;
switch (species) {
Expand Down
57 changes: 42 additions & 15 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
#include <cmath>
#include <complex>
#include <cstdint>
#include <iostream>

Check failure on line 71 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 76 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 77 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 78 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 @@ -1051,6 +1051,12 @@
return fgzMatching;
}

// Set z shift for forward tracks
static void SetZShift(float z)
{
fgzShiftFwd = z;
}

// Setup the 2 prong KFParticle
static void SetupTwoProngKFParticle(float magField)
{
Expand Down Expand Up @@ -1332,6 +1338,7 @@

static float fgMagField;
static float fgzMatching;
static float fgzShiftFwd;
static float fgCenterOfMassEnergy; // collision energy
static float fgMassofCollidingParticle; // mass of the colliding particle
static float fgTPCInterSectorBoundary; // TPC inter-sector border size at the TPC outer radius, in cm
Expand Down Expand Up @@ -1473,7 +1480,7 @@
template <typename T, typename C>
o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C& collision, const int endPoint)
{
o2::track::TrackParCovFwd fwdtrack = FwdToTrackPar(muon, muon);
o2::track::TrackParCovFwd fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwdShift(muon, fgzShiftFwd, muon);
o2::dataformats::GlobalFwdTrack propmuon;
if (static_cast<int>(muon.trackType()) > 2) {
o2::dataformats::GlobalFwdTrack track;
Expand Down Expand Up @@ -1501,12 +1508,8 @@
propmuon.setCovariances(proptrack.getCovariances());

} else if (static_cast<int>(muon.trackType()) < 2) {
double centerMFT[3] = {0, 0, -61.4};
o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
auto Bz = field->getBz(centerMFT); // Get field at centre of MFT
auto geoMan = o2::base::GeometryManager::meanMaterialBudget(muon.x(), muon.y(), muon.z(), collision.posX(), collision.posY(), collision.posZ());
auto x2x0 = static_cast<float>(geoMan.meanX2X0);
fwdtrack.propagateToVtxhelixWithMCS(collision.posZ(), {collision.posX(), collision.posY()}, {collision.covXX(), collision.covYY()}, Bz, x2x0);
std::array<double, 3> dcaInfOrig{999.f, 999.f, 999.f};
fwdtrack.propagateToDCAhelix(fgMagField, {collision.posX(), collision.posY(), collision.posZ()}, dcaInfOrig);
propmuon.setParameters(fwdtrack.getParameters());
propmuon.setZ(fwdtrack.getZ());
propmuon.setCovariances(fwdtrack.getCovariances());
Expand Down Expand Up @@ -1605,18 +1608,19 @@
}
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 1611 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 1612 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()));
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
values[kX] = mfttrack.x();
values[kY] = mfttrack.y();
values[kZ] = mfttrack.z();
values[kTgl] = mfttrack.tgl();
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd);
values[kX] = mftprop.getX();
values[kY] = mftprop.getY();
values[kZ] = mftprop.getZ();
values[kTgl] = mftprop.getTgl();
values[kPt] = pt;
values[kPz] = pz;
values[kEta] = mfttrack.eta();
values[kPhi] = mfttrack.phi();
values[kEta] = mftprop.getEta();
values[kPhi] = mftprop.getPhi();
}
}

Expand All @@ -1629,7 +1633,7 @@
if constexpr ((MuonfillMap & MuonCov) > 0) {
if constexpr ((MFTfillMap & MFTCov) > 0) {
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
o2::track::TrackParCovFwd mft = FwdToTrackPar(mfttrack, mftcov);
auto mft = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd, mftcov);

o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft);
values[kX] = globalRefit.getX();
Expand Down Expand Up @@ -2694,7 +2698,7 @@
values[kMuonTimeRes] = track.trackTimeRes();
}
// Quantities based on the muon covariance table
if constexpr ((fillMap & ReducedMuonCov) > 0 || (fillMap & MuonCov) > 0 || (fillMap & MuonCovRealign) > 0) {
if constexpr ((fillMap & ReducedMuonCov) > 0) {
values[kX] = track.x();
values[kY] = track.y();
values[kZ] = track.z();
Expand All @@ -2715,6 +2719,29 @@
values[kMuonC1Pt2Tgl] = track.c1PtTgl();
values[kMuonC1Pt21Pt2] = track.c1Pt21Pt2();
}
if constexpr ((fillMap & MuonCov) > 0 || (fillMap & MuonCovRealign) > 0) {
auto muonTrack = o2::aod::fwdtrackutils::getTrackParCovFwdShift(track, fgzShiftFwd, track);
auto muonCov = muonTrack.getCovariances();
values[kX] = muonTrack.getX();
values[kY] = muonTrack.getY();
values[kZ] = muonTrack.getZ();
values[kTgl] = muonTrack.getTgl();
values[kMuonCXX] = muonCov(0, 0);
values[kMuonCXY] = muonCov(0, 1);
values[kMuonCYY] = muonCov(1, 1);
values[kMuonCPhiX] = muonCov(2, 0);
values[kMuonCPhiY] = muonCov(2, 1);
values[kMuonCPhiPhi] = muonCov(2, 2);
values[kMuonCTglX] = muonCov(3, 0);
values[kMuonCTglY] = muonCov(3, 1);
values[kMuonCTglPhi] = muonCov(3, 2);
values[kMuonCTglTgl] = muonCov(3, 3);
values[kMuonC1Pt2X] = muonCov(4, 0);
values[kMuonC1Pt2Y] = muonCov(4, 1);
values[kMuonC1Pt2Phi] = muonCov(4, 2);
values[kMuonC1Pt2Tgl] = muonCov(4, 3);
values[kMuonC1Pt21Pt2] = muonCov(4, 4);
}

// Quantities based on the pair table(s)
if constexpr ((fillMap & Pair) > 0) {
Expand Down
5 changes: 5 additions & 0 deletions PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ struct TableMakerMC {
Configurable<std::string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> fGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
Configurable<std::string> fGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to fo"};
Configurable<std::string> fGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"};
Configurable<int64_t> timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"};
} fConfigCCDB;
Expand Down Expand Up @@ -1179,10 +1180,14 @@ struct TableMakerMC {
}
} else {
fGrpMag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(fConfigCCDB.fGrpMagPath, bcs.begin().timestamp());
auto* fZShift = fCCDB->getForTimeStamp<std::vector<float>>(fConfigCCDB.fZShiftPath, bcs.begin().timestamp());
if (fGrpMag != nullptr) {
o2::base::Propagator::initFieldFromGRP(fGrpMag);
VarManager::SetMagneticField(fGrpMag->getNominalL3Field());
}
if (fZShift != nullptr && !fZShift->empty()) {
VarManager::SetZShift((*fZShift)[0]);
}
if (fConfigVariousOptions.fPropMuon) {
VarManager::SetupMuonMagField();
}
Expand Down
5 changes: 5 additions & 0 deletions PWGDQ/TableProducer/tableMaker_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ struct TableMaker {
Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
Configurable<std::string> fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
Configurable<std::string> fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to fo"};
Configurable<std::string> fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"};
} fConfigCCDB;

Expand Down Expand Up @@ -1480,10 +1481,14 @@ struct TableMaker {
}
} else {
fGrpMag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(fConfigCCDB.fConfigGrpMagPath, bcs.begin().timestamp());
auto* fZShift = fCCDB->getForTimeStamp<std::vector<float>>(fConfigCCDB.fZShiftPath, bcs.begin().timestamp());
if (fGrpMag != nullptr) {
o2::base::Propagator::initFieldFromGRP(fGrpMag);
VarManager::SetMagneticField(fGrpMag->getNominalL3Field());
}
if (fZShift != nullptr && !fZShift->empty()) {
VarManager::SetZShift((*fZShift)[0]);
}
if (fConfigVariousOptions.fPropMuon) {
VarManager::SetupMuonMagField();
}
Expand Down
Loading