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>
14 #include <TDatabasePDG.h>
16 TG4PhysicsManager* TG4PhysicsManager::fgInstance = 0;
18 TG4PhysicsManager::TG4PhysicsManager()
26 TG4Globals::Exception(
27 "TG4PhysicsManager: attempt to create two instances of singleton.");
32 // initialize fIsCutVector
33 fIsCutVector = new TG4boolVector;
35 //for (i=0; i<kNofParticlesWSP; i++) fIsCutVector->insert(false);
36 for (i=0; i<kNofParticlesWSP; i++) fIsCutVector->push_back(false);
38 // initialize fIsFlagVector
39 fIsFlagVector = new TG4boolVector;
40 //for (i=0; i<kNofParticlesWSP; i++) fIsFlagVector->insert(false);
41 for (i=0; i<kNofParticlesWSP; i++) fIsFlagVector->push_back(false);
43 // define fCutNameVector, fFlagNameVector
44 FillG3CutNameVector();
45 FillG3FlagNameVector();
47 // fill process name map
51 TG4PhysicsManager::TG4PhysicsManager(const TG4PhysicsManager& right) {
53 TG4Globals::Exception(
54 "Attempt to copy TG4PhysicsManager singleton.");
57 TG4PhysicsManager::~TG4PhysicsManager() {
66 TG4PhysicsManager::operator=(const TG4PhysicsManager& right)
68 // check assignement to self
69 if (this == &right) return *this;
71 TG4Globals::Exception(
72 "Attempt to assign TG4PhysicsManager singleton.");
79 void TG4PhysicsManager::LockException() const
81 // Gives exception in case of attempt to modified physics
82 // setup after physics manager was locked.
85 G4String text = "TG4PhysicsManager: \n";
86 text = text + " It is too late to change physics setup. \n";
87 text = text + " PhysicsManager has been already locked.";
88 TG4Globals::Exception(text);
91 void TG4PhysicsManager::FillG3CutNameVector()
93 // Defines fCutNameVector.
96 fG3CutNameVector.insert("CUTGAM");
97 fG3CutNameVector.insert("CUTELE");
98 fG3CutNameVector.insert("CUTNEU");
99 fG3CutNameVector.insert("CUTHAD");
100 fG3CutNameVector.insert("CUTMUO");
101 fG3CutNameVector.insert("BCUTE");
102 fG3CutNameVector.insert("BCUTM");
103 fG3CutNameVector.insert("DCUTE");
104 fG3CutNameVector.insert("DCUTM");
105 fG3CutNameVector.insert("PPCUTM");
108 void TG4PhysicsManager::FillG3FlagNameVector()
110 // Defines fFlagNameVector.
113 fG3FlagNameVector.insert("PAIR");
114 fG3FlagNameVector.insert("COMP");
115 fG3FlagNameVector.insert("PHOT");
116 fG3FlagNameVector.insert("PFIS");
117 fG3FlagNameVector.insert("DRAY");
118 fG3FlagNameVector.insert("ANNI");
119 fG3FlagNameVector.insert("BREM");
120 fG3FlagNameVector.insert("HADR");
121 fG3FlagNameVector.insert("MUNU");
122 fG3FlagNameVector.insert("DCAY");
123 fG3FlagNameVector.insert("LOSS");
124 fG3FlagNameVector.insert("MULS");
127 void TG4PhysicsManager::FillProcessMap()
129 // Fills fProcessMap.
130 // The default G4 process names are used in the map.
133 // multiple scattering
134 fProcessMap.Add("msc", kPMultipleScattering);
135 fProcessMap.Add("Imsc", kPMultipleScattering);
137 // continuous energy loss
138 // !! including delta rays
139 fProcessMap.Add("eIoni", kPEnergyLoss);
140 fProcessMap.Add("IeIoni", kPEnergyLoss);
141 fProcessMap.Add("LowEnergyIoni", kPEnergyLoss);
142 fProcessMap.Add("hIoni", kPEnergyLoss);
143 fProcessMap.Add("IhIoni", kPEnergyLoss);
144 fProcessMap.Add("hLowEIoni", kPEnergyLoss);
145 fProcessMap.Add("MuIoni", kPEnergyLoss);
146 fProcessMap.Add("IMuIonisation", kPEnergyLoss);
147 fProcessMap.Add("ionIoni", kPEnergyLoss);
148 fProcessMap.Add("ionLowEIoni", kPEnergyLoss);
149 fProcessMap.Add("PAIonisation", kPEnergyLoss);
151 // bending in mag. field
155 fProcessMap.Add("Decay", kPDecay);
157 // photon pair production or
158 // muon direct pair production
159 fProcessMap.Add("conv", kPPair);
160 fProcessMap.Add("LowEnConversion", kPPair);
161 fProcessMap.Add("MuPairProd", kPPair);
162 fProcessMap.Add("IMuPairProduction", kPPair);
164 // Compton scattering
165 fProcessMap.Add("compt", kPCompton);
166 fProcessMap.Add("LowEnCompton", kPCompton);
167 fProcessMap.Add("polarCompt", kPCompton);
169 // photoelectric effect
170 fProcessMap.Add("phot", kPPhotoelectric);
171 fProcessMap.Add("LowEnPhotoElec", kPPhotoelectric);
174 fProcessMap.Add("eBrem", kPBrem);
175 fProcessMap.Add("IeBrem", kPBrem);
176 fProcessMap.Add("MuBrem", kPBrem);
177 fProcessMap.Add("IMuBremsstrahlung", kPBrem);
178 fProcessMap.Add("LowEnBrem", kPBrem);
180 // delta-ray production
182 // has to be distinguished from kPEnergyLoss on flight
184 // positron annihilation
185 fProcessMap.Add("annihil", kPAnnihilation);
186 fProcessMap.Add("Iannihil", kPAnnihilation);
188 // hadronic interaction
191 // nuclear evaporation
197 // nuclear absorption
198 fProcessMap.Add("PionMinusAbsorptionAtRest", kPNuclearAbsorption);
199 fProcessMap.Add("PiMinusAbsorptionAtRest", kPNuclearAbsorption);
200 fProcessMap.Add("KaonMinusAbsorption", kPNuclearAbsorption);
201 fProcessMap.Add("KaonMinusAbsorptionAtRest", kPNuclearAbsorption);
203 // antiproton annihilation
204 fProcessMap.Add("AntiProtonAnnihilationAtRest", kPPbarAnnihilation);
205 // fProcessMap.Add("AntiNeutronAnnihilationAtRest", not defined);
208 fProcessMap.Add("NeutronCaptureAtRest", kPNCapture);
209 // fProcessMap.Add("LCapture", hadron capture not defined);
211 // hadronic elastic incoherent scattering
212 fProcessMap.Add("LElastic", kPHElastic);
214 // hadronic inelastic scattering
215 fProcessMap.Add("inelastic", kPHInhelastic);
217 // muon nuclear interaction
218 fProcessMap.Add("MuNucl", kPMuonNuclear);
220 // exceeded time of flight cut
223 // nuclear photofission
226 // Rayleigh scattering
227 fProcessMap.Add("Rayleigh Scattering", kPRayleigh);
229 // no mechanism is active, usually at the entrance of a new volume
232 // particle has fallen below energy threshold and tracking stops
235 // Cerenkov photon absorption
236 fProcessMap.Add("Absorption", kPLightAbsorption);
238 // Cerenkov photon reflection/refraction
239 // kPLightScattering, kPLightReflection, kPLightRefraction
240 // has to be inquired from the G4OpBoundary process
242 // synchrotron radiation
243 fProcessMap.Add("SynchrotronRadiation", kPSynchrotron);
247 G4int TG4PhysicsManager::GetPDGEncoding(G4ParticleDefinition* particle)
249 // Returns the PDG code of particle;
250 // if standard PDG code is not defined the TDatabasePDG
254 // get PDG encoding from G4 particle definition
255 G4int pdgEncoding = particle->GetPDGEncoding();
257 if (pdgEncoding == 0) {
258 // get PDG encoding from TDatabasePDG
260 // get particle name from the name map
261 G4String g4name = particle->GetParticleName();
262 G4String tname = fParticleNameMap.GetSecond(g4name);
263 if (tname == "Undefined") {
264 G4String text = "TG4PhysicsManager::GetPDGEncoding: \n";
265 text = text + " Particle " + g4name;
266 text = text + " was not found in the name map.";
267 TG4Globals::Exception(text);
270 // get particle from TDatabasePDG
271 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
272 TParticlePDG* particle = pdgDB->GetParticle(tname);
274 G4String text = "TG4PhysicsManager::GetPDGEncoding: \n";
275 text = text + " Particle " + tname;
276 text = text + " was not found in TDatabasePDG.";
277 TG4Globals::Exception(text);
281 pdgEncoding = particle->PdgCode();
287 AliMCProcess TG4PhysicsManager::GetMCProcess(const G4String& g4ProcessName)
289 // Returns the AliMCProcess code of process specified by name.
292 G4int processCode = fProcessMap.GetSecond(g4ProcessName);
294 if (processCode == 0) return kPNoProcess;
296 return (AliMCProcess)processCode;
299 G4int TG4PhysicsManager::GetPDGEncoding(G4String particleName)
301 // Returns the PDG code of particle specified by name.
304 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
306 G4ParticleDefinition* particle = 0;
307 particle = particleTable->FindParticle(particleName);
309 G4String text = "TG4PhysicsManager::GetPDGEncoding:\n";
310 text = text + " G4ParticleTable::FindParticle() " + particleName;
311 text = text + " failed.";
312 TG4Globals::Exception(text);
315 return GetPDGEncoding(particle);
318 void TG4PhysicsManager::SetCut(TG3Cut cut, G4double cutValue)
320 // Sets kinetic energy cut (in a G3-like way).
324 // create vector of kinetic energy cut values
325 fCutVector = new TG4CutVector();
327 fCutVector->SetG3Cut(cut, cutValue);
328 SwitchIsCutVector(cut);
331 void TG4PhysicsManager::SetProcess(TG3Flag flag, G4int flagValue)
333 // Sets control process flag (in a G3-like way).
337 // create vector of control process flag values
338 fFlagVector = new TG4FlagVector;
340 fFlagVector->SetG3Flag(flag, flagValue);
344 Float_t TG4PhysicsManager::Xsec(char* ch, Float_t p1, Int_t i1, Int_t i2)
346 // Not yet implemented -> gives exception.
349 TG4Globals::Exception(
350 "TG4PhysicsManager::Xsec: not yet implemented.");
355 Int_t TG4PhysicsManager::IdFromPDG(Int_t pdgID) const
357 // G4 does not use the integer particle identifiers
358 // Id <-> PDG is identity.
364 Int_t TG4PhysicsManager::PDGFromId(Int_t mcID) const
366 // G4 does not use integer particle identifiers
367 // Id <-> PDG is identity.
373 void TG4PhysicsManager::DefineParticles()
376 // Taken from TGeant3
378 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
380 // and numbers above 5 000 000 for special applications
383 const Int_t kion=10000000;
384 const Int_t kspe=50000000;
386 const Double_t kGeV=0.9314943228;
387 const Double_t kHslash = 1.0545726663e-27;
388 const Double_t kErgGeV = 1/1.6021773349e-3;
389 const Double_t kHshGeV = kHslash*kErgGeV;
390 const Double_t kYearsToSec = 3600*24*365.25;
392 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
394 pdgDB->AddParticle("Deuteron","Deuteron",2*kGeV+8.071e-3,kTRUE,
395 0,1,"Ion",kion+10020);
397 pdgDB->AddParticle("Triton","Triton",3*kGeV+14.931e-3,kFALSE,
398 kHshGeV/(12.33*kYearsToSec),1,"Ion",kion+10030);
400 pdgDB->AddParticle("Alpha","Alpha",4*kGeV+2.424e-3,kTRUE,
401 kHshGeV/(12.33*kYearsToSec),2,"Ion",kion+20040);
403 pdgDB->AddParticle("HE3","HE3",3*kGeV+14.931e-3,kFALSE,
404 0,2,"Ion",kion+20030);
406 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
407 0,0,"Special",kspe+50);
409 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
410 0,0,"Special",kspe+51);
413 // To do: define the PDG database extension
416 // AliMC::ExtendPDGDatabase();
418 // end of "common" implementation
421 // map G4 particle names to TDatabasePDG names
422 // (the map is built only for particles that have not
423 // defined standard PDG encoding)
425 fParticleNameMap.Add("deuteron","Deuteron");
426 fParticleNameMap.Add("triton", "Triton");
427 fParticleNameMap.Add("alpha", "Alpha");
428 fParticleNameMap.Add("He3", "HE3");
429 fParticleNameMap.Add("opticalphoton","Cherenkov");
430 // fParticleNameMap.Add("???","FeedbackPhoton");
431 fParticleNameMap.Add("geantino", "Rootino");
433 // map G4 particle names to TDatabasePDG encodings
434 fParticlePDGMap.Add("deuteron", GetPDGEncoding("deuteron"));
435 fParticlePDGMap.Add("triton", GetPDGEncoding("triton"));
436 fParticlePDGMap.Add("alpha", GetPDGEncoding("alpha"));
437 fParticlePDGMap.Add("He3", GetPDGEncoding("He3") );
438 fParticlePDGMap.Add("opticalphoton", GetPDGEncoding("opticalphoton"));
439 // fParticlePDGMap.Add("???","FeedbackPhoton");
440 fParticleNameMap.Add("geantino", GetPDGEncoding("geantino"));
443 G4cout << "Particle maps have been filled." << G4endl;
444 //fParticleNameMap.PrintAll();
445 //fParticlePDGMap.PrintAll();
448 void TG4PhysicsManager::SwitchIsCutVector(TG3Cut cut)
450 // Updates the vector of booleans (fIsCutVector) for the specified cut.
455 (*fIsCutVector)[kGamma] = true;
458 (*fIsCutVector)[kGamma] = true;
461 (*fIsCutVector)[kGamma] = true;
464 (*fIsCutVector)[kElectron] = true;
467 (*fIsCutVector)[kElectron] = true;
470 (*fIsCutVector)[kElectron] = true;
473 (*fIsCutVector)[kNeutralHadron] = true;
476 (*fIsCutVector)[kChargedHadron] = true;
479 (*fIsCutVector)[kMuon] = true;
486 void TG4PhysicsManager::SwitchIsFlagVector(TG3Flag flag)
488 // Updates the vector of booleans (fIsFlagVector) for the specified flag.
494 (*fIsFlagVector)[kGamma] = true;
498 (*fIsFlagVector)[kGamma] = true;
502 (*fIsFlagVector)[kGamma] = true;
506 (*fIsFlagVector)[kGamma] = true;
509 // all charged particles
510 (*fIsFlagVector)[kElectron] = true;
511 (*fIsFlagVector)[kEplus] = true;
512 (*fIsFlagVector)[kChargedHadron] = true;
513 (*fIsFlagVector)[kMuon] = true;
517 (*fIsFlagVector)[kEplus] = true;
521 (*fIsFlagVector)[kElectron] = true;
522 (*fIsFlagVector)[kEplus] = true;
523 (*fIsFlagVector)[kMuon] = true;
527 (*fIsFlagVector)[kNeutralHadron] = true;
528 (*fIsFlagVector)[kChargedHadron] = true;
532 (*fIsFlagVector)[kMuon] = true;
536 (*fIsFlagVector)[kAny] = true;
539 // all charged particles
540 (*fIsFlagVector)[kElectron] = true;
541 (*fIsFlagVector)[kEplus] = true;
542 (*fIsFlagVector)[kChargedHadron] = true;
543 (*fIsFlagVector)[kMuon] = true;
546 // all charged particles
547 (*fIsFlagVector)[kElectron] = true;
548 (*fIsFlagVector)[kEplus] = true;
549 (*fIsFlagVector)[kChargedHadron] = true;
550 (*fIsFlagVector)[kMuon] = true;
557 TG3Cut TG4PhysicsManager::GetG3Cut(G4String cutName)
559 // Retrieves corresponding TG3Cut constant from the cutName.
562 if (cutName == fG3CutNameVector[kCUTGAM]) return kCUTGAM;
563 else if (cutName == fG3CutNameVector[kBCUTE]) return kBCUTE;
564 else if (cutName == fG3CutNameVector[kBCUTM]) return kBCUTM;
565 else if (cutName == fG3CutNameVector[kCUTELE]) return kCUTELE;
566 else if (cutName == fG3CutNameVector[kDCUTE]) return kDCUTE;
567 else if (cutName == fG3CutNameVector[kDCUTM]) return kDCUTM;
568 else if (cutName == fG3CutNameVector[kCUTNEU]) return kCUTNEU;
569 else if (cutName == fG3CutNameVector[kCUTHAD]) return kCUTHAD;
570 else if (cutName == fG3CutNameVector[kCUTMUO]) return kCUTMUO;
571 else return kNoG3Cuts;
574 TG3Flag TG4PhysicsManager::GetG3Flag(G4String flagName)
576 // Retrieves corresponding TG3Flag constant from the flagName.
579 if (flagName == fG3FlagNameVector[kPAIR]) return kPAIR;
580 else if (flagName == fG3FlagNameVector[kCOMP]) return kCOMP;
581 else if (flagName == fG3FlagNameVector[kPHOT]) return kPHOT;
582 else if (flagName == fG3FlagNameVector[kPFIS]) return kPFIS;
583 else if (flagName == fG3FlagNameVector[kDRAY]) return kDRAY;
584 else if (flagName == fG3FlagNameVector[kANNI]) return kANNI;
585 else if (flagName == fG3FlagNameVector[kBREM]) return kBREM;
586 else if (flagName == fG3FlagNameVector[kHADR]) return kHADR;
587 else if (flagName == fG3FlagNameVector[kMUNU]) return kMUNU;
588 else if (flagName == fG3FlagNameVector[kDCAY]) return kDCAY;
589 else if (flagName == fG3FlagNameVector[kLOSS]) return kLOSS;
590 else if (flagName == fG3FlagNameVector[kMULS]) return kMULS;
591 else return kNoG3Flags;
596 void TG4PhysicsManager::BuildPhysics()
598 // Empty function - not needed in G4.
599 // (Physics is built within /run/initialize.)
602 "TG4PhysicsManager::BuildPhysics: is empty function in G4 MC.");
605 void TG4PhysicsManager::SetCut(const char* cutName, Float_t cutValue)
607 // Sets the specified cut.
610 if (fLock) LockException();
611 TG3Cut g3Cut = GetG3Cut(cutName);
612 if (g3Cut != kNoG3Cuts)
613 SetCut(g3Cut, cutValue);
615 G4String text = "TG4PhysicsManager::SetCut:\n";
616 text = text + " Parameter " + cutName;
617 text = text + " is not implemented.";
618 TG4Globals::Warning(text);
622 void TG4PhysicsManager::SetProcess(const char* flagName, Int_t flagValue)
624 // Sets the specified process control.
627 if (fLock) LockException();
628 TG3Flag g3Flag = GetG3Flag(flagName);
629 if (g3Flag != kNoG3Flags)
630 SetProcess(g3Flag, flagValue);
632 G4String text = "TG4PhysicsManager::SetProcess:\n";
633 text = text + " Parameter " + flagName;
634 text = text + " is not implemented.";
635 TG4Globals::Warning(text);
639 void TG4PhysicsManager::SetProcessActivation()
641 // (In)Activates built processes according
642 // to the setup in fFlagVector.
646 // temporarily excluded
647 // fPhysicsList->SetProcessActivation();
650 G4String text = "TG4PhysicsManager::SetProcessActivation:\n";
651 text = text + " There is no physics list set.";
652 TG4Globals::Exception(text);
656 G4int TG4PhysicsManager::GetPDGEncodingFast(G4ParticleDefinition* particle)
658 // Returns the PDG code of particle;
659 // if standard PDG code is not defined the preregistred
660 // fParticlePDGMap is used.
663 // get PDG encoding from G4 particle definition
664 G4int pdgEncoding = particle->GetPDGEncoding();
666 if (pdgEncoding == 0) {
667 // use FParticlePDGMap if standard PDG code is not defined
668 G4String name = particle->GetParticleName();
669 pdgEncoding = fParticlePDGMap.GetSecond(name);
675 G4bool TG4PhysicsManager::CheckCutWithCutVector(G4String name,
676 G4double value, TG3Cut& cut)
678 // Retrieves corresponding TG3Cut from the name and
679 // in case the value is different from the value in cutVector
680 // sets true the value of the fIsCutVector element
681 // corresponding to this cut and returns true;
682 // returns false otherwise.
685 // convert cut name -> TG3Cut
686 cut = GetG3Cut(name);
688 // set switch vector element only if the value
689 // is different from the value in cutVector
690 if (cut !=kNoG3Cuts) {
691 // get tolerance from TG4G3Defaults in GeV
692 G4double tolerance = TG4G3Defaults::CutTolerance()/GeV;
693 if (!(fCutVector) || (abs(value - (*fCutVector)[cut]) > tolerance)) {
694 SwitchIsCutVector(cut);
702 G4bool TG4PhysicsManager::CheckFlagWithFlagVector(G4String name,
703 G4double value, TG3Flag& flag)
705 // Retrieves corresponding TG3Flag from the name and
706 // in case the value is different from the value in flagVector
707 // sets true the value of the fIsFlagVector element
708 // corresponding to this flag and returns true;
709 // returns false otherwise.
712 // convert flag name -> TG3Flag
713 flag = GetG3Flag(name);
715 // set switch vector element only if the value
716 // is different from the value in flagVector
717 if (flag !=kNoG3Flags) {
718 if (!(fFlagVector) || (abs(value - (*fFlagVector)[flag]) > 0.01)) {
719 SwitchIsFlagVector(flag);
727 G4bool TG4PhysicsManager::CheckCutWithG3Defaults(G4String name,
728 G4double value, TG3Cut& cut)
730 // Retrieves corresponding TG3Cut from the name and
731 // in case the value is different from the G3 default value
732 // sets true the value of the SwitchCutVector element
733 // corresponding to this cut and returns true;
734 // returns false otherwise.
737 // convert cut name -> TG3Cut
738 cut = GetG3Cut(name);
740 // set switch vector element only if the value
741 // is different from G3 default
742 if (cut !=kNoG3Cuts) {
743 if (!TG4G3Defaults::IsDefaultCut(cut, value)) {
744 SwitchIsCutVector(cut);
752 G4bool TG4PhysicsManager::CheckFlagWithG3Defaults(G4String name,
753 G4double value, TG3Flag& flag)
755 // Retrieves corresponding TG3Flag from the name and
756 // in case the value is different from the G3 default value
757 // sets true the value of the SwitchFlagVector element
758 // corresponding to this flag and returns true;
759 // returns false otherwise.
762 // convert flag name -> TG3Flag
763 flag = GetG3Flag(name);
765 // set switch vector element only if the value
766 // is different from G3 default
767 if (flag !=kNoG3Flags) {
768 if (!TG4G3Defaults::IsDefaultFlag(flag, value)) {
769 SwitchIsFlagVector(flag);
777 void TG4PhysicsManager::SetG3DefaultCuts()
779 // Sets G3 default values of kinetic energy cuts.
782 if (fLock) LockException();
784 // create vector of kinetic energy cut values
785 fCutVector = new TG4CutVector();
787 fCutVector->SetG3Defaults();
790 void TG4PhysicsManager::SetG3DefaultProcesses()
792 // Sets G3 default values of control process flags.
795 if (fLock) LockException();
797 // create vector of control process flag values
798 fFlagVector = new TG4FlagVector;
800 fFlagVector->SetG3Defaults();
803 G4bool TG4PhysicsManager::IsSpecialCuts() const
805 // Returns true if any special cut value is set.
808 for (G4int i=0; i<kNofParticlesWSP; i++)
809 { if ((*fIsCutVector)[i]) return true; }
814 G4bool TG4PhysicsManager::IsSpecialFlags() const
816 // Returns true if any special flag value is set.
819 for (G4int i=0; i<kNofParticlesWSP; i++)
820 { if ((*fIsFlagVector)[i]) return true; }
825 TG3ParticleWSP TG4PhysicsManager::GetG3ParticleWSP(
826 G4ParticleDefinition* particle) const
828 // Returns TG3ParticleWSP constant for the specified particle.
829 // (See TG3ParticleWSP.h, too.)
832 G4String name = particle->GetParticleName();
833 G4String pType = particle->GetParticleType();
835 if (name == "gamma") {
838 else if (name == "e-") {
841 else if (name == "e+") {
844 else if (( pType == "baryon" || pType == "meson" || pType == "nucleus" )) {
845 if (particle->GetPDGCharge() == 0) {
846 return kNeutralHadron;
849 return kChargedHadron;
851 else if ( name == "mu-" || name == "mu+" ) {
855 return kNofParticlesWSP;
859 void TG4PhysicsManager::GetG3ParticleWSPName(G4int particleWSP,
860 G4String& name) const
862 // Fills the passed name with the name/type of particle specified
863 // by TG3ParticleWSP constant.
864 // (See TG3ParticleWSP.h, too.)
867 switch (particleWSP) {
878 name = "NeutralHadron";
881 name = "ChargedHadron";
889 case kNofParticlesWSP:
893 G4String text = "TG4PhysicsList::GetG3ParticleWSPName:\n";
894 text = text + " Wrong particleWSP.";
895 TG4Globals::Exception(text);