Skip to content

Commit dfbf544

Browse files
author
Maurice Coquet
committed
Adding mid-y and test files
1 parent abd7517 commit dfbf544

6 files changed

+400
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### The setup uses an external event generator
2+
### This part sets the path of the file and the function call to retrieve it
3+
4+
[GeneratorExternal]
5+
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_NonPromptSignals_OO_gaptriggered_dq.C
6+
funcName = GeneratorBeautyToPsiAndJpsi_EvtGenMidY_OO()
7+
8+
### The external generator derives from GeneratorPythia8.
9+
### This part configures the bits of the interface: configuration and user hooks
10+
11+
[GeneratorPythia8]
12+
config = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_hf_OO_536.cfg
13+
hooksFileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14+
hooksFuncName = pythia8_userhooks_bbbar(-1.5,1.5)
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### The setup uses an external event generator
2+
### This part sets the path of the file and the function call to retrieve it
3+
4+
[GeneratorExternal]
5+
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_NonPromptSignals_pO_gaptriggered_dq.C
6+
funcName = GeneratorBeautyToPsiAndJpsi_EvtGenMidY_pO()
7+
8+
### The external generator derives from GeneratorPythia8.
9+
### This part configures the bits of the interface: configuration and user hooks
10+
11+
[GeneratorPythia8]
12+
config = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_hf_pO_961.cfg
13+
hooksFileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14+
hooksFuncName = pythia8_userhooks_bbbar(-1.5,1.5)
15+
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
int External()
2+
{
3+
int checkPdgSignal[] = {443,100443};
4+
int checkPdgDecay = 13;
5+
double rapiditymin = -4.3; double rapiditymax = -2.3;
6+
std::string path{"o2sim_Kine.root"};
7+
std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n";
8+
TFile file(path.c_str(), "READ");
9+
if (file.IsZombie()) {
10+
std::cerr << "Cannot open ROOT file " << path << "\n";
11+
return 1;
12+
}
13+
14+
auto tree = (TTree*)file.Get("o2sim");
15+
std::vector<o2::MCTrack>* tracks{};
16+
tree->SetBranchAddress("MCTrack", &tracks);
17+
18+
int nLeptons{};
19+
int nAntileptons{};
20+
int nLeptonPairs{};
21+
int nLeptonPairsToBeDone{};
22+
int nSignalJpsi{};
23+
int nSignalPsi2S{};
24+
int nSignalJpsiWithinAcc{};
25+
int nSignalPsi2SWithinAcc{};
26+
auto nEvents = tree->GetEntries();
27+
o2::steer::MCKinematicsReader mcreader("o2sim", o2::steer::MCKinematicsReader::Mode::kMCKine);
28+
Int_t bpdgs[] = {511, 521, 531, 5112, 5122, 5232, 5132};
29+
Int_t sizePdg = sizeof(bpdgs)/sizeof(Int_t);
30+
Bool_t hasBeautyMoth = kFALSE;
31+
32+
for (int i = 0; i < nEvents; i++) {
33+
tree->GetEntry(i);
34+
for (auto& track : *tracks) {
35+
auto pdg = track.GetPdgCode();
36+
auto rapidity = track.GetRapidity();
37+
auto idMoth = track.getMotherTrackId();
38+
if (pdg == checkPdgDecay) {
39+
// count leptons
40+
nLeptons++;
41+
} else if(pdg == -checkPdgDecay) {
42+
// count anti-leptons
43+
nAntileptons++;
44+
} else if (pdg == checkPdgSignal[0] || pdg == checkPdgSignal[1]) {
45+
// check if mothers are beauty hadrons
46+
hasBeautyMoth = kFALSE;
47+
if(idMoth){ // check beauty mother
48+
auto tdM = mcreader.getTrack(i, idMoth);
49+
for(int i=0; i<sizePdg; i++){ if (TMath::Abs(tdM->GetPdgCode()) == bpdgs[i] ) hasBeautyMoth = kTRUE; }
50+
}
51+
if(hasBeautyMoth){
52+
// count signal PDG
53+
pdg == checkPdgSignal[0] ? nSignalJpsi++ : nSignalPsi2S++;
54+
// count signal PDG within acceptance
55+
if(rapidity > rapiditymin && rapidity < rapiditymax) { pdg == checkPdgSignal[0] ? nSignalJpsiWithinAcc++ : nSignalPsi2SWithinAcc++;}
56+
}
57+
auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks);
58+
auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks);
59+
if (child0 != nullptr && child1 != nullptr) {
60+
// check for parent-child relations
61+
auto pdg0 = child0->GetPdgCode();
62+
auto pdg1 = child1->GetPdgCode();
63+
std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n";
64+
if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) {
65+
nLeptonPairs++;
66+
if (child0->getToBeDone() && child1->getToBeDone()) {
67+
nLeptonPairsToBeDone++;
68+
}
69+
}
70+
}
71+
}
72+
}
73+
}
74+
std::cout << "#events: " << nEvents << "\n"
75+
<< "#leptons: " << nLeptons << "\n"
76+
<< "#antileptons: " << nAntileptons << "\n"
77+
<< "#signal (jpsi <- b): " << nSignalJpsi << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalJpsiWithinAcc << "\n"
78+
<< "#signal (psi2S <- b): " << nSignalPsi2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalPsi2SWithinAcc << "\n"
79+
<< "#lepton pairs: " << nLeptonPairs << "\n"
80+
<< "#lepton pairs to be done: " << nLeptonPairs << "\n";
81+
82+
83+
if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) {
84+
std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n";
85+
return 1;
86+
}
87+
if (nLeptonPairs != nLeptonPairsToBeDone) {
88+
std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n";
89+
return 1;
90+
}
91+
92+
return 0;
93+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
int External()
2+
{
3+
int checkPdgSignal[] = {443,100443};
4+
int checkPdgDecay = 13;
5+
double rapiditymin = -4.3; double rapiditymax = -2.3;
6+
std::string path{"o2sim_Kine.root"};
7+
std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n";
8+
TFile file(path.c_str(), "READ");
9+
if (file.IsZombie()) {
10+
std::cerr << "Cannot open ROOT file " << path << "\n";
11+
return 1;
12+
}
13+
14+
auto tree = (TTree*)file.Get("o2sim");
15+
std::vector<o2::MCTrack>* tracks{};
16+
tree->SetBranchAddress("MCTrack", &tracks);
17+
18+
int nLeptons{};
19+
int nAntileptons{};
20+
int nLeptonPairs{};
21+
int nLeptonPairsToBeDone{};
22+
int nSignalJpsi{};
23+
int nSignalPsi2S{};
24+
int nSignalJpsiWithinAcc{};
25+
int nSignalPsi2SWithinAcc{};
26+
auto nEvents = tree->GetEntries();
27+
o2::steer::MCKinematicsReader mcreader("o2sim", o2::steer::MCKinematicsReader::Mode::kMCKine);
28+
Int_t bpdgs[] = {511, 521, 531, 5112, 5122, 5232, 5132};
29+
Int_t sizePdg = sizeof(bpdgs)/sizeof(Int_t);
30+
Bool_t hasBeautyMoth = kFALSE;
31+
32+
for (int i = 0; i < nEvents; i++) {
33+
tree->GetEntry(i);
34+
for (auto& track : *tracks) {
35+
auto pdg = track.GetPdgCode();
36+
auto rapidity = track.GetRapidity();
37+
auto idMoth = track.getMotherTrackId();
38+
if (pdg == checkPdgDecay) {
39+
// count leptons
40+
nLeptons++;
41+
} else if(pdg == -checkPdgDecay) {
42+
// count anti-leptons
43+
nAntileptons++;
44+
} else if (pdg == checkPdgSignal[0] || pdg == checkPdgSignal[1]) {
45+
// check if mothers are beauty hadrons
46+
hasBeautyMoth = kFALSE;
47+
if(idMoth){ // check beauty mother
48+
auto tdM = mcreader.getTrack(i, idMoth);
49+
for(int i=0; i<sizePdg; i++){ if (TMath::Abs(tdM->GetPdgCode()) == bpdgs[i] ) hasBeautyMoth = kTRUE; }
50+
}
51+
if(hasBeautyMoth){
52+
// count signal PDG
53+
pdg == checkPdgSignal[0] ? nSignalJpsi++ : nSignalPsi2S++;
54+
// count signal PDG within acceptance
55+
if(rapidity > rapiditymin && rapidity < rapiditymax) { pdg == checkPdgSignal[0] ? nSignalJpsiWithinAcc++ : nSignalPsi2SWithinAcc++;}
56+
}
57+
auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks);
58+
auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks);
59+
if (child0 != nullptr && child1 != nullptr) {
60+
// check for parent-child relations
61+
auto pdg0 = child0->GetPdgCode();
62+
auto pdg1 = child1->GetPdgCode();
63+
std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n";
64+
if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) {
65+
nLeptonPairs++;
66+
if (child0->getToBeDone() && child1->getToBeDone()) {
67+
nLeptonPairsToBeDone++;
68+
}
69+
}
70+
}
71+
}
72+
}
73+
}
74+
std::cout << "#events: " << nEvents << "\n"
75+
<< "#leptons: " << nLeptons << "\n"
76+
<< "#antileptons: " << nAntileptons << "\n"
77+
<< "#signal (jpsi <- b): " << nSignalJpsi << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalJpsiWithinAcc << "\n"
78+
<< "#signal (psi2S <- b): " << nSignalPsi2S << "; within acceptance " << rapiditymin << " < y < " << rapiditymax << " : " << nSignalPsi2SWithinAcc << "\n"
79+
<< "#lepton pairs: " << nLeptonPairs << "\n"
80+
<< "#lepton pairs to be done: " << nLeptonPairs << "\n";
81+
82+
83+
if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) {
84+
std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n";
85+
return 1;
86+
}
87+
if (nLeptonPairs != nLeptonPairsToBeDone) {
88+
std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n";
89+
return 1;
90+
}
91+
92+
return 0;
93+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
int External()
2+
{
3+
int checkPdgSignal[] = {443,100443};
4+
int checkPdgDecay = 11;
5+
std::string path{"o2sim_Kine.root"};
6+
std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n";
7+
TFile file(path.c_str(), "READ");
8+
if (file.IsZombie()) {
9+
std::cerr << "Cannot open ROOT file " << path << "\n";
10+
return 1;
11+
}
12+
13+
auto tree = (TTree*)file.Get("o2sim");
14+
std::vector<o2::MCTrack>* tracks{};
15+
tree->SetBranchAddress("MCTrack", &tracks);
16+
17+
int nLeptons{};
18+
int nAntileptons{};
19+
int nLeptonPairs{};
20+
int nLeptonPairsToBeDone{};
21+
int nSignalJpsi{};
22+
int nSignalPsi2S{};
23+
int nSignalJpsiWithinAcc{};
24+
int nSignalPsi2SWithinAcc{};
25+
auto nEvents = tree->GetEntries();
26+
o2::steer::MCKinematicsReader mcreader("o2sim", o2::steer::MCKinematicsReader::Mode::kMCKine);
27+
Int_t bpdgs[] = {511, 521, 531, 5112, 5122, 5232, 5132};
28+
Int_t sizePdg = sizeof(bpdgs)/sizeof(Int_t);
29+
Bool_t hasBeautyMoth = kFALSE;
30+
31+
for (int i = 0; i < nEvents; i++) {
32+
tree->GetEntry(i);
33+
for (auto& track : *tracks) {
34+
auto pdg = track.GetPdgCode();
35+
auto rapidity = track.GetRapidity();
36+
auto idMoth = track.getMotherTrackId();
37+
if (pdg == checkPdgDecay) {
38+
// count leptons
39+
nLeptons++;
40+
} else if(pdg == -checkPdgDecay) {
41+
// count anti-leptons
42+
nAntileptons++;
43+
} else if (pdg == checkPdgSignal[0] || pdg == checkPdgSignal[1]) {
44+
// check if mothers are beauty hadrons
45+
hasBeautyMoth = kFALSE;
46+
if(idMoth){ // check beauty mother
47+
auto tdM = mcreader.getTrack(i, idMoth);
48+
for(int i=0; i<sizePdg; i++){ if (TMath::Abs(tdM->GetPdgCode()) == bpdgs[i] ) hasBeautyMoth = kTRUE; }
49+
}
50+
if(hasBeautyMoth){
51+
// count signal PDG
52+
pdg == checkPdgSignal[0] ? nSignalJpsi++ : nSignalPsi2S++;
53+
// count signal PDG within acceptance
54+
if(std::abs(rapidity) < 1.0) { pdg == checkPdgSignal[0] ? nSignalJpsiWithinAcc++ : nSignalPsi2SWithinAcc++;}
55+
}
56+
auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks);
57+
auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks);
58+
if (child0 != nullptr && child1 != nullptr) {
59+
// check for parent-child relations
60+
auto pdg0 = child0->GetPdgCode();
61+
auto pdg1 = child1->GetPdgCode();
62+
std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n";
63+
if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) {
64+
nLeptonPairs++;
65+
if (child0->getToBeDone() && child1->getToBeDone()) {
66+
nLeptonPairsToBeDone++;
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
73+
std::cout << "#events: " << nEvents << "\n"
74+
<< "#leptons: " << nLeptons << "\n"
75+
<< "#antileptons: " << nAntileptons << "\n"
76+
<< "#signal (jpsi <- b): " << nSignalJpsi << "; within acceptance (|y| < 1): " << nSignalJpsiWithinAcc << "\n"
77+
<< "#signal (psi2S <- b): " << nSignalPsi2S << "; within acceptance (|y| < 1): " << nSignalPsi2SWithinAcc << "\n"
78+
<< "#lepton pairs: " << nLeptonPairs << "\n"
79+
<< "#lepton pairs to be done: " << nLeptonPairs << "\n";
80+
81+
82+
if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) {
83+
std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n";
84+
return 1;
85+
}
86+
if (nLeptonPairs != nLeptonPairsToBeDone) {
87+
std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n";
88+
return 1;
89+
}
90+
91+
return 0;
92+
}

0 commit comments

Comments
 (0)