Skip to content

Commit 9c5ba28

Browse files
committed
call evaluateIrSource() only once
1 parent 0c035f8 commit 9c5ba28

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

DPG/Tasks/TPC/tpcSkimsTableCreator.cxx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ struct TreeWriterTpcV0 {
107107
Configurable<bool> checkZdc{"checkZdc", false, "set ZDC flag for PbPb"};
108108
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
109109
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
110+
// Configurable for the path of CCDB General Run Parameters LHC Interface information
110111
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
111112

112113
// an arbitrary value of N sigma TOF assigned by TOF task to tracks which are not matched to TOF hits
@@ -422,6 +423,8 @@ struct TreeWriterTpcV0 {
422423
aod::pidits::ITSNSigmaEl, aod::pidits::ITSNSigmaPi,
423424
aod::pidits::ITSNSigmaKa, aod::pidits::ITSNSigmaPr>(myTracks);
424425

426+
std::string irSource{};
427+
bool isFirstCollision{true};
425428
for (const auto& collision : collisions) {
426429
if (!isEventSelected(collision, applyEvSel)) {
427430
continue;
@@ -434,7 +437,10 @@ struct TreeWriterTpcV0 {
434437
const auto v0s = myV0s.sliceBy(perCollisionV0s, static_cast<int>(collision.globalIndex()));
435438
const auto cascs = myCascs.sliceBy(perCollisionCascs, static_cast<int>(collision.globalIndex()));
436439
const auto bc = collision.bc_as<BCType>();
437-
const std::string irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
440+
if (isFirstCollision) {
441+
irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
442+
}
443+
isFirstCollision = false;
438444
const int runnumber = bc.runNumber();
439445
const auto hadronicRate = !irSource.empty() ? mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo : 0.;
440446
const int bcGlobalIndex = bc.globalIndex();
@@ -637,6 +643,7 @@ struct TreeWriterTpcTof {
637643
Configurable<bool> checkZdc{"checkZdc", false, "set ZDC flag for PbPb"};
638644
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
639645
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
646+
// Configurable for the path of CCDB General Run Parameters LHC Interface information
640647
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
641648

642649
struct TofTrack {
@@ -804,6 +811,8 @@ struct TreeWriterTpcTof {
804811
labelTrack2TrackQA.at(trackId) = trackQA.globalIndex();
805812
}
806813
}
814+
std::string irSource{};
815+
bool isFirstCollision{true};
807816
for (const auto& collision : collisions) {
808817
const auto tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex());
809818
if (!isEventSelected(collision, applyEvSel)) {
@@ -823,7 +832,10 @@ struct TreeWriterTpcTof {
823832
}
824833

825834
const auto bc = collision.bc_as<BCType>();
826-
const std::string irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
835+
if (isFirstCollision) {
836+
irSource = evaluateIrSource(ccdb, ccdbPathGrpLhcIf, bc.timestamp());
837+
}
838+
isFirstCollision = false;
827839
const int runnumber = bc.runNumber();
828840
const auto hadronicRate = !irSource.empty() ? mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * OneToKilo : 0.;
829841
const int bcGlobalIndex = bc.globalIndex();

0 commit comments

Comments
 (0)