Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/particles/management/src/G4ParticleDefinition.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /particles/management/src/G4ParticleDefinition.cc (Version 11.3.0) and /particles/management/src/G4ParticleDefinition.cc (Version 10.5.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4ParticleDefinition class implementation   << 
 27 //                                                 26 //
 28 // Authors: G.Cosmo, 2 December 1995 - Design, <<  27 //
 29 //          M.Asai, 29 January 1996 - First im <<  28 // 
 30 // History:                                    <<  29 // --------------------------------------------------------------
 31 // - 1996-2003, H.Kurashige - Revisions        <<  30 //  GEANT 4 class implementation file 
 32 // - 11.03.2003, H.Kurashige - Restructuring f <<  31 //
 33 // - 25.01.2013, G.Cosmo, A.Dotti - Introduced <<  32 //  History: first implementation, based on object model of
 34 // - 15.06.2017, K.L.Genser - Added support fo <<  33 //  2nd December 1995, G.Cosmo
 35 // ------------------------------------------- <<  34 //      ---------------- G4ParticleDefinition -----------------
                                                   >>  35 //      first implementation by Makoto Asai, 29 January 1996
                                                   >>  36 //      revised by G.Cosmo, 29 February 1996
                                                   >>  37 //      revised by H.Kurashige, 19 April 1996
                                                   >>  38 //      Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban, 26/6/96
                                                   >>  39 //      revised by H.Kurashige, 4 July 1996
                                                   >>  40 //      revised by H.Kurashige, 16 Feb 1997
                                                   >>  41 //      revised by H.Kurashige, 10 Nov 1997
                                                   >>  42 //      remove new/delete G4ProcessManager   by H.Kurashige  06 June 1998 
                                                   >>  43 //      added  Resonance flag and ApplyCuts flag  H.Kurashige 27  June 1998
                                                   >>  44 //      modify FillQuarkContents() for quarks/diquarks H.Kurashige 30 June 1998
                                                   >>  45 //      modify encoding rule H.Kurashige 23 Oct. 98
                                                   >>  46 //      modify FillQuarkContents() for deltas      25 Nov.,98 H.Kurashige
                                                   >>  47 //
                                                   >>  48 //      modify FillQuarkContents() to use G4PDGCodeChecker 17 Aug. 99 H.Kurashige
                                                   >>  49 //      modified for thread-safety for MT - G.Cosmo, A.Dotti - January 2013
                                                   >>  50 //      added support for MuonicAtom - K.L.Genser - June 2017
                                                   >>  51 // --------------------------------------------------------------
 36                                                    52 
 37 #include "G4ParticleDefinition.hh"             << 
 38                                                    53 
 39 #include "G4DecayTable.hh"                     <<  54 #include "G4ParticleDefinition.hh"
                                                   >>  55 #include "G4PhysicalConstants.hh"
                                                   >>  56 #include "G4SystemOfUnits.hh"
                                                   >>  57 #include "G4ParticleTable.hh"
 40 #include "G4IonTable.hh"                           58 #include "G4IonTable.hh"
                                                   >>  59 #include "G4DecayTable.hh"
 41 #include "G4PDGCodeChecker.hh"                     60 #include "G4PDGCodeChecker.hh"
 42 #include "G4ParticleTable.hh"                  << 
 43 #include "G4PhysicalConstants.hh"              << 
 44 #include "G4StateManager.hh"                       61 #include "G4StateManager.hh"
 45 #include "G4SystemOfUnits.hh"                  << 
 46 #include "G4Threading.hh"                      << 
 47 #include "G4UnitsTable.hh"                         62 #include "G4UnitsTable.hh"
 48                                                    63 
 49 // This new field helps to use the class G4PDe     64 // This new field helps to use the class G4PDefManager.
 50 //                                                 65 //
 51 G4PDefManager G4ParticleDefinition::subInstanc     66 G4PDefManager G4ParticleDefinition::subInstanceManager;
 52                                                    67 
 53 // This macro changes the references to fields     68 // This macro changes the references to fields that are now encapsulated
 54 // in the class G4PDefData.                        69 // in the class G4PDefData.
 55 //                                                 70 //
 56 #define G4MT_pmanager \                        <<  71 #define G4MT_pmanager ((subInstanceManager.offset()[g4particleDefinitionInstanceID]).theProcessManager)
 57   ((subInstanceManager.offset()[g4particleDefi << 
 58 #define G4MT_tmanager \                        << 
 59   ((subInstanceManager.offset()[g4particleDefi << 
 60                                                    72 
 61 // ------------------------------------------- << 
 62 // clang-format off                            << 
 63 G4ParticleDefinition::G4ParticleDefinition(        73 G4ParticleDefinition::G4ParticleDefinition(
 64         const G4String&     aName,                 74         const G4String&     aName,
 65         G4double            mass,                  75         G4double            mass,
 66         G4double            width,                 76         G4double            width,
 67         G4double            charge,                77         G4double            charge,
 68         G4int               iSpin,                 78         G4int               iSpin,
 69         G4int               iParity,               79         G4int               iParity,
 70         G4int               iConjugation,          80         G4int               iConjugation,
 71         G4int               iIsospin,              81         G4int               iIsospin,
 72         G4int               iIsospin3,             82         G4int               iIsospin3,
 73         G4int               gParity,               83         G4int               gParity,
 74         const G4String&     pType,                 84         const G4String&     pType,
 75         G4int               lepton,                85         G4int               lepton,
 76         G4int               baryon,                86         G4int               baryon,
 77         G4int               encoding,              87         G4int               encoding,
 78         G4bool              stable,                88         G4bool              stable,
 79         G4double            lifetime,              89         G4double            lifetime,
 80         G4DecayTable*       decaytable,        <<  90         G4DecayTable        *decaytable,
 81         G4bool              shortlived,            91         G4bool              shortlived,
 82         const G4String&     subType,               92         const G4String&     subType,
 83         G4int               anti_encoding,         93         G4int               anti_encoding,
 84         G4double            magneticMoment)        94         G4double            magneticMoment)
 85                                                    95 
 86     : theParticleName(aName),                      96     : theParticleName(aName),
 87       thePDGMass(mass),                            97       thePDGMass(mass),
 88       thePDGWidth(width),                          98       thePDGWidth(width),
 89       thePDGCharge(charge),                        99       thePDGCharge(charge),
 90       thePDGiSpin(iSpin),                         100       thePDGiSpin(iSpin),
 91       thePDGSpin(iSpin*0.5),                      101       thePDGSpin(iSpin*0.5),
 92       thePDGiParity(iParity),                     102       thePDGiParity(iParity),
 93       thePDGiConjugation(iConjugation),           103       thePDGiConjugation(iConjugation),
 94       thePDGiGParity(gParity),                    104       thePDGiGParity(gParity),
 95       thePDGiIsospin(iIsospin),                   105       thePDGiIsospin(iIsospin),
 96       thePDGiIsospin3(iIsospin3),                 106       thePDGiIsospin3(iIsospin3),
 97       thePDGIsospin(iIsospin*0.5),                107       thePDGIsospin(iIsospin*0.5),
 98       thePDGIsospin3(iIsospin3*0.5),              108       thePDGIsospin3(iIsospin3*0.5),
 99       thePDGMagneticMoment(magneticMoment),       109       thePDGMagneticMoment(magneticMoment),
100       theLeptonNumber(lepton),                    110       theLeptonNumber(lepton),
101       theBaryonNumber(baryon),                    111       theBaryonNumber(baryon),
102       theParticleType(pType),                     112       theParticleType(pType),
103       theParticleSubType(subType),                113       theParticleSubType(subType),
104       thePDGEncoding(encoding),                   114       thePDGEncoding(encoding),
105       theAntiPDGEncoding(-1*encoding),            115       theAntiPDGEncoding(-1*encoding),
106       fShortLivedFlag(shortlived),                116       fShortLivedFlag(shortlived),
107       thePDGStable(stable),                       117       thePDGStable(stable),
108       thePDGLifeTime(lifetime),                   118       thePDGLifeTime(lifetime),
109       theDecayTable(decaytable)                << 119       theDecayTable(decaytable),
110 // clang-format on                             << 120       theAtomicNumber(0),
                                                   >> 121       theAtomicMass(0),
                                                   >> 122       verboseLevel(1),
                                                   >> 123       fApplyCutsFlag(false),
                                                   >> 124       isGeneralIon(false),
                                                   >> 125       isMuonicAtom(false)
111 {                                                 126 {
112   static const G4String nucleus("nucleus");    << 127    static const G4String nucleus("nucleus");
113   static const G4String muAtom("MuonicAtom");  << 128    static const G4String muAtom("MuonicAtom"); 
114                                                   129 
115   g4particleDefinitionInstanceID = -1;         << 130    g4particleDefinitionInstanceID = -1;
116   theProcessManagerShadow = nullptr;           << 131    theProcessManagerShadow = 0;
117                                                   132 
118   theParticleTable = G4ParticleTable::GetParti << 133    theParticleTable = G4ParticleTable::GetParticleTable();
119                                                   134 
120   // set verboseLevel equal to ParticleTable   << 135    //set verboseLevel equal to ParticleTable 
121   verboseLevel = theParticleTable->GetVerboseL << 136    verboseLevel = theParticleTable->GetVerboseLevel();
122                                                   137 
123   if (anti_encoding != 0) theAntiPDGEncoding = << 138    if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding;
124                                                   139 
125   // check quark contents                      << 140    // check quark contents
126   if (this->FillQuarkContents() != thePDGEncod << 141    if (this->FillQuarkContents() != thePDGEncoding) {
127 #ifdef G4VERBOSE                                  142 #ifdef G4VERBOSE
128     if (verboseLevel > 0) {                    << 143      if (verboseLevel>0) {
129       // Using G4cout expecting that it is ava << 144        // Using G4cout expecting that it is available in construction of static objects 
130       // in construction of static objects     << 145        G4cout << "Particle " << aName << " has a strange PDGEncoding " <<G4endl;
131       G4cout << "Particle " << aName << " has  << 146      }
132     }                                          << 
133 #endif                                            147 #endif
134     G4Exception("G4ParticleDefintion::G4Partic << 148      G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
135                 "Strange PDGEncoding ");       << 149       "PART102", JustWarning, 
136   }                                            << 150       "Strange PDGEncoding ");
                                                   >> 151    }
137                                                   152 
138   // check initialization is in Pre_Init state << 153    // check initialization is in Pre_Init state except for ions
139   G4ApplicationState currentState = G4StateMan << 154    G4ApplicationState currentState = G4StateManager::GetStateManager()->GetCurrentState();
140                                                   155 
141   if (!fShortLivedFlag && (theParticleType !=  << 156    if ( !fShortLivedFlag && (theParticleType!=nucleus) && (theParticleType!=muAtom) && (currentState!=G4State_PreInit)){
142       && (currentState != G4State_PreInit))    << 
143   {                                            << 
144 #ifdef G4VERBOSE                                  157 #ifdef G4VERBOSE
145     if (GetVerboseLevel() > 0) {               << 158      if (GetVerboseLevel()>0) {
146       G4cout << "G4ParticleDefinition (other t << 159        G4cout << "G4ParticleDefintion (other than ions and shortlived) should be created in Pre_Init state  " 
147              << " should be created in Pre_Ini << 160               << aName << G4endl;
148     }                                          << 161      }
149 #endif                                            162 #endif
150     G4Exception("G4ParticleDefintion::G4Partic << 163      G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
151                 "G4ParticleDefinition should b << 164       "PART101", JustWarning, 
152   }                                            << 165       "G4ParticleDefinition should be created in PreInit state");
153                                                << 166    }
154   if (theParticleTable->GetIonTable()->IsIon(t << 167 
155     SetAtomicNumber(G4int(GetPDGCharge() / epl << 168    
156     SetAtomicMass(GetBaryonNumber());          << 169    if (theParticleTable->GetIonTable()->IsIon(this)) {
157   }                                            << 170      SetAtomicNumber( G4int(GetPDGCharge()/eplus) );
                                                   >> 171      SetAtomicMass( GetBaryonNumber() );
                                                   >> 172    }
                                                   >> 173   
                                                   >> 174    if (theParticleTable->GetIonTable()->IsAntiIon(this)) {
                                                   >> 175      SetAtomicNumber( std::abs(G4int(GetPDGCharge()/eplus)) );
                                                   >> 176      SetAtomicMass( std::abs(GetBaryonNumber()) );
                                                   >> 177    }
                                                   >> 178    
                                                   >> 179    // check name and register this particle into ParticleTable
                                                   >> 180    theParticleTable->Insert(this);
158                                                   181 
159   if (theParticleTable->GetIonTable()->IsAntiI << 182 }
160     SetAtomicNumber(std::abs(G4int(GetPDGCharg << 
161     SetAtomicMass(std::abs(GetBaryonNumber())) << 
162   }                                            << 
163                                                   183 
164   // check name and register this particle int << 184 G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &)
165   theParticleTable->Insert(this);              << 185 {
                                                   >> 186   G4Exception("G4ParticleDefinition::G4ParticleDefinition()",
                                                   >> 187         "PART001", FatalException,
                                                   >> 188         "Illegal call of copy Constructor for G4ParticleDefinition ");
166 }                                                 189 }
167                                                   190 
168 G4ParticleDefinition::G4ParticleDefinition()      191 G4ParticleDefinition::G4ParticleDefinition()
169 {                                                 192 {
170   G4Exception("G4ParticleDefinition::G4Particl << 193   G4Exception("G4ParticleDefinition::G4ParticleDefinition()",
171               "Illegal call of default constru << 194         "PART001", FatalException,
                                                   >> 195         "Illegal call of default Constructor for G4ParticleDefinition ");
172 }                                                 196 }
173                                                   197 
174 G4ParticleDefinition::~G4ParticleDefinition()  << 198 
                                                   >> 199 G4ParticleDefinition::~G4ParticleDefinition() 
175 {                                                 200 {
176   if (G4ParticleTable::GetParticleTable()->Get    201   if (G4ParticleTable::GetParticleTable()->GetReadiness()) {
177     G4StateManager* pStateManager = G4StateMan    202     G4StateManager* pStateManager = G4StateManager::GetStateManager();
178     G4ApplicationState currentState = pStateMa    203     G4ApplicationState currentState = pStateManager->GetCurrentState();
179     if (currentState != G4State_PreInit) {        204     if (currentState != G4State_PreInit) {
180       G4String msg = "Request of deletion for     205       G4String msg = "Request of deletion for ";
181       msg += GetParticleName();                << 206       msg += GetParticleName();  
182       msg += " has No effects because readyToU    207       msg += " has No effects because readyToUse is true.";
183       G4Exception("G4ParticleDefinition::~G4Pa << 208       G4Exception("G4ParticleDefinition::~G4ParticleDefinition()",
184       return;                                  << 209       "PART117", JustWarning, msg);
185     }                                          << 210       return ;
186                                                << 211     } else {
187 #ifdef G4VERBOSE                                  212 #ifdef G4VERBOSE
188     if (verboseLevel > 0) {                    << 213       if (verboseLevel>0){
189       G4cout << GetParticleName() << " will be << 214   G4cout << GetParticleName()
190     }                                          << 215          << " will be deleted " << G4endl;
                                                   >> 216       }
191 #endif                                            217 #endif
                                                   >> 218     }
192   }                                               219   }
193   delete theDecayTable;                        << 220 
                                                   >> 221   if (theDecayTable!= 0) delete theDecayTable;
194 }                                                 222 }
195                                                   223 
196 G4bool G4ParticleDefinition::operator==(const  << 224 
                                                   >> 225 const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right)
                                                   >> 226 {
                                                   >> 227   if (this != &right)  {
                                                   >> 228   } 
                                                   >> 229   return *this;
                                                   >> 230 }
                                                   >> 231 
                                                   >> 232 G4bool G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const
197 {                                                 233 {
198   return (this->theParticleName == right.thePa    234   return (this->theParticleName == right.theParticleName);
199 }                                                 235 }
200                                                   236 
201 G4bool G4ParticleDefinition::operator!=(const  << 237 G4bool G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const
202 {                                                 238 {
203   return (this->theParticleName != right.thePa    239   return (this->theParticleName != right.theParticleName);
204 }                                                 240 }
205                                                   241 
                                                   >> 242 
206 const G4PDefManager& G4ParticleDefinition::Get    243 const G4PDefManager& G4ParticleDefinition::GetSubInstanceManager()
                                                   >> 244   // Returns the private data instance manager.
207 {                                                 245 {
208   // Returns the private data instance manager << 
209   return subInstanceManager;                      246   return subInstanceManager;
210 }                                                 247 }
211                                                   248 
                                                   >> 249 
212 void G4ParticleDefinition::Clean()                250 void G4ParticleDefinition::Clean()
213 {                                              << 
214   // Clears memory allocated by sub-instance m    251   // Clears memory allocated by sub-instance manager
                                                   >> 252 {
215   subInstanceManager.FreeSlave();                 253   subInstanceManager.FreeSlave();
216 }                                                 254 }
217                                                   255 
218 G4ProcessManager* G4ParticleDefinition::GetPro << 
219 {                                              << 
220   if (g4particleDefinitionInstanceID < 0) retu << 
221   return G4MT_pmanager;                        << 
222 }                                              << 
223                                                   256 
224 G4VTrackingManager* G4ParticleDefinition::GetT << 257 G4ProcessManager* G4ParticleDefinition::GetProcessManager() const
225 {                                                 258 {
226   if (g4particleDefinitionInstanceID < 0) retu << 259     if(g4particleDefinitionInstanceID<0) return 0;
227   return G4MT_tmanager;                        << 260     return G4MT_pmanager;
228 }                                                 261 }
229                                                   262 
230 G4int G4ParticleDefinition::FillQuarkContents(    263 G4int G4ParticleDefinition::FillQuarkContents()
                                                   >> 264       //  calculate quark and anti-quark contents
                                                   >> 265       //  return value is PDG encoding for this particle.
                                                   >> 266       //  It means error if the return value is differnt from
                                                   >> 267       //  this->thePDGEncoding.
231 {                                                 268 {
232   // Calculate quark and anti-quark contents   << 
233   // Returned value is the PDG encoding for th << 
234   // It means error if the return value is dif << 
235   // this->thePDGEncoding                      << 
236                                                << 
237   G4int flavor;                                   269   G4int flavor;
238   for (flavor = 0; flavor < NumberOfQuarkFlavo << 270   for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){
239     theQuarkContent[flavor] = 0;               << 271     theQuarkContent[flavor]     = 0;
240     theAntiQuarkContent[flavor] = 0;              272     theAntiQuarkContent[flavor] = 0;
241   }                                               273   }
242                                                   274 
243   G4PDGCodeChecker checker;                       275   G4PDGCodeChecker checker;
244   checker.SetVerboseLevel(verboseLevel);          276   checker.SetVerboseLevel(verboseLevel);
245                                                   277 
246   G4int temp = checker.CheckPDGCode(thePDGEnco    278   G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType);
247                                                   279 
248   if (temp != 0) {                             << 280   if ( temp != 0) {
249     for (flavor = 0; flavor < NumberOfQuarkFla << 281     for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){
250       theQuarkContent[flavor] = checker.GetQua << 282       theQuarkContent[flavor]     = checker.GetQuarkContent(flavor);
251       theAntiQuarkContent[flavor] = checker.Ge    283       theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor);
252     }                                             284     }
253     if ((theParticleType == "meson") || (thePa << 285     if ((theParticleType == "meson")||(theParticleType == "baryon")) {
254       // check charge                             286       // check charge
255       if (!checker.CheckCharge(thePDGCharge))  << 287       if (!checker.CheckCharge(thePDGCharge) ){
256         temp = 0;                              << 288   temp = 0;
257         G4Exception("G4ParticleDefintion::G4Pa << 289   G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
258                     "Inconsistent charge again << 290       "PART103", JustWarning, 
                                                   >> 291       "Inconsistent charge against PDG code ");
259 #ifdef G4VERBOSE                                  292 #ifdef G4VERBOSE
260         if (verboseLevel > 0) {                << 293   if (verboseLevel>0) {
261           G4cout << "G4ParticleDefinition::Fil << 294     G4cout << "G4ParticleDefinition::FillQuarkContents  : "
262                  << " illegal charge (" << the << 295            << " illegal charge (" << thePDGCharge/eplus
263                  << G4endl;                    << 296            << " PDG code=" << thePDGEncoding <<G4endl;
264         }                                      << 297   }
265 #endif                                            298 #endif
266       }                                           299       }
267       // check spin                            << 300       // check spin 
268       if (checker.GetSpin() != thePDGiSpin) {     301       if (checker.GetSpin() != thePDGiSpin) {
269         temp = 0;                              << 302   temp=0;
270         G4Exception("G4ParticleDefintion::G4Pa << 303   G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
271                     "Inconsistent spin against << 304       "PART104", JustWarning, 
                                                   >> 305       "Inconsistent spin against PDG code ");
272 #ifdef G4VERBOSE                                  306 #ifdef G4VERBOSE
273         if (verboseLevel > 0) {                << 307   if (verboseLevel>0) {
274           G4cout << "G4ParticleDefinition::Fil << 308     G4cout << "G4ParticleDefinition::FillQuarkContents  : "
275                  << " illegal SPIN (" << thePD << 309            << " illegal SPIN (" << thePDGiSpin << "/2"
276                  << " PDG code=" << thePDGEnco << 310            << " PDG code=" << thePDGEncoding <<G4endl;
277         }                                      << 311   }
278 #endif                                            312 #endif
279       }                                           313       }
280     }                                             314     }
281   }                                               315   }
282   return temp;                                    316   return temp;
283 }                                                 317 }
284                                                   318 
                                                   >> 319 //-- No longer needed to access to G4IonTable.
                                                   >> 320 //-- Method GetIonLifeTime() itself is kept for compatibility
                                                   >> 321 //-- but moved to icc file as an inlined method.
                                                   >> 322 //G4double G4ParticleDefinition::GetIonLifeTime() const
                                                   >> 323 //{
                                                   >> 324 //  if(!isGeneralIon) return thePDGLifeTime;
                                                   >> 325 //
                                                   >> 326 //  G4IonTable* ionTable =  G4IonTable::GetIonTable();
                                                   >> 327 //  return ionTable->GetLifeTime(this);
                                                   >> 328 //}
                                                   >> 329 
285 void G4ParticleDefinition::DumpTable() const      330 void G4ParticleDefinition::DumpTable() const
286 {                                                 331 {
287   G4cout << G4endl;                               332   G4cout << G4endl;
288   G4cout << "--- G4ParticleDefinition ---" <<     333   G4cout << "--- G4ParticleDefinition ---" << G4endl;
289   G4cout << " Particle Name : " << theParticle    334   G4cout << " Particle Name : " << theParticleName << G4endl;
290   G4cout << " PDG particle code : " << thePDGE    335   G4cout << " PDG particle code : " << thePDGEncoding;
291   G4cout << " [PDG anti-particle code: " << th << 336   G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl;
292   G4cout << " Mass [GeV/c2] : " << thePDGMass  << 337   G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ;
293   G4cout << "     Width : " << thePDGWidth / G << 338   G4cout << "     Width : " << thePDGWidth/GeV << G4endl;
294   G4cout << " Lifetime [nsec] : " << thePDGLif << 339   G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl;
295   G4cout << " Charge [e]: " << thePDGCharge /  << 340   G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl;
296   G4cout << " Spin : " << thePDGiSpin << "/2"     341   G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl;
297   G4cout << " Parity : " << thePDGiParity << G    342   G4cout << " Parity : " << thePDGiParity << G4endl;
298   G4cout << " Charge conjugation : " << thePDG    343   G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl;
299   G4cout << " Isospin : (I,Iz): (" << thePDGiI << 344   G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2";
300   G4cout << " , " << thePDGiIsospin3 << "/2 )     345   G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl;
301   G4cout << " GParity : " << thePDGiGParity <<    346   G4cout << " GParity : " << thePDGiGParity << G4endl;
302   if (thePDGMagneticMoment != 0.0) {              347   if (thePDGMagneticMoment != 0.0) {
303     G4cout << " MagneticMoment [MeV/T] : " <<  << 348     G4cout << " MagneticMoment [MeV/T] : " << thePDGMagneticMoment/MeV*tesla << G4endl;
304   }                                               349   }
305   G4cout << " Quark contents     (d,u,s,c,b,t)    350   G4cout << " Quark contents     (d,u,s,c,b,t) : " << theQuarkContent[0];
306   G4cout << ", " << theQuarkContent[1];           351   G4cout << ", " << theQuarkContent[1];
307   G4cout << ", " << theQuarkContent[2];           352   G4cout << ", " << theQuarkContent[2];
308   G4cout << ", " << theQuarkContent[3];           353   G4cout << ", " << theQuarkContent[3];
309   G4cout << ", " << theQuarkContent[4];           354   G4cout << ", " << theQuarkContent[4];
310   G4cout << ", " << theQuarkContent[5] << G4en    355   G4cout << ", " << theQuarkContent[5] << G4endl;
311   G4cout << " AntiQuark contents                  356   G4cout << " AntiQuark contents               : " << theAntiQuarkContent[0];
312   G4cout << ", " << theAntiQuarkContent[1];       357   G4cout << ", " << theAntiQuarkContent[1];
313   G4cout << ", " << theAntiQuarkContent[2];       358   G4cout << ", " << theAntiQuarkContent[2];
314   G4cout << ", " << theAntiQuarkContent[3];       359   G4cout << ", " << theAntiQuarkContent[3];
315   G4cout << ", " << theAntiQuarkContent[4];       360   G4cout << ", " << theAntiQuarkContent[4];
316   G4cout << ", " << theAntiQuarkContent[5] <<     361   G4cout << ", " << theAntiQuarkContent[5] << G4endl;
317   G4cout << " Lepton number : " << theLeptonNu    362   G4cout << " Lepton number : " << theLeptonNumber;
318   G4cout << " Baryon number : " << theBaryonNu    363   G4cout << " Baryon number : " << theBaryonNumber << G4endl;
319   G4cout << " Particle type : " << theParticle << 364   G4cout << " Particle type : " << theParticleType ;
320   G4cout << " [" << theParticleSubType << "]"     365   G4cout << " [" << theParticleSubType << "]" << G4endl;
321                                                   366 
322   if ((theParticleTable->GetIonTable()->IsIon( << 367   if (   (theParticleTable->GetIonTable()->IsIon(this)) 
323       || (theParticleTable->GetIonTable()->IsA << 368       || (theParticleTable->GetIonTable()->IsAntiIon(this)) ) {
324   {                                            << 
325     G4cout << " Atomic Number : " << GetAtomic    369     G4cout << " Atomic Number : " << GetAtomicNumber();
326     G4cout << "  Atomic Mass : " << GetAtomicM << 370     G4cout << "  Atomic Mass : " << GetAtomicMass()  << G4endl;
327   }                                               371   }
328   if (fShortLivedFlag) {                       << 372   if ( fShortLivedFlag ){
329     G4cout << " ShortLived : ON" << G4endl;       373     G4cout << " ShortLived : ON" << G4endl;
330   }                                               374   }
331                                                   375 
332   if (IsGeneralIon()) {                        << 376   if ( IsGeneralIon() ) {
333     G4double lftm = GetIonLifeTime();             377     G4double lftm = GetIonLifeTime();
334     if (lftm < -1000.) {                       << 378     if(lftm<-1000.)
335       G4cout << " Stable : No data found -- un << 379     { G4cout << " Stable : No data found -- unknown" << G4endl; }
336     }                                          << 380     else if(lftm<0.)
337     else if (lftm < 0.) {                      << 381     { G4cout << " Stable : stable" << G4endl; }
338       G4cout << " Stable : stable" << G4endl;  << 382     else
339     }                                          << 383     {
340     else {                                     << 384       G4cout << " Stable : unstable -- lifetime = " << G4BestUnit(lftm,"Time") 
341       G4cout << " Stable : unstable -- lifetim << 385              << "\n  Decay table should be consulted to G4RadioactiveDecayProcess."
342              << "\n  Decay table should be con << 386              << G4endl;
343     }                                             387     }
344   }                                               388   }
345   else {                                       << 389   else
346     if (thePDGStable) {                        << 390   {
                                                   >> 391     if ( thePDGStable ){
347       G4cout << " Stable : stable" << G4endl;     392       G4cout << " Stable : stable" << G4endl;
348     }                                          << 393     } else {
349     else {                                     << 394       if( theDecayTable != 0 ){
350       if (theDecayTable != nullptr) {          << 
351         theDecayTable->DumpInfo();                395         theDecayTable->DumpInfo();
352       }                                        << 396       } else {
353       else {                                   << 397         G4cout << "Decay Table is not defined !!" <<G4endl;
354         G4cout << "Decay Table is not defined  << 
355       }                                           398       }
356     }                                             399     }
357   }                                               400   }
358 }                                                 401 }
359                                                   402 
360 void G4ParticleDefinition::SetApplyCutsFlag(G4    403 void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg)
361 {                                                 404 {
362   if (theParticleName == "gamma" || theParticl << 405   if(theParticleName=="gamma"
363       || theParticleName == "proton")          << 406   || theParticleName=="e-"
                                                   >> 407   || theParticleName=="e+"
                                                   >> 408   || theParticleName=="proton")
                                                   >> 409   { fApplyCutsFlag = flg; }
                                                   >> 410   else
364   {                                               411   {
365     fApplyCutsFlag = flg;                      << 412     G4cout
366   }                                            << 413      << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName
367   else {                                       << 414      << G4endl;
368     G4cout << "G4ParticleDefinition::SetApplyC << 415     G4cout
369     G4cout << "becomes obsolete. Production th << 416      << "becomes obsolete. Production threshold is applied only for "
370            << "gamma, e- ,e+ and proton." << G << 417      << "gamma, e- ,e+ and proton." << G4endl;
371   }                                               418   }
372 }                                                 419 }
373                                                   420 
374 G4double G4ParticleDefinition::CalculateAnomal << 421 G4double G4ParticleDefinition::CalculateAnomaly()  const
375 {                                              << 422 {
376   G4Exception("G4ParticleDefinition::G4Particl << 423   G4Exception( "G4ParticleDefintion::G4ParticleDefintion",
377               "CalculateAnomaly() method will  << 424                "PART114", JustWarning, 
378                                                << 425                "CalculateAnomaly() method will be removed in next release");
379   // gives the anomaly of magnetic moment for  << 426   
380   if (thePDGiSpin == 1) {                      << 427   // gives the anomaly of magnetic moment for spin 1/2 particles 
381     G4double muB = 0.5 * CLHEP::eplus * CLHEP: << 428   if (thePDGiSpin==1) {
382     return 0.5 * std::fabs(thePDGMagneticMomen << 429     G4double muB = 0.5*CLHEP::eplus*CLHEP::hbar_Planck/(thePDGMass/CLHEP::c_squared);
                                                   >> 430     return 0.5*std::fabs(thePDGMagneticMoment/muB - 2.*thePDGCharge/CLHEP::eplus);   
                                                   >> 431   } else {
                                                   >> 432     return 0.0;
383   }                                               433   }
384                                                << 
385   return 0.0;                                  << 
386 }                                                 434 }
387                                                   435 
388 void G4ParticleDefinition::SetParticleDefiniti    436 void G4ParticleDefinition::SetParticleDefinitionID(G4int id)
389 {                                                 437 {
390   if (id < 0) {                                << 438   if(id<0)
391     g4particleDefinitionInstanceID = subInstan << 439   {
                                                   >> 440     g4particleDefinitionInstanceID = subInstanceManager.CreateSubInstance(); 
392     G4MT_pmanager = nullptr;                      441     G4MT_pmanager = nullptr;
393   }                                               442   }
394   else {                                       << 443   else
395     if (isGeneralIon || isMuonicAtom) {        << 444   {
396       g4particleDefinitionInstanceID = id;     << 445     if( isGeneralIon || isMuonicAtom )
397     }                                          << 446     { g4particleDefinitionInstanceID = id; }
398     else {                                     << 447     else
                                                   >> 448     {
399       G4ExceptionDescription ed;                  449       G4ExceptionDescription ed;
400       ed << "ParticleDefinitionID should not b << 450       ed << "ParticleDefinitionID should not be set for the particles <"
401       G4Exception("G4ParticleDefintion::SetPar << 451          << theParticleName << ">.";
                                                   >> 452       G4Exception( "G4ParticleDefintion::SetParticleDefinitionID","PART10114",
                                                   >> 453                    FatalException,ed);
402     }                                             454     }
403   }                                               455   }
404 }                                                 456 }
405                                                   457 
406 void G4ParticleDefinition::SetProcessManager(G << 458 #include "G4Threading.hh"
                                                   >> 459 
                                                   >> 460 void G4ParticleDefinition::SetProcessManager(G4ProcessManager *aProcessManager)
407 {                                                 461 {
408   if (g4particleDefinitionInstanceID < 0 && !i << 462   if(g4particleDefinitionInstanceID<0 && !isGeneralIon)
409     if (G4Threading::G4GetThreadId() >= 0) {   << 463   {
                                                   >> 464     if(G4Threading::G4GetThreadId() >= 0)
                                                   >> 465     {
410       G4ExceptionDescription ed;                  466       G4ExceptionDescription ed;
411       ed << "ProcessManager is being set to "     467       ed << "ProcessManager is being set to " << theParticleName
412          << " without proper initialization of    468          << " without proper initialization of TLS pointer vector.\n"
413          << "This operation is thread-unsafe."    469          << "This operation is thread-unsafe.";
414       G4Exception("G4ParticleDefintion::SetPro << 470       G4Exception( "G4ParticleDefintion::SetProcessManager","PART10116",
                                                   >> 471                    JustWarning,ed);
415     }                                             472     }
416     SetParticleDefinitionID();                    473     SetParticleDefinitionID();
417   }                                               474   }
418   G4MT_pmanager = aProcessManager;                475   G4MT_pmanager = aProcessManager;
419 }                                              << 
420                                                << 
421 void G4ParticleDefinition::SetTrackingManager( << 
422 {                                              << 
423   if (g4particleDefinitionInstanceID < 0 && !i << 
424     if (G4Threading::G4GetThreadId() >= 0) {   << 
425       G4ExceptionDescription ed;               << 
426       ed << "TrackingManager is being set to " << 
427          << " without proper initialization of << 
428          << "This operation is thread-unsafe." << 
429       G4Exception("G4ParticleDefintion::SetTra << 
430     }                                          << 
431     SetParticleDefinitionID();                 << 
432   }                                            << 
433   G4MT_tmanager = aTrackingManager;            << 
434 }                                                 476 }
435                                                   477