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
16 changes: 8 additions & 8 deletions PWGLF/DataModel/LFCKSSpinalignmentTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ namespace kshortpionevent
DECLARE_SOA_COLUMN(Cent, cent, float);
DECLARE_SOA_COLUMN(Posz, posz, float);
DECLARE_SOA_COLUMN(PsiFT0C, psiFT0C, float);
DECLARE_SOA_COLUMN(PsiFT0A, psiFT0A, float);
DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float);
// DECLARE_SOA_COLUMN(PsiFT0A, psiFT0A, float);
// DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float);
} // namespace kshortpionevent

DECLARE_SOA_TABLE(KShortpionEvents, "AOD", "KSHORTPIONEVENT",
o2::soa::Index<>,
kshortpionevent::Cent,
kshortpionevent::Posz,
kshortpionevent::PsiFT0C,
kshortpionevent::PsiFT0A,
kshortpionevent::PsiTPC);
kshortpionevent::PsiFT0C);
// kshortpionevent::PsiFT0A,
// kshortpionevent::PsiTPC);

using KShortpionEvent = KShortpionEvents::iterator;

Expand All @@ -54,7 +54,7 @@ DECLARE_SOA_COLUMN(V0Cospa, v0Cospa, float);
DECLARE_SOA_COLUMN(V0Radius, v0Radius, float);
DECLARE_SOA_COLUMN(DcaPositive, dcaPositive, float);
DECLARE_SOA_COLUMN(DcaNegative, dcaNegative, float);
DECLARE_SOA_COLUMN(DcaBetweenDaughter, dcaBetweenDaughter, float);
// DECLARE_SOA_COLUMN(DcaBetweenDaughter, dcaBetweenDaughter, float);
// DECLARE_SOA_COLUMN(V0Lifetime, v0Lifetime, float);

DECLARE_SOA_COLUMN(KShortPx, kShortPx, float);
Expand All @@ -73,8 +73,8 @@ DECLARE_SOA_TABLE(KShortTracks, "AOD", "KSHORTTRACK",
kshorttrack::V0Radius,
kshorttrack::DcaPositive,
kshorttrack::DcaNegative,
kshorttrack::DcaBetweenDaughter,
// kshorttrack::V0Lifetime,
// kshorttrack::DcaBetweenDaughter,
// kshorttrack::V0Lifetime,
kshorttrack::KShortPx,
kshorttrack::KShortPy,
kshorttrack::KShortPz,
Expand Down
82 changes: 82 additions & 0 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 @@ -49,7 +49,7 @@
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <iostream>

Check failure on line 52 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 @@ -67,7 +67,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 70 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 @@ -82,14 +82,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 85 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 86 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 89 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 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<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 @@ -247,6 +247,22 @@
Configurable<std::string> confRecentereVzTimeSp3{"confRecentereVzTimeSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 3"};
Configurable<std::string> confRecentereVzTimeSp4{"confRecentereVzTimeSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 4"};
Configurable<std::string> confRecentereVzTimeSp5{"confRecentereVzTimeSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 5"};

Configurable<bool> useWidthEqualization{
"useWidthEqualization",
false,
"Apply Q-vector width equalization"};

Configurable<std::string> confWidthSigma{
"confWidthSigma",
"Users/p/prottay/My/Object/ZDC/widthEq",
"TH2F path for Q-vector width equalization"};

Configurable<std::string> confWidthMean{
"confWidthMean",
"Users/p/prottay/My/Object/ZDC/widthEq",
"TH2F path for Q-vector mean equalization"};

} confignewpro;

