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: 27 additions & 28 deletions PWGMM/Lumi/Tasks/LumiFDDFT0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>

using namespace o2;
Expand All @@ -67,25 +65,25 @@
DECLARE_SOA_COLUMN(InputMask, inputMask, uint64_t); //! CTP input mask

// Information for FDD
DECLARE_SOA_COLUMN(isFDD, isfdd, bool);
DECLARE_SOA_COLUMN(IsFDD, isfdd, bool);

Check failure on line 68 in PWGMM/Lumi/Tasks/LumiFDDFT0.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TCMTriggerFDD, tcmTriggerfdd, uint8_t);

Check failure on line 69 in PWGMM/Lumi/Tasks/LumiFDDFT0.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TimeAFDD, timeAfdd, double);

Check failure on line 70 in PWGMM/Lumi/Tasks/LumiFDDFT0.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TimeCFDD, timeCfdd, double);

Check failure on line 71 in PWGMM/Lumi/Tasks/LumiFDDFT0.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(IsCoinAmpFDDA, isCoinAmpFDDA, bool);
DECLARE_SOA_COLUMN(IsCoinAmpFDDC, isCoinAmpFDDC, bool);
DECLARE_SOA_COLUMN(ChargeAFDD, chargeAfdd, double);

Check failure on line 74 in PWGMM/Lumi/Tasks/LumiFDDFT0.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ChargeCFDD, chargeCfdd, double);

// Information for FT0
DECLARE_SOA_COLUMN(isFT0, isft0, bool);
DECLARE_SOA_COLUMN(IsFT0, isft0, bool);
DECLARE_SOA_COLUMN(TCMTriggerFT0, tcmTriggerft0, uint8_t);
DECLARE_SOA_COLUMN(TimeAFT0, timeAft0, double);
DECLARE_SOA_COLUMN(TimeCFT0, timeCft0, double);
DECLARE_SOA_COLUMN(ChargeAFT0, chargeAft0, double);
DECLARE_SOA_COLUMN(ChargeCFT0, chargeCft0, double);

// information for FV0
DECLARE_SOA_COLUMN(isFV0, isfv0, bool);
DECLARE_SOA_COLUMN(IsFV0, isfv0, bool);
DECLARE_SOA_COLUMN(TCMTriggerFV0, tcmTriggerfv0, uint8_t);
DECLARE_SOA_COLUMN(TimeAFV0, timeAfv0, double); // Only FV0-A time
DECLARE_SOA_COLUMN(ChargeAFV0, chargeAfv0, double); // Only FV0-A charge
Expand All @@ -94,12 +92,12 @@
DECLARE_SOA_TABLE(EventInfo, "AOD", "EventInfo", full::TimeStamp, full::InputMask, full::VertexX,
full::VertexY, full::VertexZ, full::GlobalBC,
full::VertexChi2, full::NContrib,
full::isFDD, full::TCMTriggerFDD,
full::IsFDD, full::TCMTriggerFDD,
full::TimeAFDD, full::TimeCFDD,
full::ChargeAFDD, full::ChargeCFDD,
full::isFT0, full::TCMTriggerFT0,
full::IsFT0, full::TCMTriggerFT0,
full::TimeAFT0, full::TimeCFT0,
full::ChargeAFT0, full::ChargeCFT0, full::isFV0,
full::ChargeAFT0, full::ChargeCFT0, full::IsFV0,
full::TCMTriggerFV0, full::TimeAFV0, full::ChargeAFV0);

