Skip to content

Commit

Permalink
update for generating a cocktail of X3872 + Psi2S to Jpsi pi pi (#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffionda authored Dec 27, 2024
1 parent c23cfd2 commit 198ebde
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Decay X_1(3872)
#### Breit-Wigner function for the pion distribution (S-Wave approximation)
1.000 J/psi pi+ pi- XJPSIRHO0PIPI_S;
Enddecay

Decay psi(2S)
1.000 J/psi pi+ pi- VVPIPI;
Enddecay

Decay J/psi
### from DECAY.DEC
1.000 e+ e- PHOTOS VLL;
Enddecay

End
25 changes: 25 additions & 0 deletions MC/config/PWGDQ/external/generator/GeneratorPromptCharmonia.C
Original file line number Diff line number Diff line change
Expand Up @@ -962,5 +962,30 @@ FairGenerator*
}


FairGenerator* GeneratorCocktailX3872AndPsi2StoJpsi_pp13TeV()
{
auto genCocktailEvtGen = new o2::eventgen::GeneratorEvtGen<GeneratorCocktail>();

auto genX3872 = new o2::eventgen::O2_GeneratorParamX3872MidY;
genX3872->SetNSignalPerEvent(1); // number of jpsis per event
auto genPsi2S = new o2::eventgen::O2_GeneratorParamPsiMidY;
genPsi2S->SetNSignalPerEvent(1); // number of jpsis per event
genCocktailEvtGen->AddGenerator(genX3872, 1); // add J/psi generator
genCocktailEvtGen->AddGenerator(genPsi2S, 1); // add Psi(2S) generator

TString pdgs = "9920443;100443";
std::string spdg;
TObjArray* obj = pdgs.Tokenize(";");
genCocktailEvtGen->SetSizePdg(obj->GetEntriesFast());
for (int i = 0; i < obj->GetEntriesFast(); i++) {
spdg = obj->At(i)->GetName();
genCocktailEvtGen->AddPdg(std::stoi(spdg), i);
printf("PDG %d \n", std::stoi(spdg));
}
TString pathO2 = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen");
genCocktailEvtGen->SetDecayTable(Form("%s/X3872ANDPSI2STOJPSIPIPI.DEC", pathO2.Data()));

return genCocktailEvtGen;
}


Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public:
case 9: // generate prompt psi2S to Jpsi pi pi at midrapidity
mGeneratorParam = (Generator*)GeneratorParamPromptPsiToJpsiPiPiEvtGen_pp13TeV("100443");
break;
case 10: // generate cocktail of prompt X_1(3872) and psi2S to Jpsi pi pi at midrapidity
mGeneratorParam = (Generator*)GeneratorCocktailX3872AndPsi2StoJpsi_pp13TeV();
break;
}
mGeneratorParam->Init();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### The external generator derives from GeneratorPythia8.
[GeneratorExternal]
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_withInjectedPromptSignals_gaptriggered_dq.C
funcName=GeneratorPythia8InjectedPromptCharmoniaGapTriggered(5,10)
[GeneratorPythia8]
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_inel_triggerGap.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
int External()
{
int checkPdgSignal[] = {9920443,100443}; // pdg code X3872
TString PdgSignalName[] = {"X(3872)", "Psi2S"};
int checkPdgDecay[] = {443, 211, -211};
int leptonPdg = 11;
Double_t rapidityWindow = 1.0;
std::string path{"o2sim_Kine.root"};
for(int iSig =0; iSig < 2; iSig++) std::cout << "Check for\nsignal PDG " << checkPdgSignal[iSig] << "\n decay PDG " << checkPdgDecay[0] << ", " << checkPdgDecay[1] << ", " << checkPdgDecay[2] << "\n";
TFile file(path.c_str(), "READ");
if (file.IsZombie()) {
std::cerr << "Cannot open ROOT file " << path << "\n";
return 1;
}
auto tree = (TTree*)file.Get("o2sim");
std::vector<o2::MCTrack>* tracks{};
tree->SetBranchAddress("MCTrack", &tracks);

int nLeptons[]={0,0};
int nAntileptons[]={0,0};
int nLeptonPairs[]={0,0};
int nLeptonPairsToBeDone[]={0,0};
int nSignalX3872[]={0,0};
int nSignalPionsPos[]={0,0};
int nSignalPionsNeg[]={0,0};
int nSignalPsi2S{};
int nSignalX3872WithinAcc[]={0,0};
int nSignalPionsPosWithinAcc[]={0,0};
int nSignalPionsNegWithinAcc[]={0,0};
auto nEvents = tree->GetEntries();
o2::steer::MCKinematicsReader mcreader("o2sim", o2::steer::MCKinematicsReader::Mode::kMCKine);
Bool_t hasPsi2SMoth = kFALSE;

for (int i = 0; i < nEvents; i++) {
tree->GetEntry(i);
for (auto& track : *tracks) {
auto pdg = track.GetPdgCode();
auto rapidity = track.GetRapidity();
auto idMoth = track.getMotherTrackId();
int idX3872 = -1; int IdChild0 = -1; int IdChild1 = -1;
for(int iSig=0; iSig<2; iSig++) {
if (pdg == leptonPdg) {
// count leptons
nLeptons[iSig]++;
} else if(pdg == -leptonPdg) {
// count anti-leptons
nAntileptons[iSig]++;
} else if (pdg == checkPdgSignal[iSig]) {
// check daughters
std::cout << "Signal PDG: " << pdg << "\n";
for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) {
auto pdgDau = tracks->at(j).GetPdgCode();
std::cout << "Daughter " << j << " is: " << pdgDau << "\n";
if(TMath::Abs(pdgDau) == checkPdgDecay[0] ) { nSignalX3872[iSig]++; if( std::abs(track.GetRapidity()) < rapidityWindow) nSignalX3872WithinAcc[iSig]++; idX3872 = j; }
if(pdgDau == checkPdgDecay[1] ) { nSignalPionsPos[iSig]++; if( std::abs(track.GetRapidity()) < rapidityWindow) nSignalPionsPosWithinAcc[iSig]++; }
if(pdgDau == checkPdgDecay[2] ) { nSignalPionsNeg[iSig]++; if( std::abs(track.GetRapidity()) < rapidityWindow) nSignalPionsNegWithinAcc[iSig]++; }
}

auto trackX3872 = tracks->at(idX3872);
for (int j{trackX3872.getFirstDaughterTrackId()}; j <= trackX3872.getLastDaughterTrackId(); ++j) {
auto pdgDau = tracks->at(j).GetPdgCode();
if(pdgDau == leptonPdg ) IdChild0 = j;
if(pdgDau == -leptonPdg ) IdChild1 = j;
}
auto child0 = tracks->at(IdChild0);
auto child1 = tracks->at(IdChild1);
// check for parent-child relations
auto pdg0 = child0.GetPdgCode();
auto pdg1 = child1.GetPdgCode();
std::cout << "Lepton daughter particles of mother " << trackX3872.GetPdgCode() << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n";
if (std::abs(pdg0) == leptonPdg && std::abs(pdg1) == leptonPdg && pdg0 == -pdg1) {
nLeptonPairs[iSig]++;
if (child0.getToBeDone() && child1.getToBeDone()) {
nLeptonPairsToBeDone[iSig]++;
}
}
}
}
}
}