struct : ConfigurableGroup {
Expand Down Expand Up @@ -503,6 +519,59 @@
std::array<TH3F*, 6> hrecenterecentvySpA{};
std::array<TH3F*, 6> hrecenterecentvzSpA{};
std::array<TH3F*, 5> hrecenterevztimeSpA{};
TH2F* hWidthMean = nullptr;
TH2F* hWidthSigma = nullptr;

bool CorrectWidthEqualization(TH2F* hMean,
TH2F* hWidth,
auto centrality,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{

if (!hMean || !hWidth) {
return false;
}

const double meanQxA = hMean->GetBinContent(
hMean->FindBin(centrality + 0.00001, 0.5));

const double meanQyA = hMean->GetBinContent(
hMean->FindBin(centrality + 0.00001, 1.5));

const double meanQxC = hMean->GetBinContent(
hMean->FindBin(centrality + 0.00001, 2.5));

const double meanQyC = hMean->GetBinContent(
hMean->FindBin(centrality + 0.00001, 3.5));

const double sigmaQxA = hWidth->GetBinContent(
hWidth->FindBin(centrality + 0.00001, 0.5));

const double sigmaQyA = hWidth->GetBinContent(
hWidth->FindBin(centrality + 0.00001, 1.5));

const double sigmaQxC = hWidth->GetBinContent(
hWidth->FindBin(centrality + 0.00001, 2.5));

const double sigmaQyC = hWidth->GetBinContent(
hWidth->FindBin(centrality + 0.00001, 3.5));

if (sigmaQxA <= 0.0 || sigmaQyA <= 0.0 ||
sigmaQxC <= 0.0 || sigmaQyC <= 0.0) {
return false;
}

qxZDCA = (qxZDCA - meanQxA) / sigmaQxA;
qyZDCA = (qyZDCA - meanQyA) / sigmaQyA;

qxZDCC = (qxZDCC - meanQxC) / sigmaQxC;
qyZDCC = (qyZDCC - meanQyC) / sigmaQyC;

return true;
}

bool CorrectfineCent(TH2F* hrecenterecentSp,
auto centrality,
Expand Down Expand Up @@ -875,13 +944,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 947 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 953 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 @@ -939,7 +1008,7 @@
qyZDCC = cZNC * (qyZDCC / sumC);
}

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

Check failure on line 1011 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 @@ -1404,6 +1473,19 @@
LOGF(fatal, "Cannot apply fine (cent,Vz) recentering, stage 6");
}
}

// -------------------- Width equalization --------------------
if (confignewpro.useWidthEqualization) {
if (currentRunNumber != lastRunNumber) {

hWidthMean = ccdb->getForTimeStamp<TH2F>(confignewpro.confWidthMean.value, bc.timestamp());
hWidthSigma = ccdb->getForTimeStamp<TH2F>(confignewpro.confWidthSigma.value, bc.timestamp());
}

if (!CorrectWidthEqualization(hWidthMean, hWidthSigma, centrality, qxZDCA, qyZDCA, qxZDCC, qyZDCC)) {
LOGF(fatal, "Cannot apply Q-vector width equalization");
}
}
}

