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
3 changes: 3 additions & 0 deletions PWGDQ/Core/VarManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,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 196 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 197 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 @@ -293,7 +293,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 296 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 @@ -460,14 +460,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 463 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 470 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 @@ -506,7 +506,7 @@
int nBins = static_cast<int>((max - min) / binWidth);
std::vector<int> counts(nBins, 0.0);

for (float x : data) {

Check failure on line 509 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 @@ -916,6 +916,8 @@
fgVariableUnits[kDCAzNPeaksTrimmed2] = "";
fgVariableNames[kDCAzNPeaksTrimmed3] = "Number of peaks in binned DCAz distribution (trimmed 3)";
fgVariableUnits[kDCAzNPeaksTrimmed3] = "";
fgVariableNames[kInteractionRate] = "Interaction rate";
fgVariableUnits[kInteractionRate] = "kHz";
fgVariableNames[kPt] = "p_{T}";
fgVariableUnits[kPt] = "GeV/c";
fgVariableNames[kPt1] = "p_{T1}";
Expand Down Expand Up @@ -2196,6 +2198,7 @@
fgVarNamesMap["kTwoR2EP1"] = kTwoR2EP1;
fgVarNamesMap["kTwoR2EP2"] = kTwoR2EP2;
fgVarNamesMap["kNPairsPerEvent"] = kNPairsPerEvent;
fgVarNamesMap["kInteractionRate"] = kInteractionRate;
fgVarNamesMap["kNEventWiseVariables"] = kNEventWiseVariables;
fgVarNamesMap["kX"] = kX;
fgVarNamesMap["kY"] = kY;
Expand Down
1 change: 1 addition & 0 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@
kTwoR2EP1, // Event plane resolution of event2 for ME technique
kTwoR2EP2, // Event plane resolution of event2 for ME technique
kNPairsPerEvent, // number of pairs per event in same-event or mixed-event pairing
kInteractionRate,

// Variables for event mixing with cumulant
kV22m,
Expand Down Expand Up @@ -1849,9 +1850,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 1853 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 1854 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 1855 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 @@ -4822,7 +4823,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 4826 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
15 changes: 15 additions & 0 deletions PWGDQ/Tasks/tableReader_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "PWGDQ/DataModel/ReducedInfoTables.h"

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/ctpRateFetcher.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/TableHelper.h"

Expand Down Expand Up @@ -330,13 +331,16 @@ struct AnalysisEventSelection {
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
Configurable<std::string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
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<bool> fConfigFetchInteractionRate{"cfgFetchInteractionRate", false, "Fetch event-wise interaction rate from the CCDB"};
Configurable<std::string> fConfigIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};

HistogramManager* fHistMan = nullptr;
MixingHandler* fMixHandler = nullptr;
AnalysisCompositeCut* fEventCut = nullptr;

Service<o2::ccdb::BasicCCDBManager> fCCDB{};
o2::ccdb::CcdbApi fCCDBApi;
ctpRateFetcher rateFetcher;

std::map<int64_t, bool> fSelMap; // key: reduced event global index, value: event selection decision
std::map<uint64_t, std::vector<int64_t>> fBCCollMap; // key: global BC, value: vector of reduced event global indices
Expand Down Expand Up @@ -442,6 +446,10 @@ struct AnalysisEventSelection {
// Reset the fValues array and fill event observables
VarManager::ResetValues(0, VarManager::kNEventWiseVariables);
VarManager::FillEvent<TEventFillMap>(event);
// Get the instantaneous IR from the CCDB
if (fConfigFetchInteractionRate.value) {
VarManager::fgValues[VarManager::kInteractionRate] = rateFetcher.fetch(fCCDB.service, event.timestamp(), fCurrentRun, fConfigIRSource.value, true) / 1000.; // kHz
}

bool decision = false;
// Fill histograms in the class Event, before cuts
Expand Down Expand Up @@ -3074,8 +3082,11 @@ struct AnalysisAsymmetricPairing {
Configurable<bool> fConfigUseAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"};
Configurable<bool> fConfigPropToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"};
Configurable<std::string> fConfigLutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
Configurable<bool> fConfigFetchInteractionRate{"cfgFetchInteractionRate", false, "Fetch event-wise interaction rate from the CCDB"};
Configurable<std::string> fConfigIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};

Service<o2::ccdb::BasicCCDBManager> fCCDB{};
ctpRateFetcher rateFetcher;

HistogramManager* fHistMan = nullptr;

Expand Down Expand Up @@ -3415,6 +3426,10 @@ struct AnalysisAsymmetricPairing {
// Reset the fValues array
VarManager::ResetValues(0, VarManager::kNVars);
VarManager::FillEvent<TEventFillMap>(event, dqtablereader_helpers::varValues());
// Get the instantaneous IR from the CCDB
if (fConfigFetchInteractionRate.value) {
VarManager::fgValues[VarManager::kInteractionRate] = rateFetcher.fetch(fCCDB.service, event.timestamp(), fCurrentRun, fConfigIRSource.value, true) / 1000.; // kHz
}

auto groupedLegAAssocs = legACandidateAssocs.sliceBy(preslice, event.globalIndex());
if (groupedLegAAssocs.size() == 0) {
Expand Down
Loading