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
55 changes: 37 additions & 18 deletions PWGCF/Tasks/dptdptcorrelations.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/// \file dptdptcorrelations.cxx
#include <CCDB/BasicCCDBManager.h>
#include <TDatabasePDG.h>

Check warning on line 14 in PWGCF/Tasks/dptdptcorrelations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Direct use of TDatabasePDG is not allowed. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG>.
#include <TDirectory.h>
#include <TFolder.h>
#include <TH1.h>
Expand Down Expand Up @@ -100,7 +100,7 @@
std::vector<TH2F*> fhSum1Pt_vsEtaPhi{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\eta,\;\phi\f$, for the different species
std::vector<TH3F*> fhN1_vsZEtaPhiPt{nch, nullptr}; //!<! single particle distribution vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
std::vector<TH3F*> fhSum1Pt_vsZEtaPhiPt{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
std::vector<TH3*> fhNuaNue_vsZEtaPhiPt{nch, nullptr}; //!<! NUA+NUE correction vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the differents species
std::vector<TH1*> fhNuaNue{nch, nullptr}; //!<! NUA+NUE correction for the differents species
std::vector<TH2*> fhPtAvg_vsEtaPhi{nch, nullptr}; //!<! average \f$p_T\f$ vs \f$\eta,\;\phi\f$, for the different species
std::vector<std::vector<TH2F*>> fhN2_vsPtPt{nch, {nch, nullptr}}; //!<! weighted two particle distribution vs \f${p_T}_1, {p_T}_2\f$ for the different species combinations
std::vector<std::vector<TH2F*>> fhN2_vsDEtaDPhi{nch, {nch, nullptr}}; //!<! two-particle distribution vs \f$\Delta\eta,\;\Delta\phi\f$ for the different species combinations
Expand Down Expand Up @@ -138,7 +138,7 @@
using namespace correlationstask;
using namespace o2::analysis::dptdptfilter;
if (!(phi < phiup)) {
return phi - constants::math::TwoPI;

Check warning on line 141 in PWGCF/Tasks/dptdptcorrelations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Consider using RecoDecay::constrainAngle to restrict angle to a given range.
} else {
return phi;
}
Expand Down Expand Up @@ -223,7 +223,7 @@

float value = deltaphilow + (deltaphi_ix + 0.5) * deltaphibinwidth;

return (value < (deltaphiup - constants::math::PI)) ? value : value - constants::math::TwoPI;

Check warning on line 226 in PWGCF/Tasks/dptdptcorrelations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Consider using RecoDecay::constrainAngle to restrict angle to a given range.
}

/// \brief Returns the TH2 global bin for the differential histograms
Expand Down Expand Up @@ -293,20 +293,32 @@
return mass2;
}

