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
44 changes: 22 additions & 22 deletions Common/Tools/EventSelectionTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/// \file EventSelectionModule.h
/// \brief
/// \author ALICE

Check failure on line 14 in Common/Tools/EventSelectionTools.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 14 in Common/Tools/EventSelectionTools.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

#ifndef COMMON_TOOLS_EVENTSELECTIONTOOLS_H_
#define COMMON_TOOLS_EVENTSELECTIONTOOLS_H_
Expand All @@ -20,6 +20,7 @@
#define bitcheck64(var, nbit) ((var) & (static_cast<uint64_t>(1) << (nbit)))

#include "MetadataHelper.h"
#include "TableHelper.h"

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/TriggerAliases.h"
Expand All @@ -39,7 +40,6 @@
#include "Framework/HistogramRegistry.h"
#include "ITSMFTBase/DPLAlpideParam.h"
#include "ITSMFTReconstruction/ChipMappingITS.h"
#include "TableHelper.h"

#include <array>
#include <cmath>
Expand Down Expand Up @@ -90,7 +90,7 @@
struct evselConfigurables : o2::framework::ConfigurableGroup {
std::string prefix = "evselOpts";
bool isMC_metadata = false;
o2::framework::Configurable<int> amIneeded{"amIneeded", -1, "run event selection or not. -1: automatic; 0: no; 1: yes"}; // o2-linter: disable=name/configurable (temporary fix)
o2::framework::Configurable<int> amIneeded{"amIneeded", -1, "run event selection or not. -1: automatic; 0: no; 1: yes"}; // o2-linter: disable=name/configurable (temporary fix)
o2::framework::Configurable<int> muonSelection{"muonSelection", 0, "0 - barrel, 1 - muon selection with pileup cuts, 2 - muon selection without pileup cuts"};
o2::framework::Configurable<float> maxDiffZvtxFT0vsPV{"maxDiffZvtxFT0vsPV", 1., "maximum difference (in cm) between z-vertex from FT0 and PV"};
o2::framework::Configurable<int> isMC{"isMC", -1, "-1 - autoset, 0 - data, 1 - MC"};
Expand All @@ -111,7 +111,7 @@
// luminosity configurables
struct lumiConfigurables : o2::framework::ConfigurableGroup {
std::string prefix = "lumiOpts";
o2::framework::Configurable<int> amIneeded{"amIneeded", -1, "run BC selection or not. -1: automatic; 0: no; 1: yes"}; // o2-linter: disable=name/configurable (temporary fix)
o2::framework::Configurable<int> amIneeded{"amIneeded", -1, "run BC selection or not. -1: automatic; 0: no; 1: yes"}; // o2-linter: disable=name/configurable (temporary fix)
};

class BcSelectionModule
Expand Down Expand Up @@ -154,20 +154,20 @@
// read in configurations from the task where it's used
bcselOpts = external_bcselopts;

if(bcselOpts.amIneeded.value<0){
if (bcselOpts.amIneeded.value < 0) {
int bcSelNeeded = -1, evSelNeeded = -1;
bcselOpts.amIneeded.value = 0;
enableFlagIfTableRequired(context, "BcSels", bcSelNeeded);
enableFlagIfTableRequired(context, "EvSels", evSelNeeded);
if(bcSelNeeded==1){
if (bcSelNeeded == 1) {
bcselOpts.amIneeded.value = 1;
LOGF(info, "BC Selection / Autodetection for aod::BcSels: subscription present, will generate.");
}
if(evSelNeeded==1 && bcSelNeeded==0){
if (evSelNeeded == 1 && bcSelNeeded == 0) {
bcselOpts.amIneeded.value = 1;
LOGF(info, "BC Selection / Autodetection for aod::BcSels: not there, but EvSel needed. Will generate.");
}
if(bcSelNeeded == 0 && evSelNeeded == 0){
if (bcSelNeeded == 0 && evSelNeeded == 0) {
LOGF(info, "BC Selection / Autodetection for aod::BcSels: not required. Skipping generation.");
return;
}
Expand Down Expand Up @@ -267,8 +267,8 @@
template <typename TCCDB, typename TBCs, typename TBcSelBuffer, typename TBcSelCursor>
void processRun2(TCCDB const& ccdb, TBCs const& bcs, TBcSelBuffer& bcselbuffer, TBcSelCursor& bcsel)
{
if(bcselOpts.amIneeded.value == 0){
bcselbuffer.clear();
if (bcselOpts.amIneeded.value == 0) {
bcselbuffer.clear();
return;
}
bcselbuffer.clear();
Expand Down Expand Up @@ -404,8 +404,8 @@
template <typename TCCDB, typename THistoRegistry, typename TBCs, typename TBcSelBuffer, typename TBcSelCursor>
void processRun3(TCCDB const& ccdb, THistoRegistry& histos, TBCs const& bcs, TBcSelBuffer& bcselbuffer, TBcSelCursor& bcsel)
{
if(bcselOpts.amIneeded.value == 0){
bcselbuffer.clear();
if (bcselOpts.amIneeded.value == 0) {
bcselbuffer.clear();
return;
}
bcselbuffer.clear();
Expand Down Expand Up @@ -665,12 +665,12 @@
// read in configurations from the task where it's used
evselOpts = external_evselopts;

if(evselOpts.amIneeded.value<0){
if (evselOpts.amIneeded.value < 0) {
enableFlagIfTableRequired(context, "EvSels", evselOpts.amIneeded.value);
if(evselOpts.amIneeded.value==0){
if (evselOpts.amIneeded.value == 0) {
LOGF(info, "Event Selection / Autodetecting for aod::EvSels: not required, won't generate.");
return;
}else{
} else {
LOGF(info, "Event Selection / Autodetecting for aod::EvSels: subscription present, will generate.");
}
}
Expand Down Expand Up @@ -724,7 +724,7 @@
template <typename TCCDB, typename THistoRegistry, typename TCollisions, typename TTracklets, typename TSlicecache, typename TBcSelBuffer, typename TEvselCursor>
void processRun2(TCCDB const& ccdb, THistoRegistry& histos, TCollisions const& collisions, TTracklets const& tracklets, TSlicecache& cache, TBcSelBuffer const& bcselbuffer, TEvselCursor& evsel)
{
if(evselOpts.amIneeded.value == 0){
if (evselOpts.amIneeded.value == 0) {
return; // dummy process
}
for (const auto& col : collisions) {
Expand Down Expand Up @@ -805,7 +805,7 @@
template <typename TCCDB, typename THistoRegistry, typename TBCs, typename TCollisions, typename TPVTracks, typename TFT0s, typename TSlicecache, typename TBcSelBuffer, typename TEvselCursor>
void processRun3(TCCDB const& ccdb, THistoRegistry& histos, TBCs const& bcs, TCollisions const& cols, TPVTracks const& pvTracks, TFT0s const& ft0s, TSlicecache& cache, TBcSelBuffer const& bcselbuffer, TEvselCursor& evsel)
{
if(evselOpts.amIneeded.value == 0){
if (evselOpts.amIneeded.value == 0) {
return; // dummy process
}
if (!configure(ccdb, bcs))
Expand Down Expand Up @@ -1302,22 +1302,22 @@
template <typename TContext, typename TLumiOpts, typename THistoRegistry>
void init(TContext& context, TLumiOpts const& external_lumiopts, THistoRegistry& histos)
{
lumiOpts = external_lumiopts;
lumiOpts = external_lumiopts;

if(lumiOpts.amIneeded.value<0){
if (lumiOpts.amIneeded.value < 0) {
int bcSelNeeded = -1, evSelNeeded = -1;
lumiOpts.amIneeded.value = 0;
enableFlagIfTableRequired(context, "BcSels", bcSelNeeded);
enableFlagIfTableRequired(context, "EvSels", evSelNeeded);
if(bcSelNeeded==1){
if (bcSelNeeded == 1) {
lumiOpts.amIneeded.value = 1;
LOGF(info, "Luminosity / Autodetection for aod::BcSels: subscription present, will generate.");
}
if(evSelNeeded==1 && bcSelNeeded==0){
if (evSelNeeded == 1 && bcSelNeeded == 0) {
lumiOpts.amIneeded.value = 1;
LOGF(info, "Luminosity / Autodetection for aod::BcSels: not there, but EvSel needed. Will generate.");
}
if(bcSelNeeded == 0 && evSelNeeded == 0){
if (bcSelNeeded == 0 && evSelNeeded == 0) {
LOGF(info, "Luminosity / Autodetection for aod::BcSels: not required. Skipping generation.");
return;
}
Expand Down Expand Up @@ -1491,15 +1491,15 @@
double perBcRateTCE = static_cast<double>(mCounterTCE[i + 1] - mCounterTCE[i]) / nOrbits / nCollidingBCs;
double perBcRateZNC = static_cast<double>(mCounterZNC[i + 1] - mCounterZNC[i]) / nOrbits / nCollidingBCs;
double perBcRateZEM = static_cast<double>(mCounterZEM[i + 1] - mCounterZEM[i]) / nOrbits / nCollidingBCs;
double muTVX = (perBcRateTVX < 1 && perBcRateTVX > 1e-10) ? -std::log(1 - perBcRateTVX) : 0;

Check failure on line 1494 in Common/Tools/EventSelectionTools.h

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.
double muTCE = (perBcRateTCE < 1 && perBcRateTCE > 1e-10) ? -std::log(1 - perBcRateTCE) : 0;

Check failure on line 1495 in Common/Tools/EventSelectionTools.h

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.
double muZNC = (perBcRateZNC < 1 && perBcRateZNC > 1e-10) ? -std::log(1 - perBcRateZNC) : 0;

Check failure on line 1496 in Common/Tools/EventSelectionTools.h

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.
double muZEM = (perBcRateZEM < 1 && perBcRateZEM > 1e-10) ? -std::log(1 - perBcRateZEM) : 0;

Check failure on line 1497 in Common/Tools/EventSelectionTools.h

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.
LOGP(debug, "orbit={} muTVX={} muTCE={} muZNC={} muZEM={}", mOrbits[i], muTVX, muTCE, muZNC, muZEM);
mPileupCorrectionTVX.push_back(muTVX > 1e-10 ? muTVX / (1 - std::exp(-muTVX)) : 1);

Check failure on line 1499 in Common/Tools/EventSelectionTools.h

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.
mPileupCorrectionTCE.push_back(muTCE > 1e-10 ? muTCE / (1 - std::exp(-muTCE)) : 1);

Check failure on line 1500 in Common/Tools/EventSelectionTools.h

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.
mPileupCorrectionZNC.push_back(muZNC > 1e-10 ? muZNC / (1 - std::exp(-muZNC)) : 1);

Check failure on line 1501 in Common/Tools/EventSelectionTools.h

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.
mPileupCorrectionZEM.push_back(muZEM > 1e-10 ? muZEM / (1 - std::exp(-muZEM)) : 1);

Check failure on line 1502 in Common/Tools/EventSelectionTools.h

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.
}
// filling last orbit range using previous orbit range
mPileupCorrectionTVX.push_back(mPileupCorrectionTVX.back());
Expand All @@ -1514,7 +1514,7 @@
template <typename TCCDB, typename THistoRegistry, typename TBCs, typename TBcSelBuffer>
void process(TCCDB& ccdb, THistoRegistry& histos, TBCs const& bcs, TBcSelBuffer const& bcselBuffer)
{
if(lumiOpts.amIneeded.value == 0){
if (lumiOpts.amIneeded.value == 0) {
return;
}

Expand Down
Loading