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
48 changes: 23 additions & 25 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 @@ -54,7 +54,7 @@
#include <array>
#include <chrono>
#include <cmath>
#include <iostream>

Check failure on line 57 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 <vector>

Expand All @@ -73,7 +73,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 76 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 @@ -86,16 +86,17 @@
Configurable<float> cfgCutCentralityMin{"cfgCutCentralityMin", 0.0f, "Centrality cut Min"};
Configurable<bool> additionalEvSel{"additionalEvSel", false, "additionalEvSel"};
Configurable<bool> usemem{"usemem", true, "usemem"};
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 92 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 93 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 96 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 99 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 @@ -293,11 +294,6 @@
int lastRunNumber = -999;
TH2D* gainprofile;
TProfile* gainprofilevxy;
/*THnF* hrecentereSp;
TH2F* hrecenterecentSp;
TH2F* hrecenterevxSp;
TH2F* hrecenterevySp;
TH2F* hrecenterevzSp;*/
std::array<THnF*, 6> hrecentereSpA; // Array of 6 histograms
std::array<TH2F*, 6> hrecenterecentSpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevxSpA; // Array of 5 histograms
Expand All @@ -306,16 +302,9 @@
TProfile3D* shiftprofileA;
TProfile3D* shiftprofileC;

// Bool_t Correctcoarse(int64_t ts, Configurable<std::string>& ConfRecentereSpp, bool useRecentereSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
//{
Bool_t Correctcoarse(const THnF* hrecentereSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
{

/*
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {
hrecentereSp = ccdb->getForTimeStamp<THnF>(ConfRecentereSpp.value, ts);
}*/

int binCoords[5];

// Get axes of the THnSparse
Expand Down Expand Up @@ -357,22 +346,13 @@
return kTRUE;
}

// Bool_t Correctfine(int64_t ts, Configurable<std::string>& ConfRecenterecentSpp, Configurable<std::string>& ConfRecenterevxSpp, Configurable<std::string>& ConfRecenterevySpp, Configurable<std::string>& ConfRecenterevzSpp, bool useRecenterefineSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
//{
Bool_t Correctfine(TH2F* hrecenterecentSp, TH2F* hrecenterevxSp, TH2F* hrecenterevySp, TH2F* hrecenterevzSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
{

if (!hrecenterecentSp || !hrecenterevxSp || !hrecenterevySp || !hrecenterevzSp) {
std::cerr << "Error: One or more histograms are null." << std::endl;
return false;
}
/*
if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) {
hrecenterecentSp = ccdb->getForTimeStamp<TH2F>(ConfRecenterecentSpp.value, ts);
hrecenterevxSp = ccdb->getForTimeStamp<TH2F>(ConfRecenterevxSpp.value, ts);
hrecenterevySp = ccdb->getForTimeStamp<TH2F>(ConfRecenterevySpp.value, ts);
hrecenterevzSp = ccdb->getForTimeStamp<TH2F>(ConfRecenterevzSpp.value, ts);
}*/

double meanxAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality + 0.00001, 0.5));
double meanyAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality + 0.00001, 1.5));
Expand Down Expand Up @@ -452,6 +432,7 @@
auto znaEnergy = zdc.energySectorZNA();
auto zncEnergycommon = zdc.energyCommonZNC();
auto znaEnergycommon = zdc.energyCommonZNA();
auto beamEne = 5.36 * 0.5;

if (znaEnergycommon <= 0.0 || zncEnergycommon <= 0.0) {
triggerevent = false;
Expand Down Expand Up @@ -504,17 +485,19 @@
auto alphaZDC = 0.395;
constexpr double x[4] = {-1.75, 1.75, -1.75, 1.75};
constexpr double y[4] = {-1.75, -1.75, 1.75, 1.75};
double zncEnergycommonsum = 0.0;
double znaEnergycommonsum = 0.0;

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 494 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 500 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 All @@ -522,6 +505,7 @@
return;
} else {
double ampl = gainequal * znaEnergy[iChA];
znaEnergycommonsum += ampl;
if (followpub) {
ampl = TMath::Power(ampl, alphaZDC);
}
Expand All @@ -537,6 +521,7 @@
return;
} else {
double ampl = gainequal * zncEnergy[iChA - 4];
zncEnergycommonsum += ampl;
if (followpub) {
ampl = TMath::Power(ampl, alphaZDC);
}
Expand All @@ -548,16 +533,29 @@
}
}

auto cZNC = 1.0;
auto cZNA = 1.0;

if (sumA > 0) {
qxZDCA = qxZDCA / sumA;
qyZDCA = qyZDCA / sumA;
float nSpecnA = znaEnergycommonsum / beamEne;
if (usecfactor)
cZNA = 1.89358 - 0.71262 / (nSpecnA + 0.71789);
else
cZNA = 1.0;
qxZDCA = cZNA * (qxZDCA / sumA);
qyZDCA = cZNA * (qyZDCA / sumA);
}
if (sumC > 0) {
qxZDCC = qxZDCC / sumC;
qyZDCC = qyZDCC / sumC;
float nSpecnC = zncEnergycommonsum / beamEne;
if (usecfactor)
cZNC = 1.89358 - 0.71262 / (nSpecnC + 0.71789);
else
cZNC = 1.0;
qxZDCC = cZNC * (qxZDCC / sumC);
qyZDCC = cZNC * (qyZDCC / sumC);
}

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

Check failure on line 558 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
Loading