Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HepMC3
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
10
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
HepMC
HepMC3
Merge requests
!202
Extend API of GenCrossSection
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Extend API of GenCrossSection
prevent_out_of_the_bounds_xsection
into
master
Overview
0
Commits
28
Pipelines
17
Changes
5
Merged
Andrii Verbytskyi
requested to merge
prevent_out_of_the_bounds_xsection
into
master
2 years ago
Overview
0
Commits
28
Pipelines
17
Changes
5
Expand
Added:
set cross-sections via vectors
accessors to vectors
checks for the index correctness.
Tag
@cgutscho
,
@lonnblad
,
@abuckley
👍
0
👎
0
Merge request reports
Compare
master
version 16
50149e72
2 years ago
version 15
86fd4a98
2 years ago
version 14
fa3c69c7
2 years ago
version 13
ce5c7950
2 years ago
version 12
2bad3cdd
2 years ago
version 11
e2d88d17
2 years ago
version 10
faa32136
2 years ago
version 9
80e0db7b
2 years ago
version 8
5aaa5c05
2 years ago
version 7
94b50d15
2 years ago
version 6
3390cc79
2 years ago
version 5
8d65209d
2 years ago
version 4
b2cc6303
2 years ago
version 3
bfaae672
2 years ago
version 2
1e0b6ede
2 years ago
version 1
aec00c17
2 years ago
master (base)
and
latest version
latest version
24014a7b
28 commits,
2 years ago
version 16
50149e72
26 commits,
2 years ago
version 15
86fd4a98
18 commits,
2 years ago
version 14
fa3c69c7
17 commits,
2 years ago
version 13
ce5c7950
16 commits,
2 years ago
version 12
2bad3cdd
15 commits,
2 years ago
version 11
e2d88d17
14 commits,
2 years ago
version 10
faa32136
12 commits,
2 years ago
version 9
80e0db7b
11 commits,
2 years ago
version 8
5aaa5c05
10 commits,
2 years ago
version 7
94b50d15
9 commits,
2 years ago
version 6
3390cc79
7 commits,
2 years ago
version 5
8d65209d
6 commits,
2 years ago
version 4
b2cc6303
5 commits,
2 years ago
version 3
bfaae672
4 commits,
2 years ago
version 2
1e0b6ede
3 commits,
2 years ago
version 1
aec00c17
1 commit,
2 years ago
5 files
+
60
−
22
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
include/HepMC3/GenCrossSection.h
+
38
−
12
Options
@@ -64,6 +64,18 @@ public:
/** @brief Set all fields */
void
set_cross_section
(
const
double
&
xs
,
const
double
&
xs_err
,
const
long
&
n_acc
=
-
1
,
const
long
&
n_att
=
-
1
);
/** @brief Set all fields */
void
set_cross_section
(
const
std
::
vector
<
double
>&
xs
,
const
std
::
vector
<
double
>&
xs_err
,
const
long
&
n_acc
=
-
1
,
const
long
&
n_att
=
-
1
);
/** @brief Get the cross-sections
*/
const
std
::
vector
<
double
>&
xsecs
()
const
{
return
cross_sections
;
}
/** @brief Get the cross-section errors
*/
const
std
::
vector
<
double
>&
xsec_errs
()
const
{
return
cross_section_errors
;
}
/** @brief Set the number of accepted events
*/
void
set_accepted_events
(
const
long
&
n_acc
)
{
@@ -92,56 +104,70 @@ public:
named \a wName.
*/
void
set_xsec
(
const
std
::
string
&
wName
,
const
double
&
xs
)
{
set_xsec
(
windx
(
wName
),
xs
);
int
pos
=
windx
(
wName
);
if
(
pos
<
0
)
throw
std
::
runtime_error
(
"GenCrossSection::set_xsec(const std::string&,const double&): no weight with given name in this run"
);
set_xsec
(
pos
,
xs
);
}
/** @brief Set the cross section corresponding to the weight with
index \a indx.
*/
void
set_xsec
(
const
int
&
indx
,
const
double
&
xs
)
{
cross_sections
[
indx
]
=
xs
;
void
set_xsec
(
const
unsigned
long
&
index
,
const
double
&
xs
)
{
if
(
index
>=
cross_sections
.
size
()
)
{
throw
std
::
runtime_error
(
"GenCrossSection::set_xsec(const unsigned long&): index outside of range"
);}
cross_sections
[
index
]
=
xs
;
}
/** @brief Set the cross section error corresponding to the weight
named \a wName.
*/
void
set_xsec_err
(
const
std
::
string
&
wName
,
const
double
&
xs_err
)
{
set_xsec_err
(
windx
(
wName
),
xs_err
);
int
pos
=
windx
(
wName
);
if
(
pos
<
0
)
throw
std
::
runtime_error
(
"GenCrossSection::set_xsec_err(const std::string&,const double&): no weight with given name in this run"
);
set_xsec_err
(
pos
,
xs_err
);
}
/** @brief Set the cross section error corresponding to the weight
with index \a indx.
*/
void
set_xsec_err
(
const
int
&
indx
,
const
double
&
xs_err
)
{
cross_section_errors
[
indx
]
=
xs_err
;
void
set_xsec_err
(
const
unsigned
long
&
index
,
const
double
&
xs_err
)
{
if
(
index
>=
cross_section_errors
.
size
()
)
{
throw
std
::
runtime_error
(
"GenCrossSection::set_xsec_err(const unsigned long&): index outside of range"
);}
cross_section_errors
[
index
]
=
xs_err
;
}
/** @brief Get the cross section corresponding to the weight named
\a wName.
*/
double
xsec
(
const
std
::
string
&
wName
)
const
{
return
xsec
(
windx
(
wName
));
int
pos
=
windx
(
wName
);
if
(
pos
<
0
)
throw
std
::
runtime_error
(
"GenCrossSection::xsec(const std::string&): no weight with given name in this run"
);
return
xsec
(
pos
);
}
/** @brief Get the cross section corresponding to the weight with index
\a indx.
*/
double
xsec
(
const
int
&
indx
=
0
)
const
{
return
cross_sections
[
indx
];
double
xsec
(
const
unsigned
long
&
index
=
0
)
const
{
if
(
index
<
cross_sections
.
size
()
)
{
return
cross_sections
.
at
(
index
);
}
else
{
throw
std
::
runtime_error
(
"GenCrossSection::xsec(const unsigned long&): index outside of range"
);}
return
0.0
;
}
/** @brief Get the cross section error corresponding to the weight
named \a wName.
*/
double
xsec_err
(
const
std
::
string
&
wName
)
const
{
return
xsec_err
(
windx
(
wName
));
int
pos
=
windx
(
wName
);
if
(
pos
<
0
)
throw
std
::
runtime_error
(
"GenCrossSection::xsec_err(const std::string&): no weight with given name in this run"
);
return
xsec_err
(
pos
);
}
/** @brief Get the cross section error corresponding to the weight
with index \a indx.
*/
double
xsec_err
(
const
int
&
indx
=
0
)
const
{
return
cross_section_errors
[
indx
];
double
xsec_err
(
const
unsigned
long
&
index
=
0
)
const
{
if
(
index
<
cross_section_errors
.
size
()
)
{
return
cross_section_errors
.
at
(
index
);}
else
{
throw
std
::
runtime_error
(
"GenCrossSection::xsec_err(const unsigned long&): index outside of range"
);}
return
0.0
;
}
bool
operator
==
(
const
GenCrossSection
&
)
const
;
///< Operator ==
Loading