Remove G4ParticleDefinition dependance.

This commit is contained in:
paraiso 2006-02-24 14:35:24 +00:00
parent cd724f2691
commit 10b30dd9a5
3 changed files with 0 additions and 746 deletions

View File

@ -1,290 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.cc,v 1.23 2005/01/14 03:00:39 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-patch-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ---------------- G4ParticleDefinition -----------------
// first implementation by Makoto Asai, 29 January 1996
// revised by G.Cosmo, 29 February 1996
// revised by H.Kurashige, 19 April 1996
// Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban, 26/6/96
// revised by H.Kurashige, 4 July 1996
// revised by H.Kurashige, 16 Feb 1997
// revised by H.Kurashige, 10 Nov 1997
// remove new/delete G4ProcessManager by H.Kurashige 06 June 1998
// added Resonance flag and ApplyCuts flag H.Kurashige 27 June 1998
// modify FillQuarkContents() for quarks/diquarks H.Kurashige 30 June 1998
// modify encoding rule H.Kurashige 23 Oct. 98
// modify FillQuarkContents() for deltas 25 Nov.,98 H.Kurashige
//
// modify FillQuarkContents() to use G4PDGCodeChecker 17 Aug. 99 H.Kurashige
// added Gyromagnetic Factors T.K.Paraïso Okt. 05
// --------------------------------------------------------------
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4DecayTable.hh"
#include "G4PDGCodeChecker.hh"
G4ParticleDefinition::G4ParticleDefinition(
const G4String& aName,
G4double mass,
G4double width,
G4double charge,
G4int iSpin,
G4int iParity,
G4int iConjugation,
G4int iIsospin,
G4int iIsospin3,
G4int gParity,
const G4String& pType,
G4int lepton,
G4int baryon,
G4int encoding,
G4bool stable,
G4double lifetime,
G4DecayTable *decaytable,
G4bool shortlived,
const G4String& subType,
G4int anti_encoding,
G4double gFactor)
: theParticleName(aName),
thePDGMass(mass),
thePDGWidth(width),
thePDGCharge(charge),
thePDGiSpin(iSpin),
thePDGSpin(iSpin*0.5),
thePDGiParity(iParity),
thePDGiConjugation(iConjugation),
thePDGiGParity(gParity),
thePDGiIsospin(iIsospin),
thePDGiIsospin3(iIsospin3),
thePDGIsospin(iIsospin*0.5),
thePDGIsospin3(iIsospin3*0.5),
theLeptonNumber(lepton),
theBaryonNumber(baryon),
theParticleType(pType),
theParticleSubType(subType),
thePDGEncoding(encoding),
theAntiPDGEncoding(-1*encoding),
fShortLivedFlag(shortlived),
thePDGStable(stable),
thePDGLifeTime(lifetime),
theDecayTable(decaytable),
theProcessManager(0),
theAtomicNumber(0),
theAtomicMass(0),
theGyromagneticFactor(gFactor),//absolute value tao
theGyromagneticRatio(gFactor*charge/(2*mass/(c_light*c_light))),
verboseLevel(1),
fApplyCutsFlag(false)
{
// tao
// check name and register this particle into ParticleTable
theParticleTable = G4ParticleTable::GetParticleTable();
theParticleTable->Insert(this);
if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding;
// check quark contents
#ifdef G4VERBOSE
if (this->FillQuarkContents() != thePDGEncoding) {
if (verboseLevel>0) {
// cerr bnot G4cerr is used intentionally
// because G4ParticleDefinition constructor may be called
// before G4cerr object is instantiated !!
G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<G4endl;
}
}
#endif
}
G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &)
{
G4Exception("You call Copy Constructor of G4ParticleDefinition ");
}
G4ParticleDefinition::G4ParticleDefinition()
{
G4Exception("You call Default Constructor of G4ParticleDefinition ");
}
G4ParticleDefinition::~G4ParticleDefinition()
{
if (theDecayTable!= 0) delete theDecayTable;
}
const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right)
{
if (this != &right) {
}
return *this;
}
G4int G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const
{
return (this->theParticleName == right.theParticleName);
}
G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const
{
return (this->theParticleName != right.theParticleName);
}
G4int G4ParticleDefinition::FillQuarkContents()
// calculate quark and anti-quark contents
// return value is PDG encoding for this particle.
// It means error if the return value is differnt from
// this->thePDGEncoding.
{
G4int flavor;
for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){
theQuarkContent[flavor] = 0;
theAntiQuarkContent[flavor] = 0;
}
G4PDGCodeChecker checker;
G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType);
if ( temp != 0) {
for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){
theQuarkContent[flavor] = checker.GetQuarkContent(flavor);
theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor);
}
if ((theParticleType == "meson")||(theParticleType == "baryon")) {
// check charge
if (!checker.CheckCharge(thePDGCharge) ){
temp = 0;
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal charge (" << thePDGCharge/eplus;
G4cout << " PDG code=" << thePDGEncoding <<G4endl;
}
#endif
}
// check spin
if (checker.GetSpin() != thePDGiSpin) {
temp=0;
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal SPIN (" << thePDGiSpin << "/2";
G4cout << " PDG code=" << thePDGEncoding <<G4endl;
}
#endif
}
}
}
return temp;
}
void G4ParticleDefinition::DumpTable() const
{
G4cout << G4endl;
G4cout << "--- G4ParticleDefinition ---" << G4endl;
G4cout << " Particle Name : " << theParticleName << G4endl;
G4cout << " PDG particle code : " << thePDGEncoding;
G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl;
G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ;
G4cout << " Width : " << thePDGWidth/GeV << G4endl;
G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl;
G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl;
G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl;
G4cout << " Parity : " << thePDGiParity << G4endl;
G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl;
G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2";
G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl;
G4cout << " GParity : " << thePDGiGParity << G4endl;
G4cout << " Quark contents (d,u,s,c,b,t) : " << theQuarkContent[0];
G4cout << ", " << theQuarkContent[1];
G4cout << ", " << theQuarkContent[2];
G4cout << ", " << theQuarkContent[3];
G4cout << ", " << theQuarkContent[4];
G4cout << ", " << theQuarkContent[5] << G4endl;
G4cout << " AntiQuark contents : " << theAntiQuarkContent[0];
G4cout << ", " << theAntiQuarkContent[1];
G4cout << ", " << theAntiQuarkContent[2];
G4cout << ", " << theAntiQuarkContent[3];
G4cout << ", " << theAntiQuarkContent[4];
G4cout << ", " << theAntiQuarkContent[5] << G4endl;
G4cout << " Lepton number : " << theLeptonNumber;
G4cout << " Baryon number : " << theBaryonNumber << G4endl;
G4cout << " Particle type : " << theParticleType ;
G4cout << " [" << theParticleSubType << "]" << G4endl;
if ( fShortLivedFlag ){
G4cout << " ShortLived : ON" << G4endl;
}
if ( thePDGStable ){
G4cout << " Stable : stable" << G4endl;
} else {
if( theDecayTable != 0 ){
theDecayTable->DumpInfo();
} else {
G4cout << "Decay Table is not defined !!" <<G4endl;
}
}
}
void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg)
{
if(theParticleName=="gamma"
|| theParticleName=="e-"
|| theParticleName=="e+")
{ fApplyCutsFlag = flg; }
else
{
G4cerr
<< "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName
<< G4endl;
G4cerr
<< "becomes obsolete. Production threshold is applied only for "
<< "gamma, e- and e+." << G4endl;
}
}

