Skip to content

Commit b240550

Browse files
committed
fix bugs in forward test failing
1 parent 20d74ef commit b240550

6 files changed

Lines changed: 122 additions & 10 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Decay psi(2S)
2+
1.000 J/psi pi+ pi- VVPIPI;
3+
Enddecay
4+
5+
Decay J/psi
6+
1.000 mu+ mu- PHOTOS VLL;
7+
Enddecay
8+
9+
End

‎MC/config/PWGDQ/external/generator/GeneratorCocktailStarlight_PbPb5TeV.C‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ void configureEvtGen(o2::eventgen::GeneratorEvtGen<GeneratorCocktail>* generator
3333
TString pathO2 = gSystem->ExpandPathName("$O2DPG_MC_CONFIG_ROOT/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen");
3434
generator->SetDecayTable(Form("%s/PSITOJPSIPIPI.DEC", pathO2.Data()));
3535
} else {
36-
generator->SetSizePdg(1);
37-
generator->AddPdg(100443, 0);
38-
TString pathO2 = gSystem->ExpandPathName("$O2DPG_MC_CONFIG_ROOT/MC/config/PWGUD/external/generator/DecayTablesEvtGen");
39-
generator->SetDecayTable(Form("%s/PSI2S.MUMUPIPI.DEC", pathO2.Data()));
36+
// generator->SetSizePdg(1);
37+
// generator->AddPdg(100443, 0);
38+
generator->SetSizePdg(2);
39+
generator->AddPdg(443, 0);
40+
generator->AddPdg(100443, 1);
41+
TString pathO2 = gSystem->ExpandPathName("$O2DPG_MC_CONFIG_ROOT/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen");
42+
generator->SetDecayTable(Form("%s/PSITOJPSITOMU.DEC", pathO2.Data()));
43+
// TString pathO2 = gSystem->ExpandPathName("$O2DPG_MC_CONFIG_ROOT/MC/config/PWGUD/external/generator/DecayTablesEvtGen");
44+
// generator->SetDecayTable(Form("%s/PSI2S.MUMUPIPI.DEC", pathO2.Data()));
4045
}
4146
}
4247
} // namespace
@@ -89,7 +94,7 @@ FairGenerator* GeneratorCocktailStarlightCoherentFwdy_PbPb5TeV(float energyCM =
8994
{
9095
auto genCocktailEvtGen = new o2::eventgen::GeneratorEvtGen<GeneratorCocktail>();
9196
configureEvtGen(genCocktailEvtGen, false);
92-
auto genCohJpsi = makeStarlightGenerator("kCohJpsiToMu", energyCM, beam1Z, beam1A, beam2Z, beam2A, extrapars, dpmjetconf);
97+
auto genCohJpsi = makeStarlightGenerator("kCohJpsiToElRad", energyCM, beam1Z, beam1A, beam2Z, beam2A, extrapars, dpmjetconf);
9398
genCocktailEvtGen->AddGenerator(genCohJpsi, 1);
9499
auto genTwoGammaToMu = makeStarlightGenerator("kTwoGammaToMuLow", energyCM, beam1Z, beam1A, beam2Z, beam2A, extrapars, dpmjetconf);
95100
genCocktailEvtGen->AddGenerator(genTwoGammaToMu, 1);
@@ -103,7 +108,7 @@ FairGenerator* GeneratorCocktailStarlightIncoherentFwdy_PbPb5TeV(float energyCM
103108
{
104109
auto genCocktailEvtGen = new o2::eventgen::GeneratorEvtGen<GeneratorCocktail>();
105110
configureEvtGen(genCocktailEvtGen, false);
106-
auto genIncohJpsi = makeStarlightGenerator("kIncohJpsiToMu", energyCM, beam1Z, beam1A, beam2Z, beam2A, extrapars, dpmjetconf);
111+
auto genIncohJpsi = makeStarlightGenerator("kIncohJpsiToElRad", energyCM, beam1Z, beam1A, beam2Z, beam2A, extrapars, dpmjetconf);
107112
genCocktailEvtGen->AddGenerator(genIncohJpsi, 1);
108113
auto genIncohPsi2S = makeStarlightGenerator("kIncohPsi2sToMuPi", energyCM, beam1Z, beam1A, beam2Z, beam2A, extrapars, dpmjetconf);
109114
genCocktailEvtGen->AddGenerator(genIncohPsi2S, 1);

‎MC/config/PWGDQ/ini/tests/Generator_InjectedCoherentCharmoniaFwdy_PbPb5TeV.C‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ int External() {
3131
int nPhotonsFromJPsi{};
3232
int nSignalJpsiWithinAcc{};
3333
int nSignalPsi2SWithinAcc{};
34+
int nDaughtersWithWrongMother{};
3435

3536
auto nEvents = tree->GetEntries();
3637
for (int i = 0; i < nEvents; i++) {
3738
tree->GetEntry(i);
3839
for (auto& track : *tracks) {
40+
int trackId = static_cast<int>(&track - tracks->data());
3941
auto pdg = track.GetPdgCode();
4042
auto rapidity = track.GetRapidity();
4143
auto idMoth = track.getMotherTrackId();
@@ -70,7 +72,16 @@ int External() {
7072
}
7173

7274
for (int iDaugh = child0Id; iDaugh <= child1Id; iDaugh++) {
73-
auto daugh = tracks->at(iDaugh);
75+
const auto& daugh = tracks->at(iDaugh);
76+
if (daugh.getMotherTrackId() != trackId) {
77+
nDaughtersWithWrongMother++;
78+
std::cerr << "Daughter does not point back to charmonium:"
79+
<< " daughter=" << iDaugh
80+
<< " daughterPdg=" << daugh.GetPdgCode()
81+
<< " mother=" << daugh.getMotherTrackId()
82+
<< " expectedMother=" << trackId
83+
<< " expectedMotherPdg=" << pdg << '\n';
84+
}
7485
if (daugh.GetPdgCode() == 22) {
7586
if (pdg == checkPdgSignal[0]) {
7687
nPhotonsFromJPsi++;
@@ -109,7 +120,13 @@ int External() {
109120
<< "#signal (prompt Psi(2S)): " << nSignalPsi2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalPsi2SWithinAcc << "\n"
110121
<< "#photons from Jpsi: " << nPhotonsFromJPsi <<" #photons from Psi(2S): "<< nPhotonsFromPsi<<"\n"
111122
<< "#pions from Psi(2S): "<< nPions<<"\n"
123+
<< "#daughters with wrong mother: " << nDaughtersWithWrongMother << "\n"
112124
<< "#lepton pairs: " << nLeptonPairs <<" #lepton pairs to be done: "<< nLeptonPairsToBeDone<<"\n";
113125

126+
if (nDaughtersWithWrongMother != 0) {
127+
std::cerr << "Some charmonium daughters do not point back to their expected mother.\n";
128+
return 1;
129+
}
130+
114131
return 0;
115132
}

‎MC/config/PWGDQ/ini/tests/Generator_InjectedCoherentCharmoniaMidy_PbPb5TeV.C‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ int External() {
3131
int nPhotonsFromJPsi{};
3232
int nSignalJpsiWithinAcc{};
3333
int nSignalPsi2SWithinAcc{};
34+
int nDaughtersWithWrongMother{};
3435

3536
auto nEvents = tree->GetEntries();
3637
for (int i = 0; i < nEvents; i++) {
3738
tree->GetEntry(i);
3839
for (auto& track : *tracks) {
40+
int trackId = static_cast<int>(&track - tracks->data());
3941
auto pdg = track.GetPdgCode();
4042
auto rapidity = track.GetRapidity();
4143
auto idMoth = track.getMotherTrackId();
@@ -58,8 +60,27 @@ int External() {
5860
}
5961
int child0Id = track.getFirstDaughterTrackId();
6062
int child1Id = track.getLastDaughterTrackId();
63+
if (child0Id < 0 || child1Id < child0Id ||
64+
child1Id >= static_cast<int>(tracks->size())) {
65+
std::cout << "Skip charmonium without valid daughters:"
66+
<< " pdg=" << pdg
67+
<< " mother=" << idMoth
68+
<< " firstDaughter=" << child0Id
69+
<< " lastDaughter=" << child1Id
70+
<< " y=" << rapidity << '\n';
71+
continue;
72+
}
6173
for (int iDaugh = child0Id; iDaugh <= child1Id; iDaugh++) {
62-
auto daugh = tracks->at(iDaugh);
74+
const auto& daugh = tracks->at(iDaugh);
75+
if (daugh.getMotherTrackId() != trackId) {
76+
nDaughtersWithWrongMother++;
77+
std::cerr << "Daughter does not point back to charmonium:"
78+
<< " daughter=" << iDaugh
79+
<< " daughterPdg=" << daugh.GetPdgCode()
80+
<< " mother=" << daugh.getMotherTrackId()
81+
<< " expectedMother=" << trackId
82+
<< " expectedMotherPdg=" << pdg << '\n';
83+
}
6384
if (daugh.GetPdgCode() == 22) {
6485
if (pdg == checkPdgSignal[0]) {
6586
nPhotonsFromJPsi++;
@@ -98,7 +119,13 @@ int External() {
98119
<< "#signal (prompt Psi(2S)): " << nSignalPsi2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalPsi2SWithinAcc << "\n"
99120
<< "#photons from Jpsi: " << nPhotonsFromJPsi <<" #photons from Psi(2S): "<< nPhotonsFromPsi<<"\n"
100121
<< "#pions from Psi(2S): "<< nPions<<"\n"
122+
<< "#daughters with wrong mother: " << nDaughtersWithWrongMother << "\n"
101123
<< "#lepton pairs: " << nLeptonPairs <<" #lepton pairs to be done: "<< nLeptonPairsToBeDone<<"\n";
102124

125+
if (nDaughtersWithWrongMother != 0) {
126+
std::cerr << "Some charmonium daughters do not point back to their expected mother.\n";
127+
return 1;
128+
}
129+
103130
return 0;
104131
}

‎MC/config/PWGDQ/ini/tests/Generator_InjectedIncoherentCharmoniaFwdy_PbPb5TeV.C‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ int External() {
3131
int nPhotonsFromJPsi{};
3232
int nSignalJpsiWithinAcc{};
3333
int nSignalPsi2SWithinAcc{};
34+
int nDaughtersWithWrongMother{};
3435

3536
auto nEvents = tree->GetEntries();
3637
for (int i = 0; i < nEvents; i++) {
3738
tree->GetEntry(i);
3839
for (auto& track : *tracks) {
40+
int trackId = static_cast<int>(&track - tracks->data());
3941
auto pdg = track.GetPdgCode();
4042
auto rapidity = track.GetRapidity();
4143
auto idMoth = track.getMotherTrackId();
@@ -58,8 +60,27 @@ int External() {
5860
}
5961
int child0Id = track.getFirstDaughterTrackId();
6062
int child1Id = track.getLastDaughterTrackId();
63+
if (child0Id < 0 || child1Id < child0Id ||
64+
child1Id >= static_cast<int>(tracks->size())) {
65+
std::cout << "Skip charmonium without valid daughters:"
66+
<< " pdg=" << pdg
67+
<< " mother=" << idMoth
68+
<< " firstDaughter=" << child0Id
69+
<< " lastDaughter=" << child1Id
70+
<< " y=" << rapidity << '\n';
71+
continue;
72+
}
6173
for (int iDaugh = child0Id; iDaugh <= child1Id; iDaugh++) {
62-
auto daugh = tracks->at(iDaugh);
74+
const auto& daugh = tracks->at(iDaugh);
75+
if (daugh.getMotherTrackId() != trackId) {
76+
nDaughtersWithWrongMother++;
77+
std::cerr << "Daughter does not point back to charmonium:"
78+
<< " daughter=" << iDaugh
79+
<< " daughterPdg=" << daugh.GetPdgCode()
80+
<< " mother=" << daugh.getMotherTrackId()
81+
<< " expectedMother=" << trackId
82+
<< " expectedMotherPdg=" << pdg << '\n';
83+
}
6384
if (daugh.GetPdgCode() == 22) {
6485
if (pdg == checkPdgSignal[0]) {
6586
nPhotonsFromJPsi++;
@@ -98,7 +119,13 @@ int External() {
98119
<< "#signal (prompt Psi(2S)): " << nSignalPsi2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalPsi2SWithinAcc << "\n"
99120
<< "#photons from Jpsi: " << nPhotonsFromJPsi <<" #photons from Psi(2S): "<< nPhotonsFromPsi<<"\n"
100121
<< "#pions from Psi(2S): "<< nPions<<"\n"
122+
<< "#daughters with wrong mother: " << nDaughtersWithWrongMother << "\n"
101123
<< "#lepton pairs: " << nLeptonPairs <<" #lepton pairs to be done: "<< nLeptonPairsToBeDone<<"\n";
102124

125+
if (nDaughtersWithWrongMother != 0) {
126+
std::cerr << "Some charmonium daughters do not point back to their expected mother.\n";
127+
return 1;
128+
}
129+
103130
return 0;
104131
}

‎MC/config/PWGDQ/ini/tests/Generator_InjectedIncoherentCharmoniaMidy_PbPb5TeV.C‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ int External() {
3131
int nPhotonsFromJPsi{};
3232
int nSignalJpsiWithinAcc{};
3333
int nSignalPsi2SWithinAcc{};
34+
int nDaughtersWithWrongMother{};
3435

3536
auto nEvents = tree->GetEntries();
3637
for (int i = 0; i < nEvents; i++) {
3738
tree->GetEntry(i);
3839
for (auto& track : *tracks) {
40+
int trackId = static_cast<int>(&track - tracks->data());
3941
auto pdg = track.GetPdgCode();
4042
auto rapidity = track.GetRapidity();
4143
auto idMoth = track.getMotherTrackId();
@@ -58,8 +60,27 @@ int External() {
5860
}
5961
int child0Id = track.getFirstDaughterTrackId();
6062
int child1Id = track.getLastDaughterTrackId();
63+
if (child0Id < 0 || child1Id < child0Id ||
64+
child1Id >= static_cast<int>(tracks->size())) {
65+
std::cout << "Skip charmonium without valid daughters:"
66+
<< " pdg=" << pdg
67+
<< " mother=" << idMoth
68+
<< " firstDaughter=" << child0Id
69+
<< " lastDaughter=" << child1Id
70+
<< " y=" << rapidity << '\n';
71+
continue;
72+
}
6173
for (int iDaugh = child0Id; iDaugh <= child1Id; iDaugh++) {
62-
auto daugh = tracks->at(iDaugh);
74+
const auto& daugh = tracks->at(iDaugh);
75+
if (daugh.getMotherTrackId() != trackId) {
76+
nDaughtersWithWrongMother++;
77+
std::cerr << "Daughter does not point back to charmonium:"
78+
<< " daughter=" << iDaugh
79+
<< " daughterPdg=" << daugh.GetPdgCode()
80+
<< " mother=" << daugh.getMotherTrackId()
81+
<< " expectedMother=" << trackId
82+
<< " expectedMotherPdg=" << pdg << '\n';
83+
}
6384
if (daugh.GetPdgCode() == 22) {
6485
if (pdg == checkPdgSignal[0]) {
6586
nPhotonsFromJPsi++;
@@ -98,7 +119,13 @@ int External() {
98119
<< "#signal (prompt Psi(2S)): " << nSignalPsi2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalPsi2SWithinAcc << "\n"
99120
<< "#photons from Jpsi: " << nPhotonsFromJPsi <<" #photons from Psi(2S): "<< nPhotonsFromPsi<<"\n"
100121
<< "#pions from Psi(2S): "<< nPions<<"\n"
122+
<< "#daughters with wrong mother: " << nDaughtersWithWrongMother << "\n"
101123
<< "#lepton pairs: " << nLeptonPairs <<" #lepton pairs to be done: "<< nLeptonPairsToBeDone<<"\n";
102124

125+
if (nDaughtersWithWrongMother != 0) {
126+
std::cerr << "Some charmonium daughters do not point back to their expected mother.\n";
127+
return 1;
128+
}
129+
103130
return 0;
104131
}

0 commit comments

Comments
 (0)