17 #include <G4ParticleTable.hh>
18 #include "G4DecayTable.hh"
19 #include <G4PhaseSpaceDecayChannel.hh>
20 #include "G4ProcessManager.hh"
39 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
42 if(line.find(
"DECAY")<line.npos){
45 std::string tmpString;
46 std::stringstream lineStream(line);
47 lineStream>>tmpString>>pdgId>>
width;
49 G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgId);
50 G4ParticleDefinition *aAntiParticle = theParticleTable->FindAntiParticle(pdgId);
51 if(!aParticle)
continue;
52 aParticle->SetDecayTable(aDecayTable);
53 aParticle->SetPDGStable(
false);
54 aParticle->SetPDGLifeTime(1.0/(width*GeV)*6.582122e-22*MeV*
s);
55 if(aAntiParticle && aAntiParticle->GetPDGEncoding()!=
pdgId){
57 aAntiParticle->SetPDGStable(
false);
58 aParticle->SetPDGLifeTime(1.0/(width*GeV)*6.582122e-22*MeV*s);
68 if(pdgCode%100 <25 &&
abs(pdgCode) / 1000000 == 0){
69 edm::LogError(
"") <<
"Pdg code too low " << pdgCode <<
" "<<
abs(pdgCode) / 1000000 << std::endl;
75 G4String pType=
"custom";
77 G4double spectatormass;
78 G4ParticleDefinition* spectator;
85 double massGeV =mass*GeV;
86 double width = 0.0*MeV;
99 G4DecayTable *decaytable =
NULL;
100 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
103 parity, conjugation, isospin, isospinZ,
104 gParity, pType, lepton, baryon, pdgCode,
105 stable, lifetime, decaytable);
107 if(pType ==
"rhadron" && name!=
"~g"){
108 G4String cloudname = name+
"cloud";
109 G4String cloudtype = pType+
"cloud";
110 spectator = theParticleTable->FindParticle(1000021);
111 spectatormass = spectator->GetPDGMass();
112 G4double cloudmass = mass-spectatormass/GeV;
114 cloudname, cloudmass * GeV , 0.0*MeV, 0 ,
123 <<particle->
GetCloud()->GetParticleName()
124 <<
" and "<<particle->
GetSpectator()->GetParticleName()<<std::endl;
126 <<particle->GetPDGMass()/GeV<<
" Gev, "
127 <<particle->
GetCloud()->GetPDGMass()/GeV<<
" GeV and "
130 }
else if(pType ==
"mesonino" || pType ==
"sbaryon")
133 if(pdgCode < 0 ) sign=-1;
135 G4String cloudname = name+
"cloud";
136 G4String cloudtype = pType+
"cloud";
137 spectator = theParticleTable->FindParticle(1000006*sign);
138 spectatormass = spectator->GetPDGMass();
139 G4double cloudmass = mass-spectatormass/GeV;
141 cloudname, cloudmass * GeV , 0.0*MeV, 0 ,
150 <<particle->
GetCloud()->GetParticleName()
151 <<
" and "<<particle->
GetSpectator()->GetParticleName()<<std::endl;
153 <<particle->GetPDGMass()/GeV<<
" Gev, "
154 <<particle->
GetCloud()->GetPDGMass()/GeV<<
" GeV and "
172 while(getline(*configFile,line))
174 if(tmp.find(
"Blo")<tmp.npos)
break;
175 std::stringstream sstr(line);
176 sstr >>pdgId>>mass>>tmp>>
name;
180 int pdgIdPartner = pdgId%100;
181 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
182 G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgIdPartner);
185 int sign = aParticle->GetAntiPDGEncoding()/pdgIdPartner;
188 <<aParticle->GetAntiPDGEncoding()
189 <<
" b "<<pdgIdPartner
191 aParticle->DumpTable();
193 if(sign==-1 && pdgId!=25 && pdgId!=35 && pdgId!=36 && pdgId!=37 && pdgId!=1000039){
196 theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId);
198 else theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId);
201 if(pdgId==1000039) theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId);
202 if(pdgId==1000024 || pdgId==1000037 || pdgId==37) {
205 theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId);
221 std::vector<int> pdg(4);
223 std::vector<std::string>
name(4);
225 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
227 std::string parentName = theParticleTable->FindParticle(pdgId)->GetParticleName();
228 G4DecayTable *decaytable=
new G4DecayTable();
230 getline(*configFile,tmp);
232 while(!configFile->eof()){
235 (*configFile)>>br>>nDaughters;
236 for(
int i=0;i<nDaughters;i++) (*configFile)>>pdg[
i];
237 getline(*configFile,tmp);
238 for(
int i=0;
i<nDaughters;
i++){
239 if(!theParticleTable->FindParticle(pdg[
i])){
243 name[
i] = theParticleTable->FindParticle(pdg[i])->GetParticleName();
246 G4PhaseSpaceDecayChannel *aDecayChannel =
new G4PhaseSpaceDecayChannel(parentName, br, nDaughters,
247 name[0],name[1],name[2],name[3]);
248 decaytable->Insert(aDecayChannel);
253 configFile->get(text,2);
256 if(tmp.find(
"#")<tmp.npos)
break;
264 std::vector<std::string>
name(4);
265 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
267 std::string parentName = theParticleTable->FindParticle(-pdgId)->GetParticleName();
268 G4DecayTable *decaytable=
new G4DecayTable();
270 for(
int i=0;
i<theDecayTable->entries();
i++){
272 G4VDecayChannel *theDecayChannel = theDecayTable->GetDecayChannel(
i);
273 for(
int j=0;
j<theDecayChannel->GetNumberOfDaughters();
j++){
274 int id = theDecayChannel->GetDaughter(
j)->GetAntiPDGEncoding();
275 std::string nameTmp = theParticleTable->FindParticle(
id)->GetParticleName();
278 G4PhaseSpaceDecayChannel *aDecayChannel =
279 new G4PhaseSpaceDecayChannel(parentName,
280 theDecayChannel->GetBR(),
281 theDecayChannel->GetNumberOfDaughters(),
282 name[0],name[1],name[2],name[3]);
283 decaytable->Insert(aDecayChannel);
static std::set< G4ParticleDefinition * > m_particles
static double s_charge(int pdg)
static bool s_isSbaryon(int pdg)
void SetCloud(G4ParticleDefinition *theCloud)
G4ParticleDefinition * GetCloud()
static void loadCustomParticles(const std::string &filePath)
static bool s_isMesonino(int pdg)
static bool s_isSLepton(int pdg)
void SetSpectator(G4ParticleDefinition *theSpectator)
static double s_spin(int pdg)
G4ParticleDefinition * GetSpectator()
static void getMassTable(std::ifstream *configFile)
static G4DecayTable * getDecayTable(std::ifstream *configFile, int pdgId)
static void addCustomParticle(int pdgCode, double mass, const std::string &name)
static G4DecayTable * getAntiDecayTable(int pdgId, G4DecayTable *theDecayTable)
static bool s_isRHadron(int pdg)
std::vector< std::vector< double > > tmp
static bool isCustomParticle(G4ParticleDefinition *particle)
static bool s_isstopHadron(int pdg)