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
14 changes: 7 additions & 7 deletions Common/TableProducer/eventSelectionService.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 Common/TableProducer/eventSelectionService.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.)

Check failure on line 1 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.

Check failure on line 1 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[o2-workflow-options]

Do not use workflow options to customise workflow topology composition in defineDataProcessing. Use process function switches or metadata instead.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -11,7 +11,7 @@

/// \file eventSelectionTester.cxx
/// \brief unified, self-configuring event selection task
/// \author ALICE

Check failure on line 14 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

//===============================================================
//
Expand Down Expand Up @@ -48,7 +48,7 @@
using FullTracks = soa::Join<aod::Tracks, aod::TracksExtra>;
using FullTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra>;

struct eventselectionRun2 {

Check failure on line 51 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
o2::common::eventselection::bcselConfigurables bcselOpts;
o2::common::eventselection::BcSelectionModule bcselmodule;

Expand All @@ -71,7 +71,7 @@
// this: a stopgap solution to avoid spawning yet another device
std::vector<o2::common::eventselection::bcselEntry> bcselsbuffer;

// auxiliary
// auxiliary
Partition<FullTracks> tracklets = (aod::track::trackType == static_cast<uint8_t>(o2::aod::track::TrackTypeEnum::Run2Tracklet));
Preslice<FullTracks> perCollision = aod::track::collisionId;

Expand Down Expand Up @@ -101,7 +101,7 @@
}
};

struct eventselectionRun3 {

Check failure on line 104 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
o2::common::eventselection::bcselConfigurables bcselOpts;
o2::common::eventselection::BcSelectionModule bcselmodule;

Expand All @@ -126,7 +126,7 @@
// this: a stopgap solution to avoid spawning yet another device
std::vector<o2::common::eventselection::bcselEntry> bcselsbuffer;

// auxiliary
// auxiliary
Partition<FullTracksIU> pvTracks = ((aod::track::flags & static_cast<uint32_t>(o2::aod::track::PVContributor)) == static_cast<uint32_t>(o2::aod::track::PVContributor));
Preslice<FullTracksIU> perCollisionIU = aod::track::collisionId;

Expand All @@ -143,7 +143,7 @@
lumimodule.init(histos);
}

void process(aod::Collisions const& collisions,
void process(aod::Collisions const& collisions,
BCsWithRun3Matchings const& bcs,
aod::Zdcs const&,
aod::FV0As const&,
Expand Down Expand Up @@ -171,16 +171,16 @@
}

LOGF(info, "Event selection autoconfiguring from metadata. Availability of info for Run 2/3 is %i", hasRunInfo);
if(!hasRunInfo){
if (!hasRunInfo) {
LOGF(info, "Metadata info missing or incomplete. Make sure --aod-file is provided at the end of the last workflow and that the AO2D has metadata stored.");
LOGF(info, "Initializing with Run 3 data as default. Please note you will not be able to change settings manually.");
LOGF(info, "You should instead make sure the metadata is read in correctly.");
return WorkflowSpec{adaptAnalysisTask<eventselectionRun3>(cfgc)};
}else{
} else {
LOGF(info, "Metadata successfully read in. Is this Run 3? %i - will self-configure.", isRun3);
if(isRun3){
if (isRun3) {
return WorkflowSpec{adaptAnalysisTask<eventselectionRun3>(cfgc)};
}else{
} else {
return WorkflowSpec{adaptAnalysisTask<eventselectionRun2>(cfgc)};
}
}
Expand Down
59 changes: 29 additions & 30 deletions Common/Tools/EventSelectionTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// or submit itself to any jurisdiction.

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

#ifndef COMMON_TOOLS_EVENTSELECTIONTOOLS_H_
Expand Down Expand Up @@ -348,30 +348,30 @@
// }

uint32_t rct = 0;

// initialize properties
o2::common::eventselection::bcselEntry entry;
entry.alias = alias;
entry.selection = selection;
entry.rct = rct;
entry.alias = alias;
entry.selection = selection;
entry.rct = rct;
entry.foundFT0Id = foundFT0;
entry.foundFV0Id = foundFV0;
entry.foundFDDId = foundFDD;
entry.foundFDDId = foundFDD;
entry.foundZDCId = foundZDC;
bcselEntries.push_back(entry);

// Fill bc selection columns
bcsel(alias, selection, rct, foundFT0, foundFV0, foundFDD, foundZDC);
} // end bc loop
return bcselEntries;
} // end processRun2
} // end processRun2

