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.1)


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