std::cout << "#events: " << nEvents << "\n";
for(int iSig=0; iSig < 2; iSig++){
std::cout << "#leptons from " << PdgSignalName[iSig] << ": " << nLeptons[iSig] << "\n"
<< "#antileptons from " << PdgSignalName[iSig] << ": " << nAntileptons[iSig] << "\n"
<< "#signal (jpsi <-" << PdgSignalName[iSig] <<"): " << nSignalX3872[iSig] << "; within acceptance (|y| < " << rapidityWindow << "): " << nSignalX3872WithinAcc[iSig] << "\n"
<< "#signal (pi+ <-" << PdgSignalName[iSig] <<"): " << nSignalPionsPos[iSig] << "; within acceptance (|y| < " << rapidityWindow << "): " << nSignalPionsPosWithinAcc[iSig] << "\n"
<< "#signal (pi- <-" << PdgSignalName[iSig] <<"): " << nSignalPionsNeg[iSig] << "; within acceptance (|y| < " << rapidityWindow << "): " << nSignalPionsNegWithinAcc[iSig] << "\n"
<< "#lepton pairs from " << PdgSignalName[iSig] <<": " << nLeptonPairs[iSig] << "\n"
<< "#lepton pairs to be done from " << PdgSignalName[iSig] <<": " << nLeptonPairs[iSig] << "\n";


if (nLeptonPairs[iSig] == 0 || nLeptons[iSig] == 0 || nAntileptons[iSig] == 0) {
std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n";
return 1;
}
if (nLeptonPairs[iSig] != nLeptonPairsToBeDone[iSig]) {
std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n";
return 1;
}

}
return 0;
}

0 comments on commit 198ebde

Please sign in to comment.