View File

@ -1,334 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.hh,v 1.27 2005/01/14 03:00:38 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-patch-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ---------------- G4ParticleDefinition ----------------
// first implementation by Makoto Asai, 29 January 1996
// revised by G.Cosmo, 29 February 1996
// revised by H.Kurashige, 19 April 1996
// revised by H.Kurashige, 4 July 1996
// added GetEnergyCuts() and GetLengthCuts() by G.Cosmo, 11 July 1996
// added Set/GetVerboseLevel() H.Kurashige 11 Nov. 1997
// added SetCuts() and ResetCuts H.Kurashige 15 Nov.1996
// change SetProcessManager as public H.Kurashige 06 June 1998
// added GetEnergyThreshold H.Kurashige 08 June 1998
// added ShortLived flag and ApplyCuts flag H.Kurashige 27 June 1998
// fixed some improper codings H.Kurashige 08 Apr. 1999
// added sub-type H.Kurashige 15 Feb. 2000
// added RestoreCuts H.Kurashige 09 Mar. 2001
// restructuring for Cuts per Region by Hisaya 11 MAr.2003
// added Gyromagnetic Factors T.K.Paraïso Okt. 05
// ------------------------------------------------------------
#ifndef G4ParticleDefinition_h
#define G4ParticleDefinition_h 1
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
class G4ProcessManager;
class G4DecayTable;
class G4ParticleTable;
class G4ParticlePropertyTable;
class G4ParticleDefinition
{
// Class Description
// This class containes all the static data of a particle.
// It also has uses a process manager in order to collect
// all the processes this kind of particle can undertake.
//
friend class G4ParticlePropertyTable;
public: // With Description
// Only one type of constructor can be used for G4ParticleDefinition.
// If you want to create new particle, you must set name of the particle
// at construction. Most of members seen as arguments of the constructor
// (except last 3 arguments concerning with decay ) are "constant"
// and can not be changed later. (No "SET" methods are available)
// Each type of particle must be constructed as a unique static object
// of special class derived from G4ParticleDefinition.
// see G4ParticleTypes for detail
G4ParticleDefinition(const G4String& aName,
G4double mass,
G4double width,
G4double charge,
G4int iSpin,
G4int iParity,
G4int iConjugation,
G4int iIsospin,
G4int iIsospinZ,
G4int gParity,
const G4String& pType,
G4int lepton,
G4int baryon,
G4int encoding,
G4bool stable,
G4double lifetime,
G4DecayTable *decaytable,
G4bool shortlived = false,
const G4String& subType ="",
G4int anti_encoding =0,
G4double gFactor=2.0023193);
virtual ~G4ParticleDefinition();
public: // With Description
// By these following Getxxxx methods, you can get values
// for members which can not be changed
//
const G4String& GetParticleName() const { return theParticleName; }
G4double GetPDGMass() const { return thePDGMass; }
G4double GetPDGWidth() const { return thePDGWidth; }
G4double GetPDGCharge() const { return thePDGCharge; }
G4double GetPDGSpin() const { return thePDGSpin; }
G4int GetPDGiSpin() const { return thePDGiSpin; }
G4int GetPDGiParity() const { return thePDGiParity; }
G4int GetPDGiConjugation() const { return thePDGiConjugation; }
G4double GetPDGIsospin() const { return thePDGIsospin; }
G4double GetPDGIsospin3() const { return thePDGIsospin3; }
G4int GetPDGiIsospin() const { return thePDGiIsospin; }
G4int GetPDGiIsospin3() const { return thePDGiIsospin3; }
G4int GetPDGiGParity() const { return thePDGiGParity; }
const G4String& GetParticleType() const { return theParticleType; }
const G4String& GetParticleSubType() const { return theParticleSubType; }
G4int GetLeptonNumber() const { return theLeptonNumber; }
G4int GetBaryonNumber() const { return theBaryonNumber; }
G4int GetPDGEncoding() const { return thePDGEncoding; }
G4int GetAntiPDGEncoding() const { return theAntiPDGEncoding; }
void SetAntiPDGEncoding(G4int aEncoding);
G4int GetQuarkContent(G4int flavor) const;
G4int GetAntiQuarkContent(G4int flavor) const;
// return the number of quark with flavor contained in this particle.
// The value of flavor is assigned as follows
// 1:d, 2:u, 3:s, 4:c, 5:b, 6:t
public: // With Description
// ShortLived flag
G4bool IsShortLived() const { return fShortLivedFlag; }
G4bool GetPDGStable() const { return thePDGStable; }
void SetPDGStable(const G4bool aFlag) { thePDGStable=aFlag; }
G4double GetPDGLifeTime() const { return thePDGLifeTime; }
void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime = aLifeTime; }
public:// With Description
G4DecayTable* GetDecayTable();
void SetDecayTable(G4DecayTable* aDecayTable);
// Set/Get Decay Table
// !! Decay Table can be modified !!
public: // With Description
G4ProcessManager* GetProcessManager() const;
void SetProcessManager(G4ProcessManager* aProcessManager);
// Set/Get Process Manager
// !! Process Manager can be modified !!
G4ParticleTable* GetParticleTable();
// get pointer to the particle table
void DumpTable() const;
// Prints information of data members.
protected:
G4int FillQuarkContents();
// calculate quark and anti-quark contents
// return value is PDG encoding for this particle.
// It means error if the return value is deffernt from
// this->thePDGEncoding.
void SetParticleSubType(const G4String& subtype);
public:
void SetAtomicNumber(G4int);
G4int GetAtomicNumber() const;
void SetAtomicMass(G4int);
G4int GetAtomicMass() const;
G4double GetGyromagneticFactor() const { return theGyromagneticFactor; }
void SetGyromagneticFactor(G4double ge) { theGyromagneticFactor = ge; }
G4double GetGyromagneticRatio() const { return theGyromagneticRatio; }
void SetGyromagneticRatio(G4double gamma) { theGyromagneticRatio = gamma; }
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
// controle flag for output message
// 0: Silent
// 1: Warning message
// 2: More
protected:
// !!! can not use "copy constructor" nor "default constructor" !!!!
G4ParticleDefinition(const G4ParticleDefinition &right);
G4ParticleDefinition();
private:
// !!! Assignment operation is forbidden !!!
const G4ParticleDefinition & operator=(const G4ParticleDefinition &right);
public:
G4int operator==(const G4ParticleDefinition &right) const;
G4int operator!=(const G4ParticleDefinition &right) const;
private:
// Values following can not be changed
// i.e. No Setxxxx Methods for them
G4String theParticleName;
// The name of the particle.
// Each object must have its specific name!!
// --- following member values must be defined with Units
G4double thePDGMass;
// The mass of the particle, in units of equivalent energy.
G4double thePDGWidth;
// The decay width of the particle, usually the width of a
// Breit-Wigner function, assuming that you are near the
// mass center anyway. (in units of equivalent energy)
G4double thePDGCharge;
// The charge of the particle.(in units of Coulomb)
// ---- following members are quantum number
// i.e. discrete numbers can be allowded
// So, you can defined only by using integer in constructor
G4int thePDGiSpin;
// The total spin of the particle, also often denoted as
// capital J, in units of 1/2.
G4double thePDGSpin;
// The total spin of the particle, in units of 1.
G4int thePDGiParity;
// The parity quantum number, in units of 1. If the parity
// is not defined for this particle, we will set this to 0.
G4int thePDGiConjugation;
// This charge conjugation quantum number in units of 1.
G4int thePDGiGParity;
// The value of the G-parity quantum number.
G4int thePDGiIsospin;
G4int thePDGiIsospin3;
// The isospin and its 3rd-component in units of 1/2.
G4double thePDGIsospin;
G4double thePDGIsospin3;
// The isospin quantum number in units of 1.
G4int theLeptonNumber;
// The lepton quantum number.
G4int theBaryonNumber;
// The baryon quantum number.
G4String theParticleType;
// More general textual type description of the particle.
G4String theParticleSubType;
// Textual type description of the particle
// eg. pion, lamda etc.
G4int thePDGEncoding;
// The Particle Data Group integer identifier of this particle
G4int theAntiPDGEncoding;
// The Particle Data Group integer identifier of the anti-particle
protected:
enum {NumberOfQuarkFlavor = 6};
G4int theQuarkContent[NumberOfQuarkFlavor];
G4int theAntiQuarkContent[NumberOfQuarkFlavor];
// the number of quark (minus Sign means anti-quark) contents
// The value of flavor is assigned as follows
// 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
private:
// Following members can be changed after construction
G4bool fShortLivedFlag;
// Particles which have true value of this flag
// will not be tracked by TrackingManager
G4bool thePDGStable;
// Is an indicator that this particle is stable. It must
// not decay. If the user tries to assign a kind of decay
// object to it, it will refuse to take it.
G4double thePDGLifeTime;
// Is related to the decay width of the particle. The mean
// life time is given in seconds.
class G4DecayTable *theDecayTable;
// Points DecayTable
private:
class G4ProcessManager *theProcessManager;
// Points to G4ProcessManager
G4ParticleTable* theParticleTable;
private:
G4int theAtomicNumber;
G4int theAtomicMass;
G4double theGyromagneticFactor;
// The gyromanetic factor of the particle
G4double theGyromagneticRatio;
// The gyromanetic ratio of the particle
private:
G4int verboseLevel;
private:
G4bool fApplyCutsFlag;
public:
void SetApplyCutsFlag(G4bool);
G4bool GetApplyCutsFlag() const;
};
#include "G4ParticleDefinition.icc"
#endif