DECLARE_SOA_TABLE(EventInfoFDD, "AOD", "EventInfoFDD",
Expand Down Expand Up @@ -141,6 +139,7 @@
Configurable<int> nContribMax{"nContribMax", 2500, "Maximum number of contributors"};
Configurable<int> nContribMin{"nContribMin", 10, "Minimum number of contributors"};
Configurable<bool> useRelTimeStamp{"useRelTimeStamp", false, "timestamp info stored as relative to fttimestamp"};
Configurable<bool> cfgKeepOnlyNonZeroCTPMask{"cfgKeepOnlyNonZeroCTPMask", false, "Keep only events with non-zero CTP mask"};

HistogramRegistry histos{
"histos",
Expand Down Expand Up @@ -187,7 +186,7 @@
o2::soa::Join<o2::aod::Tracks, o2::aod::TracksCov,
o2::aod::TracksExtra> const& unfiltered_tracks)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
const auto& bc = collision.bc_as<aod::BCsWithTimestamps>();
Long64_t relTS = bc.timestamp() - fttimestamp;
Long64_t globalBC = bc.globalBC();
std::vector<int64_t> vec_globID_contr = {};
Expand All @@ -201,7 +200,7 @@
// nNonContrib++;
continue;
}
if (unfiltered_track.pt() < 0.8 || unfiltered_track.itsNCls() < 5) {

Check failure on line 203 in PWGMM/Lumi/Tasks/LumiFDDFT0.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.
// nNonContrib++;
continue;
}
Expand Down Expand Up @@ -275,38 +274,38 @@

