00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #include "G4ParticleDefinition.hh"
00054 #include "G4PhysicalConstants.hh"
00055 #include "G4SystemOfUnits.hh"
00056 #include "G4ParticleTable.hh"
00057 #include "G4IonTable.hh"
00058 #include "G4DecayTable.hh"
00059 #include "G4PDGCodeChecker.hh"
00060 #include "G4StateManager.hh"
00061
00062 G4ParticleDefinition::G4ParticleDefinition(
00063 const G4String& aName,
00064 G4double mass,
00065 G4double width,
00066 G4double charge,
00067 G4int iSpin,
00068 G4int iParity,
00069 G4int iConjugation,
00070 G4int iIsospin,
00071 G4int iIsospin3,
00072 G4int gParity,
00073 const G4String& pType,
00074 G4int lepton,
00075 G4int baryon,
00076 G4int encoding,
00077 G4bool stable,
00078 G4double lifetime,
00079 G4DecayTable *decaytable,
00080 G4bool shortlived,
00081 const G4String& subType,
00082 G4int anti_encoding,
00083 G4double magneticMoment)
00084
00085 : theParticleName(aName),
00086 thePDGMass(mass),
00087 thePDGWidth(width),
00088 thePDGCharge(charge),
00089 thePDGiSpin(iSpin),
00090 thePDGSpin(iSpin*0.5),
00091 thePDGiParity(iParity),
00092 thePDGiConjugation(iConjugation),
00093 thePDGiGParity(gParity),
00094 thePDGiIsospin(iIsospin),
00095 thePDGiIsospin3(iIsospin3),
00096 thePDGIsospin(iIsospin*0.5),
00097 thePDGIsospin3(iIsospin3*0.5),
00098 thePDGMagneticMoment(magneticMoment),
00099 theLeptonNumber(lepton),
00100 theBaryonNumber(baryon),
00101 theParticleType(pType),
00102 theParticleSubType(subType),
00103 thePDGEncoding(encoding),
00104 theAntiPDGEncoding(-1*encoding),
00105 fShortLivedFlag(shortlived),
00106 thePDGStable(stable),
00107 thePDGLifeTime(lifetime),
00108 theDecayTable(decaytable),
00109 theProcessManager(0),
00110 theAtomicNumber(0),
00111 theAtomicMass(0),
00112 verboseLevel(1),
00113 fApplyCutsFlag(false)
00114 {
00115 static G4String nucleus("nucleus");
00116 theParticleTable = G4ParticleTable::GetParticleTable();
00117
00118
00119 verboseLevel = theParticleTable->GetVerboseLevel();
00120
00121 if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding;
00122
00123
00124 if (this->FillQuarkContents() != thePDGEncoding) {
00125 #ifdef G4VERBOSE
00126 if (verboseLevel>0) {
00127
00128 G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<G4endl;
00129 }
00130 #endif
00131 G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
00132 "PART102", JustWarning,
00133 "Strange PDGEncoding ");
00134 }
00135
00136
00137 G4ApplicationState currentState = G4StateManager::GetStateManager()->GetCurrentState();
00138
00139 if ( !fShortLivedFlag && (theParticleType!=nucleus) && (currentState!=G4State_PreInit)){
00140 #ifdef G4VERBOSE
00141 if (GetVerboseLevel()>0) {
00142 G4cerr << "G4ParticleDefintion (other than ions and shortlived) should be created in Pre_Init state "
00143 << aName << G4endl;
00144 }
00145 #endif
00146 G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
00147 "PART101", JustWarning,
00148 "G4ParticleDefinition should be created in PreInit state");
00149 }
00150
00151
00152 if (theParticleTable->GetIonTable()->IsIon(this)) {
00153 SetAtomicNumber( G4int(GetPDGCharge()/eplus) );
00154 SetAtomicMass( GetBaryonNumber() );
00155 }
00156
00157 if (theParticleTable->GetIonTable()->IsAntiIon(this)) {
00158 SetAtomicNumber( std::abs(G4int(GetPDGCharge()/eplus)) );
00159 SetAtomicMass( std::abs(GetBaryonNumber()) );
00160 }
00161
00162
00163 theParticleTable->Insert(this);
00164
00165 }
00166
00167 G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &)
00168 {
00169 G4Exception("G4ParticleDefinition::G4ParticleDefinition()",
00170 "PART001", FatalException,
00171 "Illegal call of copy Constructor for G4ParticleDefinition ");
00172 }
00173
00174 G4ParticleDefinition::G4ParticleDefinition()
00175 {
00176 G4Exception("G4ParticleDefinition::G4ParticleDefinition()",
00177 "PART001", FatalException,
00178 "Illegal call of default Constructor for G4ParticleDefinition ");
00179 }
00180
00181
00182 G4ParticleDefinition::~G4ParticleDefinition()
00183 {
00184 if (G4ParticleTable::GetParticleTable()->GetReadiness()) {
00185 G4StateManager* pStateManager = G4StateManager::GetStateManager();
00186 G4ApplicationState currentState = pStateManager->GetCurrentState();
00187 if (currentState != G4State_PreInit) {
00188 G4String msg = "Request of deletion for ";
00189 msg += GetParticleName();
00190 msg += " has No effects because readyToUse is true.";
00191 G4Exception("G4ParticleDefinition::~G4ParticleDefinition()",
00192 "PART117", JustWarning, msg);
00193 return ;
00194 } else {
00195 #ifdef G4VERBOSE
00196 if (verboseLevel>0){
00197 G4cout << GetParticleName()
00198 << " will be deleted " << G4endl;
00199 }
00200 #endif
00201 }
00202 }
00203
00204 if (theDecayTable!= 0) delete theDecayTable;
00205 }
00206
00207
00208 const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right)
00209 {
00210 if (this != &right) {
00211 }
00212 return *this;
00213 }
00214
00215 G4int G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const
00216 {
00217 return (this->theParticleName == right.theParticleName);
00218 }
00219
00220 G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const
00221 {
00222 return (this->theParticleName != right.theParticleName);
00223 }
00224
00225
00226
00227 G4int G4ParticleDefinition::FillQuarkContents()
00228
00229
00230
00231
00232 {
00233 G4int flavor;
00234 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){
00235 theQuarkContent[flavor] = 0;
00236 theAntiQuarkContent[flavor] = 0;
00237 }
00238
00239 G4PDGCodeChecker checker;
00240 checker.SetVerboseLevel(verboseLevel);
00241
00242 G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType);
00243
00244 if ( temp != 0) {
00245 for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){
00246 theQuarkContent[flavor] = checker.GetQuarkContent(flavor);
00247 theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor);
00248 }
00249 if ((theParticleType == "meson")||(theParticleType == "baryon")) {
00250
00251 if (!checker.CheckCharge(thePDGCharge) ){
00252 temp = 0;
00253 G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
00254 "PART103", JustWarning,
00255 "Inconsistent charge against PDG code ");
00256 #ifdef G4VERBOSE
00257 if (verboseLevel>0) {
00258 G4cerr << "G4ParticleDefinition::FillQuarkContents : "
00259 << " illegal charge (" << thePDGCharge/eplus
00260 << " PDG code=" << thePDGEncoding <<G4endl;
00261 }
00262 #endif
00263 }
00264
00265 if (checker.GetSpin() != thePDGiSpin) {
00266 temp=0;
00267 G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
00268 "PART104", JustWarning,
00269 "Inconsistent spin against PDG code ");
00270 #ifdef G4VERBOSE
00271 if (verboseLevel>0) {
00272 G4cerr << "G4ParticleDefinition::FillQuarkContents : "
00273 << " illegal SPIN (" << thePDGiSpin << "/2"
00274 << " PDG code=" << thePDGEncoding <<G4endl;
00275 }
00276 #endif
00277 }
00278 }
00279 }
00280 return temp;
00281 }
00282
00283 void G4ParticleDefinition::DumpTable() const
00284 {
00285 G4cout << G4endl;
00286 G4cout << "--- G4ParticleDefinition ---" << G4endl;
00287 G4cout << " Particle Name : " << theParticleName << G4endl;
00288 G4cout << " PDG particle code : " << thePDGEncoding;
00289 G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl;
00290 G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ;
00291 G4cout << " Width : " << thePDGWidth/GeV << G4endl;
00292 G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl;
00293 G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl;
00294 G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl;
00295 G4cout << " Parity : " << thePDGiParity << G4endl;
00296 G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl;
00297 G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2";
00298 G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl;
00299 G4cout << " GParity : " << thePDGiGParity << G4endl;
00300 if (thePDGMagneticMoment != 0.0) {
00301 G4cout << " MagneticMoment [MeV/T] : " << thePDGMagneticMoment/MeV*tesla << G4endl;
00302 }
00303 G4cout << " Quark contents (d,u,s,c,b,t) : " << theQuarkContent[0];
00304 G4cout << ", " << theQuarkContent[1];
00305 G4cout << ", " << theQuarkContent[2];
00306 G4cout << ", " << theQuarkContent[3];
00307 G4cout << ", " << theQuarkContent[4];
00308 G4cout << ", " << theQuarkContent[5] << G4endl;
00309 G4cout << " AntiQuark contents : " << theAntiQuarkContent[0];
00310 G4cout << ", " << theAntiQuarkContent[1];
00311 G4cout << ", " << theAntiQuarkContent[2];
00312 G4cout << ", " << theAntiQuarkContent[3];
00313 G4cout << ", " << theAntiQuarkContent[4];
00314 G4cout << ", " << theAntiQuarkContent[5] << G4endl;
00315 G4cout << " Lepton number : " << theLeptonNumber;
00316 G4cout << " Baryon number : " << theBaryonNumber << G4endl;
00317 G4cout << " Particle type : " << theParticleType ;
00318 G4cout << " [" << theParticleSubType << "]" << G4endl;
00319
00320 if ( (theParticleTable->GetIonTable()->IsIon(this))
00321 || (theParticleTable->GetIonTable()->IsAntiIon(this)) ) {
00322 G4cout << " Atomic Number : " << GetAtomicNumber();
00323 G4cout << " Atomic Mass : " << GetAtomicMass() << G4endl;
00324 }
00325 if ( fShortLivedFlag ){
00326 G4cout << " ShortLived : ON" << G4endl;
00327 }
00328
00329 if ( thePDGStable ){
00330 G4cout << " Stable : stable" << G4endl;
00331 } else {
00332 if( theDecayTable != 0 ){
00333 theDecayTable->DumpInfo();
00334 } else {
00335 G4cout << "Decay Table is not defined !!" <<G4endl;
00336 }
00337 }
00338
00339 }
00340
00341 void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg)
00342 {
00343 if(theParticleName=="gamma"
00344 || theParticleName=="e-"
00345 || theParticleName=="e+"
00346 || theParticleName=="proton")
00347 { fApplyCutsFlag = flg; }
00348 else
00349 {
00350 G4cerr
00351 << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName
00352 << G4endl;
00353 G4cerr
00354 << "becomes obsolete. Production threshold is applied only for "
00355 << "gamma, e- ,e+ and proton." << G4endl;
00356 }
00357 }