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.582122
e-22*MeV*
s);
55 if(aAntiParticle && aAntiParticle->GetPDGEncoding()!=
pdgId){
57 aAntiParticle->SetPDGStable(
false);
58 aParticle->SetPDGLifeTime(1.0/(width*GeV)*6.582122
e-22*MeV*s);
68 if(
abs(pdgCode)%100 <14 &&
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;
88 if (name.compare(0,4,
"~HIP") == 0)
91 if ((name.compare(0,7,
"~HIPbar") == 0)) {std::string str = name.substr (7); charge=eplus*atoi(str.c_str())/3.;}
92 else {std::string str = name.substr (4); charge=eplus*atoi(str.c_str())*-1./3.; }
94 if (name.compare(0,9,
"anti_~HIP") == 0)
97 if ((name.compare(0,12,
"anti_~HIPbar") == 0)) {std::string str = name.substr (12); charge=eplus*atoi(str.c_str())*-1./3.;}
98 else {std::string str = name.substr (9); charge=eplus*atoi(str.c_str())*1./3.; }
109 double lifetime = -1;
111 G4DecayTable *decaytable =
NULL;
112 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
115 parity, conjugation, isospin, isospinZ,
116 gParity, pType, lepton, baryon, pdgCode,
117 stable, lifetime, decaytable);
119 if(pType ==
"rhadron" && name!=
"~g"){
120 G4String cloudname = name+
"cloud";
121 G4String cloudtype = pType+
"cloud";
122 spectator = theParticleTable->FindParticle(1000021);
123 spectatormass = spectator->GetPDGMass();
124 G4double cloudmass = mass-spectatormass/GeV;
126 cloudname, cloudmass * GeV , 0.0*MeV, 0 ,
135 <<particle->
GetCloud()->GetParticleName()
136 <<
" and "<<particle->
GetSpectator()->GetParticleName()<<std::endl;
138 <<particle->GetPDGMass()/GeV<<
" Gev, "
139 <<particle->
GetCloud()->GetPDGMass()/GeV<<
" GeV and "
142 }
else if(pType ==
"mesonino" || pType ==
"sbaryon")
145 if(pdgCode < 0 ) sign=-1;
147 G4String cloudname = name+
"cloud";
148 G4String cloudtype = pType+
"cloud";
151 spectator = theParticleTable->FindParticle(1000006*sign);
156 spectator = theParticleTable->FindParticle(1000005*sign);
161 edm::LogError(
"CustomPhysics")<<
" Cannot find spectator parton";
164 spectatormass = spectator->GetPDGMass();
165 G4double cloudmass = mass-spectatormass/GeV;
167 cloudname, cloudmass * GeV , 0.0*MeV, 0 ,
176 <<particle->
GetCloud()->GetParticleName()
177 <<
" and "<<particle->
GetSpectator()->GetParticleName()<<std::endl;
179 <<particle->GetPDGMass()/GeV<<
" Gev, "
180 <<particle->
GetCloud()->GetPDGMass()/GeV<<
" GeV and "
198 while(getline(*configFile,line))
200 if(tmp.find(
"Blo")<tmp.npos)
break;
201 std::stringstream sstr(line);
202 sstr >>pdgId>>mass>>tmp>>
name;
206 int pdgIdPartner = pdgId%100;
207 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
208 G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgIdPartner);
211 int sign = aParticle->GetAntiPDGEncoding()/pdgIdPartner;
214 <<aParticle->GetAntiPDGEncoding()
215 <<
" b "<<pdgIdPartner
217 aParticle->DumpTable();
219 if(sign==-1 && pdgId!=25 && pdgId!=35 && pdgId!=36 && pdgId!=37 && pdgId!=1000039){
222 theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId);
224 else theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId);
227 if(pdgId==1000039) theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId);
228 if(pdgId==1000024 || pdgId==1000037 || pdgId==37) {
231 theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId);
247 std::vector<int> pdg(4);
249 std::vector<std::string>
name(4);
251 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
253 std::string parentName = theParticleTable->FindParticle(pdgId)->GetParticleName();
254 G4DecayTable *decaytable=
new G4DecayTable();
256 getline(*configFile,tmp);
258 while(!configFile->eof()){
261 (*configFile)>>br>>nDaughters;
262 for(
int i=0;i<nDaughters;i++) (*configFile)>>pdg[
i];
263 getline(*configFile,tmp);
264 for(
int i=0;
i<nDaughters;
i++){
265 if(!theParticleTable->FindParticle(pdg[
i])){
269 name[
i] = theParticleTable->FindParticle(pdg[i])->GetParticleName();
272 G4PhaseSpaceDecayChannel *aDecayChannel =
new G4PhaseSpaceDecayChannel(parentName, br, nDaughters,
273 name[0],name[1],name[2],name[3]);
274 decaytable->Insert(aDecayChannel);
279 configFile->get(text,2);
282 if(tmp.find(
"#")<tmp.npos)
break;
290 std::vector<std::string>
name(4);
291 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
293 std::string parentName = theParticleTable->FindParticle(-pdgId)->GetParticleName();
294 G4DecayTable *decaytable=
new G4DecayTable();
296 for(
int i=0;
i<theDecayTable->entries();
i++){
298 G4VDecayChannel *theDecayChannel = theDecayTable->GetDecayChannel(
i);
299 for(
int j=0;
j<theDecayChannel->GetNumberOfDaughters();
j++){
300 int id = theDecayChannel->GetDaughter(
j)->GetAntiPDGEncoding();
301 std::string nameTmp = theParticleTable->FindParticle(
id)->GetParticleName();
304 G4PhaseSpaceDecayChannel *aDecayChannel =
305 new G4PhaseSpaceDecayChannel(parentName,
306 theDecayChannel->GetBR(),
307 theDecayChannel->GetNumberOfDaughters(),
308 name[0],name[1],name[2],name[3]);
309 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 s_issbottomHadron(int pdg)
static bool isCustomParticle(G4ParticleDefinition *particle)
static bool s_isstopHadron(int pdg)