void storeTrackCorrections(std::vector<TH3*> corrs)
void storeTrackCorrections(std::vector<TH1*> corrs)
{
LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size());
for (uint i = 0; i < corrs.size(); ++i) {
LOGF(info, " Stored NUA&NUE corrections %s for track id %d %s", corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, corrs[i] != nullptr ? "yes" : "no");
fhNuaNue_vsZEtaPhiPt[i] = corrs[i];
if (fhNuaNue_vsZEtaPhiPt[i] != nullptr) {
int nDimensions = corrs[i] != nullptr ? corrs[i]->GetDimension() : 0;
LOGF(info, " Stored NUA&NUE corrections %s for track id %d with %d dimensions %s",
corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, nDimensions, corrs[i] != nullptr ? "yes" : "no");
fhNuaNue[i] = corrs[i];
if (fhNuaNue[i] != nullptr) {
int nbins = 0;
double avg = 0.0;
for (int ix = 0; ix < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsX(); ++ix) {
for (int iy = 0; iy < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsY(); ++iy) {
for (int iz = 0; iz < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsZ(); ++iz) {
nbins++;
avg += fhNuaNue_vsZEtaPhiPt[i]->GetBinContent(ix + 1, iy + 1, iz + 1);
for (int ix = 0; ix < fhNuaNue[i]->GetNbinsX(); ++ix) {
if (nDimensions == 1) {
nbins++;
avg += fhNuaNue[i]->GetBinContent(ix + 1);
} else {
for (int iy = 0; iy < fhNuaNue[i]->GetNbinsY(); ++iy) {
if (nDimensions == 2) {
nbins++;
avg += fhNuaNue[i]->GetBinContent(ix + 1, iy + 1);
} else {
for (int iz = 0; iz < fhNuaNue[i]->GetNbinsZ(); ++iz) {
nbins++;
avg += fhNuaNue[i]->GetBinContent(ix + 1, iy + 1, iz + 1);
}
}
}
}
}
Expand All @@ -331,9 +343,16 @@
{
std::vector<float>* corr = new std::vector<float>(tracks.size(), 1.0f);
int index = 0;
for (auto& t : tracks) {

Check warning on line 346 in PWGCF/Tasks/dptdptcorrelations.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 (fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()] != nullptr) {
(*corr)[index] = fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->FindFixBin(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt()));
if (fhNuaNue[t.trackacceptedid()] != nullptr) {
int nDimensions = fhNuaNue[t.trackacceptedid()]->GetDimension();
if (nDimensions == 1) {
(*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(t.pt()));
} else if (nDimensions == 2) {
(*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(t.eta(), t.pt()));
} else {
(*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt()));
}
}
index++;
}
Expand All @@ -345,7 +364,7 @@
{
std::vector<float>* ptavg = new std::vector<float>(tracks.size(), 0.0f);
int index = 0;
for (auto& t : tracks) {

Check warning on line 367 in PWGCF/Tasks/dptdptcorrelations.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 (fhPtAvg_vsEtaPhi[t.trackacceptedid()] != nullptr) {
(*ptavg)[index] = fhPtAvg_vsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvg_vsEtaPhi[t.trackacceptedid()]->FindFixBin(t.eta(), t.phi()));
index++;
Expand All @@ -361,7 +380,7 @@
void processSingles(TrackListObject const& passedtracks, std::vector<float>* corrs, float zvtx)
{
int index = 0;
for (auto& track : passedtracks) {

Check warning on line 383 in PWGCF/Tasks/dptdptcorrelations.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.
float corr = (*corrs)[index];
fhN1_vsPt[track.trackacceptedid()]->Fill(track.pt(), corr);
if constexpr (smallsingles) {
Expand Down Expand Up @@ -390,7 +409,7 @@
std::vector<double> n1nw(nch, 0.0); ///< not weighted number of single tracks for current collision
std::vector<double> sum1Ptnw(nch, 0.0); ///< accumulated sum of not weighted single \f$p_T\f$ for current collision
int index = 0;
for (auto& track : passedtracks) {

Check warning on line 412 in PWGCF/Tasks/dptdptcorrelations.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.
float corr = (*corrs)[index];
n1[track.trackacceptedid()] += corr;
sum1Pt[track.trackacceptedid()] += track.pt() * corr;
Expand Down Expand Up @@ -463,10 +482,10 @@
float deltaeta = track1.eta() - track2.eta();
float deltaphi = track1.phi() - track2.phi();
while (deltaphi >= deltaphiup) {
deltaphi -= constants::math::TwoPI;

Check warning on line 485 in PWGCF/Tasks/dptdptcorrelations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Consider using RecoDecay::constrainAngle to restrict angle to a given range.
}
while (deltaphi < deltaphilow) {
deltaphi += constants::math::TwoPI;

Check warning on line 488 in PWGCF/Tasks/dptdptcorrelations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Consider using RecoDecay::constrainAngle to restrict angle to a given range.
}
if ((fUseConversionCuts && fPairCuts.conversionCuts(track1, track2)) || (fUseTwoTrackCut && fPairCuts.twoTrackCut(track1, track2, bfield))) {
/* suppress the pair */
Expand Down Expand Up @@ -616,7 +635,7 @@
LOGF(info, "Do invariant mass: %s; do correlation histograms: %s", doinvmass ? "yes" : "no", docorrelations ? "yes" : "no");

/* create the histograms */
Bool_t oldstatus = TH1::AddDirectoryStatus();

Check warning on line 638 in PWGCF/Tasks/dptdptcorrelations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root-entity]

Consider replacing ROOT entities with equivalents from standard C++ or from O2.
TH1::AddDirectory(kFALSE);

if (!processpairs) {
Expand Down Expand Up @@ -690,7 +709,7 @@
fhSum1Pt_vsZEtaPhiPt[i]->SetBit(TH1::kIsNotW);
fhSum1Pt_vsZEtaPhiPt[i]->Sumw2(false);
}
fhNuaNue_vsZEtaPhiPt[i] = nullptr;
fhNuaNue[i] = nullptr;
fhPtAvg_vsEtaPhi[i] = nullptr;

fOutputList->Add(fhN1_vsPt[i]);
Expand Down Expand Up @@ -724,7 +743,7 @@
100, 0.0, 100.0);
fhSum1Ptnw_vsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tnames[i].c_str()).Data(),
TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tnames[i].c_str(), tnames[i].c_str()).Data(), 100, 0.0, 100.0);
fhNuaNue_vsZEtaPhiPt[i] = nullptr;
fhNuaNue[i] = nullptr;
fhPtAvg_vsEtaPhi[i] = nullptr;
fOutputList->Add(fhN1_vsEtaPhi[i]);
fOutputList->Add(fhSum1Pt_vsEtaPhi[i]);
Expand Down Expand Up @@ -1200,9 +1219,9 @@
}
storePtAverages(ptavgs);
} else {
std::vector<TH3*> corrs{tnames.size(), nullptr};
std::vector<TH1*> corrs{tnames.size(), nullptr};
for (uint isp = 0; isp < tnames.size(); ++isp) {
corrs[isp] = reinterpret_cast<TH3*>(ccdblst->FindObject(
corrs[isp] = reinterpret_cast<TH1*>(ccdblst->FindObject(
TString::Format("correction_%02d-%02d_%s",
static_cast<int>(fCentMultMin[ixDCE]),
static_cast<int>(fCentMultMax[ixDCE]),
Expand Down Expand Up @@ -1274,9 +1293,9 @@
}
dataCEME[ixDCE]->storePtAverages(ptavgs);
} else {
std::vector<TH3*> corrs{tnames.size(), nullptr};
std::vector<TH1*> corrs{tnames.size(), nullptr};
for (uint isp = 0; isp < tnames.size(); ++isp) {
corrs[isp] = reinterpret_cast<TH3*>(ccdblst->FindObject(
corrs[isp] = reinterpret_cast<TH1*>(ccdblst->FindObject(
TString::Format("correction_%02d-%02d_%s",
static_cast<int>(fCentMultMin[ixDCE]),
static_cast<int>(fCentMultMax[ixDCE]),
Expand Down
Loading