Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ATLAS-EGamma
athena
Commits
84d0f7a5
Commit
84d0f7a5
authored
Jun 30, 2022
by
Adam Edward Barton
Browse files
Merge branch 'rhadron' into 'master'
Rhadrons: initial thread-checker fixes See merge request
atlas/athena!54672
parents
ed74a922
4b098246
Changes
7
Hide whitespace changes
Inline
Side-by-side
Simulation/G4Extensions/RHadrons/CMakeLists.txt
View file @
84d0f7a5
...
...
@@ -20,7 +20,7 @@ if( NOT GENERATIONBASE )
OBJECT
NO_PUBLIC_HEADERS
PRIVATE_INCLUDE_DIRS
${
GEANT4_INCLUDE_DIRS
}
${
XERCESC_INCLUDE_DIRS
}
${
CLHEP_INCLUDE_DIRS
}
${
PYTHIA8_INCLUDE_DIRS
}
PRIVATE_LINK_LIBRARIES
${
GEANT4_LIBRARIES
}
${
XERCESC_LIBRARIES
}
${
CLHEP_LIBRARIES
}
${
PYTHIA8_LIBRARIES
}
GaudiKernel AthenaBaseComps G4AtlasInterfaces G4AtlasToolsLib G4ExternalDecay SimHelpers Pythia8_iLib
)
PRIVATE_LINK_LIBRARIES
${
GEANT4_LIBRARIES
}
${
XERCESC_LIBRARIES
}
${
CLHEP_LIBRARIES
}
${
PYTHIA8_LIBRARIES
}
GaudiKernel AthenaBaseComps
CxxUtils
G4AtlasInterfaces G4AtlasToolsLib G4ExternalDecay SimHelpers Pythia8_iLib
)
endif
()
# Install files from the package:
...
...
Simulation/G4Extensions/RHadrons/src/CustomParticleFactory.cxx
View file @
84d0f7a5
/*
Copyright (C) 2002-20
17
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
22
CERN for the benefit of the ATLAS collaboration
*/
#include <fstream>
...
...
@@ -17,18 +17,22 @@
#include "G4DecayTable.hh"
#include "G4PhaseSpaceDecayChannel.hh"
bool
CustomParticleFactory
::
loaded
=
false
;
std
::
set
<
G4ParticleDefinition
*>
CustomParticleFactory
::
m_particles
;
bool
CustomParticleFactory
::
isCustomParticle
(
G4ParticleDefinition
*
particle
)
{
return
(
m_particles
.
find
(
particle
)
!=
m_particles
.
end
());
static
const
std
::
set
<
G4ParticleDefinition
*>
particles
=
load
();
return
(
particle
!=
nullptr
&&
particles
.
find
(
particle
)
!=
particles
.
end
());
}
void
CustomParticleFactory
::
loadCustomParticles
()
{
if
(
loaded
)
return
;
loaded
=
true
;
// tickle the loading of the particles if it wasn't done yet
isCustomParticle
(
nullptr
);
}
std
::
set
<
G4ParticleDefinition
*>
CustomParticleFactory
::
load
()
{
std
::
set
<
G4ParticleDefinition
*>
particles
;
std
::
ifstream
configFile
(
"particles.txt"
);
G4String
pType
=
"custom"
;
G4String
pSubType
=
""
;
...
...
@@ -117,7 +121,7 @@ void CustomParticleFactory::loadCustomParticles()
<<
G4endl
;
}
m_
particles
.
insert
(
particle
);
particles
.
insert
(
particle
);
}
configFile
.
close
();
...
...
@@ -132,7 +136,7 @@ void CustomParticleFactory::loadCustomParticles()
decayFile
.
close
();
// Looping over custom particles to add decays
for
(
std
::
set
<
G4ParticleDefinition
*>::
iterator
part
=
m_
particles
.
begin
();
part
!=
m_
particles
.
end
();
part
++
)
{
for
(
std
::
set
<
G4ParticleDefinition
*>::
iterator
part
=
particles
.
begin
();
part
!=
particles
.
end
();
part
++
)
{
name
=
(
*
part
)
->
GetParticleName
();
std
::
vector
<
std
::
vector
<
std
::
string
>
>
mydecays
;
for
(
unsigned
int
i
=
0
;
i
!=
decays
.
size
();
i
++
){
...
...
@@ -163,5 +167,5 @@ void CustomParticleFactory::loadCustomParticles()
(
*
part
)
->
SetDecayTable
(
table
);
}
}
return
;
return
particles
;
}
Simulation/G4Extensions/RHadrons/src/CustomParticleFactory.h
View file @
84d0f7a5
/*
Copyright (C) 2002-20
17
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
22
CERN for the benefit of the ATLAS collaboration
*/
#ifndef CustomParticleFactory_h
...
...
@@ -15,15 +15,13 @@
class
CustomParticleFactory
{
private:
static
bool
loaded
;
static
std
::
set
<
G4ParticleDefinition
*>
m_particles
;
public:
static
void
loadCustomParticles
();
static
bool
isCustomParticle
(
G4ParticleDefinition
*
particle
);
private:
static
std
::
set
<
G4ParticleDefinition
*>
load
();
};
...
...
Simulation/G4Extensions/RHadrons/src/FullModelHadronicProcess.cxx
View file @
84d0f7a5
/*
Copyright (C) 2002-20
19
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
22
CERN for the benefit of the ATLAS collaboration
*/
#include "FullModelHadronicProcess.hh"
...
...
@@ -82,7 +82,7 @@ G4VParticleChange* FullModelHadronicProcess::PostStepDoIt(const G4Track& aTrack,
// A little setting up
aParticleChange
.
Initialize
(
aTrack
);
// G4DynamicParticle* OrgPart = const_cast<G4DynamicParticle*>(aTrack.GetDynamicParticle());
G4DynamicParticle
*
IncidentRhadron
=
const_cast
<
G4DynamicParticle
*>
(
aTrack
.
GetDynamicParticle
()
)
;
const
G4DynamicParticle
*
IncidentRhadron
=
aTrack
.
GetDynamicParticle
();
CustomParticle
*
CustomIncident
=
static_cast
<
CustomParticle
*>
(
IncidentRhadron
->
GetDefinition
());
const
G4ThreeVector
&
aPosition
=
aTrack
.
GetPosition
();
const
G4int
theIncidentPDG
=
IncidentRhadron
->
GetDefinition
()
->
GetPDGEncoding
();
...
...
Simulation/G4Extensions/RHadrons/src/FullModelReactionDynamics.cxx
View file @
84d0f7a5
...
...
@@ -1021,7 +1021,8 @@ G4bool FullModelReactionDynamics::GenerateXandPt(
G4cerr
<<
"currentParticle side = "
<<
currentParticle
.
GetSide
()
<<
G4endl
;
for
(
i
=
0
;
i
<
vecLen
;
++
i
)
G4cerr
<<
"particle #"
<<
i
<<
" side = "
<<
vec
[
i
]
->
GetSide
()
<<
G4endl
;
exit
(
EXIT_FAILURE
);
throw
std
::
runtime_error
(
"FullModelReactionDynamics::GenerateXandPt: "
"tempLen is not the same as backwardNucleonCount"
);
}
constantCrossSection
=
true
;
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
...
...
Simulation/G4Extensions/RHadrons/src/G4ProcessHelper.cxx
View file @
84d0f7a5
/*
Copyright (C) 2002-20
17
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
22
CERN for the benefit of the ATLAS collaboration
*/
#include "G4ProcessHelper.hh"
...
...
@@ -13,6 +13,8 @@
#include <fstream>
#include <stdexcept>
#include "CxxUtils/checker_macros.h"
G4ProcessHelper
::
G4ProcessHelper
()
:
theTarget
(
0
)
,
theRmesoncloud
(
0
)
...
...
@@ -160,25 +162,23 @@ G4ProcessHelper::G4ProcessHelper()
return
;
}
G4ProcessHelper
*
G4ProcessHelper
::
pinstance
=
0
;
G4ProcessHelper
*
G4ProcessHelper
::
Instance
()
{
if
(
pinstance
==
0
)
{
pinstance
=
new
G4ProcessHelper
();
}
return
pinstance
;
static
G4ProcessHelper
instance
;
return
&
instance
;
}
G4bool
G4ProcessHelper
::
ApplicabilityTester
(
const
G4ParticleDefinition
&
aPart
){
const
G4ParticleDefinition
*
aP
=
&
aPart
;
if
(
known_particles
[
aP
])
return
true
;
return
false
;
G4bool
G4ProcessHelper
::
ApplicabilityTester
(
const
G4ParticleDefinition
&
aPart
)
const
{
try
{
return
known_particles
.
at
(
&
aPart
);
}
catch
(
const
std
::
out_of_range
&
e
)
{
return
false
;
}
}
G4double
G4ProcessHelper
::
GetInclusiveCrossSection
(
const
G4DynamicParticle
*
aParticle
,
const
G4Element
*
anElement
){
const
G4Element
*
anElement
)
const
{
//We really do need a dedicated class to handle the cross sections. They might not always be constant
//Disassemble the PDG-code
...
...
@@ -484,7 +484,8 @@ G4double G4ProcessHelper::ReactionProductMass(const ReactionProduct& aReaction,c
G4double
M_after
=
0
;
for
(
ReactionProduct
::
const_iterator
r_it
=
aReaction
.
begin
();
r_it
!=
aReaction
.
end
();
r_it
++
){
//G4cout<<"Mass contrib: "<<(particleTable->FindParticle(*r_it)->GetPDGMass())/CLHEP::MeV<<" MeV"<<G4endl;
M_after
+=
particleTable
->
FindParticle
(
*
r_it
)
->
GetPDGMass
();
auto
table
ATLAS_THREAD_SAFE
=
particleTable
;
// safe because table has been loaded by now
M_after
+=
table
->
FindParticle
(
*
r_it
)
->
GetPDGMass
();
}
//G4cout<<"Intending to return this ReactionProductMass: " << sqrts << " - " << M_after << " MeV"<<G4endl;
return
sqrts
-
M_after
;
...
...
Simulation/G4Extensions/RHadrons/src/G4ProcessHelper.hh
View file @
84d0f7a5
/*
Copyright (C) 2002-20
17
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
22
CERN for the benefit of the ATLAS collaboration
*/
#ifndef RHADRONS_G4PROCESSHELPER_HH
...
...
@@ -25,10 +25,10 @@ class G4ProcessHelper {
public:
static
G4ProcessHelper
*
Instance
();
G4bool
ApplicabilityTester
(
const
G4ParticleDefinition
&
aPart
);
G4bool
ApplicabilityTester
(
const
G4ParticleDefinition
&
aPart
)
const
;
G4double
GetInclusiveCrossSection
(
const
G4DynamicParticle
*
aParticle
,
const
G4Element
*
anElement
);
const
G4Element
*
anElement
)
const
;
//Make sure the element is known (for n/p-decision)
ReactionProduct
GetFinalState
(
const
G4Track
&
aTrack
,
G4ParticleDefinition
*&
aTarget
);
...
...
@@ -52,8 +52,6 @@ private:
ReactionMap
*
theReactionMap
;
static
G4ProcessHelper
*
pinstance
;
// Version where we know if we baryonize already
ReactionProduct
GetFinalStateInternal
(
const
G4Track
&
aTrack
,
G4ParticleDefinition
*&
aTarget
,
const
bool
baryonize_failed
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment