Skip to content

Commit 972f232

Browse files
committed
Fix test
1 parent 98d2c7c commit 972f232

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

MC/config/PWGHF/external/generator/generator_pythia8_gaptriggered_hf.C

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public:
2323
mGeneratedEvents = 0;
2424
mInverseTriggerRatio = inputTriggerRatio;
2525
mQuarkRapidityMin = -1.5;
26-
mQuarkRapidityMax = -1.5;
26+
mQuarkRapidityMax = 1.5;
2727
mHadRapidityMin = -1.5;
28-
mHadRapidityMax = -1.5;
28+
mHadRapidityMax = 1.5;
2929
mQuarkPdg = 0;
3030
mHadronPdg = 0;
3131
mQuarkPdgList = quarkPdgList;
@@ -266,7 +266,6 @@ protected:
266266
}
267267

268268
int charge = mPythia.event[iPartToReplace].id() / std::abs(mPythia.event[iPartToReplace].id());
269-
int status = mPythia.event[iPartToReplace].status();
270269
float px = mPythia.event[iPartToReplace].px();
271270
float py = mPythia.event[iPartToReplace].py();
272271
float pz = mPythia.event[iPartToReplace].pz();
@@ -293,13 +292,16 @@ protected:
293292
mPythia.event[iPartToReplace].undoDecay();
294293
mPythia.event.remove(iPartToReplace, iPartToReplace, true); // we remove the original particle
295294

295+
int status = std::abs(mPythia.event[iPartToReplace].status());
296+
if (status < 81) {
297+
status = 81;
298+
}
296299
mPythia.event.append(charge * pdgCodeNew, status, mothers[0], mothers[1], 0, 0, 0, 0, px, py, pz, energy, mass);
297300
mPythia.moreDecays(); // we need to decay the new particle
301+
298302
return true;
299303
}
300304

301-
// id:all = name antiName spinType chargeType colType m0 mWidth mMin mMax tau0
302-
303305
private:
304306
// Interface to override import particles
305307
Pythia8::Event mOutputEvent;

MC/config/PWGHF/ini/tests/GeneratorHF_D2H_ccbar_and_bbbar_gap5_DResoTrigger.C

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
int External() {
2-
std::string path{"o2sim_Kine.root"};
2+
std::string path{"tf1/sgn_Kine.root"};
33

44
int checkPdgQuarkOne{4};
55
int checkPdgQuarkTwo{5};
66
float ratioTrigger = 1./5.; // one event triggered out of 5
7-
std::array<std::array<int, 2>, 6> pdgReplParticles = {{10433, 30433}, {10433, 437}, {435, 4325}, {435, 4326}, {425, 4315}, {425, 4316}};
8-
std::array<std::array<int, 2>, 6> pdgReplPartCounters = {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}};
9-
std::array<float, 4> freqRepl = {0.1, 0.1, 0.1, 0.1, 0.5, 0.5}; // one event triggered out of 5
7+
std::array<std::array<int, 2>, 6> pdgReplParticles = {std::array{10433, 30433}, std::array{10433, 437}, std::array{435, 4325}, std::array{435, 4326}, std::array{425, 4315}, std::array{425, 4316}};
8+
std::array<std::array<int, 2>, 6> pdgReplPartCounters = {std::array{0, 0}, std::array{0, 0}, std::array{0, 0}, std::array{0, 0}, std::array{0, 0}, std::array{0, 0}};
9+
std::array<float, 6> freqRepl = {0.1, 0.1, 0.1, 0.1, 0.5, 0.5};
1010

11-
std::vector<int> checkPdgHadron{10433, 30433, 435, 437, 4325, 4326, 4315, 4316};
11+
std::array<int, 11> checkPdgHadron{411, 421, 10433, 30433, 435, 437, 4325, 4326, 4315, 4316, 531};
1212
std::map<int, std::vector<std::vector<int>>> checkHadronDecays{ // sorted pdg of daughters
1313
{411, {{-321, 211, 211}, {-313, 211}, {211, 311}, {211, 333}}}, // D+
1414
{421, {{-321, 211}, {-321, 211, 111}}}, // D0
@@ -43,9 +43,10 @@ int External() {
4343
tree->GetEntry(i);
4444

4545
// check subgenerator information
46+
int subGeneratorId{-1};
4647
if (eventHeader->hasInfo(o2::mcgenid::GeneratorProperty::SUBGENERATORID)) {
4748
bool isValid = false;
48-
int subGeneratorId = eventHeader->getInfo<int>(o2::mcgenid::GeneratorProperty::SUBGENERATORID, isValid);
49+
subGeneratorId = eventHeader->getInfo<int>(o2::mcgenid::GeneratorProperty::SUBGENERATORID, isValid);
4950
if (subGeneratorId == 0) {
5051
nEventsMB++;
5152
} else if (subGeneratorId == checkPdgQuarkOne) {
@@ -66,11 +67,11 @@ int External() {
6667
nQuarksTwo++;
6768
continue;
6869
}
69-
if (std::find(checkPdgHadron.begin(), checkPdgHadron.end(), std::abs(pdg)) != checkPdgHadron.end()) { // found signal
70+
if (std::find(checkPdgHadron.begin(), checkPdgHadron.end(), absPdg) != checkPdgHadron.end()) { // found signal
7071
nSignals++; // count signal PDG
7172

7273
if (subGeneratorId == checkPdgQuarkOne) { // replacement only for prompt
73-
for (int iRepl{0}; iRepl<4; ++iRepl) {
74+
for (int iRepl{0}; iRepl<6; ++iRepl) {
7475
if (absPdg == pdgReplParticles[iRepl][0]) {
7576
pdgReplPartCounters[iRepl][0]++;
7677
} else if (absPdg == pdgReplParticles[iRepl][1]) {
@@ -142,7 +143,7 @@ int External() {
142143
return 1;
143144
}
144145

145-
for (int iRepl{0}; iRepl<4; ++iRepl) {
146+
for (int iRepl{0}; iRepl<6; ++iRepl) {
146147
if (std::abs(pdgReplPartCounters[iRepl][1] - freqRepl[iRepl] * pdgReplPartCounters[iRepl][0]) > 2 * std::sqrt(freqRepl[iRepl] * pdgReplPartCounters[iRepl][0])) { // 2 sigma compatibility
147148
std::cerr << "Fraction of replaced " << pdgReplParticles[iRepl][0] << " into " << pdgReplParticles[iRepl][1] << " is " << pdgReplPartCounters[iRepl][1] / pdgReplPartCounters[iRepl][0] <<" (expected "<< freqRepl[iRepl] << ")\n";
148149
return 1;

0 commit comments

Comments
 (0)