Skip to content

Commit 585acae

Browse files
committed
Autoconfigure by default source for IR fetcher in HF event selection
1 parent b8282e3 commit 585acae

File tree

7 files changed

+51
-28
lines changed

7 files changed

+51
-28
lines changed

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ struct HfCandidateCreator2Prong {
118118
HfEventSelection hfEvSel; // event selection and monitoring
119119
o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter
120120
Service<o2::ccdb::BasicCCDBManager> ccdb;
121-
ctpRateFetcher mRateFetcher;
122121

123122
int runNumber{0};
124123
double bz{0.};
@@ -747,7 +746,7 @@ struct HfCandidateCreator2Prong {
747746
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
748747
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
749748
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
750-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
749+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
751750
/// monitor the satisfied event selections
752751
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
753752

@@ -766,7 +765,7 @@ struct HfCandidateCreator2Prong {
766765
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
767766
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
768767
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
769-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
768+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
770769
/// monitor the satisfied event selections
771770
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
772771

@@ -785,7 +784,7 @@ struct HfCandidateCreator2Prong {
785784
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
786785
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
787786
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
788-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
787+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
789788
/// monitor the satisfied event selections
790789
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
791790

@@ -809,7 +808,7 @@ struct HfCandidateCreator2Prong {
809808
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
810809
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc<true, CentralityEstimator::None, aod::BcFullInfos>(collision, centrality, ccdb, registry, bcs);
811810
const auto bc = collision.template foundBC_as<aod::BcFullInfos>();
812-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
811+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
813812
/// monitor the satisfied event selections
814813
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
815814

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ struct HfCandidateCreator3Prong {
135135
HfEventSelection hfEvSel; // event selection and monitoring
136136
o2::vertexing::DCAFitterN<3> df; // 3-prong vertex fitter
137137
Service<o2::ccdb::BasicCCDBManager> ccdb;
138-
ctpRateFetcher mRateFetcher;
139138

140139
int runNumber{0};
141140
double bz{0.};
@@ -904,7 +903,7 @@ struct HfCandidateCreator3Prong {
904903
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
905904
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
906905
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
907-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
906+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
908907
/// monitor the satisfied event selections
909908
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
910909

@@ -923,7 +922,7 @@ struct HfCandidateCreator3Prong {
923922
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
924923
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
925924
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
926-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
925+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
927926
/// monitor the satisfied event selections
928927
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
929928

@@ -942,7 +941,7 @@ struct HfCandidateCreator3Prong {
942941
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
943942
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
944943
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
945-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
944+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
946945
/// monitor the satisfied event selections
947946
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
948947

@@ -966,7 +965,7 @@ struct HfCandidateCreator3Prong {
966965
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
967966
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc<true, CentralityEstimator::None, aod::BcFullInfos>(collision, centrality, ccdb, registry, bcs);
968967
const auto bc = collision.template foundBC_as<aod::BcFullInfos>();
969-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
968+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
970969
/// monitor the satisfied event selections
971970
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
972971

PWGHF/TableProducer/candidateCreatorCascade.cxx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "PWGLF/DataModel/LFStrangenessTables.h"
2626
#include "PWGLF/DataModel/mcCentrality.h"
2727

28-
#include "Common/CCDB/ctpRateFetcher.h"
2928
#include "Common/Core/RecoDecay.h"
3029
#include "Common/Core/ZorroSummary.h"
3130
#include "Common/Core/trackUtilities.h"
@@ -96,7 +95,6 @@ struct HfCandidateCreatorCascade {
9695
Service<o2::ccdb::BasicCCDBManager> ccdb;
9796
o2::base::MatLayerCylSet* lut{};
9897
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
99-
ctpRateFetcher mRateFetcher;
10098

10199
int runNumber{0};
102100
double massP{0.};
@@ -385,7 +383,7 @@ struct HfCandidateCreatorCascade {
385383
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
386384
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
387385
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
388-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
386+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
389387
/// monitor the satisfied event selections
390388
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
391389

@@ -404,7 +402,7 @@ struct HfCandidateCreatorCascade {
404402
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
405403
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
406404
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
407-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
405+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
408406
/// monitor the satisfied event selections
409407
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
410408

@@ -423,7 +421,7 @@ struct HfCandidateCreatorCascade {
423421
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
424422
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
425423
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
426-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
424+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
427425
/// monitor the satisfied event selections
428426
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
429427

PWGHF/TableProducer/candidateCreatorDstar.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ struct HfCandidateCreatorDstar {
109109
HfEventSelection hfEvSel; // event selection and monitoring
110110
Service<o2::ccdb::BasicCCDBManager> ccdb; // From utilsBfieldCCDB.h
111111
o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
112-
ctpRateFetcher mRateFetcher;
113112
// D0-prong vertex fitter
114113
o2::vertexing::DCAFitterN<2> df;
115114
int runNumber{};
@@ -505,7 +504,7 @@ struct HfCandidateCreatorDstar {
505504
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
506505
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
507506
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
508-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
507+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
509508
/// monitor the satisfied event selections
510509
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
511510

@@ -524,7 +523,7 @@ struct HfCandidateCreatorDstar {
524523
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
525524
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
526525
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
527-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
526+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
528527
/// monitor the satisfied event selections
529528
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
530529

@@ -543,7 +542,7 @@ struct HfCandidateCreatorDstar {
543542
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
544543
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
545544
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
546-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
545+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
547546
/// monitor the satisfied event selections
548547
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
549548

PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ struct HfCandidateCreatorXic0Omegac0 {
147147
Service<o2::ccdb::BasicCCDBManager> ccdb;
148148
o2::base::MatLayerCylSet* lut{};
149149
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
150-
ctpRateFetcher mRateFetcher;
151150
int runNumber{-1};
152151
double magneticField{0.};
153152

@@ -2241,7 +2240,7 @@ struct HfCandidateCreatorXic0Omegac0 {
22412240
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
22422241
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
22432242
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
2244-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
2243+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
22452244
/// monitor the satisfied event selections
22462245
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
22472246

@@ -2260,7 +2259,7 @@ struct HfCandidateCreatorXic0Omegac0 {
22602259
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
22612260
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
22622261
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
2263-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
2262+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
22642263
/// monitor the satisfied event selections
22652264
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
22662265

@@ -2279,7 +2278,7 @@ struct HfCandidateCreatorXic0Omegac0 {
22792278
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
22802279
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
22812280
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
2282-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
2281+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
22832282
/// monitor the satisfied event selections
22842283
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
22852284

PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ struct HfCandidateCreatorXicToXiPiPi {
116116
Service<o2::ccdb::BasicCCDBManager> ccdb;
117117
o2::base::MatLayerCylSet* lut{};
118118
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
119-
ctpRateFetcher mRateFetcher;
120119

121120
o2::vertexing::DCAFitterN<3> df;
122121

@@ -807,7 +806,7 @@ struct HfCandidateCreatorXicToXiPiPi {
807806
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
808807
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
809808
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
810-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
809+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
811810
/// monitor the satisfied event selections
812811
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
813812

@@ -825,7 +824,7 @@ struct HfCandidateCreatorXicToXiPiPi {
825824
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
826825
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
827826
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
828-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
827+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
829828
/// monitor the satisfied event selections
830829
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
831830

@@ -843,7 +842,7 @@ struct HfCandidateCreatorXicToXiPiPi {
843842
const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator);
844843
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
845844
const auto bc = collision.template foundBC_as<aod::BCsWithTimestamps>();
846-
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), hfEvSel.irSource, true); // Hz
845+
const auto ir = hfEvSel.getInteractionRate(bc, ccdb); // Hz
847846
/// monitor the satisfied event selections
848847
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy, ir);
849848

PWGHF/Utils/utilsEvSelHf.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@
1818
#ifndef PWGHF_UTILS_UTILSEVSELHF_H_
1919
#define PWGHF_UTILS_UTILSEVSELHF_H_
2020

21+
2122
#include "PWGHF/Core/CentralityEstimation.h"
2223
//
2324
#include "PWGUD/Core/SGCutParHolder.h"
2425
#include "PWGUD/Core/SGSelector.h"
2526

27+
#include "CCDB/BasicCCDBManager.h"
2628
#include "Common/CCDB/EventSelectionParams.h"
2729
#include "Common/CCDB/RCTSelectionFlags.h"
2830
#include "Common/CCDB/ctpRateFetcher.h"
31+
#include "Common/Core/CollisionTypeHelper.h"
2932
#include "Common/Core/Zorro.h"
3033
#include "Common/Core/ZorroSummary.h"
34+
#include "DataFormatsParameters/GRPLHCIFData.h"
3135

3236
#include <Framework/AnalysisHelpers.h>
3337
#include <Framework/Configurable.h>
@@ -181,7 +185,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
181185
o2::framework::Configurable<std::string> rctLabel{"rctLabel", "CBT_hadronPID", "RCT selection flag (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo)"};
182186
o2::framework::Configurable<bool> rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"};
183187
o2::framework::Configurable<bool> rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"};
184-
o2::framework::Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
188+
o2::framework::Configurable<std::string> irSource{"irSource", "", "Estimator of the interaction rate (Empty: automatically set. Otherwise recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
185189

186190
// SG selector
187191
SGSelector sgSelector;
@@ -209,6 +213,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
209213
Zorro zorro;
210214
int currentRun{-1};
211215

216+
// util to retrieve IR
217+
ctpRateFetcher irFetcher;
218+
std::string irSourceForCptFetcher;
219+
212220
/// Set standard preselection gap trigger (values taken from UD group)
213221
SGCutParHolder setSgPreselection()
214222
{
@@ -261,6 +269,11 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
261269

262270
// we initialise histograms
263271
addHistograms(registry);
272+
273+
// we initialise IR fetcher
274+
if (!irSource.value.empty()) {
275+
irSourceForCptFetcher = irSource.value;
276+
}
264277
}
265278

266279
/// \brief Applies event selection.
@@ -431,6 +444,23 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
431444
hCollisionsCentOcc->Fill(centrality, occupancy);
432445
hCollisionsCentIR->Fill(centrality, ir);
433446
}
447+
448+
template <typename TBc>
449+
double getInteractionRate(TBc const& bc,
450+
o2::framework::Service<o2::ccdb::BasicCCDBManager> const& ccdb)
451+
{
452+
if (irSourceForCptFetcher.empty()) {
453+
o2::parameters::GRPLHCIFData* grpo = ccdb.service->getSpecificForRun<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", bc.runNumber());
454+
auto collsys = o2::common::core::CollisionSystemType::getCollisionTypeFromGrp(grpo);
455+
if (collsys == o2::common::core::CollisionSystemType::kCollSyspp) {
456+
irSourceForCptFetcher = std::string("T0VTX");
457+
} else {
458+
irSourceForCptFetcher = std::string("ZNC hadronic");
459+
}
460+
}
461+
462+
return irFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSourceForCptFetcher, true);
463+
}
434464
};
435465

436466
struct HfEventSelectionMc {

0 commit comments

Comments
 (0)