Skip to content

Commit 0c035f8

Browse files
committed
read irSource from ccdb
1 parent 7daa5b1 commit 0c035f8

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

DPG/Tasks/TPC/tpcSkimsTableCreator.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct TreeWriterTpcV0 {
8888
Configurable<float> nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"};
8989
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
9090
Configurable<int> trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"};
91-
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
9291
/// Configurables downsampling
9392
Configurable<double> dwnSmplFactorPi{"dwnSmplFactorPi", 1., "downsampling factor for pions, default fraction to keep is 1."};
9493
Configurable<double> dwnSmplFactorPr{"dwnSmplFactorPr", 1., "downsampling factor for protons, default fraction to keep is 1."};
@@ -108,6 +107,7 @@ struct TreeWriterTpcV0 {
108107
Configurable<bool> checkZdc{"checkZdc", false, "set ZDC flag for PbPb"};
109108
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
110109
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
110+
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
111111

112112
// an arbitrary value of N sigma TOF assigned by TOF task to tracks which are not matched to TOF hits
113113
constexpr static float NSigmaTofUnmatched{o2::aod::v0data::kNoTOFValue};
@@ -434,8 +434,9 @@ struct TreeWriterTpcV0 {
434434
const auto v0s = myV0s.sliceBy(perCollisionV0s, static_cast<int>(collision.globalIndex()));
435435
const auto cascs = myCascs.sliceBy(perCollisionCascs, static_cast<int>(collision.globalIndex()));
436436
const auto bc = collision.bc_as<BCType>();
437+
const std::string irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
437438
const int runnumber = bc.runNumber();
438-
const auto hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo;
439+
const auto hadronicRate = !irSource.empty() ? mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo : 0.;
439440
const int bcGlobalIndex = bc.globalIndex();
440441
int bcTimeFrameId{}, bcBcInTimeFrame{};
441442
if constexpr (ModeId == ModeWithdEdxTrkQA || ModeId == ModeStandard) {
@@ -591,7 +592,6 @@ struct TreeWriterTpcTof {
591592
Configurable<float> nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"};
592593
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
593594
Configurable<int> trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"};
594-
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
595595
/// Triton
596596
Configurable<float> maxMomTPCOnlyTr{"maxMomTPCOnlyTr", 1.5, "Maximum momentum for TPC only cut triton"};
597597
Configurable<float> maxMomHardCutOnlyTr{"maxMomHardCutOnlyTr", 50, "Maximum TPC inner momentum for triton"};
@@ -637,6 +637,7 @@ struct TreeWriterTpcTof {
637637
Configurable<bool> checkZdc{"checkZdc", false, "set ZDC flag for PbPb"};
638638
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
639639
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
640+
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
640641

641642
struct TofTrack {
642643
bool isApplyHardCutOnly;
@@ -822,8 +823,9 @@ struct TreeWriterTpcTof {
822823
}
823824

824825
const auto bc = collision.bc_as<BCType>();
826+
const std::string irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
825827
const int runnumber = bc.runNumber();
826-
const auto hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo;
828+
const auto hadronicRate = !irSource.empty() ? mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo : 0.;
827829
const int bcGlobalIndex = bc.globalIndex();
828830
int bcTimeFrameId{}, bcBcInTimeFrame{};
829831
if constexpr (ModeId == ModeStandard || ModeId == ModeWithdEdxTrkQA) {

DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@
2222

2323
#include "tpcSkimsTableCreator.h"
2424

25+
#include "Common/Core/CollisionTypeHelper.h"
2526
#include "Common/DataModel/OccupancyTables.h"
2627

28+
#include <CCDB/BasicCCDBManager.h>
29+
#include <DataFormatsParameters/GRPLHCIFData.h>
2730
#include <Framework/ASoA.h>
31+
#include <Framework/AnalysisHelpers.h>
32+
#include <Framework/Logger.h>
2833

2934
#include <TRandom3.h>
3035

3136
#include <cmath>
37+
#include <string>
3238

3339
namespace o2::dpg_tpcskimstablecreator
3440
{
@@ -112,6 +118,26 @@ double tpcSignalGeneric(const TrkType& track)
112118
}
113119
}
114120

121+
/// Determine inteaction rate source from CCDB
122+
std::string evaluateIrSource(const o2::framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, const std::string& ccdbPathGrpLhcIf, const uint64_t timestamp)
123+
{
124+
std::string irSource{};
125+
o2::parameters::GRPLHCIFData* genRunParams = ccdb->template getForTimeStamp<o2::parameters::GRPLHCIFData>(ccdbPathGrpLhcIf, timestamp);
126+
if (genRunParams != nullptr) {
127+
o2::common::core::CollisionSystemType::collType collSys = CollisionSystemType::getCollisionTypeFromGrp(genRunParams);
128+
if (collSys == CollisionSystemType::kCollSyspp) {
129+
irSource = "T0VTX";
130+
} else {
131+
irSource = "ZNC hadronic";
132+
}
133+
LOG(info) << "irSource determined from General Run Parameters: " << irSource;
134+
} else {
135+
LOG(info) << "No General Run Parameters object found. irSource will remain undefined";
136+
}
137+
138+
return irSource;
139+
}
140+
115141
struct OccupancyValues {
116142
float tmoPrimUnfm80{UndefValueFloat};
117143
float tmoFV0AUnfm80{UndefValueFloat};

0 commit comments

Comments
 (0)