View File

@ -1,122 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.icc,v 1.8 2004/12/02 08:08:58 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
inline
G4ParticleTable* G4ParticleDefinition::GetParticleTable()
{
return theParticleTable;
}
inline
G4DecayTable* G4ParticleDefinition::GetDecayTable()
{
return theDecayTable;
}
inline
void G4ParticleDefinition::SetDecayTable(G4DecayTable* aDecayTable)
{
theDecayTable = aDecayTable;
}
inline
void G4ParticleDefinition::SetVerboseLevel(G4int value)
{
verboseLevel = value;
}
inline
G4int G4ParticleDefinition::GetVerboseLevel() const
{
return verboseLevel;
}
inline
G4ProcessManager* G4ParticleDefinition::GetProcessManager() const
{
return theProcessManager;
}
inline
void G4ParticleDefinition::SetProcessManager(G4ProcessManager *aProcessManager)
{
theProcessManager = aProcessManager;
}
inline
G4int G4ParticleDefinition::GetQuarkContent(G4int flavor) const
{
G4int content = 0;
if ((flavor>0) && (flavor<=NumberOfQuarkFlavor)){
content = theQuarkContent[flavor-1];
}else {
#ifdef G4VERBOSE
if (verboseLevel >0) {
G4cout << "Invalid Quark Flavor for G4ParticleDefinition::GetQuarkContent";
G4cout << ": flavor=" << flavor <<G4endl;
}
#endif
}
return content;
}
inline
G4int G4ParticleDefinition::GetAntiQuarkContent(G4int flavor) const
{
G4int content = 0;
if ((flavor>0) && (flavor<=NumberOfQuarkFlavor)){
content = theAntiQuarkContent[flavor-1];
}else {
#ifdef G4VERBOSE
if (verboseLevel >0) {
G4cout <<"Invalid Quark Flavor for G4ParticleDefinition::GetAntiQuarkContent";
G4cout << ": flavor=" << flavor <<G4endl;
}
#endif
}
return content;
}
inline
void G4ParticleDefinition::SetParticleSubType(const G4String& subtype)
{
theParticleSubType = subtype;
}
inline
void G4ParticleDefinition::SetAntiPDGEncoding(G4int aEncoding)
{
theAntiPDGEncoding = aEncoding;
}
inline
G4bool G4ParticleDefinition::GetApplyCutsFlag() const
{
return fApplyCutsFlag;
}