histos.fill(HIST("hpQxZDCAvstime"), timeMin, qxZDCA);
Expand Down
48 changes: 37 additions & 11 deletions PWGLF/TableProducer/Resonances/cksspinalignment.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ struct cksspinalignment {
Configurable<float> cfgK0sMassMin{"cfgK0sMassMin", 0.45f, "Minimum K0s invariant mass"};
Configurable<float> cfgK0sMassMax{"cfgK0sMassMax", 0.55f, "Maximum K0s invariant mass"};

Configurable<float> cfgKeepFraction{"cfgKeepFraction", 0.4f, "Fraction of events to keep"};

HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
RCTFlagsChecker rctChecker;

Expand All @@ -136,6 +138,26 @@ struct cksspinalignment {
histos.add("hNStoredPions", "hNStoredPions;N_{#pi};Events", kTH1F, {{500, 0.0f, 500.0f}});
}

bool keepEvent(uint64_t eventIndex) const
{ /*
if (cfgKeepFraction >= 1.0f) {
return true;
}
*/
// SplitMix64 pseudo-random hash
uint64_t x = eventIndex + 0x9e3779b97f4a7c15ULL;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL;
x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL;
x = x ^ (x >> 31);

// Convert hash to uniform random number in [0,1)
const double u =
static_cast<double>(x >> 11) *
(1.0 / 9007199254740992.0);

return u < cfgKeepFraction.value;
}

template <typename T>
bool selectionTrack(const T& candidate)
{
Expand Down Expand Up @@ -222,8 +244,8 @@ struct cksspinalignment {
float radius;
float dcaPositive;
float dcaNegative;
float dcaBetweenDaughters;
// float lifetime;
// float dcaBetweenDaughters;
// float lifetime;
int64_t positiveIndex;
int64_t negativeIndex;
};
Expand Down Expand Up @@ -361,8 +383,8 @@ struct cksspinalignment {
const int occupancy = collision.trackOccupancyInTimeRange();

const float psiFT0C = collision.psiFT0C();
const float psiFT0A = collision.psiFT0A();
const float psiTPC = collision.psiTPC();
// const float psiFT0A = collision.psiFT0A();
// const float psiTPC = collision.psiTPC();

histos.fill(HIST("hEvtSelInfo"), 0.5);

Expand All @@ -386,6 +408,10 @@ struct cksspinalignment {
return;
}

if (!keepEvent(static_cast<uint64_t>(collision.globalIndex()))) {
return;
}

histos.fill(HIST("hEvtSelInfo"), 2.5);
histos.fill(HIST("hCent"), centrality);

Expand Down Expand Up @@ -462,8 +488,8 @@ struct cksspinalignment {
static_cast<float>(v0.v0radius()),
static_cast<float>(std::abs(v0.dcapostopv())),
static_cast<float>(std::abs(v0.dcanegtopv())),
static_cast<float>(std::abs(v0.dcaV0daughters())),
// lifetime,
// static_cast<float>(std::abs(v0.dcaV0daughters())),
// lifetime,
posId,
negId});

Expand All @@ -483,9 +509,9 @@ struct cksspinalignment {

kshortpionEvent(centrality,
vz,
psiFT0C,
psiFT0A,
psiTPC);
psiFT0C);
// psiFT0A,
// psiTPC);

const int64_t indexEvent = kshortpionEvent.lastIndex();

Expand All @@ -495,8 +521,8 @@ struct cksspinalignment {
k0s.radius,
k0s.dcaPositive,
k0s.dcaNegative,
k0s.dcaBetweenDaughters,
// k0s.lifetime,
// k0s.dcaBetweenDaughters,
// k0s.lifetime,
k0s.px,
k0s.py,
k0s.pz,
Expand Down
10 changes: 5 additions & 5 deletions PWGLF/Tasks/Resonances/cksspinalignder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct cksspinalignder {
Configurable<float> radiusMin{"radiusMin", 1.2f, "Minimum V0 radius"};
Configurable<float> radiusMax{"radiusMax", 100.0f, "Maximum V0 radius"};
Configurable<float> dcaPion{"dcaPion", 0.1f, "Minimum V0 daughter DCA to PV"};
Configurable<float> dcaDaughters{"dcaDaughters", 1.0f, "Maximum DCA between V0 daughters"};
// Configurable<float> dcaDaughters{"dcaDaughters", 1.0f, "Maximum DCA between V0 daughters"};
Configurable<float> k0sPtMin{"k0sPtMin", 0.0f, "Minimum K0s pT"};
Configurable<float> k0sPtMax{"k0sPtMax", 10.0f, "Maximum K0s pT"};
Configurable<float> k0sEtaMax{"k0sEtaMax", 0.8f, "Maximum K0s eta"};
Expand Down Expand Up @@ -193,11 +193,11 @@ struct cksspinalignder {
candidate.v0Radius() > radiusMax.value) {
return false;
}

/*
if (candidate.dcaBetweenDaughter() > dcaDaughters.value) {
return false;
}

*/
if (candidate.dcaPositive() < dcaPion.value ||
candidate.dcaNegative() < dcaPion.value) {
return false;
Expand Down Expand Up @@ -230,9 +230,9 @@ struct cksspinalignder {
case 0:
return collision.psiFT0C();
case 1:
return collision.psiFT0A();
return collision.psiFT0C();
case 2:
return collision.psiTPC();
return collision.psiFT0C();
default:
LOGF(warn, "epChoice=%d is invalid. Using FT0C.", epChoice.value);
return collision.psiFT0C();
Expand Down
Loading