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
57 changes: 51 additions & 6 deletions PWGLF/TableProducer/Common/spvector.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -51,7 +51,7 @@
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <iostream>

Check failure on line 54 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <string>
#include <unordered_map>
#include <vector>
Expand All @@ -71,7 +71,7 @@
// Configurables.
struct : ConfigurableGroup {
Configurable<std::string> cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"};
Configurable<int64_t> nolaterthan{"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"};

Check failure on line 74 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
} cfgCcdbParam;

// Enable access to the CCDB for the offset and correction constants and save them in dedicated variables.
Expand All @@ -87,14 +87,14 @@
Configurable<bool> usecfactor{"usecfactor", false, "use c factor"};

struct : ConfigurableGroup {
Configurable<int> QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"};

Check failure on line 90 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<int> PhiNbins{"PhiNbins", 100, "Number of bins in phi histogram"};

Check failure on line 91 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<float> lbinQxy{"lbinQxy", -5.0, "lower bin value in QxQy histograms"};
Configurable<float> hbinQxy{"hbinQxy", 5.0, "higher bin value in QxQy histograms"};
Configurable<int> VxNbins{"VxNbins", 25, "Number of bins in Vx histograms"};

Check failure on line 94 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<float> lbinVx{"lbinVx", -0.05, "lower bin value in Vx histograms"};
Configurable<float> hbinVx{"hbinVx", 0.0, "higher bin value in Vx histograms"};
Configurable<int> VyNbins{"VyNbins", 25, "Number of bins in Vy histograms"};

Check failure on line 97 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<float> lbinVy{"lbinVy", -0.02, "lower bin value in Vy histograms"};
Configurable<float> hbinVy{"hbinVy", 0.02, "higher bin value in Vy histograms"};
Configurable<int> VzNbins{"VzNbins", 20, "Number of bins in Vz histograms"};
Expand Down Expand Up @@ -173,6 +173,8 @@
Configurable<std::string> ConfRecenterevzSp6{"ConfRecenterevzSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere6"};
Configurable<std::string> ConfShiftC{"ConfShiftC", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift C"};
Configurable<std::string> ConfShiftA{"ConfShiftA", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift A"};
Configurable<bool> useTimeRecentering{"useTimeRecentering", false, "Use residual time recentering"};
Configurable<std::string> confRecentereTimeSp{"confRecentereTimeSp", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast2", "Path to time recentering map"};

// Event selection cuts - Alex
/*
Expand Down Expand Up @@ -276,6 +278,10 @@
histos.add("hpCosPsiAPsiC", "hpCosPsiAPsiC", kTProfile, {centfineAxis});
histos.add("hpSinPsiAPsiC", "hpSinPsiAPsiC", kTProfile, {centfineAxis});
histos.add("AvgVxy", "AvgVxy", kTProfile, {VxyAxis});
histos.add("hpQxZDCAvstime", "hpQxZDCAvstime", kTProfile, {{timefineAxis}});
histos.add("hpQxZDCCvstime", "hpQxZDCCvstime", kTProfile, {{timefineAxis}});
histos.add("hpQyZDCAvstime", "hpQyZDCAvstime", kTProfile, {{timefineAxis}});
histos.add("hpQyZDCCvstime", "hpQyZDCCvstime", kTProfile, {{timefineAxis}});

// Event selection cut additional - Alex
/*
Expand Down Expand Up @@ -308,6 +314,7 @@
std::array<TH2F*, 6> hrecenterevzSpA; // Array of 5 histograms
TProfile3D* shiftprofileA;
TProfile3D* shiftprofileC;
TH2F* hrecentereTimeSp = nullptr;

Bool_t Correctcoarse(const THnF* hrecentereSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
{
Expand Down Expand Up @@ -389,6 +396,30 @@
return kTRUE;
}

bool Correcttime(TH2F* hrecentereTimeSp,
auto timeMin,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecentereTimeSp) {
return false;
}

double meanxA = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 0.5));
double meanyA = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 1.5));
double meanxC = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 2.5));
double meanyC = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 3.5));

qxZDCA -= meanxA;
qyZDCA -= meanyA;
qxZDCC -= meanxC;
qyZDCC -= meanyC;

return true;
}

using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::FT0sCorrected, aod::CentFT0Cs>;
using AllTrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullPr, aod::pidTPCFullKa>;
Preslice<aod::Zdcs> zdcPerCollision = aod::collision::bcId;
Expand Down Expand Up @@ -443,7 +474,7 @@
runStartTime[currentRunNumber] = timestampzdc;
}

double timeInMinutes = (timestampzdc - runStartTime[currentRunNumber]) / 60000.0; // ms -> minutes
double timeMin = (timestampzdc - runStartTime[currentRunNumber]) / 60000.0; // ms -> minutes

auto zdc = bc.zdc();
auto zncEnergy = zdc.energySectorZNC();
Expand Down Expand Up @@ -509,13 +540,13 @@
histos.fill(HIST("ZDCAmpCommon"), 0.5, vz, znaEnergycommon);
histos.fill(HIST("ZDCAmpCommon"), 1.5, vz, zncEnergycommon);

for (std::size_t iChA = 0; iChA < 8; iChA++) {

Check failure on line 543 in PWGLF/TableProducer/Common/spvector.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.
auto chanelid = iChA;
if (useGainCallib && gainprofile) {
gainequal = gainprofile->GetBinContent(gainprofile->FindBin(vz + 0.00001, chanelid + 0.5));
}

if (iChA < 4) {

Check failure on line 549 in PWGLF/TableProducer/Common/spvector.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.

if (znaEnergy[iChA] <= 0.0) {
triggerevent = false;
Expand Down Expand Up @@ -573,7 +604,7 @@
qyZDCC = cZNC * (qyZDCC / sumC);
}

if (sumA <= 1e-4 || sumC <= 1e-4) {

Check failure on line 607 in PWGLF/TableProducer/Common/spvector.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.
qxZDCA = 0.0;
qxZDCC = 0.0;
qyZDCA = 0.0;
Expand Down Expand Up @@ -709,6 +740,25 @@
if (res == 0 && resfine == 0 && check == 0) {
LOG(info) << "Histograms are null";
}

if (useTimeRecentering && (currentRunNumber != lastRunNumber)) {
hrecentereTimeSp = ccdb->getForTimeStamp<TH2F>(confRecentereTimeSp.value, bc.timestamp());
}

bool restime = false;
if (useTimeRecentering) {
restime = Correcttime(hrecentereTimeSp, timeMin, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (restime == 0) {
LOG(info) << "Histograms are null";
}

histos.fill(HIST("hpQxZDCAvstime"), timeMin, qxZDCA);
histos.fill(HIST("hpQxZDCCvstime"), timeMin, qxZDCC);
histos.fill(HIST("hpQyZDCAvstime"), timeMin, qyZDCA);
histos.fill(HIST("hpQyZDCCvstime"), timeMin, qyZDCC);

psiZDCC = 1.0 * TMath::ATan2(qyZDCC, qxZDCC);
psiZDCA = 1.0 * TMath::ATan2(qyZDCA, qxZDCA);

Expand Down Expand Up @@ -771,11 +821,6 @@
histos.fill(HIST("hvzQyZDCA"), vz, qyZDCA);
histos.fill(HIST("hvzQxZDCC"), vz, qxZDCC);
histos.fill(HIST("hvzQyZDCC"), vz, qyZDCC);

histos.fill(HIST("htimeQxZDCA"), timeInMinutes, qxZDCA);
histos.fill(HIST("htimeQyZDCA"), timeInMinutes, qyZDCA);
histos.fill(HIST("htimeQxZDCC"), timeInMinutes, qxZDCC);
histos.fill(HIST("htimeQyZDCC"), timeInMinutes, qyZDCC);
}

histos.fill(HIST("hpCosPsiAPsiC"), centrality, (TMath::Cos(psiZDCA - psiZDCC)));
Expand Down
Loading