in HTML wrappers.
+
+16 January 2020 John Allison
+- Requires intercoms-V10-07-00.
+- Introduce choice of output styles:
+ o /gui/outputStyle
+
+
+
+ o Highlighting applies to the echoed command line if echoing is
+ requested with /control/verbose > 0.
+
+29 December 2020 John Allison
+- G4UIQt.cc: Use 12pt Courier for G4UIQt output window.
+
29 November 2020 Gabriele Cosmo (interfaces-V10-06-11)
- G4UIQt.cc: protected MT code within G4MULTITHREADED in workaround
introduced previously.
diff --git a/source/interfaces/basic/include/G4UIQt.hh b/source/interfaces/basic/include/G4UIQt.hh
index 76a1bd291a8..d03fd4fba06 100644
--- a/source/interfaces/basic/include/G4UIQt.hh
+++ b/source/interfaces/basic/include/G4UIQt.hh
@@ -147,6 +147,11 @@ public: // With description
// Third argument is the Geant4 command executed when the button is fired.
// Fourth argument is the path to the icon file if "user_icon" selected
// Ex : AddButton("change background color","../background.xpm"," /vis/viewer/set/background");
+ void OutputStyle (const char*,const char*,const char*);
+ // Specify an output style
+ // First argument destination (cout cerr warnings errors all)
+ // Second argument is the style (fixed proportional)
+ // Third argument highlights commands if "highlight" (and if /control/verbose > 0)
void DefaultIcons(bool aVal);
// Enable/Disable the default icon ToolBar in Qt
@@ -376,6 +381,10 @@ private:
bool fPickSelected;
bool fZoomInSelected;
bool fZoomOutSelected;
+ struct G4UIQtStyle {
+ G4bool fixed, highlight;
+ };
+ std::map fOutputStyles;
private Q_SLOTS :
void ExitSession();
diff --git a/source/interfaces/basic/src/G4UIQt.cc b/source/interfaces/basic/src/G4UIQt.cc
index 82b271de2c7..d93acd955f4 100644
--- a/source/interfaces/basic/src/G4UIQt.cc
+++ b/source/interfaces/basic/src/G4UIQt.cc
@@ -212,6 +212,14 @@ G4UIQt::G4UIQt (
}
CreateIcons();
+ // Set default output styles
+ for (const auto& destination: {"cout","cerr","warnings","errors"}) {
+ G4UIQtStyle defaultStyle;
+ defaultStyle.fixed = true;
+ defaultStyle.highlight = true;
+ fOutputStyles[destination] = defaultStyle;
+ }
+
fMainWindow = new QMainWindow();
fMainWindow->setAttribute(Qt::WA_DeleteOnClose);
@@ -2025,10 +2033,34 @@ G4int G4UIQt::ReceiveG4cout (
#endif
std::cout << aString;
- QStringList newStr;
+ G4String aStringWithStyle;
+ // aString has a \n on the end (maybe it comes from G4endl or from the
+ // Enter key on the command line) - ignore it. That’s why
+ // i < aString.length() - 1
+ // But other \n need to be translated to an HTML newline.
+ // Similarly, spaces need to be translated to an HTML "non-breaking space".
+ // Tabs (\t) are more tricky since the number of equivalent spaces depends
+ // on how many characters precede it. Probably needs an HTML table. For now
+ // we replace \t with four spaces.
+ for (size_t i = 0; i < aString.length() - 1; ++i) {
+ if (aString[i] == '\n') {
+ aStringWithStyle += "
";
+ } else if (aString[i] == ' ') {
+ aStringWithStyle += " ";
+ } else if (aString[i] == '\t') {
+ aStringWithStyle += " ";
+ } else {
+ aStringWithStyle += aString[i];
+ }
+ }
+ if (fOutputStyles["cout"].fixed) {
+ aStringWithStyle = "" + aStringWithStyle + "";
+ } else {
+ aStringWithStyle = "" + aStringWithStyle + "";
+ }
// Add to string
- G4UIOutputString txt = G4UIOutputString(QString((char*)aString.data()).trimmed(),GetThreadPrefix());
+ G4UIOutputString txt = G4UIOutputString(QString((char*)aStringWithStyle.data()),GetThreadPrefix());
fG4OutputString.push_back(txt);
#ifdef G4MULTITHREADED
@@ -2040,6 +2072,17 @@ G4int G4UIQt::ReceiveG4cout (
if (result.isEmpty()) {
return 0;
}
+
+ G4UImanager* UI = G4UImanager::GetUIpointer();
+ if (fOutputStyles["cout"].highlight) {
+ if (!UI->IsLastCommandOutputTreated() ) {
+ QPalette pal;
+ result = QString(" "
+ + " " + result + "";
+ }
+ }
+ UI->SetLastCommandOutputTreated();
+
fCoutTBTextArea->append(result);
fCoutTBTextArea->ensureCursorVisible ();
@@ -2075,11 +2118,35 @@ G4int G4UIQt::ReceiveG4cerr (
#endif
std::cerr << aString;
- QStringList newStr;
+ G4String aStringWithStyle;
+ // aString has a \n on the end (maybe it comes from G4endl or from the
+ // Enter key on the command line) - ignore it. That’s why
+ // i < aString.length() - 1
+ // But other \n need to be translated to an HTML newline.
+ // Similarly, spaces need to be translated to an HTML "non-breaking space".
+ // Tabs (\t) are more tricky since the number of equivalent spaces depends
+ // on how many characters precede it. Probably needs an HTML table. For now
+ // we replace \t with four spaces.
+ for (size_t i = 0; i < aString.length() - 1; ++i) {
+ if (aString[i] == '\n') {
+ aStringWithStyle += "
";
+ } else if (aString[i] == ' ') {
+ aStringWithStyle += " ";
+ } else if (aString[i] == '\t') {
+ aStringWithStyle += " ";
+ } else {
+ aStringWithStyle += aString[i];
+ }
+ }
+ if (fOutputStyles["cerr"].fixed) {
+ aStringWithStyle = "" + aStringWithStyle + "";
+ } else {
+ aStringWithStyle = "" + aStringWithStyle + "";
+ }
// Add to string
- G4UIOutputString txt = G4UIOutputString(QString((char*)aString.data()).trimmed(),
+ G4UIOutputString txt = G4UIOutputString(QString((char*)aStringWithStyle.data()).trimmed(),
GetThreadPrefix(),
"error");
fG4OutputString.push_back(txt);
@@ -2502,6 +2569,25 @@ void G4UIQt::AddIcon(const char* aLabel, const char* aIconFile, const char* aCom
}
+void G4UIQt::OutputStyle (const char* destination,const char* style,const char* highlight)
+{
+ // Specify an output style
+ // First argument destination (cout cerr warnings errors all)
+ // Second argument is the style (fixed proportional)
+ // Third argument highlights commands if "highlight" (and if /control/verbose > 0)
+ G4String uiQtDestination(destination);
+ G4UIQtStyle uiQtStyle;
+ if (G4String(style) == "fixed") uiQtStyle.fixed = true; else uiQtStyle.fixed = false;
+ if (G4String(highlight) == "highlight") uiQtStyle.highlight = true; else uiQtStyle.highlight = false;
+ if (uiQtDestination == "all") {
+ for (auto& i: fOutputStyles) {
+ i.second = uiQtStyle;
+ }
+ } else {
+ fOutputStyles[uiQtDestination] = uiQtStyle;
+ }
+}
+
void G4UIQt::ActivateCommand(
G4String newCommand
diff --git a/source/interfaces/common/include/G4InteractorMessenger.hh b/source/interfaces/common/include/G4InteractorMessenger.hh
index fc36a7e3b54..b187ca2beb3 100644
--- a/source/interfaces/common/include/G4InteractorMessenger.hh
+++ b/source/interfaces/common/include/G4InteractorMessenger.hh
@@ -48,6 +48,7 @@ private:
G4UIcommand* addIcon;
G4UIcommand* defaultIcons;
G4UIcommand* sys;
+ G4UIcommand* outputStyle;
};
#endif
diff --git a/source/interfaces/common/include/G4VInteractiveSession.hh b/source/interfaces/common/include/G4VInteractiveSession.hh
index dd737f0abe4..78c8ab33216 100644
--- a/source/interfaces/common/include/G4VInteractiveSession.hh
+++ b/source/interfaces/common/include/G4VInteractiveSession.hh
@@ -51,6 +51,7 @@ class G4VInteractiveSession
virtual void AddButton (const char*,const char*,const char*);
virtual void AddIcon (const char*,const char*,const char*,const char*);
virtual void DefaultIcons (bool);
+ virtual void OutputStyle (const char*,const char*,const char*);
void AddInteractor(G4String,G4Interactor);
G4Interactor GetInteractor(G4String);
diff --git a/source/interfaces/common/src/G4InteractorMessenger.cc b/source/interfaces/common/src/G4InteractorMessenger.cc
index deebd56ac80..da83d284f8d 100644
--- a/source/interfaces/common/src/G4InteractorMessenger.cc
+++ b/source/interfaces/common/src/G4InteractorMessenger.cc
@@ -130,12 +130,31 @@ G4InteractorMessenger::G4InteractorMessenger (
parameter->SetDefaultValue("");
sys->SetParameter (parameter);
+ // /gui/outputStyle :
+ outputStyle = new G4UIcommand("/gui/outputStyle",this);
+ outputStyle->SetGuidance("Set output style.");
+ outputStyle->SetGuidance("Highlights commands if requested and if /control/verbose > 0.");
+ parameter = new G4UIparameter("destination",'s',true); // Omitable
+ parameter->SetParameterCandidates("cout cerr warnings errors all");
+ parameter->SetDefaultValue("all");
+ outputStyle->SetParameter (parameter);
+ parameter = new G4UIparameter("type",'s',true); // Omitable
+ parameter->SetParameterCandidates("fixed proportional");
+ parameter->SetDefaultValue("fixed");
+ outputStyle->SetParameter (parameter);
+ parameter = new G4UIparameter("highlight",'s',true); // Omitable
+ parameter->SetParameterCandidates("highlight no-highlight");
+ parameter->SetDefaultValue("highlight");
+ outputStyle->SetParameter (parameter);
}
G4InteractorMessenger::~G4InteractorMessenger()
{
- delete addButton;
+ delete outputStyle;
+ delete sys;
+ delete defaultIcons;
delete addIcon;
+ delete addButton;
delete addMenu;
delete interactorDirectory;
}
@@ -159,6 +178,8 @@ void G4InteractorMessenger::SetNewValue (
} else if(command==sys) {
int rc = system((const char*)params[0]);
if ( rc < 0 ){ }
+ } else if(command==outputStyle) {
+ session->OutputStyle((const char*)params[0],(const char*)params[1],(const char*)params[2]);
}
}
delete [] params;
diff --git a/source/interfaces/common/src/G4VInteractiveSession.cc b/source/interfaces/common/src/G4VInteractiveSession.cc
index abccb384980..ca4035adfe5 100644
--- a/source/interfaces/common/src/G4VInteractiveSession.cc
+++ b/source/interfaces/common/src/G4VInteractiveSession.cc
@@ -61,6 +61,11 @@ void G4VInteractiveSession::AddIcon (const char*,const char*,const char*,const c
{
}
+/***************************************************************************/
+void G4VInteractiveSession::OutputStyle(const char*,const char*,const char*)
+{
+}
+
/***************************************************************************/
void G4VInteractiveSession::AddInteractor (G4String a_name,
G4Interactor a_interactor)
diff --git a/source/persistency/gdml/History b/source/persistency/gdml/History
index b0f5c2058b1..a790c20a4bd 100644
--- a/source/persistency/gdml/History
+++ b/source/persistency/gdml/History
@@ -16,9 +16,21 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+3 February 2021 Gabriele Cosmo (gdml-V10-06-06)
+- Fixed parsing of regions in G4GDMLParser::ImportRegions().
+ Allow for proper deletion of meta-data lists in destructor.
+ Based on GitHub PR#19 by shangjiaxuan.
+- Fixed reading of units for GenericTrap in G4GDMLReadSolids.
+ Addressing problem report #2317.
+
+18 January 2021 Witek Pokorski
+- Fixed importing of skin/border-surface properties by changing the key of
+ the G4GDMLReadSolids property vector map from 'name' to 'name + ref'.
+ Addressing problem report #2305
+
5 November 2020 Witek Pokorski (gdml-V10-06-05)
- Adding new method to the parser SetOutputFileOverwrite(G4bool flag) which
-allows to set the flag to enable overwriting of the output GDML file.
+ allows to set the flag to enable overwriting of the output GDML file.
19 October 2020 Witek Pokorski (gdml-V10-06-04)
- Fix for problem 2273 (fixing loops when from == to).
diff --git a/source/persistency/gdml/src/G4GDMLParser.cc b/source/persistency/gdml/src/G4GDMLParser.cc
index efb29281b1d..a52284c8485 100644
--- a/source/persistency/gdml/src/G4GDMLParser.cc
+++ b/source/persistency/gdml/src/G4GDMLParser.cc
@@ -83,9 +83,9 @@ G4GDMLParser::~G4GDMLParser()
if(!uwcode)
{
delete writer;
- delete ullist;
- delete rlist;
}
+ delete ullist;
+ delete rlist;
delete messenger;
}
@@ -98,7 +98,7 @@ void G4GDMLParser::ImportRegions()
for(auto iaux = auxInfoList->cbegin(); iaux != auxInfoList->cend(); ++iaux)
{
if(iaux->type != "Region")
- return;
+ continue;
G4String name = iaux->value;
if(strip)
diff --git a/source/persistency/gdml/src/G4GDMLReadSolids.cc b/source/persistency/gdml/src/G4GDMLReadSolids.cc
index 7eef9079876..6473d5f8317 100644
--- a/source/persistency/gdml/src/G4GDMLReadSolids.cc
+++ b/source/persistency/gdml/src/G4GDMLReadSolids.cc
@@ -2323,7 +2323,7 @@ void G4GDMLReadSolids::GenTrapRead(
}
else if(attName == "lunit")
{
- G4UnitDefinition::GetValueOf(attValue);
+ lunit = G4UnitDefinition::GetValueOf(attValue);
if(G4UnitDefinition::GetCategory(attValue) != "Length")
{
G4Exception("G4GDMLReadSolids::GenTrapRead()", "InvalidRead",
@@ -3558,8 +3558,10 @@ void G4GDMLReadSolids::PropertyRead(
else // build the material properties vector
{
G4MaterialPropertyVector* propvect;
+ G4String temp = name + ref;
+ std::cout << temp << std::endl;
// first check if it was already built
- if(mapOfMatPropVects.find(Strip(name)) == mapOfMatPropVects.end())
+ if(mapOfMatPropVects.find(temp) == mapOfMatPropVects.end())
{
// if not create a new one
propvect = new G4MaterialPropertyVector();
@@ -3568,11 +3570,11 @@ void G4GDMLReadSolids::PropertyRead(
propvect->InsertValues(matrix.Get(i, 0), matrix.Get(i, 1));
}
// and add it to the list for potential future reuse
- mapOfMatPropVects[Strip(name)] = propvect;
+ mapOfMatPropVects[temp] = propvect;
}
else
{
- propvect = mapOfMatPropVects[Strip(name)];
+ propvect = mapOfMatPropVects[temp];
}
matprop->AddProperty(Strip(name), propvect);
diff --git a/source/physics_lists/builders/History b/source/physics_lists/builders/History
index ffb0576c269..f8f2ae0204c 100644
--- a/source/physics_lists/builders/History
+++ b/source/physics_lists/builders/History
@@ -13,6 +13,19 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+07-January-2021 Alberto Ribon (phys-builders-V10-06-15)
+- G4HadronicBuilder : replaced 2-body decays of bottom mesons into
+ charmed mesons and charged rho resonance, with 3-body decays into
+ the same charmed mesons and charged pion and neutral pion.
+ This allows to get a more precise numerical treatment of the decay
+ kinematics in the rest frame, avoiding spurious energy-momentum
+ violations reported by G4DecayProducts::IsChecked.
+
+07-December-2020 Vladimir Ivanchenko (phys-builders-V10-06-14)
+- OrderingParameterTable - added forgotten processes (general
+ positron, surface reflection, DNA) coherently with
+ G4PhysicsListHelper
+
19-October-2020 Vladimir Ivanchenko (phys-builders-V10-06-13)
- G4HadronicBuilder - added methods for FTFQGSP_BERT physics
diff --git a/source/physics_lists/builders/OrderingParameterTable b/source/physics_lists/builders/OrderingParameterTable
index 847c0b2be8c..23b52e1ffe3 100644
--- a/source/physics_lists/builders/OrderingParameterTable
+++ b/source/physics_lists/builders/OrderingParameterTable
@@ -16,10 +16,12 @@ Compton 2 13 -1 -1 1000 0
Conv 2 14 -1 -1 1000 0
ConvToMuMu 2 15 -1 -1 1000 0
GammaSuper 2 16 -1 -1 1000 0
+PositronSuper 2 17 1 1 1 0
Cerenkov 2 21 -1 -1 1000 0
Scintillation 2 22 9999 -1 9999 0
SynchRad 2 23 -1 -1 1000 0
TransRad 2 24 -1 -1 1000 0
+SurfaceRefl 2 25 -1 -1 1000 0
OpAbsorp 3 31 -1 -1 1000 0
OpBoundary 3 32 -1 -1 1000 0
OpRayleigh 3 33 -1 -1 1000 0
@@ -33,9 +35,17 @@ DNAVibExcit 2 54 -1 -1 1000 0
DNAAttachment 2 55 -1 -1 1000 0
DNAChargeDec 2 56 -1 -1 1000 0
DNAChargeInc 2 57 -1 -1 1000 0
+DNAElecSolv 2 58 -1 -1 1000 0
+DNAMolecDecay 2 59 1000 -1 -1 0
+ITTransport 1 60 -1 0 0 0
+DNABrownTrans 1 61 -1 0 0 0
+DNADoubleIoni 2 62 -1 -1 1000 0
+DNADoubleCap 2 63 -1 -1 1000 0
+DNAIoniTransfer 2 64 -1 -1 1000 0
HadElastic 4 111 -1 -1 1000 0
-HadInElastic 4 121 -1 -1 1000 0
-HadCaptue 4 131 -1 -1 1000 0
+HadInelastic 4 121 -1 -1 1000 0
+HadCapture 4 131 -1 -1 1000 0
+MuAtomCapture 4 132 -1 -1 1000 0
HadFission 4 141 -1 -1 1000 0
HadAtRest 4 151 1000 -1 -1 0
HadCEX 4 161 -1 -1 1000 0
@@ -44,9 +54,11 @@ DecayWSpin 6 202 1000 -1 1000 0
DecayPiWSpin 6 203 1000 -1 1000 0
DecayRadio 6 210 1000 -1 1000 0
DecayUnKnown 6 211 1000 -1 1000 0
+DecayMuAtom 6 221 1000 -1 1000 0
DecayExt 6 231 1000 -1 1000 0
StepLimiter 7 401 -1 -1 1000 0
UsrSpecCuts 7 402 -1 -1 1000 0
NeutronKiller 7 403 -1 -1 1000 0
+ParallelWorld 10 491 9900 1 9900 1
diff --git a/source/physics_lists/builders/src/G4HadronicBuilder.cc b/source/physics_lists/builders/src/G4HadronicBuilder.cc
index 16f88e1a7af..8f4b6ec8c57 100644
--- a/source/physics_lists/builders/src/G4HadronicBuilder.cc
+++ b/source/physics_lists/builders/src/G4HadronicBuilder.cc
@@ -373,22 +373,22 @@ void G4HadronicBuilder::BuildDecayTableForBCHadrons() {
break;
// Bottom mesons
case 521 : // B+
- mode[0] = new G4PhaseSpaceDecayChannel( "B+", 1.0, 2, "anti_D0", "rho+" );
+ mode[0] = new G4PhaseSpaceDecayChannel( "B+", 1.0, 3, "anti_D0", "pi+", "pi0" );
break;
case -521 : // B-
- mode[0] = new G4PhaseSpaceDecayChannel( "B-", 1.0, 2, "D0", "rho-" );
+ mode[0] = new G4PhaseSpaceDecayChannel( "B-", 1.0, 3, "D0", "pi-", "pi0" );
break;
case 511 : // B0
- mode[0] = new G4PhaseSpaceDecayChannel( "B0", 1.0, 2, "D-", "rho+" );
+ mode[0] = new G4PhaseSpaceDecayChannel( "B0", 1.0, 3, "D-", "pi+", "pi0" );
break;
case -511 : // anti_B0
- mode[0] = new G4PhaseSpaceDecayChannel( "anti_B0", 1.0, 2, "D+", "rho-" );
+ mode[0] = new G4PhaseSpaceDecayChannel( "anti_B0", 1.0, 3, "D+", "pi-", "pi0" );
break;
case 531 : // Bs0
- mode[0] = new G4PhaseSpaceDecayChannel( "Bs0", 1.0, 2, "Ds-", "rho+" );
+ mode[0] = new G4PhaseSpaceDecayChannel( "Bs0", 1.0, 3, "Ds-", "pi+", "pi0" );
break;
case -531 : // anti_Bs0
- mode[0] = new G4PhaseSpaceDecayChannel( "anti_Bs0", 1.0, 2, "Ds+", "rho-" );
+ mode[0] = new G4PhaseSpaceDecayChannel( "anti_Bs0", 1.0, 3, "Ds+", "pi-", "pi0" );
break;
case 541 : // Bc+
mode[0] = new G4PhaseSpaceDecayChannel( "Bc+", 1.0, 2, "J/psi", "pi+" );
diff --git a/source/physics_lists/constructors/electromagnetic/History b/source/physics_lists/constructors/electromagnetic/History
index 78de7291e65..11943a8879a 100644
--- a/source/physics_lists/constructors/electromagnetic/History
+++ b/source/physics_lists/constructors/electromagnetic/History
@@ -13,6 +13,14 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+18 January 2021, V.Ivanchenko (phys-ctor-em-V10-06-21)
+- G4GammaGeneralProcess - changed 1st energy limit from 50 keV to 150 keV
+ to guarantee K-shell energy for any element be within 1st energy area;
+ changed logic for selection of a concrete process - maximally reduced
+ use 'if' operators; reduce number of 'return' in run time methods;
+ remove shadowing of base class methods; expected more performant code;
+ fixed problem #2309
+
04 November 2020, V.Ivanchenko (phys-ctor-em-V10-06-20)
- G4GammaGeneralProcess - improved printouts and make some methods
protected
diff --git a/source/physics_lists/constructors/electromagnetic/include/G4GammaGeneralProcess.hh b/source/physics_lists/constructors/electromagnetic/include/G4GammaGeneralProcess.hh
index 9ae3b41e447..846618deae9 100644
--- a/source/physics_lists/constructors/electromagnetic/include/G4GammaGeneralProcess.hh
+++ b/source/physics_lists/constructors/electromagnetic/include/G4GammaGeneralProcess.hh
@@ -69,7 +69,7 @@ public:
explicit G4GammaGeneralProcess();
- virtual ~G4GammaGeneralProcess();
+ ~G4GammaGeneralProcess() override;
G4bool IsApplicable(const G4ParticleDefinition&) override;
@@ -120,12 +120,16 @@ public:
const G4String& directory,
G4bool ascii) override;
- const G4String& GetProcessName() const;
+ // Temporary method
+ const G4String& GetSubProcessName() const;
- G4int GetProcessSubType() const;
+ // Temporary method
+ G4int GetSubProcessSubType() const;
G4VEmProcess* GetEmProcess(const G4String& name) override;
+ inline const G4VProcess* GetSelectedProcess() const;
+
// hide copy constructor and assignment operator
G4GammaGeneralProcess(G4GammaGeneralProcess &) = delete;
G4GammaGeneralProcess & operator=
@@ -140,13 +144,11 @@ protected:
inline G4double GetProbability(size_t idxt);
- inline void SelectedProcess(const G4Step& track, const G4VProcess* ptr);
+ inline void SelectedProcess(const G4Step& step, G4VProcess* ptr);
- inline G4VParticleChange* SampleEmSecondaries(const G4Track&, const G4Step&,
- G4VEmProcess*);
+ inline void SelectEmProcess(const G4Step&, G4VEmProcess*);
- G4VParticleChange* SampleHadSecondaries(const G4Track&, const G4Step&,
- G4HadronicProcess*);
+ void SelectHadProcess(const G4Track&, const G4Step&, G4HadronicProcess*);
private:
@@ -156,7 +158,7 @@ private:
protected:
G4HadronicProcess* theGammaNuclear;
- const G4VProcess* selectedProc;
+ G4VProcess* selectedProc;
private:
static G4EmDataHandler* theHandler;
@@ -197,14 +199,14 @@ G4GammaGeneralProcess::ComputeGeneralLambda(size_t idxe, size_t idxt)
inline G4double G4GammaGeneralProcess::GetProbability(size_t idxt)
{
- return (theT[idxt]) ? theHandler->GetVector(idxt, basedCoupleIndex)
- ->LogVectorValue(preStepKinEnergy, preStepLogE) : 1.0;
+ return theHandler->GetVector(idxt, basedCoupleIndex)
+ ->LogVectorValue(preStepKinEnergy, preStepLogE);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void
-G4GammaGeneralProcess::SelectedProcess(const G4Step& step, const G4VProcess* ptr)
+G4GammaGeneralProcess::SelectedProcess(const G4Step& step, G4VProcess* ptr)
{
selectedProc = ptr;
step.GetPostStepPoint()->SetProcessDefinedStep(ptr);
@@ -212,12 +214,17 @@ G4GammaGeneralProcess::SelectedProcess(const G4Step& step, const G4VProcess* ptr
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-inline G4VParticleChange* G4GammaGeneralProcess::SampleEmSecondaries(
- const G4Track& track, const G4Step& step, G4VEmProcess* proc)
+inline void G4GammaGeneralProcess::SelectEmProcess(const G4Step& step, G4VEmProcess* proc)
{
proc->CurrentSetup(currentCouple,preStepKinEnergy);
SelectedProcess(step, proc);
- return proc->PostStepDoIt(track, step);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4VProcess* G4GammaGeneralProcess::GetSelectedProcess() const
+{
+ return selectedProc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
diff --git a/source/physics_lists/constructors/electromagnetic/src/G4GammaGeneralProcess.cc b/source/physics_lists/constructors/electromagnetic/src/G4GammaGeneralProcess.cc
index d97719abb37..a0b94c665a0 100644
--- a/source/physics_lists/constructors/electromagnetic/src/G4GammaGeneralProcess.cc
+++ b/source/physics_lists/constructors/electromagnetic/src/G4GammaGeneralProcess.cc
@@ -76,15 +76,15 @@
G4EmDataHandler* G4GammaGeneralProcess::theHandler = nullptr;
G4bool G4GammaGeneralProcess::theT[nTables] =
- {true,false,true,true,false,false,true,true,true,
- false,true,true,true,false,false};
+ {true,false,true,true,true,false,true,true,true,
+ true,true,true,true,true,true};
G4String G4GammaGeneralProcess::nameT[nTables] =
{"0","1","2","3","4","5","6","7","8",
"9","10","11","12","13","14"};
G4GammaGeneralProcess::G4GammaGeneralProcess():
G4VEmProcess("GammaGeneralProc", fElectromagnetic),
- minPEEnergy(50*CLHEP::keV),
+ minPEEnergy(150*CLHEP::keV),
minEEEnergy(2*CLHEP::electron_mass_c2),
minMMEnergy(100*CLHEP::MeV),
peLambda(0.0),
@@ -109,8 +109,6 @@ G4GammaGeneralProcess::G4GammaGeneralProcess():
G4GammaGeneralProcess::~G4GammaGeneralProcess()
{
- //std::cout << "G4GammaGeneralProcess::~G4GammaGeneralProcess " << isTheMaster
- // << " " << theHandler << G4endl;
if(isTheMaster) {
delete theHandler;
theHandler = nullptr;
@@ -128,7 +126,7 @@ G4bool G4GammaGeneralProcess::IsApplicable(const G4ParticleDefinition&)
void G4GammaGeneralProcess::AddEmProcess(G4VEmProcess* ptr)
{
- if(!ptr) { return; }
+ if(nullptr == ptr) { return; }
G4int stype = ptr->GetProcessSubType();
if(stype == fRayleigh) { theRayleigh = ptr; }
else if(stype == fPhotoElectricEffect) { thePhotoElectric = ptr; }
@@ -171,6 +169,18 @@ void G4GammaGeneralProcess::PreparePhysicsTable(const G4ParticleDefinition& part
<< " isMaster: " << isTheMaster << G4endl;
}
+ // 3 sub-processes must be always defined
+ if(thePhotoElectric == nullptr || theCompton == nullptr ||
+ theConversionEE == nullptr) {
+ G4ExceptionDescription ed;
+ ed << "### G4GeneralGammaProcess is initialized incorrectly"
+ << "\n Photoelectric: " << thePhotoElectric
+ << "\n Compton: " << theCompton
+ << "\n Conversion: " << theConversionEE;
+ G4Exception("G4GeneralGammaProcess","em0004",
+ FatalException, ed,"");
+ }
+
if(thePhotoElectric) { thePhotoElectric->PreparePhysicsTable(part); }
if(theCompton) { theCompton->PreparePhysicsTable(part); }
if(theConversionEE) { theConversionEE->PreparePhysicsTable(part); }
@@ -188,11 +198,9 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
if(isTheMaster) {
// tables are created and its size is defined only once
- if(!theHandler) {
+ if(nullptr == theHandler) {
theHandler = new G4EmDataHandler(nTables);
- if(theRayleigh) { theT[1] = theT[4] = true; }
- if(theGammaNuclear) { theT[9] = theT[13] = true; }
- if(theConversionMM) { theT[14] = true; }
+ if(theRayleigh) { theT[1] = true; }
theHandler->SetMasterProcess(thePhotoElectric);
theHandler->SetMasterProcess(theCompton);
@@ -216,7 +224,7 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
G4PhysicsLogVector bVector(minPEEnergy,minEEEnergy,nLowE);
G4PhysicsLogVector cVector(minEEEnergy,minMMEnergy,nHighE);
G4PhysicsLogVector dVector(minMMEnergy,maxe,nbin2);
- if(splineFlag) {
+ if(splineFlag) {
aVector.SetSpline(splineFlag);
bVector.SetSpline(splineFlag);
cVector.SetSpline(splineFlag);
@@ -224,25 +232,24 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
}
for(size_t i=0; iMakeTable(i);
- //G4cout << " make table " << table << G4endl;
- for(size_t j=0; jGetFlag(j) && !vec) {
- //G4cout << " i= " << i << " j= " << j << " make new vector" << G4endl;
- if(i<=1) {
- vec = new G4PhysicsVector(aVector);
- } else if(i<=5) {
- vec = new G4PhysicsVector(bVector);
- } else if(i<=9) {
- vec = new G4PhysicsVector(cVector);
- } else {
- vec = new G4PhysicsVector(dVector);
- }
- G4PhysicsTableHelper::SetPhysicsVector(table, j, vec);
+ G4PhysicsTable* table = theHandler->MakeTable(i);
+ //G4cout << " make table " << table << G4endl;
+ for(size_t j=0; jGetFlag(j) && nullptr == vec) {
+ //G4cout <<" i= "<SetEmMasterProcess(theHandler->GetMasterProcess(0));
- }
- thePhotoElectric->BuildPhysicsTable(part);
+ if(!isTheMaster) {
+ thePhotoElectric->SetEmMasterProcess(theHandler->GetMasterProcess(0));
}
- if(theCompton != nullptr) {
- if(!isTheMaster) {
- theCompton->SetEmMasterProcess(theHandler->GetMasterProcess(1));
- }
- theCompton->BuildPhysicsTable(part);
+ thePhotoElectric->BuildPhysicsTable(part);
+
+ if(!isTheMaster) {
+ theCompton->SetEmMasterProcess(theHandler->GetMasterProcess(1));
}
- if(theConversionEE != nullptr) {
- if(!isTheMaster) {
- theConversionEE->SetEmMasterProcess(theHandler->GetMasterProcess(2));
- }
- theConversionEE->BuildPhysicsTable(part);
+ theCompton->BuildPhysicsTable(part);
+
+ if(!isTheMaster) {
+ theConversionEE->SetEmMasterProcess(theHandler->GetMasterProcess(2));
}
+ theConversionEE->BuildPhysicsTable(part);
+
if(theRayleigh != nullptr) {
if(!isTheMaster) {
theRayleigh->SetEmMasterProcess(theHandler->GetMasterProcess(3));
@@ -294,7 +298,7 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
G4LossTableBuilder* bld = lManager->GetTableBuilder();
const std::vector& tables = theHandler->GetTables();
- G4CrossSectionDataStore* gn = (theGammaNuclear)
+ G4CrossSectionDataStore* gn = (nullptr != theGammaNuclear)
? theGammaNuclear->GetCrossSectionDataStore() : nullptr;
G4DynamicParticle* dynParticle =
new G4DynamicParticle(G4Gamma::Gamma(),G4ThreeVector(1,0,0),1.0);
@@ -313,15 +317,16 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
// energy interval 0
size_t nn = (*(tables[0]))[idx]->GetVectorLength();
- if(1 < verboseLevel) {
- G4cout << "======= Zone 0 ======= N= " << nn
+ if(1 < verboseLevel) {
+ G4cout << "======= Zone 0 ======= N= " << nn
<< " for " << material->GetName() << G4endl;
}
for(size_t j=0; jEnergy(j);
G4double loge = G4Log(e);
- sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
- sigR = (theRayleigh) ? theRayleigh->GetLambda(e, couple, loge) : 0.0;
+ sigComp = theCompton->GetLambda(e, couple, loge);
+ sigR = (nullptr != theRayleigh) ?
+ theRayleigh->GetLambda(e, couple, loge) : 0.0;
G4double sum = sigComp + sigR;
if(1 < verboseLevel) {
G4cout << j << ". E= " << e << " xs= " << sum
@@ -329,7 +334,7 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
}
(*(tables[0]))[idx]->PutValue(j, sum);
if(theT[1]) {
- val = (sum > 0.0) ? sigComp/sum : 0.0;
+ val = sigR/sum;
(*(tables[1]))[idx]->PutValue(j, val);
}
}
@@ -342,16 +347,11 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(size_t j=0; jEnergy(j);
G4double loge = G4Log(e);
- sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
- sigR = (theRayleigh) ? theRayleigh->GetLambda(e, couple, loge) : 0.0;
- sigPE = (thePhotoElectric)
- ? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
- sigN = 0.0;
- if(gn) {
- dynParticle->SetKineticEnergy(e);
- sigN = gn->ComputeCrossSection(dynParticle, material);
- }
- G4double sum = sigComp + sigR + sigPE + sigN;
+ sigComp = theCompton->GetLambda(e, couple, loge);
+ sigR = (nullptr != theRayleigh) ?
+ theRayleigh->GetLambda(e, couple, loge) : 0.0;
+ sigPE = thePhotoElectric->GetLambda(e, couple, loge);
+ G4double sum = sigComp + sigR + sigPE;
if(1 < verboseLevel) {
G4cout << j << ". E= " << e << " xs= " << sum
<< " compt= " << sigComp << " conv= " << sigConv
@@ -359,16 +359,12 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " GN= " << sigN << G4endl;
}
(*(tables[2]))[idx]->PutValue(j, sum);
- val = (sum > 0.0) ? sigPE/sum : 0.0;
+
+ val = sigPE/sum;
(*(tables[3]))[idx]->PutValue(j, val);
- if(theT[4]) {
- val = (sum > 0.0) ? (sigComp + sigPE)/sum : 0.0;
- (*(tables[4]))[idx]->PutValue(j, val);
- }
- if(theT[5]) {
- val = (sum > 0.0) ? (sigComp + sigPE + sigR)/sum : 0.0;
- (*(tables[5]))[idx]->PutValue(j, val);
- }
+
+ val = (sigR > 0.0) ? (sigComp + sigPE)/sum : 1.0;
+ (*(tables[4]))[idx]->PutValue(j, val);
}
// energy interval 2
@@ -379,13 +375,11 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(size_t j=0; jEnergy(j);
G4double loge = G4Log(e);
- sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
- sigConv = (theConversionEE)
- ? theConversionEE->GetLambda(e, couple, loge) : 0.0;
- sigPE = (thePhotoElectric)
- ? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
+ sigComp = theCompton->GetLambda(e, couple, loge);
+ sigConv = theConversionEE->GetLambda(e, couple, loge);
+ sigPE = thePhotoElectric->GetLambda(e, couple, loge);
sigN = 0.0;
- if(gn) {
+ if(nullptr != gn) {
dynParticle->SetKineticEnergy(e);
sigN = gn->ComputeCrossSection(dynParticle, material);
}
@@ -397,14 +391,15 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " GN= " << sigN << G4endl;
}
(*(tables[6]))[idx]->PutValue(j, sum);
- val = (sum > 0.0) ? sigConv/sum : 0.0;
+
+ val = sigConv/sum;
(*(tables[7]))[idx]->PutValue(j, val);
- val = (sum > 0.0) ? (sigConv + sigComp)/sum : 0.0;
+
+ val = (sigConv + sigComp)/sum;
(*(tables[8]))[idx]->PutValue(j, val);
- if(theT[9]) {
- val = (sum > 0.0) ? (sigConv + sigComp + sigPE)/sum : 0.0;
- (*(tables[9]))[idx]->PutValue(j, val);
- }
+
+ val = (sigN > 0.0) ? (sigConv + sigComp + sigPE)/sum : 1.0;
+ (*(tables[9]))[idx]->PutValue(j, val);
}
// energy interval 3
@@ -416,18 +411,16 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(size_t j=0; jEnergy(j);
G4double loge = G4Log(e);
- sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
- sigConv = (theConversionEE)
- ? theConversionEE->GetLambda(e, couple, loge) : 0.0;
- sigPE = (thePhotoElectric)
- ? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
+ sigComp = theCompton->GetLambda(e, couple, loge);
+ sigConv = theConversionEE->GetLambda(e, couple, loge);
+ sigPE = thePhotoElectric->GetLambda(e, couple, loge);
sigN = 0.0;
- if(gn) {
+ if(nullptr != gn) {
dynParticle->SetKineticEnergy(e);
sigN = gn->ComputeCrossSection(dynParticle, material);
}
sigM = 0.0;
- if(theConversionMM) {
+ if(nullptr != theConversionMM) {
val = theConversionMM->ComputeMeanFreePath(e, material);
sigM = (val < DBL_MAX) ? 1./val : 0.0;
}
@@ -439,22 +432,21 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " GN= " << sigN << G4endl;
}
(*(tables[10]))[idx]->PutValue(j, sum);
- val = (sum > 0.0) ? 1.0 - sigConv/sum : 1.0;
+
+ val = (sigComp + sigPE + sigN + sigM)/sum;
(*(tables[11]))[idx]->PutValue(j, val);
- val = (sum > 0.0) ? 1.0 - (sigConv + sigComp)/sum : 1.0;
+
+ val = (sigPE + sigN + sigM)/sum;
(*(tables[12]))[idx]->PutValue(j, val);
- if(theT[13]) {
- val = (sum > 0.0) ? 1.0 - (sigConv + sigComp + sigPE)/sum : 1.0;
- (*(tables[13]))[idx]->PutValue(j, val);
- }
- if(theT[14]) {
- val = (sum > 0.0)
- ? 1.0 - (sigConv + sigComp + sigPE + sigN)/sum : 1.0;
- (*(tables[14]))[idx]->PutValue(j, val);
- }
+
+ val = (sigN + sigM)/sum;
+ (*(tables[13]))[idx]->PutValue(j, val);
+
+ val = sigN/sum;
+ (*(tables[14]))[idx]->PutValue(j, val);
}
for(size_t k=0; kFillSecondDerivatives();
}
}
@@ -553,8 +545,7 @@ G4double G4GammaGeneralProcess::TotalCrossSectionPerVolume()
if(preStepKinEnergy < minPEEnergy) {
cross = ComputeGeneralLambda(0, 0);
//G4cout << "XS1: " << cross << G4endl;
- peLambda = (thePhotoElectric) ? thePhotoElectric
- ->GetLambda(preStepKinEnergy, currentCouple, preStepLogE) : 0.0;
+ peLambda = thePhotoElectric->GetLambda(preStepKinEnergy, currentCouple, preStepLogE);
cross += peLambda;
//G4cout << "XS2: " << cross << G4endl;
@@ -585,9 +576,8 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
{
// In all cases clear number of interaction lengths
theNumberOfInteractionLengthLeft = -1.0;
- G4double q = G4UniformRand();
- G4double x = preStepLambda*G4UniformRand();
- G4double p;
+ selectedProc = nullptr;
+ G4double q = G4UniformRand();
/*
G4cout << "PostStep: preStepLambda= " << preStepLambda << " x= " << x
<< " PE= " << peLambda << " q= " << q << " idxE= " << idxEnergy
@@ -595,92 +585,70 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
*/
switch (idxEnergy) {
case 0:
- if(x <= peLambda) {
- return SampleEmSecondaries(track, step, thePhotoElectric);
+ if(preStepLambda*q <= peLambda) {
+ SelectEmProcess(step, thePhotoElectric);
} else {
- p = GetProbability(1);
- if(x <= peLambda + (preStepLambda - peLambda)*p) {
- return SampleEmSecondaries(track, step, theCompton);
- } else if(theRayleigh != nullptr) {
- return SampleEmSecondaries(track, step, theRayleigh);
+ if(theT[1] && preStepLambda*q < preStepLambda*GetProbability(1) + peLambda) {
+ SelectEmProcess(step, theRayleigh);
+ } else {
+ SelectEmProcess(step, theCompton);
}
}
break;
- case 1:
- p = GetProbability(3);
- if(q <= p) {
- return SampleEmSecondaries(track, step, thePhotoElectric);
- }
- p = GetProbability(4);
- if(q <= p) {
- return SampleEmSecondaries(track, step, theCompton);
- }
- p = GetProbability(5);
- if(q <= p) {
- if(theRayleigh != nullptr) {
- return SampleEmSecondaries(track, step, theRayleigh);
- }
- } else if(theGammaNuclear != nullptr) {
- return SampleHadSecondaries(track, step, theGammaNuclear);
+ case 1:
+ if(q <= GetProbability(3)) {
+ SelectEmProcess(step, thePhotoElectric);
+ } else if(q <= GetProbability(4)) {
+ SelectEmProcess(step, theCompton);
+ } else if(theRayleigh) {
+ SelectEmProcess(step, theRayleigh);
}
break;
case 2:
- p = GetProbability(7);
- if(q <= p) {
- return SampleEmSecondaries(track, step, theConversionEE);
- }
- p = GetProbability(8);
- if(q <= p) {
- return SampleEmSecondaries(track, step, theCompton);
- }
- p = GetProbability(9);
- if(q <= p) {
- return SampleEmSecondaries(track, step, thePhotoElectric);
- } else if(theGammaNuclear != nullptr) {
- return SampleHadSecondaries(track, step, theGammaNuclear);
+ if(q <= GetProbability(7)) {
+ SelectEmProcess(step, theConversionEE);
+ } else if(q <= GetProbability(8)) {
+ SelectEmProcess(step, theCompton);
+ } else if(q <= GetProbability(9)) {
+ SelectEmProcess(step, thePhotoElectric);
+ } else if(theGammaNuclear) {
+ SelectHadProcess(track, step, theGammaNuclear);
}
break;
case 3:
- p = 1.0 - GetProbability(11);
- if(q <= p) {
- return SampleEmSecondaries(track, step, theConversionEE);
- }
- p = 1.0 - GetProbability(12);
- if(q <= p) {
- return SampleEmSecondaries(track, step, theCompton);
- }
- p = 1.0 - GetProbability(13);
- if(q <= p) {
- return SampleEmSecondaries(track, step, thePhotoElectric);
- }
- p = 1.0 - GetProbability(14);
- if(q <= p) {
- if(theGammaNuclear != nullptr) {
- return SampleHadSecondaries(track, step, theGammaNuclear);
- }
- } else if(theConversionMM != nullptr) {
+ if(q + GetProbability(11) <= 1.0) {
+ SelectEmProcess(step, theConversionEE);
+ } else if(q + GetProbability(12) <= 1.0) {
+ SelectEmProcess(step, theCompton);
+ } else if(q + GetProbability(13) <= 1.0) {
+ SelectEmProcess(step, thePhotoElectric);
+ } else if(theGammaNuclear && q + GetProbability(14) <= 1.0) {
+ SelectHadProcess(track, step, theGammaNuclear);
+ } else if(theConversionMM) {
SelectedProcess(step, theConversionMM);
- return theConversionMM->PostStepDoIt(track, step);
}
break;
}
- // no interaction
+ // sample secondaries
+ if(selectedProc != nullptr) {
+ return selectedProc->PostStepDoIt(track, step);
+ }
+ // no interaction - exception case
fParticleChange.InitializeForPostStep(track);
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-G4VParticleChange* G4GammaGeneralProcess::SampleHadSecondaries(
- const G4Track& track, const G4Step& step, G4HadronicProcess* proc)
+void G4GammaGeneralProcess::SelectHadProcess(const G4Track& track,
+ const G4Step& step, G4HadronicProcess* proc)
{
SelectedProcess(step, proc);
proc->GetCrossSectionDataStore()->ComputeCrossSection(track.GetDynamicParticle(),
track.GetMaterial());
- return proc->PostStepDoIt(track, step);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -691,14 +659,11 @@ G4bool G4GammaGeneralProcess::StorePhysicsTable(const G4ParticleDefinition* part
{
G4bool yes = true;
if(!isTheMaster) { return yes; }
- if(thePhotoElectric != nullptr &&
- !thePhotoElectric->StorePhysicsTable(part, directory, ascii))
+ if(!thePhotoElectric->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
- if(theCompton != nullptr &&
- !theCompton->StorePhysicsTable(part, directory, ascii))
+ if(!theCompton->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
- if(theConversionEE != nullptr &&
- !theConversionEE->StorePhysicsTable(part, directory, ascii))
+ if(!theConversionEE->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theRayleigh != nullptr &&
!theRayleigh->StorePhysicsTable(part, directory, ascii))
@@ -728,14 +693,11 @@ G4GammaGeneralProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
<< GetProcessName() << G4endl;
}
G4bool yes = true;
- if(thePhotoElectric != nullptr &&
- !thePhotoElectric->RetrievePhysicsTable(part, directory, ascii))
+ if(!thePhotoElectric->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
- if(theCompton != nullptr &&
- !theCompton->RetrievePhysicsTable(part, directory, ascii))
+ if(!theCompton->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
- if(theConversionEE != nullptr &&
- !theConversionEE->RetrievePhysicsTable(part, directory, ascii))
+ if(!theConversionEE->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theRayleigh != nullptr &&
!theRayleigh->RetrievePhysicsTable(part, directory, ascii))
@@ -767,9 +729,9 @@ G4double G4GammaGeneralProcess::GetMeanFreePath(const G4Track& track,
void G4GammaGeneralProcess::ProcessDescription(std::ostream& out) const
{
- if(thePhotoElectric) { thePhotoElectric->ProcessDescription(out); }
- if(theCompton) { theCompton->ProcessDescription(out); }
- if(theConversionEE) { theConversionEE->ProcessDescription(out); }
+ thePhotoElectric->ProcessDescription(out);
+ theCompton->ProcessDescription(out);
+ theConversionEE->ProcessDescription(out);
if(theRayleigh) { theRayleigh->ProcessDescription(out); }
if(theGammaNuclear) { theGammaNuclear->ProcessDescription(out); }
if(theConversionMM) { theConversionMM->ProcessDescription(out); }
@@ -777,16 +739,15 @@ void G4GammaGeneralProcess::ProcessDescription(std::ostream& out) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-const G4String& G4GammaGeneralProcess::GetProcessName() const
+const G4String& G4GammaGeneralProcess::GetSubProcessName() const
{
- //G4cout << "GetProcessName(): " << selectedProc << G4endl;
return (selectedProc) ? selectedProc->GetProcessName()
: G4VProcess::GetProcessName();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-G4int G4GammaGeneralProcess::GetProcessSubType() const
+G4int G4GammaGeneralProcess::GetSubProcessSubType() const
{
return (selectedProc) ? selectedProc->GetProcessSubType()
: fGammaGeneralProcess;
@@ -797,11 +758,11 @@ G4int G4GammaGeneralProcess::GetProcessSubType() const
G4VEmProcess* G4GammaGeneralProcess::GetEmProcess(const G4String& name)
{
G4VEmProcess* proc = nullptr;
- if(thePhotoElectric != nullptr && name == thePhotoElectric->GetProcessName()) {
+ if(name == thePhotoElectric->GetProcessName()) {
proc = thePhotoElectric;
- } else if(theCompton != nullptr && name == theCompton->GetProcessName()) {
+ } else if(name == theCompton->GetProcessName()) {
proc = theCompton;
- } else if(theConversionEE != nullptr && name == theConversionEE->GetProcessName()) {
+ } else if(name == theConversionEE->GetProcessName()) {
proc = theConversionEE;
} else if(theRayleigh != nullptr && name == theRayleigh->GetProcessName()) {
proc = theRayleigh;
diff --git a/source/physics_lists/constructors/hadron_elastic/History b/source/physics_lists/constructors/hadron_elastic/History
index 5cc3e1a321c..c6203af0480 100644
--- a/source/physics_lists/constructors/hadron_elastic/History
+++ b/source/physics_lists/constructors/hadron_elastic/History
@@ -13,6 +13,11 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+07-December-2020, Vladimir Ivanchenko (phys-ctor-helastic-V10-06-07)
+- G4HadronElasticPhysics : fixed type of builder in all hadron
+ elastic constructors (problem #2183)
+ G4IonElasticPhysics, G4ThermalNeutrons - added comments
+
01-Oct-2020, V. Ivanchenko (phys-ctor-helastic-V10-06-06)
- G4ThermalNeutrons - use G4PhysListUtils to access neutron elastic
process
diff --git a/source/physics_lists/constructors/hadron_elastic/src/G4HadronElasticPhysics.cc b/source/physics_lists/constructors/hadron_elastic/src/G4HadronElasticPhysics.cc
index 72be8640dfc..6366224fe15 100644
--- a/source/physics_lists/constructors/hadron_elastic/src/G4HadronElasticPhysics.cc
+++ b/source/physics_lists/constructors/hadron_elastic/src/G4HadronElasticPhysics.cc
@@ -68,6 +68,7 @@
#include "G4HadParticles.hh"
#include "G4HadProcesses.hh"
#include "G4PhysListUtil.hh"
+#include "G4BuilderType.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
@@ -82,6 +83,7 @@ G4HadronElasticPhysics::G4HadronElasticPhysics(G4int ver, const G4String& nam)
G4cout << "### G4HadronElasticPhysics: " << GetPhysicsName()
<< G4endl;
}
+ SetPhysicsType(bHadronElastic);
}
G4HadronElasticPhysics::~G4HadronElasticPhysics()
diff --git a/source/physics_lists/constructors/hadron_inelastic/History b/source/physics_lists/constructors/hadron_inelastic/History
index 03c6a5dbc18..516f8ba12f2 100644
--- a/source/physics_lists/constructors/hadron_inelastic/History
+++ b/source/physics_lists/constructors/hadron_inelastic/History
@@ -13,6 +13,11 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+05-December-2020, Vladimir Ivanchenko (phys-ctor-hinelastic-V10-06-19)
+- G4HadronPhysicsFTFP_BERT, G4HadronPhysicsQGSP_BERT, G4HadronInelasticQBBC,
+ G4HadronPhysicsQGSP_BIC : fixed type of builder in all hadron
+ inelatic constructors (problem #2296)
+
26-November-2020, Alberto Ribon (phys-ctor-hinelastic-V10-06-18)
- Update README.
diff --git a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronInelasticQBBC.cc b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronInelasticQBBC.cc
index 07b29ee84f1..1ee82fe7a0f 100644
--- a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronInelasticQBBC.cc
+++ b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronInelasticQBBC.cc
@@ -70,6 +70,7 @@
#include "G4HadronicBuilder.hh"
#include "G4HadParticles.hh"
#include "G4HadProcesses.hh"
+#include "G4BuilderType.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
@@ -79,6 +80,7 @@ G4_DECLARE_PHYSCONSTR_FACTORY(G4HadronInelasticQBBC);
G4HadronInelasticQBBC::G4HadronInelasticQBBC(G4int ver)
: G4VHadronPhysics("hInelasticQBBC"),verbose(ver)
{
+ SetPhysicsType(bHadronInelastic);
G4HadronicParameters::Instance()->SetEnableBCParticles(true);
}
diff --git a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsFTFP_BERT.cc b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsFTFP_BERT.cc
index c0274f6e065..94d50eff2b0 100644
--- a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsFTFP_BERT.cc
+++ b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsFTFP_BERT.cc
@@ -80,6 +80,7 @@
#include "G4HadParticles.hh"
#include "G4HadronicParameters.hh"
#include "G4HadronicBuilder.hh"
+#include "G4BuilderType.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
@@ -93,6 +94,7 @@ G4HadronPhysicsFTFP_BERT::G4HadronPhysicsFTFP_BERT(G4int) :
G4HadronPhysicsFTFP_BERT::G4HadronPhysicsFTFP_BERT(const G4String& name, G4bool qe)
: G4VPhysicsConstructor(name), QuasiElastic(qe)
{
+ SetPhysicsType(bHadronInelastic);
G4HadronicParameters* param = G4HadronicParameters::Instance();
minFTFP_pion = param->GetMinEnergyTransitionFTF_Cascade();
maxBERT_pion = param->GetMaxEnergyTransitionFTF_Cascade();
diff --git a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BERT.cc b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BERT.cc
index e58bc00d91a..4534bda0b68 100644
--- a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BERT.cc
+++ b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BERT.cc
@@ -82,6 +82,7 @@
#include "G4HadParticles.hh"
#include "G4HadronicParameters.hh"
#include "G4HadronicBuilder.hh"
+#include "G4BuilderType.hh"
#include "G4PhysicsConstructorFactory.hh"
//
@@ -93,6 +94,7 @@ G4HadronPhysicsQGSP_BERT::G4HadronPhysicsQGSP_BERT(G4int)
G4HadronPhysicsQGSP_BERT::G4HadronPhysicsQGSP_BERT(const G4String& name, G4bool)
: G4VPhysicsConstructor(name)
{
+ SetPhysicsType(bHadronInelastic);
QuasiElasticFTF= false; // Use built-in quasi-elastic (not add-on)
QuasiElasticQGS= true; // For QGS, it must use it.
G4HadronicParameters* param = G4HadronicParameters::Instance();
diff --git a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BIC.cc b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BIC.cc
index 2e9447fba42..5f05c4a61b8 100644
--- a/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BIC.cc
+++ b/source/physics_lists/constructors/hadron_inelastic/src/G4HadronPhysicsQGSP_BIC.cc
@@ -79,6 +79,7 @@
#include "G4HadParticles.hh"
#include "G4HadronicParameters.hh"
#include "G4HadronicBuilder.hh"
+#include "G4BuilderType.hh"
#include "G4PhysicsConstructorFactory.hh"
@@ -91,6 +92,7 @@ G4HadronPhysicsQGSP_BIC::G4HadronPhysicsQGSP_BIC(G4int)
G4HadronPhysicsQGSP_BIC::G4HadronPhysicsQGSP_BIC(const G4String& name, G4bool)
: G4VPhysicsConstructor(name)
{
+ SetPhysicsType(bHadronInelastic);
QuasiElasticFTF= false; // Use built-in quasi-elastic (not add-on)
QuasiElasticQGS= true; // For QGS, it must use it.
G4HadronicParameters* param = G4HadronicParameters::Instance();
diff --git a/source/processes/electromagnetic/lowenergy/History b/source/processes/electromagnetic/lowenergy/History
index 10aa11e3fb1..cee822dd11e 100644
--- a/source/processes/electromagnetic/lowenergy/History
+++ b/source/processes/electromagnetic/lowenergy/History
@@ -16,6 +16,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+29.01.2021 V.Ivanchenko, emlowen-V10-06-14
+- G4MicroElecLOPhononModel - fixed Coverity warning; removed debug
+ printout; rename member of class
+
+06.12.2020 V.Ivanchenko,
+- G4MicroElecSurface, G4MicroElecLOPhononModel - fixed trivial
+ Coverity warnings
+
17.11.2020 V.Ivanchenko, emlowen-V10-06-13
- G4MicroElecInelasticModel_new, G4MicroElecInelastic_new,
G4MicroElecSurface - fixed Coverity warnings (non-initialized
diff --git a/source/processes/electromagnetic/lowenergy/include/G4MicroElecLOPhononModel.hh b/source/processes/electromagnetic/lowenergy/include/G4MicroElecLOPhononModel.hh
index e6a2bea3887..25fc0cacd4c 100644
--- a/source/processes/electromagnetic/lowenergy/include/G4MicroElecLOPhononModel.hh
+++ b/source/processes/electromagnetic/lowenergy/include/G4MicroElecLOPhononModel.hh
@@ -59,7 +59,7 @@
class G4MicroElecLOPhononModel : public G4VEmModel
{
public:
- G4MicroElecLOPhononModel(const G4ParticleDefinition*p = 0,
+ G4MicroElecLOPhononModel(const G4ParticleDefinition*p = nullptr,
const G4String& nam = "G4MicroElecLOPhononModel");
~G4MicroElecLOPhononModel() override;
@@ -81,14 +81,13 @@ protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
- G4bool Interband;
G4MicroElecLOPhononModel & operator=(const G4MicroElecLOPhononModel &right);
G4MicroElecLOPhononModel(const G4MicroElecLOPhononModel&);
- G4bool isOkToBeInitialised;
- G4bool isInitialised;
- G4bool abs = false;
- G4double Eprim = 0, signe = -1,phononEnergy=0;
+ G4bool Interband = false;
+ G4bool isInitialised = false;
+ G4bool absor = false;
+ G4double phononEnergy = 0.;
};
#endif
diff --git a/source/processes/electromagnetic/lowenergy/src/G4MicroElecLOPhononModel.cc b/source/processes/electromagnetic/lowenergy/src/G4MicroElecLOPhononModel.cc
index a7a31b31a57..88f554e046c 100644
--- a/source/processes/electromagnetic/lowenergy/src/G4MicroElecLOPhononModel.cc
+++ b/source/processes/electromagnetic/lowenergy/src/G4MicroElecLOPhononModel.cc
@@ -60,11 +60,10 @@
G4MicroElecLOPhononModel::G4MicroElecLOPhononModel(const G4ParticleDefinition*,
const G4String& nam)
- : G4VEmModel(nam),isInitialised(false)
+ : G4VEmModel(nam)
{
- abs = false;
fParticleChangeForGamma = GetParticleChangeForGamma();
- G4cout << "SiO2 Phonon model is constructed " << G4endl;
+ //G4cout << "SiO2 Phonon model is constructed " << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -74,60 +73,42 @@ G4MicroElecLOPhononModel::~G4MicroElecLOPhononModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-void G4MicroElecLOPhononModel::Initialise(const G4ParticleDefinition* /*particle*/,
- const G4DataVector& /*cuts*/)
+void G4MicroElecLOPhononModel::Initialise(const G4ParticleDefinition*,
+ const G4DataVector& /*cuts*/)
{
-
- if (isOkToBeInitialised == true && isInitialised == false) {
- G4cout << "Calling G4MicroElecLOPhononModel" << "::Initialise()" << G4endl;
-
- if (isInitialised) { return; }
- fParticleChangeForGamma = GetParticleChangeForGamma();
- isInitialised = true;
- }
+ if (isInitialised) { return; }
+ //G4cout << "Calling G4MicroElecLOPhononModel::Initialise()" << G4endl;
+ fParticleChangeForGamma = GetParticleChangeForGamma();
+ isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MicroElecLOPhononModel::CrossSectionPerVolume(const G4Material* material,
- const G4ParticleDefinition* p,
+ const G4ParticleDefinition*,
G4double ekin,
G4double, G4double)
{
- G4double e = CLHEP::eplus / coulomb,
-
- m0 = CLHEP::electron_mass_c2 / c_squared / kg,
- h = CLHEP::hbar_Planck / (m2*kg / s),
- eps0 = CLHEP::epsilon0 / (farad / m),
- kb = CLHEP::k_Boltzmann / (joule / kelvin);
- G4double eps = 9,
- einf = 3,
- T = 300;
-
- isOkToBeInitialised = true;
+ if (material->GetName()!="G4_SILICON_DIOXIDE") return 0.0;
+
+ const G4double e = CLHEP::eplus / CLHEP::coulomb;
+ const G4double m0 = CLHEP::electron_mass_c2 / (CLHEP::c_squared*CLHEP::kg);
+ const G4double h = CLHEP::hbar_Planck * CLHEP::s/ (CLHEP::m2*CLHEP::kg);
+ const G4double eps0 = CLHEP::epsilon0 * CLHEP::m/ (CLHEP::farad);
+ const G4double kb = CLHEP::k_Boltzmann * CLHEP::kelvin/ CLHEP::joule;
- const G4DataVector cuts;
- Initialise(p, cuts);
-
- if (material->GetName()!="G4_SILICON_DIOXIDE") return 1/DBL_MAX;
-
- G4double E =(ekin/eV)*e;
-
// Parameters SiO2
- eps = 3.84;
- einf = 2.25;
- phononEnergy = (0.75*0.153+0.25*0.063 )* eV;
- G4double hw = (phononEnergy / eV) * e;
- G4double n = 1.0 / (std::exp(hw / (kb*T)) - 1); //Phonon distribution
+ phononEnergy = (0.75*0.153+0.25*0.063 )* CLHEP::eV;
+ const G4double eps = 3.84;
+ const G4double einf = 2.25;
+ const G4double T = 300; // should be taken from material property
+
+ G4double E =(ekin/CLHEP::eV)*e;
- if (abs) { //Absorption
- Eprim = E + hw;
- signe = -1;
- }
- else { //Emission
- Eprim = E - hw;
- signe = +1;
- }
+ G4double hw = (phononEnergy / CLHEP::eV) * e;
+ G4double n = 1.0 / (std::exp(hw / (kb*T)) - 1); //Phonon distribution
+
+ G4double signe = (absor) ? -1. : 1.;
G4double racine = std::sqrt(1. + ((-signe*hw) / E));
@@ -135,7 +116,7 @@ G4double G4MicroElecLOPhononModel::CrossSectionPerVolume(const G4Material* mater
G4double MFP = (std::sqrt(2. * E / m0) / P)*m;
- return 2 / MFP;
+ return 2. / MFP;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -148,13 +129,8 @@ void G4MicroElecLOPhononModel::SampleSecondaries(
{
G4double E = aDynamicElectron->GetKineticEnergy();
-
- if (abs) {
- Eprim = E + phononEnergy;
- }
- else {
- Eprim = E - phononEnergy;
- }
+ G4double Eprim = (absor) ? E + phononEnergy : E - phononEnergy;
+
G4double rand = G4UniformRand();
G4double B = (E + Eprim + 2 * std::sqrt(E*Eprim)) / (E + Eprim - 2 * std::sqrt(E*Eprim));
G4double cosTheta = ((E + Eprim) / (2 * std::sqrt(E*Eprim)))*(1 - std::pow(B, rand)) + std::pow(B, rand);
@@ -162,7 +138,7 @@ void G4MicroElecLOPhononModel::SampleSecondaries(
if(Interband){
cosTheta = 1 - 2 * G4UniformRand(); //Isotrope
}
- G4double phi = 2. * pi * G4UniformRand();
+ G4double phi = twopi * G4UniformRand();
G4ThreeVector zVers = aDynamicElectron->GetMomentumDirection();
G4ThreeVector xVers = zVers.orthogonal();
G4ThreeVector yVers = zVers.cross(xVers);
diff --git a/source/processes/electromagnetic/lowenergy/src/G4MicroElecSurface.cc b/source/processes/electromagnetic/lowenergy/src/G4MicroElecSurface.cc
index 982e853c436..cc5f2d11d64 100644
--- a/source/processes/electromagnetic/lowenergy/src/G4MicroElecSurface.cc
+++ b/source/processes/electromagnetic/lowenergy/src/G4MicroElecSurface.cc
@@ -221,36 +221,34 @@ G4VParticleChange* G4MicroElecSurface::PostStepDoIt(const G4Track& aTrack, const
if (aTrack.GetStepLength()<=kCarTolerance)
{
theStatus = StepTooSmallSurf;
- if (pPostStepPoint) {
- WorkFunctionTable::iterator postStepWF;
- postStepWF = tableWF.find(pPostStepPoint->GetMaterial()->GetName());
- WorkFunctionTable::iterator preStepWF;
- preStepWF = tableWF.find(pPreStepPoint->GetMaterial()->GetName());
+ WorkFunctionTable::iterator postStepWF;
+ postStepWF = tableWF.find(pPostStepPoint->GetMaterial()->GetName());
+ WorkFunctionTable::iterator preStepWF;
+ preStepWF = tableWF.find(pPreStepPoint->GetMaterial()->GetName());
- if (postStepWF == tableWF.end()) {
- G4String str = "Material ";
- str += pPostStepPoint->GetMaterial()->GetName() + " not found!";
- G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
- return 0;
- }
+ if (postStepWF == tableWF.end()) {
+ G4String str = "Material ";
+ str += pPostStepPoint->GetMaterial()->GetName() + " not found!";
+ G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
+ return 0;
+ }
- else if (preStepWF == tableWF.end()) {
- G4String str = "Material ";
- str += pPreStepPoint->GetMaterial()->GetName() + " not found!";
- G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
- return 0;
- }
+ else if (preStepWF == tableWF.end()) {
+ G4String str = "Material ";
+ str += pPreStepPoint->GetMaterial()->GetName() + " not found!";
+ G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
+ return 0;
+ }
- if (pPreStepPoint->GetMaterial() != pPostStepPoint->GetMaterial()) {
+ if (pPreStepPoint->GetMaterial() != pPostStepPoint->GetMaterial()) {
- flag_franchissement_surface = false;
+ flag_franchissement_surface = false;
- if (flag_reflexion == true && flag_normal == true) {
- aParticleChange.ProposeMomentumDirection(-Reflexion(aStep.GetPostStepPoint()));
- flag_reflexion = false;
- flag_normal = false;
- }
+ if (flag_reflexion == true && flag_normal == true) {
+ aParticleChange.ProposeMomentumDirection(-Reflexion(aStep.GetPostStepPoint()));
+ flag_reflexion = false;
+ flag_normal = false;
}
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
diff --git a/source/processes/electromagnetic/standard/History b/source/processes/electromagnetic/standard/History
index 7980533aed5..141fd46b5eb 100644
--- a/source/processes/electromagnetic/standard/History
+++ b/source/processes/electromagnetic/standard/History
@@ -17,6 +17,11 @@ committal in the CVS repository !
----------------------------------------------------------
+26 January 21: V.Ivanchenko (emstand-V10-06-20)
+- G4BetheBlochModel, G4LindhardSorensenIonModel - fixed problem #2312,
+ restore computation of maximum energy transfer from Geant4 10.4,
+ affect only ultrarelativistic ions
+
11 November 20: V.Ivanchenko (emstand-V10-06-19)
- G4UrbanMscModel - restored parameterisation of step limit to
the variant of emstand-V10-06-13
diff --git a/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc b/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
index ade3e289bc0..5c84cf4dd2a 100644
--- a/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
@@ -166,15 +166,14 @@ void G4BetheBlochModel::SetupParameters()
formfact = 0.0;
tlimit = DBL_MAX;
if(particle->GetLeptonNumber() == 0) {
- G4int iz = G4lrint(q);
- if(iz <= 1) {
- formfact = (spin == 0.0 && mass < GeV) ? 1.181e-6 : 1.548e-6;
- } else {
- G4double x = nist->GetA27(iz);
- formfact = 3.969e-6*x*x;
+ G4double x = 0.8426*CLHEP::GeV;
+ if(spin == 0.0 && mass < GeV) { x = 0.736*CLHEP::GeV; }
+ else if (mass > CLHEP::GeV) {
+ G4int iz = G4lrint(std::abs(q));
+ if(iz > 1) { x /= nist->GetA27(iz); }
}
- tlimit = std::sqrt(0.414/formfact +
- electron_mass_c2*electron_mass_c2) - electron_mass_c2;
+ formfact = 2.0*CLHEP::electron_mass_c2/(x*x);
+ tlimit = 2.0/formfact;
}
}
@@ -252,7 +251,8 @@ G4double G4BetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
G4double cut)
{
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
- G4double cutEnergy = std::min(cut,tmax);
+ // projectile formfactor limit energy loss
+ G4double cutEnergy = std::min(std::min(cut,tmax), tlimit);
G4double tau = kineticEnergy/mass;
G4double gam = tau + 1.0;
@@ -405,7 +405,7 @@ void G4BetheBlochModel::SampleSecondaries(vector* vdp,
// projectile formfactor - suppresion of high energy
// delta-electron production at high energy
- G4double x = formfact*deltaKinEnergy*(deltaKinEnergy + 2*electron_mass_c2);
+ G4double x = formfact*deltaKinEnergy;
if(x > 1.e-6) {
G4double x1 = 1.0 + x;
@@ -440,8 +440,8 @@ void G4BetheBlochModel::SampleSecondaries(vector* vdp,
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * dp->GetTotalMomentum());
- if(cost > 1.0) { cost = 1.0; }
- G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
+ cost = std::min(cost, 1.0);
+ G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi*rndmEngineMod->flat();
@@ -479,12 +479,12 @@ void G4BetheBlochModel::SampleSecondaries(vector* vdp,
G4double G4BetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
G4double kinEnergy)
{
- // here particle type is checked for any method
+ // here particle type is checked for the case,
+ // when this model is shared between particles
SetParticle(pd);
G4double tau = kinEnergy/mass;
- G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
- (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
- return std::min(tmax,tlimit);
+ return 2.0*CLHEP::electron_mass_c2*tau*(tau + 2.) /
+ (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/source/processes/electromagnetic/standard/src/G4LindhardSorensenIonModel.cc b/source/processes/electromagnetic/standard/src/G4LindhardSorensenIonModel.cc
index 4c7b75e9b4c..31ae6ec083b 100644
--- a/source/processes/electromagnetic/standard/src/G4LindhardSorensenIonModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4LindhardSorensenIonModel.cc
@@ -135,20 +135,18 @@ void G4LindhardSorensenIonModel::SetupParameters()
mass = particle->GetPDGMass();
spin = particle->GetPDGSpin();
charge = particle->GetPDGCharge()*inveplus;
- Zin = G4lrint(charge);
+ Zin = G4lrint(std::abs(charge));
chargeSquare = charge*charge;
ratio = electron_mass_c2/mass;
static const G4double aMag = 1./(0.5*eplus*hbar_Planck*c_squared);
G4double magmom = particle->GetPDGMagneticMoment()*mass*aMag;
magMoment2 = magmom*magmom - 1.0;
- if(Zin <= 1) {
- formfact = (spin == 0.0 && mass < GeV) ? 1.181e-6 : 1.548e-6;
- } else {
- G4double x = nist->GetA27(Zin);
- formfact = 3.969e-6*x*x;
- }
- tlimit = std::sqrt(0.414/formfact +
- electron_mass_c2*electron_mass_c2) - electron_mass_c2;
+ G4double x = 0.8426*CLHEP::GeV;
+ if(spin == 0.0 && mass < GeV) { x = 0.736*CLHEP::GeV; }
+ else if (Zin > 1) { x /= nist->GetA27(Zin); }
+
+ formfact = 2.0*CLHEP::electron_mass_c2/(x*x);
+ tlimit = 2.0/formfact;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -170,7 +168,7 @@ G4LindhardSorensenIonModel::ComputeCrossSectionPerElectron(
{
G4double cross = 0.0;
// take into account formfactor
- G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy),tlimit);
+ G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double maxEnergy = std::min(tmax,maxKinEnergy);
if(cutEnergy < maxEnergy) {
@@ -228,7 +226,7 @@ G4LindhardSorensenIonModel::ComputeDEDXPerVolume(const G4Material* material,
{
// formfactor is taken into account in CorrectionsAlongStep(..)
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
- G4double cutEnergy = std::min(cut,tmax);
+ G4double cutEnergy = std::min(std::min(cut,tmax), tlimit);
G4double tau = kineticEnergy/mass;
G4double gam = tau + 1.0;
@@ -317,8 +315,7 @@ void G4LindhardSorensenIonModel::SampleSecondaries(
{
G4double kineticEnergy = dp->GetKineticEnergy();
// take into account formfactor
- G4double tmax =
- std::min(MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy),tlimit);
+ G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
G4double maxKinEnergy = std::min(maxEnergy,tmax);
if(minKinEnergy >= maxKinEnergy) { return; }
@@ -356,7 +353,7 @@ void G4LindhardSorensenIonModel::SampleSecondaries(
// projectile formfactor - suppresion of high energy
// delta-electron production at high energy
- G4double x = formfact*deltaKinEnergy*(deltaKinEnergy + 2*electron_mass_c2);
+ G4double x = formfact*deltaKinEnergy;
if(x > 1.e-6) {
G4double x1 = 1.0 + x;
@@ -391,7 +388,7 @@ void G4LindhardSorensenIonModel::SampleSecondaries(
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * dp->GetTotalMomentum());
- if(cost > 1.0) { cost = 1.0; }
+ cost = std::min(cost, 1.0);
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi*rndmEngineMod->flat();
@@ -434,10 +431,8 @@ G4LindhardSorensenIonModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
// here particle type is checked for any method
SetParticle(pd);
G4double tau = kinEnergy/mass;
- G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
- (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
- // formfactor is not taken into account
- return tmax;
+ return 2.0*CLHEP::electron_mass_c2*tau*(tau + 2.) /
+ (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/source/processes/electromagnetic/utils/History b/source/processes/electromagnetic/utils/History
index 6c5dec08c29..1df4870f26f 100644
--- a/source/processes/electromagnetic/utils/History
+++ b/source/processes/electromagnetic/utils/History
@@ -16,6 +16,15 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+30 January 21: V.Ivanchenko (emutils-V10-06-16)
+- G4VEnergyLossProcess, G4VEmProcess, - improved printout
+ G4EmExtraParameters, G4EmExtraParametersMessenger - fixed #2292
+
+11 January 21: V.Ivanchenko
+- G4EmCorrections - fix 2-D interpolation of shell corrections
+ (problem #2308), which provides minor change of ranges of
+ charge particles (< 0.1 mm)
+
12 November 20: B. Morgan (emutils-V10-06-15)
- Apply typo fixes from Gurkan Myczko (https://github.com/Geant4/geant4/pull/15)
diff --git a/source/processes/electromagnetic/utils/include/G4EmCorrections.hh b/source/processes/electromagnetic/utils/include/G4EmCorrections.hh
index 7c8f94a3fe6..451aec59760 100644
--- a/source/processes/electromagnetic/utils/include/G4EmCorrections.hh
+++ b/source/processes/electromagnetic/utils/include/G4EmCorrections.hh
@@ -287,9 +287,8 @@ inline G4double G4EmCorrections::Value2(G4double xv, G4double yv,
G4double z11, G4double z21,
G4double z12, G4double z22) const
{
- return (z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) +
- 0.5*(z12*((x2-xv)*(yv-y1)+(xv-x1)*(y2-yv))+
- z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv))))
+ return ( z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) +
+ z12*(x2-xv)*(yv-y1) + z21*(xv-x1)*(y2-yv) )
/ ((x2-x1)*(y2-y1));
}
diff --git a/source/processes/electromagnetic/utils/src/G4EmExtraParameters.cc b/source/processes/electromagnetic/utils/src/G4EmExtraParameters.cc
index 22c9cb3b2e0..a89da86c28a 100644
--- a/source/processes/electromagnetic/utils/src/G4EmExtraParameters.cc
+++ b/source/processes/electromagnetic/utils/src/G4EmExtraParameters.cc
@@ -284,7 +284,7 @@ const std::vector& G4EmExtraParameters::TypesPhysics() const
void G4EmExtraParameters::SetSubCutoff(G4bool val, const G4String& region)
{
- G4String r = CheckRegion(region);
+ const G4String& r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; iSetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
+ G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
+ SubSecCmd->SetParameter(subSec);
+
+ G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
+ SubSecCmd->SetParameter(subSecReg);
+
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
@@ -167,12 +173,6 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
unitPrm3->SetDefaultValue("mm");
StepFuncCmd3->SetParameter(unitPrm3);
- G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
- SubSecCmd->SetParameter(subSec);
-
- G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
- SubSecCmd->SetParameter(subSecReg);
-
bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
bfCmd->SetGuidance("Set factor for the process cross section.");
bfCmd->SetGuidance(" procName : process name");
diff --git a/source/processes/electromagnetic/utils/src/G4VEmProcess.cc b/source/processes/electromagnetic/utils/src/G4VEmProcess.cc
index 6b764ffacfb..4844de86f1b 100644
--- a/source/processes/electromagnetic/utils/src/G4VEmProcess.cc
+++ b/source/processes/electromagnetic/utils/src/G4VEmProcess.cc
@@ -897,10 +897,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
yes = theLambdaTable->StorePhysicsTable(nam,ascii);
if ( yes ) {
- G4cout << "Physics table is stored for " << particle->GetParticleName()
- << " and process " << GetProcessName()
- << " in the directory <" << directory
- << "> " << G4endl;
+ if(0 < verboseLevel) G4cout << "Stored: " << nam << G4endl;
} else {
G4cout << "Fail to store Physics Table for "
<< particle->GetParticleName()
@@ -915,11 +912,13 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
yes = theLambdaTablePrim->StorePhysicsTable(name,ascii);
if ( yes ) {
- G4cout << "Physics table prim is stored for "
- << particle->GetParticleName()
- << " and process " << GetProcessName()
- << " in the directory <" << directory
- << "> " << G4endl;
+ if(0 < verboseLevel) {
+ G4cout << "Physics table prim is stored for "
+ << particle->GetParticleName()
+ << " and process " << GetProcessName()
+ << " in the directory <" << directory
+ << "> " << G4endl;
+ }
} else {
G4cout << "Fail to store Physics Table Prim for "
<< particle->GetParticleName()
diff --git a/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc b/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc
index 57a649b65b7..0334bc21976 100644
--- a/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc
+++ b/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc
@@ -1738,21 +1738,6 @@ G4bool G4VEnergyLossProcess::StorePhysicsTable(
if(!StoreTable(part,theSubLambdaTable,ascii,directory,"SubLambda"))
{res = false;}
- if ( !res ) {
- if(1 < verboseLevel) {
- G4cout << "Physics tables are stored for "
- << particle->GetParticleName()
- << " and process " << GetProcessName()
- << " in the directory <" << directory
- << "> " << G4endl;
- }
- } else {
- G4cout << "Fail to store Physics Tables for "
- << particle->GetParticleName()
- << " and process " << GetProcessName()
- << " in the directory <" << directory
- << "> " << G4endl;
- }
return res;
}
@@ -1765,7 +1750,7 @@ G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
{
G4bool res = true;
if (!isMaster) return res;
- const G4String particleName = part->GetParticleName();
+ const G4String& particleName = part->GetParticleName();
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
@@ -1830,14 +1815,15 @@ G4bool G4VEnergyLossProcess::StoreTable(const G4ParticleDefinition* part,
const G4String& directory,
const G4String& tname)
{
- //G4cout << "G4VEnergyLossProcess::StoreTable: " << aTable
- // << " " << directory << " " << tname << G4endl;
G4bool res = true;
if ( aTable ) {
- const G4String name = GetPhysicsTableFileName(part,directory,tname,ascii);
- G4cout << name << G4endl;
- //G4cout << *aTable << G4endl;
- if( !aTable->StorePhysicsTable(name,ascii)) res = false;
+ const G4String& name = GetPhysicsTableFileName(part, directory, tname, ascii);
+ if ( aTable->StorePhysicsTable(name,ascii) ) {
+ if (0 < verboseLevel) G4cout << "Stored: " << name << G4endl;
+ } else {
+ res = false;
+ G4cout << "Fail to store: " << name << G4endl;
+ }
}
return res;
}
diff --git a/source/processes/hadronic/cross_sections/History b/source/processes/hadronic/cross_sections/History
index c4f752ada03..910a9b056b6 100644
--- a/source/processes/hadronic/cross_sections/History
+++ b/source/processes/hadronic/cross_sections/History
@@ -14,6 +14,32 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
+17 December 2020 - Vladimir Ivanchenko (hadr-cross-V10-06-18)
+- G4GammaNuclearXS - fixed duplicated name of static variable
+- G4ParticleInelasticXS, G4NeutronCaptureXS, G4NeutronElasticXS,
+ G4NeutronInelasticXS - make MAXZ variable static class member
+
+16 December 2020 - Guilherme Amadio
+- Drop cache for per-element G4CrossSectionDataStore::GetCrossSection(),
+ since the cache is never used in practice. This method is always called
+ by G4CrossSectionDataStore::ComputeCrossSection() inside a for loop in
+ which the element changes for each iteration, which ensures the cache
+ is always missed. Note that material, particle, and energy are still
+ cached by G4CrossSectionDataStore::ComputeCrossSection(), and that cache
+ hit rate has been measured to be about 6.9% for a full CMS ttbar event
+ simulation at 14 TeV. The condition to check for the cache in that case
+ has been optimized to minimize unnecessary checks by reordering checked
+ conditions from most to least discriminant.
+
+11 December 2020 - Vladimir Ivanchenko
+- G4VCrossSectionRatio - use inheritance from G4VCrossSectionDataSet
+ in order to guarantee deletion of object end of run
+
+06 December 2020 - Vladimir Ivanchenko
+- G4ParticleInelasticXS, G4CrossSectionInelastic, G4CrossSectionElastic
+ extended maximum energy range for ion cross sections (QBBC and other
+ Physics Lists has the same high energy limits)
+
24 November 2020 - A. Ribon (hadr-cross-V10-06-17)
- G4EMDissociationCrossSection : apply fixes suggested by Laurie Nevay and
Andrey Abramov (bug report #2254) to avoid numerical crashes for ions
diff --git a/source/processes/hadronic/cross_sections/include/G4CrossSectionDataStore.hh b/source/processes/hadronic/cross_sections/include/G4CrossSectionDataStore.hh
index 04f601bd04a..68034eeb35b 100644
--- a/source/processes/hadronic/cross_sections/include/G4CrossSectionDataStore.hh
+++ b/source/processes/hadronic/cross_sections/include/G4CrossSectionDataStore.hh
@@ -122,12 +122,6 @@ private:
G4double matKinEnergy;
G4double matCrossSection;
- const G4Material* elmMaterial;
- const G4Element* currentElement;
- const G4ParticleDefinition* elmParticle;
- G4double elmKinEnergy;
- G4double elmCrossSection;
-
G4int nDataSetList;
G4int verboseLevel;
//Fast path: caching
diff --git a/source/processes/hadronic/cross_sections/include/G4GammaNuclearXS.hh b/source/processes/hadronic/cross_sections/include/G4GammaNuclearXS.hh
index 35856a8cb98..f3f62d338f3 100644
--- a/source/processes/hadronic/cross_sections/include/G4GammaNuclearXS.hh
+++ b/source/processes/hadronic/cross_sections/include/G4GammaNuclearXS.hh
@@ -48,8 +48,6 @@
#include "G4Threading.hh"
#include
-const G4int MAXZEL = 93;
-
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -101,8 +99,9 @@ private:
G4VCrossSectionDataSet* ggXsection;
const G4ParticleDefinition* gamma;
- static G4PhysicsVector* data[MAXZEL];
- static G4double coeff[MAXZEL];
+ static const G4int MAXZGAMMAN = 93;
+ static G4PhysicsVector* data[MAXZGAMMAN];
+ static G4double coeff[MAXZGAMMAN];
static G4String gDataDirectory;
G4bool isMaster;
diff --git a/source/processes/hadronic/cross_sections/include/G4NeutronCaptureXS.hh b/source/processes/hadronic/cross_sections/include/G4NeutronCaptureXS.hh
index 5621373808d..42d66ac821c 100644
--- a/source/processes/hadronic/cross_sections/include/G4NeutronCaptureXS.hh
+++ b/source/processes/hadronic/cross_sections/include/G4NeutronCaptureXS.hh
@@ -51,8 +51,6 @@
#include
#include
-const G4int MAXZCAPTURE = 93;
-
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -113,6 +111,7 @@ private:
G4bool isMaster;
+ static const G4int MAXZCAPTURE = 93;
static G4ElementData* data;
static G4String gDataDirectory;
diff --git a/source/processes/hadronic/cross_sections/include/G4NeutronElasticXS.hh b/source/processes/hadronic/cross_sections/include/G4NeutronElasticXS.hh
index 4572147e63c..1738aeb4b5a 100644
--- a/source/processes/hadronic/cross_sections/include/G4NeutronElasticXS.hh
+++ b/source/processes/hadronic/cross_sections/include/G4NeutronElasticXS.hh
@@ -48,8 +48,6 @@
#include "G4Threading.hh"
#include
-const G4int MAXZEL = 93;
-
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -102,6 +100,7 @@ private:
G4VComponentCrossSection* ggXsection;
const G4ParticleDefinition* neutron;
+ static const G4int MAXZEL = 93;
static G4PhysicsVector* data[MAXZEL];
static G4double coeff[MAXZEL];
static G4String gDataDirectory;
diff --git a/source/processes/hadronic/cross_sections/include/G4NeutronInelasticXS.hh b/source/processes/hadronic/cross_sections/include/G4NeutronInelasticXS.hh
index b7ccec6e4b0..c608869c6be 100644
--- a/source/processes/hadronic/cross_sections/include/G4NeutronInelasticXS.hh
+++ b/source/processes/hadronic/cross_sections/include/G4NeutronInelasticXS.hh
@@ -48,8 +48,6 @@
#include "G4Threading.hh"
#include
-const G4int MAXZINEL = 93;
-
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -111,6 +109,7 @@ private:
G4bool isMaster;
+ static const G4int MAXZINEL = 93;
static G4ElementData* data;
static G4double coeff[MAXZINEL];
static G4String gDataDirectory;
diff --git a/source/processes/hadronic/cross_sections/include/G4ParticleInelasticXS.hh b/source/processes/hadronic/cross_sections/include/G4ParticleInelasticXS.hh
index 2449cf6c775..614d79cdb13 100644
--- a/source/processes/hadronic/cross_sections/include/G4ParticleInelasticXS.hh
+++ b/source/processes/hadronic/cross_sections/include/G4ParticleInelasticXS.hh
@@ -49,8 +49,6 @@
#include "G4Threading.hh"
#include
-const G4int MAXZINELP = 93;
-
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -113,6 +111,7 @@ private:
G4int index;
G4bool isMaster;
+ static const G4int MAXZINELP = 93;
static G4ElementData* data[5];
static G4double coeff[MAXZINELP][5];
static G4String gDataDirectory[5];
diff --git a/source/processes/hadronic/cross_sections/include/G4VCrossSectionDataSet.hh b/source/processes/hadronic/cross_sections/include/G4VCrossSectionDataSet.hh
index 06ced671905..8a6410898f9 100644
--- a/source/processes/hadronic/cross_sections/include/G4VCrossSectionDataSet.hh
+++ b/source/processes/hadronic/cross_sections/include/G4VCrossSectionDataSet.hh
@@ -143,8 +143,6 @@ public: //with description
virtual void CrossSectionDescription(std::ostream&) const;
-public: // Without Description
-
virtual G4int GetVerboseLevel() const;
virtual void SetVerboseLevel(G4int value);
@@ -163,12 +161,14 @@ public: // Without Description
inline const G4String& GetName() const;
-protected:
+ inline void SetName(const G4String& nam);
- inline void SetName(const G4String&);
+protected:
G4int verboseLevel;
+ G4String name;
+
private:
G4VCrossSectionDataSet & operator=(const G4VCrossSectionDataSet &right);
@@ -181,7 +181,6 @@ private:
G4bool isForAllAtomsAndEnergies;
- G4String name;
};
inline G4double
diff --git a/source/processes/hadronic/cross_sections/include/G4VCrossSectionRatio.hh b/source/processes/hadronic/cross_sections/include/G4VCrossSectionRatio.hh
index 9757ecbed91..92987b6d59e 100644
--- a/source/processes/hadronic/cross_sections/include/G4VCrossSectionRatio.hh
+++ b/source/processes/hadronic/cross_sections/include/G4VCrossSectionRatio.hh
@@ -45,60 +45,28 @@
#ifndef G4VCrossSectionRatio_h
#define G4VCrossSectionRatio_h 1
-#include "globals.hh"
+#include "G4VCrossSectionDataSet.hh"
class G4ParticleDefinition;
-class G4VCrossSectionRatio
+class G4VCrossSectionRatio : G4VCrossSectionDataSet
{
public:
- G4VCrossSectionRatio(const G4String& nam = "", G4int verb = 0);
+ G4VCrossSectionRatio(const G4String& nam = "XSRatio", G4int verb = 0);
- virtual ~G4VCrossSectionRatio();
+ ~G4VCrossSectionRatio() override;
virtual
G4double ComputeRatio(const G4ParticleDefinition*,
G4double kinEnergy,
G4int /*Z*/, G4int /*A*/) = 0;
- virtual
- void BuildPhysicsTable(const G4ParticleDefinition&);
-
- virtual
- void DumpPhysicsTable(const G4ParticleDefinition&);
-
- virtual
- void Description() const;
-
- inline void SetVerboseLevel(G4int value);
-
- inline G4int GetVerboseLevel() const;
-
- inline const G4String& GetName() const;
-
private:
G4VCrossSectionRatio & operator=(const G4VCrossSectionRatio &right);
G4VCrossSectionRatio(const G4VCrossSectionRatio&);
- G4int verboseLevel;
- const G4String name;
};
-inline void G4VCrossSectionRatio::SetVerboseLevel(G4int value)
-{
- verboseLevel = value;
-}
-
-inline G4int G4VCrossSectionRatio::GetVerboseLevel() const
-{
- return verboseLevel;
-}
-
-inline const G4String& G4VCrossSectionRatio::GetName() const
-{
- return name;
-}
-
#endif
diff --git a/source/processes/hadronic/cross_sections/src/G4CrossSectionDataStore.cc b/source/processes/hadronic/cross_sections/src/G4CrossSectionDataStore.cc
index 7e091dfcb64..06e446f1923 100644
--- a/source/processes/hadronic/cross_sections/src/G4CrossSectionDataStore.cc
+++ b/source/processes/hadronic/cross_sections/src/G4CrossSectionDataStore.cc
@@ -57,16 +57,19 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
-G4CrossSectionDataStore::G4CrossSectionDataStore() :
- nDataSetList(0), verboseLevel(0),fastPathFlags(),fastPathParams(),
- counters(),fastPathCache()
-{
- nist = G4NistManager::Instance();
- currentMaterial = elmMaterial = nullptr;
- currentElement = nullptr; //ALB 14-Aug-2012 Coverity fix.
- matParticle = elmParticle = nullptr;
- matKinEnergy = elmKinEnergy = matCrossSection = elmCrossSection = 0.0;
-}
+G4CrossSectionDataStore::G4CrossSectionDataStore()
+ : nist(G4NistManager::Instance())
+ , currentMaterial(nullptr)
+ , matParticle(nullptr)
+ , matKinEnergy(0.0)
+ , matCrossSection(0.0)
+ , nDataSetList(0)
+ , verboseLevel(0)
+ , fastPathFlags()
+ , fastPathParams()
+ , counters()
+ , fastPathCache()
+{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -268,10 +271,10 @@ G4double
G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
const G4Material* mat)
{
- if(mat == currentMaterial && part->GetDefinition() == matParticle
- && part->GetKineticEnergy() == matKinEnergy) {
+ if(part->GetKineticEnergy() == matKinEnergy && mat == currentMaterial &&
+ part->GetDefinition() == matParticle)
return matCrossSection;
- }
+
currentMaterial = mat;
matParticle = part->GetDefinition();
matKinEnergy = part->GetKineticEnergy();
@@ -292,58 +295,36 @@ G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
-G4double
-G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
- const G4Element* elm,
- const G4Material* mat)
+G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
+ const G4Element* elm,
+ const G4Material* mat)
{
- if(mat == elmMaterial && elm == currentElement &&
- part->GetDefinition() == elmParticle &&
- part->GetKineticEnergy() == elmKinEnergy)
- { return elmCrossSection; }
-
- elmMaterial = mat;
- currentElement = elm;
- elmParticle = part->GetDefinition();
- elmKinEnergy = part->GetKineticEnergy();
- elmCrossSection = 0.0;
-
- G4int i = nDataSetList-1;
+ G4int i = nDataSetList - 1;
G4int Z = elm->GetZasInt();
- if (elm->GetNaturalAbundanceFlag() &&
- dataSetList[i]->IsElementApplicable(part, Z, mat)) {
+ if(elm->GetNaturalAbundanceFlag() &&
+ dataSetList[i]->IsElementApplicable(part, Z, mat))
+ {
// element wise cross section
- elmCrossSection = dataSetList[i]->GetElementCrossSection(part, Z, mat);
+ return dataSetList[i]->GetElementCrossSection(part, Z, mat);
+ }
- //G4cout << "Element wise " << elmParticle->GetParticleName()
- // << " xsec(barn)= " << elmCrossSection/barn
- // << " E(MeV)= " << elmKinEnergy/MeV
- // << " Z= " << Z << " AbundFlag= " << elm->GetNaturalAbandancesFlag()
- // <GetNumberOfIsotopes();
- } else {
- // isotope wise cross section
- size_t nIso = elm->GetNumberOfIsotopes();
-
- // user-defined isotope abundances
- const G4double* abundVector = elm->GetRelativeAbundanceVector();
-
- for (size_t j=0; j 0.0) {
- const G4Isotope* iso = elm->GetIsotope(j);
- elmCrossSection += abundVector[j]*
- GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
- //G4cout << "Isotope wise " << elmParticle->GetParticleName()
- // << " xsec(barn)= " << elmCrossSection/barn
- // << " E(MeV)= " << elmKinEnergy/MeV
- // << " Z= " << Z << " A= " << iso->GetN() << " j= " << j << G4endl;
- }
- }
+ // user-defined isotope abundances
+ const G4double* abundVector = elm->GetRelativeAbundanceVector();
+
+ G4double sigma = 0.0;
+
+ for(size_t j = 0; j < nIso; ++j)
+ {
+ const G4Isotope* iso = elm->GetIsotope(j);
+ sigma += abundVector[j] *
+ GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
}
- //G4cout << " E(MeV)= " << elmKinEnergy/MeV
- // << "xsec(barn)= " << elmCrossSection/barn <GetMaxEnergy() *
- ( std::abs( p.GetBaryonNumber() ) > 1 ? Zmax : 1 ) );
+ G4int fact = (std::abs(p.GetBaryonNumber()) > 1 ||
+ p.GetParticleName() == "GenericIon") ? Zmax : 1;
+ SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
}
void G4CrossSectionElastic::DumpPhysicsTable(const G4ParticleDefinition& p)
diff --git a/source/processes/hadronic/cross_sections/src/G4CrossSectionInelastic.cc b/source/processes/hadronic/cross_sections/src/G4CrossSectionInelastic.cc
index 72a21d1ec0c..24f64830c41 100644
--- a/source/processes/hadronic/cross_sections/src/G4CrossSectionInelastic.cc
+++ b/source/processes/hadronic/cross_sections/src/G4CrossSectionInelastic.cc
@@ -91,8 +91,9 @@ void G4CrossSectionInelastic::BuildPhysicsTable(const G4ParticleDefinition& p)
// often shared between the different types of ions (d, t, He3, alpha, and
// genericIon) therefore we scale by Zmax - which is safely larger than the
// number of nucleons of the heaviest nuclides.
- SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() *
- ( std::abs( p.GetBaryonNumber() ) > 1 ? Zmax : 1 ) );
+ G4int fact = (std::abs(p.GetBaryonNumber()) > 1 ||
+ p.GetParticleName() == "GenericIon") ? Zmax : 1;
+ SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
}
void G4CrossSectionInelastic::DumpPhysicsTable(const G4ParticleDefinition& p)
diff --git a/source/processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc b/source/processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc
index fd8fadb5991..e7c8d7550fd 100644
--- a/source/processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc
+++ b/source/processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc
@@ -73,7 +73,7 @@ G4GammaNuclearXS::G4GammaNuclearXS()
// verboseLevel = 0;
if(verboseLevel > 0){
G4cout << "G4GammaNuclearXS::G4GammaNuclearXS Initialise for Z < "
- << MAXZEL << G4endl;
+ << MAXZGAMMAN << G4endl;
}
ggXsection = G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet("PhotoNuclearXS");
if(ggXsection == nullptr) ggXsection = new G4PhotoNuclearCrossSection();
@@ -83,7 +83,7 @@ G4GammaNuclearXS::G4GammaNuclearXS()
G4GammaNuclearXS::~G4GammaNuclearXS()
{
if(isMaster) {
- for(G4int i=0; iGetKineticEnergy();
- G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
+ G4int Z = (ZZ >= MAXZGAMMAN) ? MAXZGAMMAN - 1 : ZZ;
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
@@ -217,7 +217,7 @@ G4GammaNuclearXS::BuildPhysicsTable(const G4ParticleDefinition& p)
auto elmVec = mat->GetElementVector();
size_t numOfElem = mat->GetNumberOfElements();
for (size_t ie = 0; ie < numOfElem; ++ie) {
- G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZEL-1));
+ G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZGAMMAN-1));
if(data[Z] == nullptr) { Initialise(Z); }
}
}
diff --git a/source/processes/hadronic/cross_sections/src/G4ParticleInelasticXS.cc b/source/processes/hadronic/cross_sections/src/G4ParticleInelasticXS.cc
index fd6402b2ad3..8fbf961de80 100644
--- a/source/processes/hadronic/cross_sections/src/G4ParticleInelasticXS.cc
+++ b/source/processes/hadronic/cross_sections/src/G4ParticleInelasticXS.cc
@@ -49,6 +49,7 @@
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4IsotopeList.hh"
+#include "G4HadronicParameters.hh"
#include
#include
@@ -297,6 +298,9 @@ G4ParticleInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
return;
}
+ G4int fact = (p.GetParticleName() == "proton") ? 1 : 256;
+ SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
+
if(data[index] == nullptr) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&particleInelasticXSMutex);
diff --git a/source/processes/hadronic/cross_sections/src/G4VCrossSectionDataSet.cc b/source/processes/hadronic/cross_sections/src/G4VCrossSectionDataSet.cc
index 60eb07e6959..fa03546b129 100644
--- a/source/processes/hadronic/cross_sections/src/G4VCrossSectionDataSet.cc
+++ b/source/processes/hadronic/cross_sections/src/G4VCrossSectionDataSet.cc
@@ -47,9 +47,9 @@
#include "G4HadronicParameters.hh"
G4VCrossSectionDataSet::G4VCrossSectionDataSet(const G4String& nam) :
- verboseLevel(0),minKinEnergy(0.0),
+ verboseLevel(0),name(nam),minKinEnergy(0.0),
maxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy()),
- isForAllAtomsAndEnergies(false),name(nam)
+ isForAllAtomsAndEnergies(false)
{
registry = G4CrossSectionDataSetRegistry::Instance();
registry->Register(this);
diff --git a/source/processes/hadronic/cross_sections/src/G4VCrossSectionRatio.cc b/source/processes/hadronic/cross_sections/src/G4VCrossSectionRatio.cc
index a377a3c183f..372b13950d9 100644
--- a/source/processes/hadronic/cross_sections/src/G4VCrossSectionRatio.cc
+++ b/source/processes/hadronic/cross_sections/src/G4VCrossSectionRatio.cc
@@ -37,23 +37,13 @@
//
#include "G4VCrossSectionRatio.hh"
-#include "G4ParticleDefinition.hh"
G4VCrossSectionRatio::G4VCrossSectionRatio(const G4String& nam, G4int verb)
- : verboseLevel(verb),name(nam)
-{}
+ : G4VCrossSectionDataSet(nam)
+{
+ SetVerboseLevel(verb);
+}
G4VCrossSectionRatio::~G4VCrossSectionRatio()
{}
-void
-G4VCrossSectionRatio::Description() const
-{}
-
-void
-G4VCrossSectionRatio::BuildPhysicsTable(const G4ParticleDefinition&)
-{}
-
-void
-G4VCrossSectionRatio::DumpPhysicsTable(const G4ParticleDefinition&)
-{}
diff --git a/source/processes/hadronic/models/particle_hp/History b/source/processes/hadronic/models/particle_hp/History
index d1a9fcc097c..97c71c74255 100644
--- a/source/processes/hadronic/models/particle_hp/History
+++ b/source/processes/hadronic/models/particle_hp/History
@@ -14,6 +14,11 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
+05 January 2021 Vladimir Ivanchenko (hadr-hpp-V10-06-13)
+--------------------------------------------------------
+- G4ParticleHPThermalScattering - add final state phi-rotation;
+ fixed problems #2290 and #1856
+
05 November 2020 Alberto Ribon (hadr-hpp-V10-06-12)
--------------------------------------------------
- G4ParticleHPInelastic, G4ParticleHPInelasticData : improved error message
diff --git a/source/processes/hadronic/models/particle_hp/src/G4ParticleHPThermalScattering.cc b/source/processes/hadronic/models/particle_hp/src/G4ParticleHPThermalScattering.cc
index 496ecdc1ae3..d9033811acd 100644
--- a/source/processes/hadronic/models/particle_hp/src/G4ParticleHPThermalScattering.cc
+++ b/source/processes/hadronic/models/particle_hp/src/G4ParticleHPThermalScattering.cc
@@ -65,74 +65,19 @@ G4ParticleHPThermalScattering::G4ParticleHPThermalScattering()
SetMaxEnergy( 4*eV );
theXSection = new G4ParticleHPThermalScatteringData();
- //sizeOfMaterialTable = G4Material::GetMaterialTable()->size();
- //buildPhysicsTable();
nMaterial = 0;
nElement = 0;
}
-
+
G4ParticleHPThermalScattering::~G4ParticleHPThermalScattering()
{
-
-/*
- for ( std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >::iterator it = incoherentFSs->begin() ; it != incoherentFSs->end() ; it++ )
- {
- std::map < G4double , std::vector < E_isoAng* >* >::iterator itt;
- for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
- {
- std::vector< E_isoAng* >::iterator ittt;
- for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
- {
- delete *ittt;
- }
- delete itt->second;
- }
- delete it->second;
- }
-
- for ( std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >::iterator it = coherentFSs->begin() ; it != coherentFSs->end() ; it++ )
- {
- std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >::iterator itt;
- for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
- {
- std::vector < std::pair< G4double , G4double >* >::iterator ittt;
- for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
- {
- delete *ittt;
- }
- delete itt->second;
- }
- delete it->second;
- }
-
- for ( std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >::iterator it = inelasticFSs->begin() ; it != inelasticFSs->end() ; it++ )
- {
- std::map < G4double , std::vector < E_P_E_isoAng* >* >::iterator itt;
- for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
- {
- std::vector < E_P_E_isoAng* >::iterator ittt;
- for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
- {
- std::vector < E_isoAng* >::iterator it4;
- for ( it4 = (*ittt)->vE_isoAngle.begin() ; it4 != (*ittt)->vE_isoAngle.end() ; it4++ )
- {
- delete *it4;
- }
- delete *ittt;
- }
- delete itt->second;
- }
- delete it->second;
- }
-*/
-
delete theHPElastic;
- //TKDB 160506
- //delete theXSection;
}
+
+
void G4ParticleHPThermalScattering::clearCurrentFSData() {
if ( incoherentFSs != NULL ) {
@@ -392,20 +337,11 @@ E_isoAng* G4ParticleHPThermalScattering::readAnE_isoAng( std::istream* file )
G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus )
{
-/*
- //Trick for dynamically generated materials
- if ( sizeOfMaterialTable != G4Material::GetMaterialTable()->size() ) {
- sizeOfMaterialTable = G4Material::GetMaterialTable()->size();
- buildPhysicsTable();
- theXSection->BuildPhysicsTable( *aTrack.GetDefinition() );
- }
-*/
// Select Element > Reaction >
const G4Material * theMaterial = aTrack.GetMaterial();
G4double aTemp = theMaterial->GetTemperature();
G4int n = theMaterial->GetNumberOfElements();
- //static const G4ElementTable* theElementTable = G4Element::GetElementTable();
G4bool findThermalElement = false;
G4int ielement;
@@ -521,10 +457,11 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
//set
theParticleChange.SetEnergyChange( sE );
- theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
+ G4double phi = CLHEP::twopi*G4UniformRand();
+ G4double sint= std::sqrt ( 1 - mu*mu );
+ theParticleChange.SetMomentumChange( sint*std::cos(phi), sint*std::sin(phi), mu );
}
- //else if ( random <= ( inelastic + theXSection->GetCoherentCrossSection( dp , (*theElementTable)[ ielement ] , aTemp ) ) / total )
else if ( random <= ( inelastic + theXSection->GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
{
// Coherent Elastic
@@ -582,7 +519,6 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
std::vector< G4double > vp_T;
G4int n1 = pvE_p_TL->size();
- //G4int n2 = pvE_p_TH->size();
//171005 fix bug, contribution from H.N. TRAN@CEA
for ( G4int i=0 ; i < n1 ; i++ )
@@ -623,7 +559,9 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
//G4cout << "E= " << E/eV << ", Ei= " << Ei << ", mu= " << mu << G4endl;
theParticleChange.SetEnergyChange( E );
- theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
+ G4double phi = CLHEP::twopi*G4UniformRand();
+ G4double sint= std::sqrt ( 1 - mu*mu );
+ theParticleChange.SetMomentumChange( sint*std::cos(phi), sint*std::sin(phi), mu );
}
else
@@ -693,7 +631,9 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
// Set Final State
theParticleChange.SetEnergyChange( aTrack.GetKineticEnergy() ); // No energy change in Elastic
- theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
+ G4double phi = CLHEP::twopi*G4UniformRand();
+ G4double sint= std::sqrt ( 1 - mu*mu );
+ theParticleChange.SetMomentumChange( sint*std::cos(phi), sint*std::sin(phi), mu );
}
delete dp;
diff --git a/source/processes/hadronic/stopping/History b/source/processes/hadronic/stopping/History
index cfec7684e6e..6862b693bef 100644
--- a/source/processes/hadronic/stopping/History
+++ b/source/processes/hadronic/stopping/History
@@ -14,6 +14,15 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
+29 January 2021 V.Ivanchenko (hadr-stopping-V10-06-03)
+ --------------------------------------------------------------------
+- G4MuonicAtomDecay - fixed remaining Coverity warning, removed
+ commented code
+
+05 December 2020 V.Ivanchenko
+ --------------------------------------------------------------------
+- G4MuonicAtomDecay - fixed Coverity warning, removed commented code
+
01 April 2020 V.Ivanchenko (hadr-stopping-V10-06-02)
--------------------------------------------------------------------
- G4MuonicAtomDecay - fixed Coverity warning
diff --git a/source/processes/hadronic/stopping/src/G4MuonicAtomDecay.cc b/source/processes/hadronic/stopping/src/G4MuonicAtomDecay.cc
index 62024dc1a5d..30dfad30232 100644
--- a/source/processes/hadronic/stopping/src/G4MuonicAtomDecay.cc
+++ b/source/processes/hadronic/stopping/src/G4MuonicAtomDecay.cc
@@ -84,7 +84,6 @@ G4MuonicAtomDecay::G4MuonicAtomDecay(G4HadronicInteraction* hiptr,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuonicAtomDecay::~G4MuonicAtomDecay()
-//{delete theTotalResult;}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -176,7 +175,7 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
G4ForceCondition* condition = nullptr; // it is unused in the following call anyway
G4double meanlife = GetMeanLifeTime(aTrack, condition);
- G4HadFinalState* result = nullptr; // result before converting to G4VParticleChange*
+ G4HadFinalState* result = nullptr; // result before converting to G4VParticleChange*
// G4int nSecondaries = 0;
// save track time and start from zero time
// G4double time0 = aTrack.GetGlobalTime(); FillResult does it
@@ -220,7 +219,7 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
G4VDecayChannel* decaychannel = nullptr;
G4double massParent = aParticle->GetMass();
decaychannel = decaytable->SelectADecayChannel(massParent);
- if ( decaychannel ==0) {
+ if (decaychannel == nullptr) {
// decay channel not found
G4ExceptionDescription ed;
ed << "Can not determine decay channel for "
@@ -256,17 +255,18 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
}
#endif
products = decaychannel->DecayIt(aParticle->GetMass());
- if(!products) {
+ if(products == nullptr) {
G4ExceptionDescription ed;
ed << "No products are generated for "
<< aParticleDef->GetParticleName();
G4Exception("G4MuonicAtomDecay::DecayIt","DECAY003",FatalException,ed);
+ return &theTotalResult;
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
decaychannel->SetVerboseLevel(temp);
}
- if (GetVerboseLevel()>2 && products) {
+ if (GetVerboseLevel()>2) {
if (! products->IsChecked() ) products->DumpInfo();
}
#endif
@@ -304,11 +304,11 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
// PostStep case
products->Boost( ParentEnergy, ParentDirection);
}
- // G4ParticleChangeForDecay fParticleChangeForDecay; // is it equivalent to G4ParticleChange* theTotalResult;
//add products in theTotalResult
- G4int numberOfSecondaries = products->entries();
+ G4int numberOfSecondaries = (nullptr != products) ? products->entries() : 0;
theTotalResult.SetNumberOfSecondaries(numberOfSecondaries);
+
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << "G4MuonicAtomDecay::DecayIt : Decay vertex :";
@@ -414,7 +414,7 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
FatalException, ed);
}
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
- } while(!result);
+ } while(result == nullptr);
// add delay time of capture (inter + intra)
G4int nsec = result->GetNumberOfSecondaries();
@@ -432,8 +432,6 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
FillResult(result,aTrack);
- // delete result;// causes bad free check fixme; move to the class members?
-
ClearNumberOfInteractionLengthLeft();
return &theTotalResult;
diff --git a/source/processes/transportation/History b/source/processes/transportation/History
index c7607fc5007..90291e25f36 100644
--- a/source/processes/transportation/History
+++ b/source/processes/transportation/History
@@ -16,8 +16,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
-Oct 26th 2020, G. Amadio & J.Apostolakis transport-V10-06-00
+Dec 16th 2020, G. Amadio transport-V10-06-01
+----------------------------
+Limit reporting of number of calls to G4Transportation::AlongStepDoIt()
+to when either G4VERBOSE or G4DEBUG_TRANSPORT is defined, which allows to
+avoid using a thread local variable for a slight performance gain.
+Oct 26th 2020, G. Amadio & J.Apostolakis transport-V10-06-00
+----------------------------
A substantial reorganisation of G4Transportation::AlongStepGPIL
to use values already in cache, reduce the number of branches, and
use extra local variables for track properties to avoid indirections.
diff --git a/source/processes/transportation/src/G4Transportation.cc b/source/processes/transportation/src/G4Transportation.cc
index dd19e071efc..833dde37d8a 100644
--- a/source/processes/transportation/src/G4Transportation.cc
+++ b/source/processes/transportation/src/G4Transportation.cc
@@ -492,9 +492,12 @@ G4double G4Transportation::AlongStepGetPhysicalInteractionLength(
G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
const G4Step& stepData )
{
+#if defined(G4VERBOSE) || defined(G4DEBUG_TRANSPORT)
static G4ThreadLocal G4long noCallsASDI=0;
- const char *methodName= "AlongStepDoIt";
noCallsASDI++;
+#else
+ #define noCallsASDI 0
+#endif
fParticleChange.Initialize(track) ;
@@ -591,7 +594,7 @@ G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
if( endEnergy > fThreshold_Warning_Energy && ! fSilenceLooperWarnings )
{
fpLogger->ReportLoopingTrack( track, stepData, fNoLooperTrials,
- noCallsASDI, methodName );
+ noCallsASDI, __func__ );
}
fNoLooperTrials=0;
}
@@ -606,7 +609,7 @@ G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
#ifdef G4VERBOSE
if( verboseLevel > 2 && ! fSilenceLooperWarnings )
{
- G4cout << " " << methodName
+ G4cout << " " << __func__
<< " Particle is looping but is saved ..." << G4endl
<< " Number of trials = " << fNoLooperTrials << G4endl
<< " No of calls to = " << noCallsASDI << G4endl;
diff --git a/source/processes/transportation/src/G4TransportationLogger.cc b/source/processes/transportation/src/G4TransportationLogger.cc
index e02c045bfcf..2cdd2dc6ae2 100644
--- a/source/processes/transportation/src/G4TransportationLogger.cc
+++ b/source/processes/transportation/src/G4TransportationLogger.cc
@@ -129,10 +129,11 @@ void G4TransportationLogger::ReportLoopingTrack( const G4Track & track,
<< G4endl
<< " Number of propagation trials = " << numTrials
<< " ( vs maximum = " << GetThresholdTrials() << " for 'important' particles ) "
- << G4endl
- << " ( Number of *calls* of Transport/AlongStepDoIt = " << noCalls << " )"
<< G4endl;
+ if (noCalls)
+ msg << " ( Number of *calls* of Transport/AlongStepDoIt = " << noCalls << " )" << G4endl;
+
const G4int numPrints= 5;
if( numAdviceExcessSteps++ < numPrints )
{
diff --git a/source/run/History b/source/run/History
index ba2637dedfc..dadad38dd56 100644
--- a/source/run/History
+++ b/source/run/History
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+December 07, 2020 Vladimir Ivanchenko (run-V10-06-20)
+- G4PhysicsListHelper - added forgotten processes (general positron
+ and surface reflection)
+
November 21, 2020 Gabriele Cosmo (run-V10-06-19)
- Fixed compilation warnings in G4RunManager.
diff --git a/source/run/src/G4PhysicsListHelper.cc b/source/run/src/G4PhysicsListHelper.cc
index be4d059f8e7..26967420f8d 100644
--- a/source/run/src/G4PhysicsListHelper.cc
+++ b/source/run/src/G4PhysicsListHelper.cc
@@ -820,6 +820,16 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
+ tmp.processTypeName = "PositronSuper";
+ tmp.processType = 2;
+ tmp.processSubType = 17;
+ tmp.ordering[0] = 1;
+ tmp.ordering[1] = 1;
+ tmp.ordering[2] = 1;
+ tmp.isDuplicable = false;
+ theTable->push_back(tmp);
+ sizeOfTable += 1;
+
tmp.processTypeName = "Cerenkov";
tmp.processType = 2;
tmp.processSubType = 21;
@@ -860,6 +870,16 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
+ tmp.processTypeName = "SurfaceRefl";
+ tmp.processType = 2;
+ tmp.processSubType = 25;
+ tmp.ordering[0] = -1;
+ tmp.ordering[1] = -1;
+ tmp.ordering[2] = 1000;
+ tmp.isDuplicable = false;
+ theTable->push_back(tmp);
+ sizeOfTable += 1;
+
tmp.processTypeName = "OpAbsorb";
tmp.processType = 3;
tmp.processSubType = 31;
@@ -990,7 +1010,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "DNAElectronSolvatation";
+ tmp.processTypeName = "DNAElecSolv";
tmp.processType = 2;
tmp.processSubType = 58;
tmp.ordering[0] = -1;
@@ -1000,7 +1020,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "DNAMolecularDecay";
+ tmp.processTypeName = "DNAMolecDecay";
tmp.processType = 6;
tmp.processSubType = 59;
tmp.ordering[0] = 1000;
@@ -1010,7 +1030,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "ITTransportation";
+ tmp.processTypeName = "ITTransport";
tmp.processType = 1;
tmp.processSubType = 60;
tmp.ordering[0] = -1;
@@ -1020,7 +1040,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "DNABrownianTransportation";
+ tmp.processTypeName = "DNABrownTrans";
tmp.processType = 1;
tmp.processSubType = 61;
tmp.ordering[0] = -1;
@@ -1030,7 +1050,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "DNADoubleIonisation";
+ tmp.processTypeName = "DNADoubleIoni";
tmp.processType = 2;
tmp.processSubType = 62;
tmp.ordering[0] = -1;
@@ -1040,7 +1060,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "DNADoubleCapture";
+ tmp.processTypeName = "DNADoubleCap";
tmp.processType = 2;
tmp.processSubType = 63;
tmp.ordering[0] = -1;
@@ -1050,7 +1070,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "DNAIonisingTransfer";
+ tmp.processTypeName = "DNAIoniTransfer";
tmp.processType = 2;
tmp.processSubType = 64;
tmp.ordering[0] = -1;
@@ -1070,7 +1090,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "HadInElastic";
+ tmp.processTypeName = "HadInelastic";
tmp.processType = 4;
tmp.processSubType = 121;
tmp.ordering[0] = -1;
@@ -1090,7 +1110,7 @@ void G4PhysicsListHelper::ReadInDefaultOrderingParameter()
theTable->push_back(tmp);
sizeOfTable += 1;
- tmp.processTypeName = "MuAtomicCapture";
+ tmp.processTypeName = "MuAtomCapture";
tmp.processType = 4;
tmp.processSubType = 132;
tmp.ordering[0] = -1;
diff --git a/source/tasking/History b/source/tasking/History
index 1b7590dd7ad..e66a125ee98 100644
--- a/source/tasking/History
+++ b/source/tasking/History
@@ -16,6 +16,13 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
+Jan 25th, 2021 Makoto Asai (tasking-V10-06-14)
+- G4WorkerTaskRunManager.cc : Correct the way to count the number of events
+ processed in a worker thread. This correction also fixes a rare crash due to
+ accessing to the seed vector more than necessary.
+- G4TaskRunManager.cc : Reduce number of events per task to evenly distribute
+ evnets to all available threads.
+
Nov 12th, 2020 Jonathan Madsen (tasking-V10-06-13)
- Added G4Profiler support
- Removed TIMEMORY_AUTO_TIMER
diff --git a/source/tasking/src/G4TaskRunManager.cc b/source/tasking/src/G4TaskRunManager.cc
index 3d5aae0a04c..30657d4b7a5 100644
--- a/source/tasking/src/G4TaskRunManager.cc
+++ b/source/tasking/src/G4TaskRunManager.cc
@@ -313,6 +313,26 @@ void G4TaskRunManager::ComputeNumberOfTasks()
? (numberOfEventToBeProcessed / grainSize)
: 1;
+ if(eventModuloDef > 0)
+ { eventModulo = eventModuloDef; }
+ else
+ {
+ eventModulo = G4int(std::sqrt(G4double(numberOfEventToBeProcessed)));
+ if(eventModulo < 1) eventModulo = 1;
+ }
+ if(eventModulo > nEvtsPerTask)
+ {
+ G4int oldMod = eventModulo;
+ eventModulo = nEvtsPerTask;
+
+ G4ExceptionDescription msgd;
+ msgd << "Event modulo is reduced to " << eventModulo << " (was "
+ << oldMod << ")" << " to distribute events to all threads.";
+ G4Exception("G4TaskRunManager::InitializeEventLoop()", "Run10035",
+ JustWarning, msgd);
+ }
+ nEvtsPerTask = eventModulo;
+
if(fakeRun)
nEvtsPerTask = G4GetEnv(
"G4FORCE_EVENTS_PER_TASK", nEvtsPerTask,
@@ -510,30 +530,6 @@ void G4TaskRunManager::InitializeEventLoop(G4int n_event, const char* macroFile,
// initialize seeds
// If user did not implement InitializeSeeds,
// use default: nSeedsPerEvent seeds per event
- if(eventModuloDef > 0)
- {
- eventModulo = eventModuloDef;
- if(eventModulo > numberOfEventsPerTask)
- {
- G4int oldMod = eventModulo;
- eventModulo = numberOfEventsPerTask;
- if(eventModulo < 1)
- eventModulo = 1;
-
- G4ExceptionDescription msgd;
- msgd << "Event modulo is reduced to " << eventModulo << " (was "
- << oldMod << ")"
- << " to distribute events to all threads.";
- G4Exception("G4TaskRunManager::InitializeEventLoop()", "Run10035",
- JustWarning, msgd);
- }
- }
- else
- {
- eventModulo = G4int(std::sqrt(G4double(numberOfEventsPerTask)));
- if(eventModulo < 1)
- eventModulo = 1;
- }
if(n_event > 0)
{
@@ -682,6 +678,7 @@ G4int G4TaskRunManager::SetUpNEvents(G4Event* evt, G4SeedsQueue* seedsQueue,
nmod = numberOfEventToBeProcessed - numberOfEventProcessed;
}
evt->SetEventID(numberOfEventProcessed);
+
if(reseedRequired)
{
G4RNGHelper* helper = G4RNGHelper::GetInstance();
diff --git a/source/tasking/src/G4WorkerTaskRunManager.cc b/source/tasking/src/G4WorkerTaskRunManager.cc
index 14772887e07..6426152fd0e 100644
--- a/source/tasking/src/G4WorkerTaskRunManager.cc
+++ b/source/tasking/src/G4WorkerTaskRunManager.cc
@@ -223,13 +223,9 @@ void G4WorkerTaskRunManager::DoEventLoop(G4int n_event, const char* macroFile,
if(eventLoopOnGoing)
{
TerminateOneEvent();
- if(runAborted)
- eventLoopOnGoing = false;
- }
- else
- {
- numberOfEventProcessed++;
+ if(runAborted) eventLoopOnGoing = false;
}
+ if(!eventLoopOnGoing) break;
}
// TerminateEventLoop();
diff --git a/source/visualization/OpenInventor/History b/source/visualization/OpenInventor/History
index 99914417f3b..552d126453d 100644
--- a/source/visualization/OpenInventor/History
+++ b/source/visualization/OpenInventor/History
@@ -19,6 +19,26 @@ committal in the CVS repository !
History file for visualization/OpenInventor
-------------------------------------------
+06 January 2021 Frederick Jones (openinventor-V10-06-12)
+- G4OpenInventorQtViewer, G4OpenInventorQtExaminerViewer
+ o Under UIQt: viewer fails (root node is null) if
+ /vis/open/OI command is entered. Suspected a timing
+ problem and moved uiQt->addTabWidget() from G4OIQtViewer
+ to G4OIQtExaminerviewer::afterRealizeHook().
+
+08 December 2020 Frederick Jones
+- G4OpenInventorQtViewer.hh,cc:
+ o Fixed the uiQt->addTabWidget() call with correct arguments
+ so that tabbed viewer opens correctly.
+ o For UIQt case suppressed the viewer window titling which was
+ changing the UI window title.
+
+22 October 2020 John Allison
+- Some changes to instantiation and initialisation.
+ o G4OpenInventorQtViewer now opens in a tab with correct name.
+ o The main window name is left unchanged (it has same name as executable).
+ o But the G4OpenInventorQtExaminerViewer still opens in a detached window.
+
20 October 2020 Frederick Jones (openinventor-V10-06-11)
- Completed all the planned features of the OIQt viewer.
- This Qt based viewer implements all the functionality
diff --git a/source/visualization/OpenInventor/include/G4OpenInventorQtExaminerViewer.hh b/source/visualization/OpenInventor/include/G4OpenInventorQtExaminerViewer.hh
index 6926e118e60..4e61b2e27dd 100644
--- a/source/visualization/OpenInventor/include/G4OpenInventorQtExaminerViewer.hh
+++ b/source/visualization/OpenInventor/include/G4OpenInventorQtExaminerViewer.hh
@@ -127,6 +127,7 @@ private Q_SLOTS :
private:
static G4OpenInventorQtExaminerViewer* viewer;
+ const char* fName;
void (*escapeCallback)();
// void (*escapeCallback)(void*);
diff --git a/source/visualization/OpenInventor/src/G4OpenInventorQt.cc b/source/visualization/OpenInventor/src/G4OpenInventorQt.cc
index faca02bbe63..0e37addbef1 100644
--- a/source/visualization/OpenInventor/src/G4OpenInventorQt.cc
+++ b/source/visualization/OpenInventor/src/G4OpenInventorQt.cc
@@ -31,14 +31,7 @@
// this :
#include "G4OpenInventorQt.hh"
-#include
-
#include "G4SoQt.hh"
-#include "G4UIQt.hh"
-#include "G4Qt.hh"
-#include "G4UImanager.hh"
-#include
-//#include "G4Qt.hh"
#include "G4OpenInventorSceneHandler.hh"
#include "G4OpenInventorQtViewer.hh"
@@ -119,20 +112,28 @@ G4OpenInventorQt::~G4OpenInventorQt()
G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
const G4String& name)
{
- G4UImanager* UI = G4UImanager::GetUIpointer();
- G4UIQt *uiQt = static_cast (UI->GetG4UIWindow());
- if (uiQt) {
- if (!((G4Qt*)(GetInteractorManager()->GetMainInteractor()))->IsExternalApp()) {
- QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
- // Trying to get around git by adding this comment 2
- uiQt->AddTabWidget((QWidget*)mainWin,QString(name));
+ auto pView = new G4OpenInventorQtViewer(static_cast(scene), name);
+
+ if (pView) {
+ if (pView->GetViewId() < 0) {
+ G4cerr <<
+ "G4OpenInventorQt::CreateViewer: ERROR flagged by negative"
+ " view id in G4OpenInventorQtViewer creation."
+ "\n Destroying view and returning null pointer."
+ << G4endl;
+ delete pView;
+ pView = 0;
}
}
+ if (!pView) {
+ G4cerr <<
+ "G4OpenInventorQt::CreateViewer: ERROR: null pointer on new G4OpenInventorQtViewer."
+ << G4endl;
+ }
Initialize();
-
- G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
- return new G4OpenInventorQtViewer(*pScene, name);
+
+ return pView;
}
#endif
diff --git a/source/visualization/OpenInventor/src/G4OpenInventorQtExaminerViewer.cc b/source/visualization/OpenInventor/src/G4OpenInventorQtExaminerViewer.cc
index 2591a5bec61..53b31ff98cf 100644
--- a/source/visualization/OpenInventor/src/G4OpenInventorQtExaminerViewer.cc
+++ b/source/visualization/OpenInventor/src/G4OpenInventorQtExaminerViewer.cc
@@ -40,8 +40,8 @@
#include // For using sort on a vector
#include "G4ios.hh"
-//#include "G4UImanager.hh"
-//#include "G4UIQt.hh"
+#include "G4UImanager.hh"
+#include "G4UIQt.hh"
#include
#include
@@ -131,7 +131,7 @@ G4OpenInventorQtExaminerViewer(QWidget* parent, const char* name, SbBool embed,
// FWJ THIS DOESN'T WORK APPARENTLY NO MAINWINDOW
// QMenuBar* menubar = ((QMainWindow*)parent)->menuBar();
// G4cout << "G4OpenInventorQtExaminerViewer menubar=" << menubar << G4endl;
-
+ fName = name;
viewer = this;
construct(TRUE);
}
@@ -164,12 +164,6 @@ void G4OpenInventorQtExaminerViewer::construct(const SbBool)
buildWidget(getParentWidget());
- // TRY TO EMBED IN Qt UI
- // Works but dumps core on a subsequent vis/open OIQt
- // auto UI = G4UImanager::GetUIpointer();
- // auto uiQt = dynamic_cast(UI->GetG4UIWindow());
- // if (uiQt) uiQt->AddTabWidget(getParentWidget(), "OIQt");
-
fileName = "bookmarkFile"; // Default viewpoint file name
viewPtIdx = -1; // index of the most recent viewpoint in viewPtList vector
@@ -762,6 +756,11 @@ void G4OpenInventorQtExaminerViewer::afterRealizeHook()
AuxWindow->show();
AuxWindow->raise();
AuxWindow->activateWindow();
+
+ auto UI = G4UImanager::GetUIpointer();
+ auto uiQt = dynamic_cast(UI->GetG4UIWindow());
+ // This explicitly sets the TabWidget as parent before addTab():
+ if (uiQt) uiQt->AddTabWidget(getParentWidget(), QString(fName));
}
diff --git a/source/visualization/OpenInventor/src/G4OpenInventorQtViewer.cc b/source/visualization/OpenInventor/src/G4OpenInventorQtViewer.cc
index 3b289575feb..b5c7f9129ab 100644
--- a/source/visualization/OpenInventor/src/G4OpenInventorQtViewer.cc
+++ b/source/visualization/OpenInventor/src/G4OpenInventorQtViewer.cc
@@ -51,6 +51,8 @@
#include "G4OpenInventorSceneHandler.hh"
#include "G4VInteractorManager.hh"
#include "G4VisManager.hh"
+#include "G4UImanager.hh"
+#include "G4UIQt.hh"
#include "G4SoQt.hh"
@@ -64,7 +66,7 @@ G4OpenInventorQtViewer::G4OpenInventorQtViewer(
{
// FWJ fName is in G4VViewer parent of G4OpenInventorViewer
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
- G4cout << "Window name: " << fName << G4endl;
+ G4cout << "Window name: " << fName << G4endl;
}
@@ -77,8 +79,23 @@ void G4OpenInventorQtViewer::Initialise()
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
// parent << G4endl;
- // fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
- fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
+ fViewer = new G4OpenInventorQtExaminerViewer(parent, fName, TRUE);
+
+ auto UI = G4UImanager::GetUIpointer();
+ auto uiQt = dynamic_cast(UI->GetG4UIWindow());
+
+ // Moved this to G4OpenInventorQtExaminerViewer::afterRealizeHook()
+ ///////////////////////////////////////////////////////////
+ //
+ // This explicitly sets the TabWidget as parent before addTab():
+ // if (uiQt) uiQt->AddTabWidget(parent, QString(fName));
+ ///////////////////////////////////////////////////////////
+
+ // Simpler: calls addTab(), but causes viewer parts to show (temporarily)
+ // in the "Useful tips" page !!
+ // if (uiQt) uiQt->AddViewerTab(parent, fName);
+ // Leaves an empty viewer window frame hanging around:
+ // if (uiQt) uiQt->AddTabWidget(fViewer->getWidget(), QString(fName));
// G4String wName = fName;
//
@@ -215,7 +232,8 @@ void G4OpenInventorQtViewer::Initialise()
fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
fViewer->viewAll();
fViewer->saveHomePosition();
- fViewer->setTitle(fName);
+ // SOMEHOW this also the OIQt main window title
+ if (!uiQt) fViewer->setTitle(fName);
fViewer->show();
// This SHOULD invoke the event loop:
diff --git a/source/visualization/Qt3D/History b/source/visualization/Qt3D/History
index 34ae450d0d9..22ee47bef91 100644
--- a/source/visualization/Qt3D/History
+++ b/source/visualization/Qt3D/History
@@ -19,6 +19,12 @@ committal in the CVS repository !
History file for visualization/Qt3D sub-category
-----------------------------------------------
+29-Dec-2020 John Allison (visQt3D-V10-06-03)
+- G4Qt3DViewer: Move code from constructor to G4Qt3DViewer::Initialise().
+- G4Qt3DSceneHandler:
+ o Implement auxiliary edge suppression.
+ o Tidy up G4Qt3DSceneHandler::AddPrimitive(const G4Text& - still doesn't work.
+
29-Oct-2020 Ben Morgan (visQt3D-V10-06-02)
- Remove inclusion of obsolete CMake module
diff --git a/source/visualization/Qt3D/include/G4Qt3DViewer.hh b/source/visualization/Qt3D/include/G4Qt3DViewer.hh
index 636d889e593..53a97bc8ab1 100644
--- a/source/visualization/Qt3D/include/G4Qt3DViewer.hh
+++ b/source/visualization/Qt3D/include/G4Qt3DViewer.hh
@@ -42,6 +42,7 @@ public:
G4Qt3DViewer(G4Qt3DSceneHandler&,const G4String& name);
virtual ~G4Qt3DViewer();
+ void Initialise();
void SetView();
void ClearView();
void DrawView();
diff --git a/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc b/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc
index 23380d116f2..605b7001a87 100644
--- a/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc
+++ b/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc
@@ -480,9 +480,8 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
first = false;
G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Text& text)",
"qt3D-0002", JustWarning,
- "Text drawing not yet implemented");
- }
- return;
+ "Text drawing doesn't work yet");
+ } // OK. Not working, but let it execute, which it does without error.
auto currentNode = CreateNewNode();
if (!currentNode) return; // Node not available
@@ -493,32 +492,34 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
auto transform = G4Qt3DUtils::CreateQTransformFrom(position);
transform->setScale(10);
+// auto currentEntity = new Qt3DCore::QEntity(currentNode);
+
// This simply does not work
- // auto qtext = new Qt3DExtras::QText2DEntity(currentNode);
- // qtext->setText(text.GetText().c_str());
- // qtext->setHeight(100);
- // qtext->setWidth(1000);
- // qtext->setColor(Qt::green);
- // qtext->setFont(QFont("Courier New", 10));
- //
- // qtext->addComponent(transform);
- // qtext->addComponent(material);
+ auto qtext = new Qt3DExtras::QText2DEntity();
+ qtext->setParent(currentNode);
+// qtext->setParent(currentEntity); // ?? Doesn't help
+ qtext->setText(text.GetText().c_str());
+ qtext->setHeight(100);
+ qtext->setWidth(1000);
+ qtext->setColor(Qt::green);
+ qtext->setFont(QFont("Courier New", 10));
+ qtext->addComponent(transform);
// This produces text in 3D facing +z - not what we want
- const auto& colour = GetTextColour(text);
- auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
- material->setObjectName("materialForText");
- material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
- if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
-
- auto textMesh = new Qt3DExtras::QExtrudedTextMesh();
- textMesh->setText(text.GetText().c_str());
- textMesh->setFont(QFont("Courier New", 10));
- textMesh->setDepth(.01f);
-
- currentNode->addComponent(material);
- currentNode->addComponent(transform);
- currentNode->addComponent(textMesh);
+// const auto& colour = GetTextColour(text);
+// auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
+// material->setObjectName("materialForText");
+// material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
+// if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
+//
+// auto textMesh = new Qt3DExtras::QExtrudedTextMesh();
+// textMesh->setText(text.GetText().c_str());
+// textMesh->setFont(QFont("Courier New", 10));
+// textMesh->setDepth(.01f);
+//
+// currentNode->addComponent(material);
+// currentNode->addComponent(transform);
+// currentNode->addComponent(textMesh);
}
void G4Qt3DSceneHandler::AddPrimitive(const G4Circle& circle)
@@ -671,6 +672,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
lines.push_back(newLine);
};
+ G4bool isAuxilaryEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible();
G4bool notLastFace;
do {
G4int nEdges;
@@ -684,12 +686,12 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
normals.push_back(normal[0]);
normals.push_back(normal[1]);
normals.push_back(normal[2]);
- insertIfNew(Line(vertex[0],vertex[1]));
- insertIfNew(Line(vertex[1],vertex[2]));
+ if(isAuxilaryEdgeVisible||edgeFlag[0]>0)insertIfNew(Line(vertex[0],vertex[1]));
+ if(isAuxilaryEdgeVisible||edgeFlag[1]>0)insertIfNew(Line(vertex[1],vertex[2]));
if (nEdges == 3) {
// Face is a triangle
// One more line for wireframe, triangles for surfaces are complete
- insertIfNew(Line(vertex[2],vertex[0]));
+ if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[0]));
} else if (nEdges == 4) {
// Face is a quadrilateral
// Create another triangle for surfaces, add two more lines for wireframe
@@ -699,8 +701,8 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
normals.push_back(normal[2]);
normals.push_back(normal[3]);
normals.push_back(normal[0]);
- insertIfNew(Line(vertex[2],vertex[3]));
- insertIfNew(Line(vertex[3],vertex[0]));
+ if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[3]));
+ if(isAuxilaryEdgeVisible||edgeFlag[3]>0)insertIfNew(Line(vertex[3],vertex[0]));
} else {
G4cerr << "ERROR: polyhedron face with more than 4 edges" << G4endl;
return;
diff --git a/source/visualization/Qt3D/src/G4Qt3DViewer.cc b/source/visualization/Qt3D/src/G4Qt3DViewer.cc
index 811857d9a55..55316c793b8 100644
--- a/source/visualization/Qt3D/src/G4Qt3DViewer.cc
+++ b/source/visualization/Qt3D/src/G4Qt3DViewer.cc
@@ -45,6 +45,9 @@ G4Qt3DViewer::G4Qt3DViewer
, fMousePressed(false)
, fMousePressedX(0.)
, fMousePressedY(0.)
+{}
+
+void G4Qt3DViewer::Initialise()
{
setObjectName(fName.c_str());