//__________________________________________________
template <typename TCCDB, typename THistoRegistry, typename TBCs, typename TBcSelBuffer, typename TBcSelCursor>
std::vector<o2::common::eventselection::bcselEntry> processRun3(TCCDB const& ccdb, THistoRegistry& histos, TBCs const& bcs, TBcSelBuffer const& bcselbuffer, TBcSelCursor& bcsel)
{
std::vector<o2::common::eventselection::bcselEntry> bcselEntries;
if(!configure(ccdb, bcs))
if (!configure(ccdb, bcs))
return bcselEntries; // don't do anything in case configuration reported not ok

int run = bcs.iteratorAt(0).runNumber();
Expand All @@ -382,7 +382,7 @@
}

int triggerBcShift = bcselOpts.confTriggerBcShift;
if (bcselOpts.confTriggerBcShift == 999) { // o2-linter: disable=magic-number (special shift for early 2022 data)
if (bcselOpts.confTriggerBcShift == 999) { // o2-linter: disable=magic-number (special shift for early 2022 data)
triggerBcShift = (run <= 526766 || (run >= 526886 && run <= 527237) || (run >= 527259 && run <= 527518) || run == 527523 || run == 527734 || run >= 534091) ? 0 : 294; // o2-linter: disable=magic-number (magic list of runs)
}

Expand Down Expand Up @@ -533,12 +533,12 @@

// initialize properties
o2::common::eventselection::bcselEntry entry;
entry.alias = alias;
entry.selection = selection;
entry.rct = rct;
entry.alias = alias;
entry.selection = selection;
entry.rct = rct;
entry.foundFT0Id = foundFT0;
entry.foundFV0Id = foundFV0;
entry.foundFDDId = foundFDD;
entry.foundFDDId = foundFDD;
entry.foundZDCId = foundZDC;
bcselEntries.push_back(entry);

Expand Down Expand Up @@ -659,7 +659,7 @@
nBCsPerTF = evselOpts.confNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * nBCsPerOrbit : evselOpts.confNumberOfOrbitsPerTF * nBCsPerOrbit;
// colliding bc pattern
int64_t ts = bcs.iteratorAt(0).timestamp();
// getForTimeStamp replaced with getSpecific to set metadata to zero
// getForTimeStamp replaced with getSpecific to set metadata to zero
// avoids crash related to specific run number
auto grplhcif = ccdb->template getSpecific<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", ts);
bcPatternB = grplhcif->getBunchFilling().getBCPattern();
Expand Down Expand Up @@ -751,13 +751,13 @@
}
} // end processRun2

//__________________________________________________
//__________________________________________________
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(!configure(ccdb, bcs))
if (!configure(ccdb, bcs))
return; // don't do anything in case configuration reported not ok

int run = bcs.iteratorAt(0).runNumber();
// create maps from globalBC to bc index for TVX-fired bcs
// to be used for closest TVX searches
Expand Down Expand Up @@ -791,15 +791,15 @@
}
return;
}
std::vector<int> vTracksITS567perColl(cols.size(), 0); // counter of tracks per collision for occupancy studies
std::vector<float> vAmpFT0CperColl(cols.size(), 0); // amplitude FT0C per collision
std::vector<float> vCollVz(cols.size(), 0); // vector with vZ positions for each collision
std::vector<bool> vIsFullInfoForOccupancy(cols.size(), 0); // info for occupancy in +/- windows is available (i.e. a given coll is not too close to the TF borders)
std::vector<int> vTracksITS567perColl(cols.size(), 0); // counter of tracks per collision for occupancy studies
std::vector<float> vAmpFT0CperColl(cols.size(), 0); // amplitude FT0C per collision
std::vector<float> vCollVz(cols.size(), 0); // vector with vZ positions for each collision
std::vector<bool> vIsFullInfoForOccupancy(cols.size(), 0); // info for occupancy in +/- windows is available (i.e. a given coll is not too close to the TF borders)
const float timeWinOccupancyCalcMinNS = evselOpts.confTimeIntervalForOccupancyCalculationMin * 1e3; // ns
const float timeWinOccupancyCalcMaxNS = evselOpts.confTimeIntervalForOccupancyCalculationMax * 1e3; // ns
std::vector<bool> vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track
std::vector<bool> vIsVertexTOFmatched(cols.size(), 0); // at least one of vertex contributors is matched to TOF
std::vector<bool> vIsVertexTRDmatched(cols.size(), 0); // at least one of vertex contributors is matched to TRD
std::vector<bool> vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track
std::vector<bool> vIsVertexTOFmatched(cols.size(), 0); // at least one of vertex contributors is matched to TOF
std::vector<bool> vIsVertexTRDmatched(cols.size(), 0); // at least one of vertex contributors is matched to TRD

