Skip to content

Commit f85cf19

Browse files
maciaccoalibuild
andauthored
[PWGLF] check trigger classes for HM (#9029)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent d611c91 commit f85cf19

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

PWGLF/TableProducer/Nuspex/ebyeMaker.cxx

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include <vector>
13+
#include <map>
1314
#include <utility>
1415
#include <random>
1516
#include <string>
@@ -35,6 +36,7 @@
3536
#include "DataFormatsTPC/BetheBlochAleph.h"
3637
#include "Common/Core/PID/PIDTOF.h"
3738
#include "Common/TableProducer/PID/pidTOFBase.h"
39+
#include "CCDB/CcdbApi.h"
3840

3941
#include "Common/Core/PID/TPCPIDResponse.h"
4042
#include "Common/DataModel/PIDResponse.h"
@@ -205,6 +207,7 @@ struct ebyeMaker {
205207
std::array<std::vector<CandidateTrack>, 2> candidateTracks;
206208
Service<o2::ccdb::BasicCCDBManager> ccdb;
207209
o2::vertexing::DCAFitterN<2> fitter;
210+
std::vector<int> classIds;
208211

209212
int mRunNumber;
210213
float d_bz;
@@ -380,7 +383,7 @@ struct ebyeMaker {
380383
if (mRunNumber == bc.runNumber()) {
381384
return;
382385
}
383-
386+
classIds.clear();
384387
auto timestamp = bc.timestamp();
385388
o2::parameters::GRPObject* grpo = 0x0;
386389
o2::parameters::GRPMagField* grpmag = 0x0;
@@ -441,6 +444,20 @@ struct ebyeMaker {
441444
d_bz = o2::base::Propagator::Instance()->getNominalBz();
442445
LOG(info) << "Retrieved GRP for timestamp " << timestamp << " with magnetic field of " << d_bz << " kG";
443446
mRunNumber = bc.runNumber();
447+
if (doprocessMiniRun2) {
448+
o2::ccdb::CcdbApi ccdbApi;
449+
ccdbApi.init("http://alice-ccdb.cern.ch");
450+
std::map<std::string, std::string> metadata;
451+
std::map<std::string, int>* classNameToIndexMap = ccdbApi.retrieveFromTFileAny<std::map<std::string, int>>("CTP/ClassNameToIndexMap", metadata, mRunNumber);
452+
for (const auto& classToIndexPair : *classNameToIndexMap) {
453+
bool hasClassName = classToIndexPair.first.find("HMV0M") < classToIndexPair.first.length();
454+
int classId = hasClassName ? classToIndexPair.second - 1 : -1;
455+
if (classId < 0) {
456+
continue;
457+
}
458+
classIds.push_back(classId);
459+
}
460+
}
444461
fitter.setBz(d_bz);
445462

446463
// o2::base::Propagator::Instance()->setMatLUT(lut);
@@ -1041,7 +1058,7 @@ struct ebyeMaker {
10411058
continue;
10421059

10431060
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1044-
float cV0M = -999.f;
1061+
float cV0M = 105.f;
10451062
if (Run2V0MInfo.mCalibrationStored) {
10461063
cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
10471064
if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((cV0M >= 10 && cV0M < 30) || cV0M > 50))))
@@ -1127,7 +1144,7 @@ struct ebyeMaker {
11271144
continue;
11281145

11291146
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1130-
float cV0M = -999.f;
1147+
float cV0M = 105.f;
11311148
if (Run2V0MInfo.mCalibrationStored) {
11321149
cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
11331150
}
@@ -1141,6 +1158,16 @@ struct ebyeMaker {
11411158
fillRecoEvent(collision, tracks, V0Table_thisCollision, cV0M);
11421159

11431160
uint8_t trigger = collision.alias_bit(kINT7) ? 0x1 : 0x0;
1161+
bool hasHMV0M = false;
1162+
for (auto& classId : classIds) {
1163+
if (bc.triggerMask() & BIT(classId)) {
1164+
hasHMV0M = true;
1165+
break;
1166+
}
1167+
}
1168+
if (!hasHMV0M && trigger == 0x0) {
1169+
continue;
1170+
}
11441171
miniCollTable(static_cast<int8_t>(collision.posZ() * 10), trigger, nTrackletsColl, cV0M);
11451172

11461173
for (auto& candidateTrack : candidateTracks[0]) { // protons
@@ -1247,7 +1274,7 @@ struct ebyeMaker {
12471274
continue;
12481275

12491276
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1250-
float cV0M = -999.f;
1277+
float cV0M = 105.f;
12511278
if (Run2V0MInfo.mCalibrationStored) {
12521279
cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
12531280
}
@@ -1319,7 +1346,7 @@ struct ebyeMaker {
13191346
continue;
13201347

13211348
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1322-
float cV0M = -999.f;
1349+
float cV0M = 105.f;
13231350
if (Run2V0MInfo.mCalibrationStored) {
13241351
cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
13251352
}

0 commit comments

Comments
 (0)