Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions PWGDQ/Core/VarManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,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 194 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 195 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 @@ -291,7 +291,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 294 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 Expand Up @@ -386,14 +386,14 @@
// Bimodality coefficient = (skewness^2 + 1) / kurtosis
// return a tuple including the coefficient, mean, RMS, skewness, and kurtosis
size_t n = data.size();
if (n < 3) {

Check failure on line 389 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.
return std::make_tuple(-1.0, -1.0, -1.0, -1.0, -1.0);
}
float mean = std::accumulate(data.begin(), data.end(), 0.0) / n;

float m2 = 0.0, m3 = 0.0, m4 = 0.0;
float diff, diff2;
for (float x : data) {

Check failure on line 396 in PWGDQ/Core/VarManager.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.
diff = x - mean;
diff2 = diff * diff;
m2 += diff2;
Expand Down Expand Up @@ -432,7 +432,7 @@
int nBins = static_cast<int>((max - min) / binWidth);
std::vector<int> counts(nBins, 0.0);

for (float x : data) {

Check failure on line 435 in PWGDQ/Core/VarManager.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 (x < min || x >= max) {
continue; // skip out-of-range values
}
Expand Down Expand Up @@ -2239,6 +2239,7 @@
fgVarNamesMap["kMCPdgCode"] = kMCPdgCode;
fgVarNamesMap["kMCCosTheta"] = kMCCosTheta;
fgVarNamesMap["kMCHadronPdgCode"] = kMCHadronPdgCode;
fgVarNamesMap["kMCAccweight"] = kMCAccweight;
fgVarNamesMap["kMCCosChi"] = kMCCosChi;
fgVarNamesMap["kMCHadronPt"] = kMCHadronPt;
fgVarNamesMap["kMCWeight_before"] = kMCWeight_before;
Expand Down Expand Up @@ -2481,6 +2482,7 @@
fgVarNamesMap["kDeltaPhiSym"] = kDeltaPhiSym;
fgVarNamesMap["kCosTheta"] = kCosTheta;
fgVarNamesMap["kCosChi"] = kCosChi;
fgVarNamesMap["kWeight"] = kWeight;
fgVarNamesMap["kECWeight"] = kECWeight;
fgVarNamesMap["kEWeight_before"] = kEWeight_before;
fgVarNamesMap["kPtDau"] = kPtDau;
Expand Down
39 changes: 21 additions & 18 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@
kMCHadronPdgCode,
kMCCosTheta,
kMCJpsiPt,
kMCAccweight,
kMCCosChi,
kMCdeltaphi,
kMCdeltaeta,
Expand Down Expand Up @@ -930,6 +931,7 @@
kCosChi,
kEtaDau,
kPhiDau,
kWeight,
kECWeight,
kPtDau,
kCosTheta,
Expand Down Expand Up @@ -1335,7 +1337,7 @@
template <typename U, typename T>
static void FillTrackMC(const U& mcStack, T const& track, float* values = nullptr);
template <int pairType, typename T, typename T1>
static void FillEnergyCorrelatorsMC(T const& track, T1 const& t1, float* values = nullptr, float Translow = 1. / 3, float Transhigh = 2. / 3);
static void FillEnergyCorrelatorsMC(T const& track, T1 const& t1, float* values = nullptr, float Translow = 1. / 3, float Transhigh = 2. / 3, float Accweight = 1.0f);
template <uint32_t fillMap, typename T1, typename T2, typename C>
static void FillPairPropagateMuon(T1 const& muon1, T2 const& muon2, const C& collision, float* values = nullptr);
template <uint32_t fillMap, typename T1, typename T2, typename C>
Expand Down Expand Up @@ -1369,9 +1371,9 @@
template <typename T1, typename T2>
static void FillDileptonHadron(T1 const& dilepton, T2 const& hadron, float* values = nullptr, float hadronMass = 0.0f);
template <typename T1, typename T2, typename T3>
static void FillEnergyCorrelatorTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, float* values = nullptr, float Translow = 1. / 3, float Transhigh = 2. / 3, bool applyFitMass = false, float sidebandMass = 0.0f);
static void FillEnergyCorrelatorTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, float* values = nullptr, float Translow = 1. / 3, float Transhigh = 2. / 3, bool applyFitMass = false, float sidebandMass = 0.0f, float weight = 1.0f);
template <int pairType, typename T1, typename T2, typename T3, typename T4, typename T5>
static void FillEnergyCorrelatorsUnfoldingTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, T4 const& track, T5 const& t1, float* values = nullptr, bool applyFitMass = false);
static void FillEnergyCorrelatorsUnfoldingTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, T4 const& track, T5 const& t1, float* values = nullptr, bool applyFitMass = false, float Effweight_rec = 1.f, float Accweight_gen = 1.f);
template <typename T1, typename T2>
static void FillDileptonPhoton(T1 const& dilepton, T2 const& photon, float* values = nullptr);
template <typename T>
Expand Down Expand Up @@ -1791,9 +1793,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 1796 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 1797 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 1798 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));
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd);
values[kX] = mftprop.getX();
Expand Down Expand Up @@ -3302,7 +3304,7 @@
}