std::vector<int> vCollisionsPerBc(bcs.size(), 0); // counter of collisions per found bc for pileup checks
std::vector<int> vFoundBCindex(cols.size(), -1); // indices of found bcs
Expand Down Expand Up @@ -941,12 +941,11 @@
int32_t colIndex = col.globalIndex();
int64_t foundGlobalBC = vFoundGlobalBC[colIndex];
auto bcselEntr = bcselbuffer[vFoundBCindex[colIndex]];
if (bcselEntr.foundFT0Id>-1){
if (bcselEntr.foundFT0Id > -1) {
// required: explicit ft0s table
auto foundFT0 = ft0s.rawIteratorAt(bcselEntr.foundFT0Id);
vAmpFT0CperColl[colIndex] = foundFT0.sumAmpC();
}


int64_t tfId = (foundGlobalBC - bcSOR) / nBCsPerTF;
int64_t rofId = (foundGlobalBC + nBCsPerOrbit - rofOffset) / rofLength;
Expand Down Expand Up @@ -1165,7 +1164,7 @@

// compare zVtx from FT0 and from PV
bool isGoodZvtxFT0vsPV = 0;
if(bcselEntry.foundFT0Id>-1){
if (bcselEntry.foundFT0Id > -1) {
auto foundFT0 = ft0s.rawIteratorAt(bcselEntry.foundFT0Id);
isGoodZvtxFT0vsPV = std::fabs(foundFT0.posZ() - col.posZ()) < evselOpts.maxDiffZvtxFT0vsPV;
}
Expand Down Expand Up @@ -1204,7 +1203,7 @@

// fill counters
histos.template get<TH1>(HIST("eventselection/hColCounterAll"))->Fill(Form("%d", bc.runNumber()), 1);
if (bitcheck64(bcselEntry.selection,aod::evsel::kIsTriggerTVX)) {
if (bitcheck64(bcselEntry.selection, aod::evsel::kIsTriggerTVX)) {
histos.template get<TH1>(HIST("eventselection/hColCounterTVX"))->Fill(Form("%d", bc.runNumber()), 1);
}
if (sel8) {
Expand Down Expand Up @@ -1414,10 +1413,10 @@
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 1416 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 1417 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 1418 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 1419 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);
mPileupCorrectionTCE.push_back(muTCE > 1e-10 ? muTCE / (1 - std::exp(-muTCE)) : 1);
Expand All @@ -1430,14 +1429,14 @@
mPileupCorrectionZNC.push_back(mPileupCorrectionZNC.back());
mPileupCorrectionZEM.push_back(mPileupCorrectionZEM.back());
} // access ccdb once per run
return true; // carry on, please
return true; // carry on, please
}

//__________________________________________________
template <typename TCCDB, typename THistoRegistry, typename TBCs, typename TBcSelBuffer>
void process(TCCDB& ccdb, THistoRegistry& histos, TBCs const& bcs, TBcSelBuffer const& bcselBuffer)
{
if(!configure(ccdb, bcs))
if (!configure(ccdb, bcs))
return; // don't do anything in case configuration reported not ok

int run = bcs.iteratorAt(0).runNumber();
Expand Down
Loading