Skip to content
Draft
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
26 changes: 20 additions & 6 deletions DPG/Tasks/TPC/tpcSkimsTableCreator.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 DPG/Tasks/TPC/tpcSkimsTableCreator.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 @@ -88,7 +88,6 @@
Configurable<float> nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"};
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
Configurable<int> trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"};
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
/// Configurables downsampling
Configurable<double> dwnSmplFactorPi{"dwnSmplFactorPi", 1., "downsampling factor for pions, default fraction to keep is 1."};
Configurable<double> dwnSmplFactorPr{"dwnSmplFactorPr", 1., "downsampling factor for protons, default fraction to keep is 1."};
Expand All @@ -108,6 +107,8 @@
Configurable<bool> checkZdc{"checkZdc", false, "set ZDC flag for PbPb"};
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
// Configurable for the path of CCDB General Run Parameters LHC Interface information
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};

// an arbitrary value of N sigma TOF assigned by TOF task to tracks which are not matched to TOF hits
constexpr static float NSigmaTofUnmatched{o2::aod::v0data::kNoTOFValue};
Expand Down Expand Up @@ -263,7 +264,7 @@
void fillSkimmedV0Table(V0Casc const& v0casc, T const& track, aod::TracksQA const& trackQA, const bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float nSigmaITS, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const float hadronicRate, const int bcGlobalIndex, const int bcTimeFrameId, const int bcBcInTimeFrame, const OccupancyValues& occValues, const bool isGoodRctEvent)
{
const double ncl = track.tpcNClsFound();
const double nclPID = track.tpcNClsFindableMinusPID();
const double nclPID = track.tpcNClsPID();
const double p = track.tpcInnerParam();
const double mass = o2::track::pid_constants::sMasses[id];
const double bg = p / mass;
Expand Down Expand Up @@ -422,6 +423,8 @@
aod::pidits::ITSNSigmaEl, aod::pidits::ITSNSigmaPi,
aod::pidits::ITSNSigmaKa, aod::pidits::ITSNSigmaPr>(myTracks);

std::string irSource{};
bool isFirstCollision{true};
for (const auto& collision : collisions) {
if (!isEventSelected(collision, applyEvSel)) {
continue;
Expand All @@ -434,8 +437,12 @@
const auto v0s = myV0s.sliceBy(perCollisionV0s, static_cast<int>(collision.globalIndex()));
const auto cascs = myCascs.sliceBy(perCollisionCascs, static_cast<int>(collision.globalIndex()));
const auto bc = collision.bc_as<BCType>();
if (isFirstCollision) {
irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
}
isFirstCollision = false;
const int runnumber = bc.runNumber();
const auto hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo;
const auto hadronicRate = !irSource.empty() ? mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo : 0.;
const int bcGlobalIndex = bc.globalIndex();
int bcTimeFrameId{}, bcBcInTimeFrame{};
if constexpr (ModeId == ModeWithdEdxTrkQA || ModeId == ModeStandard) {
Expand Down Expand Up @@ -591,7 +598,6 @@
Configurable<float> nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"};
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
Configurable<int> trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"};
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
/// Triton
Configurable<float> maxMomTPCOnlyTr{"maxMomTPCOnlyTr", 1.5, "Maximum momentum for TPC only cut triton"};
Configurable<float> maxMomHardCutOnlyTr{"maxMomHardCutOnlyTr", 50, "Maximum TPC inner momentum for triton"};
Expand Down Expand Up @@ -637,6 +643,8 @@
Configurable<bool> checkZdc{"checkZdc", false, "set ZDC flag for PbPb"};
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
// Configurable for the path of CCDB General Run Parameters LHC Interface information
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};

struct TofTrack {
bool isApplyHardCutOnly;
Expand Down Expand Up @@ -698,7 +706,7 @@
void fillSkimmedTpcTofTable(T const& track, aod::TracksQA const& trackQA, const bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float nSigmaITS, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const double hadronicRate, const int bcGlobalIndex, const int bcTimeFrameId, const int bcBcInTimeFrame, const OccupancyValues& occValues, const bool isGoodRctEvent)
{
const double ncl = track.tpcNClsFound();
const double nclPID = track.tpcNClsFindableMinusPID();
const double nclPID = track.tpcNClsPID();
const double p = track.tpcInnerParam();
const double mass = o2::track::pid_constants::sMasses[id];
const double bg = p / mass;
Expand Down Expand Up @@ -803,6 +811,8 @@
labelTrack2TrackQA.at(trackId) = trackQA.globalIndex();
}
}
std::string irSource{};
bool isFirstCollision{true};
for (const auto& collision : collisions) {
const auto tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex());
if (!isEventSelected(collision, applyEvSel)) {
Expand All @@ -822,8 +832,12 @@
}

const auto bc = collision.bc_as<BCType>();
if (isFirstCollision) {
irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
}
isFirstCollision = false;
const int runnumber = bc.runNumber();
const auto hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo;
const auto hadronicRate = !irSource.empty() ? mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo : 0.;
const int bcGlobalIndex = bc.globalIndex();
int bcTimeFrameId{}, bcBcInTimeFrame{};
if constexpr (ModeId == ModeStandard || ModeId == ModeWithdEdxTrkQA) {
Expand Down
26 changes: 26 additions & 0 deletions DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@

#include "tpcSkimsTableCreator.h"

#include "Common/Core/CollisionTypeHelper.h"
#include "Common/DataModel/OccupancyTables.h"

#include <CCDB/BasicCCDBManager.h>
#include <DataFormatsParameters/GRPLHCIFData.h>
#include <Framework/ASoA.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/Logger.h>

#include <TRandom3.h>

#include <cmath>
#include <string>

namespace o2::dpg_tpcskimstablecreator
{
Expand Down Expand Up @@ -112,6 +118,26 @@ double tpcSignalGeneric(const TrkType& track)
}
}

/// Determine inteaction rate source from CCDB
std::string evaluateIrSource(const o2::framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, const std::string& ccdbPathGrpLhcIf, const uint64_t timestamp)
{
std::string irSource{};
o2::parameters::GRPLHCIFData* genRunParams = ccdb->template getForTimeStamp<o2::parameters::GRPLHCIFData>(ccdbPathGrpLhcIf, timestamp);
if (genRunParams != nullptr) {
o2::common::core::CollisionSystemType::collType collSys = CollisionSystemType::getCollisionTypeFromGrp(genRunParams);
if (collSys == CollisionSystemType::kCollSyspp) {
irSource = "T0VTX";
} else {
irSource = "ZNC hadronic";
}
LOG(info) << "irSource determined from General Run Parameters: " << irSource;
} else {
LOG(info) << "No General Run Parameters object found. irSource will remain undefined";
}

return irSource;
}

struct OccupancyValues {
float tmoPrimUnfm80{UndefValueFloat};
float tmoFV0AUnfm80{UndefValueFloat};
Expand Down
Loading