template <int pairType, typename T, typename T1>
void VarManager::FillEnergyCorrelatorsMC(T const& track, T1 const& t1, float* values, float Translow, float Transhigh)
void VarManager::FillEnergyCorrelatorsMC(T const& track, T1 const& t1, float* values, float Translow, float Transhigh, float Accweight)
{
// energy correlators
float MassHadron;
Expand All @@ -3319,8 +3321,9 @@
float E_boost = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2);
float CosChi = LorentzTransformJpsihadroncosChi("coschi", v1, v2);
float CosTheta = LorentzTransformJpsihadroncosChi("costheta", v1, v2);
values[kMCAccweight] = Accweight;
values[kMCCosChi] = CosChi;
values[kMCWeight_before] = t1.pt() / o2::constants::physics::MassJPsi;
values[kMCWeight_before] = t1.pt() / o2::constants::physics::MassJPsi * Accweight;
values[kMCCosTheta] = CosTheta;
values[kMCdeltaphi] = deltaphi;
values[kMCdeltaeta] = deltaeta;
Expand Down Expand Up @@ -3350,15 +3353,15 @@

ROOT::Math::PtEtaPhiMVector v2_randomPhi_trans(v2.pt(), v2.eta(), randomPhi_trans, MassHadron);
values[kMCCosChi_randomPhi_trans] = LorentzTransformJpsihadroncosChi("coschi", v1, v2_randomPhi_trans);
values[kMCWeight_randomPhi_trans] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_trans) / v1.M();
values[kMCWeight_randomPhi_trans] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_trans) / v1.M() * Accweight;

ROOT::Math::PtEtaPhiMVector v2_randomPhi_toward(v2.pt(), v2.eta(), randomPhi_toward, MassHadron);
values[kMCCosChi_randomPhi_toward] = LorentzTransformJpsihadroncosChi("coschi", v1, v2_randomPhi_toward);
values[kMCWeight_randomPhi_toward] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_toward) / v1.M();
values[kMCWeight_randomPhi_toward] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_toward) / v1.M() * Accweight;

ROOT::Math::PtEtaPhiMVector v2_randomPhi_away(v2.pt(), v2.eta(), randomPhi_away, MassHadron);
values[kMCCosChi_randomPhi_away] = LorentzTransformJpsihadroncosChi("coschi", v1, v2_randomPhi_away);
values[kMCWeight_randomPhi_away] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_away) / v1.M();
values[kMCWeight_randomPhi_away] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_away) / v1.M() * Accweight;

values[kMCdeltaphi_randomPhi_trans] = RecoDecay::constrainAngle(v1.phi() - randomPhi_trans, -o2::constants::math::PIHalf);
values[kMCdeltaphi_randomPhi_toward] = RecoDecay::constrainAngle(v1.phi() - randomPhi_toward, -o2::constants::math::PIHalf);
Expand Down Expand Up @@ -4545,7 +4548,7 @@
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 4551 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)
Expand Down Expand Up @@ -5795,7 +5798,7 @@
}

template <typename T1, typename T2, typename T3>
void VarManager::FillEnergyCorrelatorTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, float* values, float Translow, float Transhigh, bool applyFitMass, float sidebandMass)
void VarManager::FillEnergyCorrelatorTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, float* values, float Translow, float Transhigh, bool applyFitMass, float sidebandMass, float weight)
{
float m1 = o2::constants::physics::MassElectron;
float m2 = o2::constants::physics::MassElectron;
Expand All @@ -5818,9 +5821,10 @@
ROOT::Math::PtEtaPhiMVector v2(hadron.pt(), hadron.eta(), hadron.phi(), o2::constants::physics::MassPionCharged);
values[kCosChi] = LorentzTransformJpsihadroncosChi("coschi", v1, v2);
float E_boost = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2);
values[kECWeight] = E_boost / v1.M();
values[kWeight] = weight;
values[kECWeight] = E_boost / v1.M() * weight;
values[kCosTheta] = LorentzTransformJpsihadroncosChi("costheta", v1, v2);
values[kEWeight_before] = v2.Pt() / v1.M();
values[kEWeight_before] = v2.Pt() / v1.M() * weight;
values[kPtDau] = v2.pt();
values[kEtaDau] = v2.eta();
values[kPhiDau] = RecoDecay::constrainAngle(v2.phi(), -o2::constants::math::PIHalf);
Expand All @@ -5847,15 +5851,14 @@

