4 // See the class description in the header file.
6 #include "TG4PhysicsManager.h"
7 #include "TG4PhysicsList.h"
8 #include "TG4CutVector.h"
9 #include "TG4FlagVector.h"
10 #include "TG4G3Defaults.h"
12 #include <G4ParticleDefinition.hh>
13 #include <G4VProcess.hh>
15 #include <TDatabasePDG.h>
17 TG4PhysicsManager* TG4PhysicsManager::fgInstance = 0;
19 TG4PhysicsManager::TG4PhysicsManager()
27 TG4Globals::Exception(
28 "TG4PhysicsManager: attempt to create two instances of singleton.");
33 // initialize fIsCutVector
34 fIsCutVector = new TG4boolVector;
36 //for (i=0; i<kNofParticlesWSP; i++) fIsCutVector->insert(false);
37 for (i=0; i<kNofParticlesWSP; i++) fIsCutVector->push_back(false);
39 // initialize fIsFlagVector
40 fIsFlagVector = new TG4boolVector;
41 //for (i=0; i<kNofParticlesWSP; i++) fIsFlagVector->insert(false);
42 for (i=0; i<kNofParticlesWSP; i++) fIsFlagVector->push_back(false);
44 // define fCutNameVector, fFlagNameVector
45 FillG3CutNameVector();
46 FillG3FlagNameVector();
48 // fill process name map
52 TG4PhysicsManager::TG4PhysicsManager(const TG4PhysicsManager& right) {
54 TG4Globals::Exception(
55 "Attempt to copy TG4PhysicsManager singleton.");
58 TG4PhysicsManager::~TG4PhysicsManager() {
67 TG4PhysicsManager::operator=(const TG4PhysicsManager& right)
69 // check assignement to self
70 if (this == &right) return *this;
72 TG4Globals::Exception(
73 "Attempt to assign TG4PhysicsManager singleton.");
80 void TG4PhysicsManager::LockException() const
82 // Gives exception in case of attempt to modified physics
83 // setup after physics manager was locked.
86 G4String text = "TG4PhysicsManager: \n";
87 text = text + " It is too late to change physics setup. \n";
88 text = text + " PhysicsManager has been already locked.";
89 TG4Globals::Exception(text);
92 void TG4PhysicsManager::FillG3CutNameVector()
94 // Defines fCutNameVector.
97 fG3CutNameVector.insert("CUTGAM");
98 fG3CutNameVector.insert("CUTELE");
99 fG3CutNameVector.insert("CUTNEU");
100 fG3CutNameVector.insert("CUTHAD");
101 fG3CutNameVector.insert("CUTMUO");
102 fG3CutNameVector.insert("BCUTE");
103 fG3CutNameVector.insert("BCUTM");
104 fG3CutNameVector.insert("DCUTE");
105 fG3CutNameVector.insert("DCUTM");
106 fG3CutNameVector.insert("PPCUTM");
109 void TG4PhysicsManager::FillG3FlagNameVector()
111 // Defines fFlagNameVector.
114 fG3FlagNameVector.insert("PAIR");
115 fG3FlagNameVector.insert("COMP");
116 fG3FlagNameVector.insert("PHOT");
117 fG3FlagNameVector.insert("PFIS");
118 fG3FlagNameVector.insert("DRAY");
119 fG3FlagNameVector.insert("ANNI");
120 fG3FlagNameVector.insert("BREM");
121 fG3FlagNameVector.insert("HADR");
122 fG3FlagNameVector.insert("MUNU");
123 fG3FlagNameVector.insert("DCAY");
124 fG3FlagNameVector.insert("LOSS");
125 fG3FlagNameVector.insert("MULS");
128 void TG4PhysicsManager::FillProcessMap()
130 // Fills fProcessMap.
131 // The default G4 process names are used in the map.
134 // multiple scattering
135 fProcessMap.Add("msc", kPMultipleScattering);
136 fProcessMap.Add("Imsc", kPMultipleScattering);
138 // continuous energy loss
139 // !! including delta rays
140 fProcessMap.Add("eIoni", kPEnergyLoss);
141 fProcessMap.Add("IeIoni", kPEnergyLoss);
142 fProcessMap.Add("LowEnergyIoni", kPEnergyLoss);
143 fProcessMap.Add("hIoni", kPEnergyLoss);
144 fProcessMap.Add("IhIoni", kPEnergyLoss);
145 fProcessMap.Add("hLowEIoni", kPEnergyLoss);
146 fProcessMap.Add("MuIoni", kPEnergyLoss);
147 fProcessMap.Add("IMuIonisation", kPEnergyLoss);
148 fProcessMap.Add("ionIoni", kPEnergyLoss);
149 fProcessMap.Add("ionLowEIoni", kPEnergyLoss);
150 fProcessMap.Add("PAIonisation", kPEnergyLoss);
152 // bending in mag. field
156 fProcessMap.Add("Decay", kPDecay);
158 // photon pair production or
159 // muon direct pair production
160 fProcessMap.Add("conv", kPPair);
161 fProcessMap.Add("LowEnConversion", kPPair);
162 fProcessMap.Add("MuPairProd", kPPair);
163 fProcessMap.Add("IMuPairProduction", kPPair);
165 // Compton scattering
166 fProcessMap.Add("compt", kPCompton);
167 fProcessMap.Add("LowEnCompton", kPCompton);
168 fProcessMap.Add("polarCompt", kPCompton);
170 // photoelectric effect
171 fProcessMap.Add("phot", kPPhotoelectric);
172 fProcessMap.Add("LowEnPhotoElec", kPPhotoelectric);
175 fProcessMap.Add("eBrem", kPBrem);
176 fProcessMap.Add("IeBrem", kPBrem);
177 fProcessMap.Add("MuBrem", kPBrem);
178 fProcessMap.Add("IMuBremsstrahlung", kPBrem);
179 fProcessMap.Add("LowEnBrem", kPBrem);
181 // delta-ray production
183 // has to be distinguished from kPEnergyLoss on flight
185 // positron annihilation
186 fProcessMap.Add("annihil", kPAnnihilation);
187 fProcessMap.Add("Iannihil", kPAnnihilation);
189 // hadronic interaction
192 // nuclear evaporation
198 // nuclear absorption
199 fProcessMap.Add("PionMinusAbsorptionAtRest", kPNuclearAbsorption);
200 fProcessMap.Add("PiMinusAbsorptionAtRest", kPNuclearAbsorption);
201 fProcessMap.Add("KaonMinusAbsorption", kPNuclearAbsorption);
202 fProcessMap.Add("KaonMinusAbsorptionAtRest", kPNuclearAbsorption);
204 // antiproton annihilation
205 fProcessMap.Add("AntiProtonAnnihilationAtRest", kPPbarAnnihilation);
206 // fProcessMap.Add("AntiNeutronAnnihilationAtRest", not defined);
209 fProcessMap.Add("NeutronCaptureAtRest", kPNCapture);
210 // fProcessMap.Add("LCapture", hadron capture not defined);
212 // hadronic elastic incoherent scattering
213 fProcessMap.Add("LElastic", kPHElastic);
215 // hadronic inelastic scattering
216 fProcessMap.Add("inelastic", kPHInhelastic);
218 // muon nuclear interaction
219 fProcessMap.Add("MuNucl", kPMuonNuclear);
221 // exceeded time of flight cut
224 // nuclear photofission
227 // Rayleigh scattering
228 fProcessMap.Add("Rayleigh Scattering", kPRayleigh);
230 // no mechanism is active, usually at the entrance of a new volume
231 fProcessMap.Add("Transportation", kPNull);
233 // particle has fallen below energy threshold and tracking stops
236 // Cerenkov photon absorption
237 fProcessMap.Add("Absorption", kPLightAbsorption);
239 // Cerenkov photon reflection/refraction
240 // kPLightScattering, kPLightReflection, kPLightRefraction
241 // has to be inquired from the G4OpBoundary process
243 // synchrotron radiation
244 fProcessMap.Add("SynchrotronRadiation", kPSynchrotron);
248 G4int TG4PhysicsManager::GetPDGEncoding(G4ParticleDefinition* particle)
250 // Returns the PDG code of particle;
251 // if standard PDG code is not defined the TDatabasePDG
255 // get PDG encoding from G4 particle definition
256 G4int pdgEncoding = particle->GetPDGEncoding();
258 if (pdgEncoding == 0) {
259 // get PDG encoding from TDatabasePDG
261 // get particle name from the name map
262 G4String g4name = particle->GetParticleName();
263 G4String tname = fParticleNameMap.GetSecond(g4name);
264 if (tname == "Undefined") {
265 G4String text = "TG4PhysicsManager::GetPDGEncoding: \n";
266 text = text + " Particle " + g4name;
267 text = text + " was not found in the name map.";
268 TG4Globals::Exception(text);
271 // get particle from TDatabasePDG
272 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
273 TParticlePDG* particle = pdgDB->GetParticle(tname);
275 G4String text = "TG4PhysicsManager::GetPDGEncoding: \n";
276 text = text + " Particle " + tname;
277 text = text + " was not found in TDatabasePDG.";
278 TG4Globals::Exception(text);
282 pdgEncoding = particle->PdgCode();
288 AliMCProcess TG4PhysicsManager::GetMCProcess(const G4VProcess* process)
290 // Returns the AliMCProcess code of the specified G4 process.
293 if (!process) return kPNoProcess;
295 G4String name = process->GetProcessName();
296 G4int code = fProcessMap.GetSecond(name);
298 if (code == 0) return kPNoProcess;
300 return (AliMCProcess)code;
303 G4int TG4PhysicsManager::GetPDGEncoding(G4String particleName)
305 // Returns the PDG code of particle specified by name.
308 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
310 G4ParticleDefinition* particle = 0;
311 particle = particleTable->FindParticle(particleName);
313 G4String text = "TG4PhysicsManager::GetPDGEncoding:\n";
314 text = text + " G4ParticleTable::FindParticle() " + particleName;
315 text = text + " failed.";
316 TG4Globals::Exception(text);
319 return GetPDGEncoding(particle);
322 void TG4PhysicsManager::SetCut(TG3Cut cut, G4double cutValue)
324 // Sets kinetic energy cut (in a G3-like way).
328 // create vector of kinetic energy cut values
329 fCutVector = new TG4CutVector();
331 fCutVector->SetG3Cut(cut, cutValue);
332 SwitchIsCutVector(cut);
335 void TG4PhysicsManager::SetProcess(TG3Flag flag, G4int flagValue)
337 // Sets control process flag (in a G3-like way).
341 // create vector of control process flag values
342 fFlagVector = new TG4FlagVector;
344 fFlagVector->SetG3Flag(flag, flagValue);
348 Float_t TG4PhysicsManager::Xsec(char* ch, Float_t p1, Int_t i1, Int_t i2)
350 // Not yet implemented -> gives exception.
353 TG4Globals::Exception(
354 "TG4PhysicsManager::Xsec: not yet implemented.");
359 Int_t TG4PhysicsManager::IdFromPDG(Int_t pdgID) const
361 // G4 does not use the integer particle identifiers
362 // Id <-> PDG is identity.
368 Int_t TG4PhysicsManager::PDGFromId(Int_t mcID) const
370 // G4 does not use integer particle identifiers
371 // Id <-> PDG is identity.
377 void TG4PhysicsManager::DefineParticles()
380 // Taken from TGeant3
382 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
384 // and numbers above 5 000 000 for special applications
387 const Int_t kion=10000000;
388 const Int_t kspe=50000000;
390 const Double_t kGeV=0.9314943228;
391 const Double_t kHslash = 1.0545726663e-27;
392 const Double_t kErgGeV = 1/1.6021773349e-3;
393 const Double_t kHshGeV = kHslash*kErgGeV;
394 const Double_t kYearsToSec = 3600*24*365.25;
396 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
398 pdgDB->AddParticle("Deuteron","Deuteron",2*kGeV+8.071e-3,kTRUE,
399 0,1,"Ion",kion+10020);
401 pdgDB->AddParticle("Triton","Triton",3*kGeV+14.931e-3,kFALSE,
402 kHshGeV/(12.33*kYearsToSec),1,"Ion",kion+10030);
404 pdgDB->AddParticle("Alpha","Alpha",4*kGeV+2.424e-3,kTRUE,
405 kHshGeV/(12.33*kYearsToSec),2,"Ion",kion+20040);
407 pdgDB->AddParticle("HE3","HE3",3*kGeV+14.931e-3,kFALSE,
408 0,2,"Ion",kion+20030);
410 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
411 0,0,"Special",kspe+50);
413 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
414 0,0,"Special",kspe+51);
417 // To do: define the PDG database extension
420 // AliMC::ExtendPDGDatabase();
422 // end of "common" implementation
425 // map G4 particle names to TDatabasePDG names
426 // (the map is built only for particles that have not
427 // defined standard PDG encoding)
429 fParticleNameMap.Add("deuteron","Deuteron");
430 fParticleNameMap.Add("triton", "Triton");
431 fParticleNameMap.Add("alpha", "Alpha");
432 fParticleNameMap.Add("He3", "HE3");
433 fParticleNameMap.Add("opticalphoton","Cherenkov");
434 // fParticleNameMap.Add("???","FeedbackPhoton");
435 fParticleNameMap.Add("geantino", "Rootino");
437 // map G4 particle names to TDatabasePDG encodings
438 fParticlePDGMap.Add("deuteron", GetPDGEncoding("deuteron"));
439 fParticlePDGMap.Add("triton", GetPDGEncoding("triton"));
440 fParticlePDGMap.Add("alpha", GetPDGEncoding("alpha"));
441 fParticlePDGMap.Add("He3", GetPDGEncoding("He3") );
442 fParticlePDGMap.Add("opticalphoton", GetPDGEncoding("opticalphoton"));
443 // fParticlePDGMap.Add("???","FeedbackPhoton");
444 fParticleNameMap.Add("geantino", GetPDGEncoding("geantino"));
447 G4cout << "Particle maps have been filled." << G4endl;
448 //fParticleNameMap.PrintAll();
449 //fParticlePDGMap.PrintAll();
452 void TG4PhysicsManager::SwitchIsCutVector(TG3Cut cut)
454 // Updates the vector of booleans (fIsCutVector) for the specified cut.
459 (*fIsCutVector)[kGamma] = true;
462 (*fIsCutVector)[kGamma] = true;
465 (*fIsCutVector)[kGamma] = true;
468 (*fIsCutVector)[kElectron] = true;
471 (*fIsCutVector)[kElectron] = true;
474 (*fIsCutVector)[kElectron] = true;
477 (*fIsCutVector)[kNeutralHadron] = true;
480 (*fIsCutVector)[kChargedHadron] = true;
483 (*fIsCutVector)[kMuon] = true;
490 void TG4PhysicsManager::SwitchIsFlagVector(TG3Flag flag)
492 // Updates the vector of booleans (fIsFlagVector) for the specified flag.
498 (*fIsFlagVector)[kGamma] = true;
502 (*fIsFlagVector)[kGamma] = true;
506 (*fIsFlagVector)[kGamma] = true;
510 (*fIsFlagVector)[kGamma] = true;
513 // all charged particles
514 (*fIsFlagVector)[kElectron] = true;
515 (*fIsFlagVector)[kEplus] = true;
516 (*fIsFlagVector)[kChargedHadron] = true;
517 (*fIsFlagVector)[kMuon] = true;
521 (*fIsFlagVector)[kEplus] = true;
525 (*fIsFlagVector)[kElectron] = true;
526 (*fIsFlagVector)[kEplus] = true;
527 (*fIsFlagVector)[kMuon] = true;
531 (*fIsFlagVector)[kNeutralHadron] = true;
532 (*fIsFlagVector)[kChargedHadron] = true;
536 (*fIsFlagVector)[kMuon] = true;
540 (*fIsFlagVector)[kAny] = true;
543 // all charged particles
544 (*fIsFlagVector)[kElectron] = true;
545 (*fIsFlagVector)[kEplus] = true;
546 (*fIsFlagVector)[kChargedHadron] = true;
547 (*fIsFlagVector)[kMuon] = true;
550 // all charged particles
551 (*fIsFlagVector)[kElectron] = true;
552 (*fIsFlagVector)[kEplus] = true;
553 (*fIsFlagVector)[kChargedHadron] = true;
554 (*fIsFlagVector)[kMuon] = true;
561 TG3Cut TG4PhysicsManager::GetG3Cut(G4String cutName)
563 // Retrieves corresponding TG3Cut constant from the cutName.
566 if (cutName == fG3CutNameVector[kCUTGAM]) return kCUTGAM;
567 else if (cutName == fG3CutNameVector[kBCUTE]) return kBCUTE;
568 else if (cutName == fG3CutNameVector[kBCUTM]) return kBCUTM;
569 else if (cutName == fG3CutNameVector[kCUTELE]) return kCUTELE;
570 else if (cutName == fG3CutNameVector[kDCUTE]) return kDCUTE;
571 else if (cutName == fG3CutNameVector[kDCUTM]) return kDCUTM;
572 else if (cutName == fG3CutNameVector[kCUTNEU]) return kCUTNEU;
573 else if (cutName == fG3CutNameVector[kCUTHAD]) return kCUTHAD;
574 else if (cutName == fG3CutNameVector[kCUTMUO]) return kCUTMUO;
575 else return kNoG3Cuts;
578 TG3Flag TG4PhysicsManager::GetG3Flag(G4String flagName)
580 // Retrieves corresponding TG3Flag constant from the flagName.
583 if (flagName == fG3FlagNameVector[kPAIR]) return kPAIR;
584 else if (flagName == fG3FlagNameVector[kCOMP]) return kCOMP;
585 else if (flagName == fG3FlagNameVector[kPHOT]) return kPHOT;
586 else if (flagName == fG3FlagNameVector[kPFIS]) return kPFIS;
587 else if (flagName == fG3FlagNameVector[kDRAY]) return kDRAY;
588 else if (flagName == fG3FlagNameVector[kANNI]) return kANNI;
589 else if (flagName == fG3FlagNameVector[kBREM]) return kBREM;
590 else if (flagName == fG3FlagNameVector[kHADR]) return kHADR;
591 else if (flagName == fG3FlagNameVector[kMUNU]) return kMUNU;
592 else if (flagName == fG3FlagNameVector[kDCAY]) return kDCAY;
593 else if (flagName == fG3FlagNameVector[kLOSS]) return kLOSS;
594 else if (flagName == fG3FlagNameVector[kMULS]) return kMULS;
595 else return kNoG3Flags;
600 void TG4PhysicsManager::BuildPhysics()
602 // Empty function - not needed in G4.
603 // (Physics is built within /run/initialize.)
606 "TG4PhysicsManager::BuildPhysics: is empty function in G4 MC.");
609 void TG4PhysicsManager::SetCut(const char* cutName, Float_t cutValue)
611 // Sets the specified cut.
614 if (fLock) LockException();
615 TG3Cut g3Cut = GetG3Cut(cutName);
616 if (g3Cut != kNoG3Cuts)
617 SetCut(g3Cut, cutValue);
619 G4String text = "TG4PhysicsManager::SetCut:\n";
620 text = text + " Parameter " + cutName;
621 text = text + " is not implemented.";
622 TG4Globals::Warning(text);
626 void TG4PhysicsManager::SetProcess(const char* flagName, Int_t flagValue)
628 // Sets the specified process control.
631 if (fLock) LockException();
632 TG3Flag g3Flag = GetG3Flag(flagName);
633 if (g3Flag != kNoG3Flags)
634 SetProcess(g3Flag, flagValue);
636 G4String text = "TG4PhysicsManager::SetProcess:\n";
637 text = text + " Parameter " + flagName;
638 text = text + " is not implemented.";
639 TG4Globals::Warning(text);
643 void TG4PhysicsManager::SetProcessActivation()
645 // (In)Activates built processes according
646 // to the setup in fFlagVector.
650 // temporarily excluded
651 // fPhysicsList->SetProcessActivation();
654 G4String text = "TG4PhysicsManager::SetProcessActivation:\n";
655 text = text + " There is no physics list set.";
656 TG4Globals::Exception(text);
660 G4int TG4PhysicsManager::GetPDGEncodingFast(G4ParticleDefinition* particle)
662 // Returns the PDG code of particle;
663 // if standard PDG code is not defined the preregistred
664 // fParticlePDGMap is used.
667 // get PDG encoding from G4 particle definition
668 G4int pdgEncoding = particle->GetPDGEncoding();
670 if (pdgEncoding == 0) {
671 // use FParticlePDGMap if standard PDG code is not defined
672 G4String name = particle->GetParticleName();
673 pdgEncoding = fParticlePDGMap.GetSecond(name);
679 G4bool TG4PhysicsManager::CheckCutWithCutVector(G4String name,
680 G4double value, TG3Cut& cut)
682 // Retrieves corresponding TG3Cut from the name and
683 // in case the value is different from the value in cutVector
684 // sets true the value of the fIsCutVector element
685 // corresponding to this cut and returns true;
686 // returns false otherwise.
689 // convert cut name -> TG3Cut
690 cut = GetG3Cut(name);
692 // set switch vector element only if the value
693 // is different from the value in cutVector
694 if (cut !=kNoG3Cuts) {
695 // get tolerance from TG4G3Defaults in GeV
696 G4double tolerance = TG4G3Defaults::CutTolerance()/GeV;
697 if (!(fCutVector) || (abs(value - (*fCutVector)[cut]) > tolerance)) {
698 SwitchIsCutVector(cut);
706 G4bool TG4PhysicsManager::CheckFlagWithFlagVector(G4String name,
707 G4double value, TG3Flag& flag)
709 // Retrieves corresponding TG3Flag from the name and
710 // in case the value is different from the value in flagVector
711 // sets true the value of the fIsFlagVector element
712 // corresponding to this flag and returns true;
713 // returns false otherwise.
716 // convert flag name -> TG3Flag
717 flag = GetG3Flag(name);
719 // set switch vector element only if the value
720 // is different from the value in flagVector
721 if (flag !=kNoG3Flags) {
722 if (!(fFlagVector) || (abs(value - (*fFlagVector)[flag]) > 0.01)) {
723 SwitchIsFlagVector(flag);
731 G4bool TG4PhysicsManager::CheckCutWithG3Defaults(G4String name,
732 G4double value, TG3Cut& cut)
734 // Retrieves corresponding TG3Cut from the name and
735 // in case the value is different from the G3 default value
736 // sets true the value of the SwitchCutVector element
737 // corresponding to this cut and returns true;
738 // returns false otherwise.
741 // convert cut name -> TG3Cut
742 cut = GetG3Cut(name);
744 // set switch vector element only if the value
745 // is different from G3 default
746 if (cut !=kNoG3Cuts) {
747 if (!TG4G3Defaults::IsDefaultCut(cut, value)) {
748 SwitchIsCutVector(cut);
756 G4bool TG4PhysicsManager::CheckFlagWithG3Defaults(G4String name,
757 G4double value, TG3Flag& flag)
759 // Retrieves corresponding TG3Flag from the name and
760 // in case the value is different from the G3 default value
761 // sets true the value of the SwitchFlagVector element
762 // corresponding to this flag and returns true;
763 // returns false otherwise.
766 // convert flag name -> TG3Flag
767 flag = GetG3Flag(name);
769 // set switch vector element only if the value
770 // is different from G3 default
771 if (flag !=kNoG3Flags) {
772 if (!TG4G3Defaults::IsDefaultFlag(flag, value)) {
773 SwitchIsFlagVector(flag);
781 void TG4PhysicsManager::SetG3DefaultCuts()
783 // Sets G3 default values of kinetic energy cuts.
786 if (fLock) LockException();
788 // create vector of kinetic energy cut values
789 fCutVector = new TG4CutVector();
791 fCutVector->SetG3Defaults();
794 void TG4PhysicsManager::SetG3DefaultProcesses()
796 // Sets G3 default values of control process flags.
799 if (fLock) LockException();
801 // create vector of control process flag values
802 fFlagVector = new TG4FlagVector;
804 fFlagVector->SetG3Defaults();
807 G4bool TG4PhysicsManager::IsSpecialCuts() const
809 // Returns true if any special cut value is set.
812 for (G4int i=0; i<kNofParticlesWSP; i++)
813 { if ((*fIsCutVector)[i]) return true; }
818 G4bool TG4PhysicsManager::IsSpecialFlags() const
820 // Returns true if any special flag value is set.
823 for (G4int i=0; i<kNofParticlesWSP; i++)
824 { if ((*fIsFlagVector)[i]) return true; }
829 TG3ParticleWSP TG4PhysicsManager::GetG3ParticleWSP(
830 G4ParticleDefinition* particle) const
832 // Returns TG3ParticleWSP constant for the specified particle.
833 // (See TG3ParticleWSP.h, too.)
836 G4String name = particle->GetParticleName();
837 G4String pType = particle->GetParticleType();
839 if (name == "gamma") {
842 else if (name == "e-") {
845 else if (name == "e+") {
848 else if (( pType == "baryon" || pType == "meson" || pType == "nucleus" )) {
849 if (particle->GetPDGCharge() == 0) {
850 return kNeutralHadron;
853 return kChargedHadron;
855 else if ( name == "mu-" || name == "mu+" ) {
859 return kNofParticlesWSP;
863 void TG4PhysicsManager::GetG3ParticleWSPName(G4int particleWSP,
864 G4String& name) const
866 // Fills the passed name with the name/type of particle specified
867 // by TG3ParticleWSP constant.
868 // (See TG3ParticleWSP.h, too.)
871 switch (particleWSP) {
882 name = "NeutralHadron";
885 name = "ChargedHadron";
893 case kNofParticlesWSP:
897 G4String text = "TG4PhysicsList::GetG3ParticleWSPName:\n";
898 text = text + " Wrong particleWSP.";
899 TG4Globals::Exception(text);