35int main(
int argc,
char** argv)
39 std::cerr <<
"Exactly one argument required containing the PDGs to look up.\n";
43 std::ifstream is{argv[1]};
45 std::cerr <<
"Cannot open " << argv[1] <<
"\n";
54 auto runConfiguration =
new TG4RunConfiguration(
"geomRoot", physicsSetup);
55 auto vmc =
new TGeant4(
"TGeant4",
"The Geant4 Monte Carlo", runConfiguration);
60 auto g4IonTable = G4ParticleTable::GetParticleTable()->GetIonTable();
66 std::vector<int> stillUnknown;
67 std::vector<int> checkedIons;
68 std::vector<int> addedIons;
71 while (std::getline(is, line)) {
77 auto pdg = std::stoi(line);
78 checkedIons.push_back(pdg);
81 auto pdgToLookFor = pdg / 10 * 10;
82 auto particle = g4IonTable->GetIon(pdgToLookFor);
84 stillUnknown.push_back(pdg);
87 if (pdgDB->GetParticle(pdg) || pdgDB->GetParticle(pdgToLookFor)) {
91 auto name = particle->GetParticleName();
93 pdgDB->AddParticle(
name.c_str(),
name.c_str(), particle->GetPDGMass() / TG4G3Units::Energy(), particle->GetPDGStable(), particle->GetPDGWidth() / TG4G3Units::Energy(), particle->GetPDGCharge() * 3,
"Ion", pdgToLookFor);
94 addedIons.push_back(pdgToLookFor);
103 std::cout <<
"Ran over " << checkedIons.size() <<
" different PDGs"
104 <<
"\nout of which " << addedIons.size() <<
" ground states were added."
105 <<
"\nStill unkown (probably originating from event generator) " << stillUnknown.size() <<
"\n";
106 for (
auto& it : stillUnknown) {
107 std::cout <<
" " << it <<
"\n";
110 std::string pdgTableOut{
"newPDGTable.dat"};
111 pdgDB->WritePDGTable(pdgTableOut.c_str());
112 std::cout <<
"New PDG table written to " << pdgTableOut <<
"\n";