Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eicd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
EIC
eicd
Merge requests
!20
Resolve "Helper library"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Helper library"
3-helper-library
into
master
Overview
0
Commits
1
Pipelines
2
Changes
4
Merged
Whitney Armstrong
requested to merge
3-helper-library
into
master
4 years ago
Overview
0
Commits
1
Pipelines
2
Changes
4
Expand
Closes
#3 (closed)
Edited
4 years ago
by
Whitney Armstrong
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
9e671a62
1 commit,
4 years ago
4 files
+
107
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
source/include/eicd/helpers.h
0 → 100644
+
43
−
0
Options
#ifndef EICD_HELPERS_HH
#define EICD_HELPERS_HH
#include
<algorithm>
#include
<cmath>
#include
<exception>
#include
<limits>
#include
<string>
#include
<vector>
#include
<Math/Vector4D.h>
#include
"eicd/TrackParametersCollection.h"
#include
"eicd/ReconstructedParticleCollection.h"
#include
"eicd/ReconstructedParticleData.h"
namespace
eicd
::
helpers
{
/** Four momentum from track and mass.
* Get a vector of 4-momenta from raw tracking info, using an externally
* provided particle mass assumption.
*/
inline
auto
momenta_from_tracking
(
const
std
::
vector
<
eic
::
TrackParametersData
>&
tracks
,
const
double
mass
)
{
std
::
vector
<
ROOT
::
Math
::
PxPyPzMVector
>
momenta
{
tracks
.
size
()};
// transform our raw tracker info into proper 4-momenta
std
::
transform
(
tracks
.
begin
(),
tracks
.
end
(),
momenta
.
begin
(),
[
mass
](
const
auto
&
track
)
{
// make sure we don't divide by zero
if
(
fabs
(
track
.
qOverP
)
<
1e-9
)
{
return
ROOT
::
Math
::
PxPyPzMVector
{};
}
const
double
p
=
fabs
(
1.
/
track
.
qOverP
);
const
double
px
=
p
*
cos
(
track
.
phi
)
*
sin
(
track
.
theta
);
const
double
py
=
p
*
sin
(
track
.
phi
)
*
sin
(
track
.
theta
);
const
double
pz
=
p
*
cos
(
track
.
theta
);
return
ROOT
::
Math
::
PxPyPzMVector
{
px
,
py
,
pz
,
mass
};
});
return
momenta
;
}
}
// namespace eicd::helpers
#endif
Loading