// now get information for FDD
if (collision.has_foundFDD()) {
auto fdd = collision.foundFDD();
const auto& fdd = collision.foundFDD();
mTriggerFDD = fdd.triggerMask();
timeaFDD = fdd.timeA();
timecFDD = fdd.timeC();
for (auto amplitude : fdd.chargeA()) {
for (const auto& amplitude : fdd.chargeA()) {
chargeaFDD += amplitude;
}
for (auto amplitude : fdd.chargeC()) {
for (const auto& amplitude : fdd.chargeC()) {
chargecFDD += amplitude;
}
} // fdd

if (collision.has_foundFT0()) {
auto ft0 = collision.foundFT0();
const auto& ft0 = collision.foundFT0();
mTriggerFT0 = ft0.triggerMask();
timeaFT0 = ft0.timeA();
timecFT0 = ft0.timeC();
for (auto amplitude : ft0.amplitudeA()) {
for (const auto& amplitude : ft0.amplitudeA()) {
chargeaFT0 += amplitude;
}

for (auto amplitude : ft0.amplitudeC()) {
for (const auto& amplitude : ft0.amplitudeC()) {
chargecFT0 += amplitude;
}
} // ft0

// FV0
if (collision.has_foundFV0()) {
auto fv0 = collision.foundFV0();
const auto& fv0 = collision.foundFV0();
mTriggerFV0 = fv0.triggerMask();
timeaFV0 = fv0.time();
for (auto amplitude : fv0.amplitude()) {
for (const auto& amplitude : fv0.amplitude()) {
chargeaFV0 += amplitude;
}
} // fv0
Expand All @@ -317,7 +316,7 @@

histos.fill(HIST("chisquare_Refitted"), chi2);
if (nContrib > nContribMin && nContrib < nContribMax &&
(chi2 / nContrib) < 4.0 && chi2 > 0) {

Check failure on line 319 in PWGMM/Lumi/Tasks/LumiFDDFT0.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.
histos.fill(HIST("vertexx_Refitted"), refitX);
histos.fill(HIST("vertexy_Refitted"), refitY);

Expand All @@ -325,7 +324,7 @@
histos.fill(HIST("vertexy_Refitted_timestamp"), relTS, refitY);
}
histos.fill(HIST("chisquare"), collision.chi2());
if (collision.chi2() / collision.numContrib() > 4)

Check failure on line 327 in PWGMM/Lumi/Tasks/LumiFDDFT0.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;
if (collision.numContrib() > nContribMax ||
collision.numContrib() < nContribMin)
Expand All @@ -338,7 +337,7 @@
histos.fill(HIST("vertexy_timestamp"), relTS, collision.posY());

if (nContrib > nContribMin && nContrib < nContribMax &&
(chi2 / nContrib) < 4.0 && chi2 > 0) {

Check failure on line 340 in PWGMM/Lumi/Tasks/LumiFDDFT0.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.
histos.fill(HIST("vertexx_Refitted_vertexx"), collision.posX(), refitX);
histos.fill(HIST("vertexy_Refitted_vertexy"), collision.posY(), refitY);
}
Expand All @@ -352,7 +351,7 @@
for (const auto& bc : bcs) {
if (!bc.timestamp())
continue;
if (bc.inputMask() == 0) // No trigger inputs active
if (bc.inputMask() == 0 && cfgKeepOnlyNonZeroCTPMask) // No trigger inputs active
continue;

if (useRelTimeStamp) {
Expand All @@ -364,15 +363,15 @@
}

// Scan over the FDD table and store charge and time along with globalBC
for (auto& fdd : fdds) {
auto bc = fdd.bc_as<BCsWithTimestamps>();
for (const auto& fdd : fdds) {
const auto& bc = fdd.bc_as<BCsWithTimestamps>();
if (!bc.timestamp())
continue;
if (mRunNumber != bc.runNumber()) {
o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(ccdbpath_grp, bc.timestamp());
if (grpo != nullptr) {
o2::base::Propagator::initFieldFromGRP(grpo);
std::cout << "run " << bc.runNumber() << std::endl;
LOG(info) << "run " << bc.runNumber();
} else {
LOGF(fatal,
"GRP object is not available in CCDB for run=%d at timestamp=%llu",
Expand All @@ -393,7 +392,7 @@
auto SideC = fdd.chargeC();
std::vector<int> channelA;
std::vector<int> channelC;
for (auto i = 0; i < 8; i++) {

Check failure on line 395 in PWGMM/Lumi/Tasks/LumiFDDFT0.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 (SideA[i] > 0) {
channelA.push_back(i);
}
Expand All @@ -413,8 +412,8 @@
} // end of fdd table

// Scan over the FT0 table and store charge and time along with globalBC
for (auto& ft0 : ft0s) {
auto bc = ft0.bc_as<BCsWithTimestamps>();
for (const auto& ft0 : ft0s) {
const auto& bc = ft0.bc_as<BCsWithTimestamps>();
if (!bc.timestamp())
continue;
Long64_t relTS = bc.timestamp() - fttimestamp;
Expand All @@ -423,17 +422,17 @@
histoslite.fill(HIST("BCFT0"), localBC);
double chargeaFT0 = 0.;
double chargecFT0 = 0.;
for (auto amplitude : ft0.amplitudeA()) {
for (const auto& amplitude : ft0.amplitudeA()) {
chargeaFT0 += amplitude;
}
for (auto amplitude : ft0.amplitudeC()) {
for (const auto& amplitude : ft0.amplitudeC()) {
chargecFT0 += amplitude;
}
rowEventInfoft0(relTS, globalBC, bc.inputMask(), ft0.triggerMask(), ft0.timeA(), ft0.timeC(), chargeaFT0, chargecFT0);
} // end of ft0 table

// Scan over the FV0 table and store charge and time along with globalBC
for (auto& fv0 : fv0s) {
for (const auto& fv0 : fv0s) {
auto bc = fv0.bc_as<BCsWithTimestamps>();
if (!bc.timestamp())
continue;
Expand All @@ -443,7 +442,7 @@
histoslite.fill(HIST("BCFV0"), localBC);

double chargeaFV0 = 0.;
for (auto amplitude : fv0.amplitude()) {
for (const auto& amplitude : fv0.amplitude()) {
chargeaFV0 += amplitude;
}
rowEventInfofv0(relTS, globalBC, bc.inputMask(), fv0.triggerMask(), fv0.time(), chargeaFV0);
Expand All @@ -466,6 +465,6 @@

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
WorkflowSpec w{adaptAnalysisTask<LumiFDDFT0>(cfgc, TaskName{"LumiFDDFT0"})};
WorkflowSpec w{adaptAnalysisTask<LumiFDDFT0>(cfgc)};
return w;
}
Loading