ROOT::Math::PtEtaPhiMVector v2_randomPhi_trans(v2.pt(), v2.eta(), randomPhi_trans, o2::constants::physics::MassPionCharged);
values[kCosChi_randomPhi_trans] = LorentzTransformJpsihadroncosChi("coschi", v1, v2_randomPhi_trans);
values[kWeight_randomPhi_trans] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_trans) / v1.M();
values[kWeight_randomPhi_trans] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_trans) / v1.M() * weight;

ROOT::Math::PtEtaPhiMVector v2_randomPhi_toward(v2.pt(), v2.eta(), randomPhi_toward, o2::constants::physics::MassPionCharged);
values[kCosChi_randomPhi_toward] = LorentzTransformJpsihadroncosChi("coschi", v1, v2_randomPhi_toward);
values[kWeight_randomPhi_toward] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_toward) / v1.M();

values[kWeight_randomPhi_toward] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_toward) / v1.M() * weight;
ROOT::Math::PtEtaPhiMVector v2_randomPhi_away(v2.pt(), v2.eta(), randomPhi_away, o2::constants::physics::MassPionCharged);
values[kCosChi_randomPhi_away] = LorentzTransformJpsihadroncosChi("coschi", v1, v2_randomPhi_away);
values[kWeight_randomPhi_away] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_away) / v1.M();
values[kWeight_randomPhi_away] = LorentzTransformJpsihadroncosChi("weight_boost", v1, v2_randomPhi_away) / v1.M() * weight;

values[kdeltaphi_randomPhi_trans] = RecoDecay::constrainAngle(v1.phi() - randomPhi_trans, -o2::constants::math::PIHalf);
values[kdeltaphi_randomPhi_toward] = RecoDecay::constrainAngle(v1.phi() - randomPhi_toward, -o2::constants::math::PIHalf);
Expand All @@ -5865,7 +5868,7 @@
}

template <int pairType, typename T1, typename T2, typename T3, typename T4, typename T5>
void VarManager::FillEnergyCorrelatorsUnfoldingTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, T4 const& track, T5 const& t1, float* values, bool applyFitMass)
void VarManager::FillEnergyCorrelatorsUnfoldingTriple(T1 const& lepton1, T2 const& lepton2, T3 const& hadron, T4 const& track, T5 const& t1, float* values, bool applyFitMass, float Effweight_rec, float Accweight_gen)
{
if (fgUsedVars[kMCCosChi_gen] || fgUsedVars[kMCWeight_gen] || fgUsedVars[kMCdeltaeta_gen] || fgUsedVars[kMCCosChi_rec] || fgUsedVars[kMCWeight_rec] || fgUsedVars[kMCdeltaeta_rec]) {
// energy correlators
Expand Down Expand Up @@ -5894,14 +5897,14 @@
float E_boost_gen = LorentzTransformJpsihadroncosChi("weight_boost", v1_gen, v2_gen);
float CosChi_gen = LorentzTransformJpsihadroncosChi("coschi", v1_gen, v2_gen);
values[kMCCosChi_gen] = CosChi_gen;
values[kMCWeight_gen] = E_boost_gen / o2::constants::physics::MassJPsi;
values[kMCWeight_gen] = E_boost_gen / o2::constants::physics::MassJPsi * Accweight_gen;
values[kMCdeltaeta_gen] = track.eta() - t1.eta();

ROOT::Math::PtEtaPhiMVector v1_rec(dilepton.pt(), dilepton.eta(), dilepton.phi(), dileptonmass);
ROOT::Math::PtEtaPhiMVector v2_rec(hadron.pt(), hadron.eta(), hadron.phi(), o2::constants::physics::MassPionCharged);
values[kMCCosChi_rec] = LorentzTransformJpsihadroncosChi("coschi", v1_rec, v2_rec);
float E_boost_rec = LorentzTransformJpsihadroncosChi("weight_boost", v1_rec, v2_rec);
values[kMCWeight_rec] = E_boost_rec / v1_rec.M();
values[kMCWeight_rec] = E_boost_rec / v1_rec.M() * Effweight_rec;
values[kMCdeltaeta_rec] = dilepton.eta() - hadron.eta();
}
}
Expand Down
Loading
Loading