Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Ran Bi
athena
Commits
c58585eb
Commit
c58585eb
authored
4 years ago
by
Simone Pagan Griso
Browse files
Options
Downloads
Patches
Plain Diff
catch exception if energy balance fails to converge and handle it properly
parent
c0dc15c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Generators/Pythia8_i/src/UserHooks/DecayToSUEP.cxx
+16
-1
16 additions, 1 deletion
Generators/Pythia8_i/src/UserHooks/DecayToSUEP.cxx
Generators/Pythia8_i/src/UserHooks/suep_shower.cxx
+13
-1
13 additions, 1 deletion
Generators/Pythia8_i/src/UserHooks/suep_shower.cxx
with
29 additions
and
2 deletions
Generators/Pythia8_i/src/UserHooks/DecayToSUEP.cxx
+
16
−
1
View file @
c58585eb
...
...
@@ -128,7 +128,22 @@ namespace Pythia8{
// Generate the shower, output are 4 vectors in the rest frame of the shower
higgs4mom
=
process
[
ii
].
p
();
suep_shower4momenta
=
suep_shower
.
generate_shower
();
int
nShowerAttempts
=
0
;
do
{
try
{
nShowerAttempts
++
;
suep_shower4momenta
=
suep_shower
.
generate_shower
();
nShowerAttempts
=
-
1
;
//exit condition
}
catch
(
std
::
exception
&
e
)
{
//Failed to generate the shower!
//Can happen in some rare circumstances, try again
}
}
while
((
nShowerAttempts
>
0
)
&&
(
nShowerAttempts
<
3
));
if
(
nShowerAttempts
>=
3
)
{
//Something is seriously wrong then, print warning and skip to next event
std
::
cout
<<
"[SUEP] ERROR: Something went terribly wrong in generating the shower. Skipping the event."
<<
std
::
endl
;
return
true
;
//veto the event!
}
// Loop over hidden sector mesons and append to the event
for
(
unsigned
j
=
0
;
j
<
suep_shower4momenta
.
size
();
++
j
){
...
...
This diff is collapsed.
Click to expand it.
Generators/Pythia8_i/src/UserHooks/suep_shower.cxx
+
13
−
1
View file @
c58585eb
...
...
@@ -150,7 +150,19 @@ vector< Vec4 > Suep_shower::generate_shower(){
// finally, ballance the total energy, without destroying momentum conservation
tolerance
tol
=
0.00001
;
double
p_scale
;
p_scale
=
(
bisect
(
boost
::
bind
(
&
Suep_shower
::
reballance_func
,
this
,
_1
,
event
),
0.0
,
2.0
,
tol
)).
first
;
try
{
p_scale
=
(
bisect
(
boost
::
bind
(
&
Suep_shower
::
reballance_func
,
this
,
_1
,
event
),
0.0
,
2.0
,
tol
)).
first
;
}
catch
(
std
::
exception
&
e
)
{
//in some rare circumstances, this balancing might fail
std
::
cout
<<
"[SUEP_SHOWER] WARNING: Failed to rebalance the following event; Printing for debug and throw exception"
<<
std
::
endl
;
std
::
cout
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"N. Particle, px, py, pz, E"
<<
std
::
endl
;
for
(
size_t
jj
=
0
;
jj
<
event
.
size
();
jj
++
)
{
//print out event
std
::
cout
<<
jj
<<
": "
<<
event
[
jj
].
px
()
<<
", "
<<
event
[
jj
].
py
()
<<
", "
<<
event
[
jj
].
pz
()
<<
", "
<<
event
[
jj
].
e
()
<<
std
::
endl
;
}
throw
e
;
}
for
(
int
n
=
0
;
n
<
len
;
n
++
){
event
[
n
].
px
(
p_scale
*
event
[
n
].
px
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment