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
Commits
296bcddf
Commit
296bcddf
authored
3 years ago
by
Sylvester Joosten
Browse files
Options
Downloads
Patches
Plain Diff
new EICD builds properly, ready for comments
parent
be02b47f
No related branches found
No related tags found
1 merge request
!33
Draft: Streamline data model
Pipeline
#14406
failed
3 years ago
Stage: config
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/include/eicd/helpers.h
+26
-24
26 additions, 24 deletions
source/include/eicd/helpers.h
with
26 additions
and
24 deletions
source/include/eicd/helpers.h
+
26
−
24
View file @
296bcddf
#ifndef EICD_HELPERS_HH
#define EICD_HELPERS_HH
#include
<algorithm>
#include
<cmath>
#include
<exception>
...
...
@@ -11,33 +10,36 @@
#include
<Math/Vector4D.h>
#include
"eicd/TrackParametersCollection.h"
#include
"eicd/ReconstructedParticleCollection.h"
#include
"eicd/ReconstructedParticleData.h"
#include
"eicd/TrackParametersCollection.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
;
}
/** 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
.
direction
.
phi
)
*
sin
(
track
.
direction
.
theta
);
const
double
py
=
p
*
sin
(
track
.
direction
.
phi
)
*
sin
(
track
.
direction
.
theta
);
const
double
pz
=
p
*
cos
(
track
.
direction
.
theta
);
return
ROOT
::
Math
::
PxPyPzMVector
{
px
,
py
,
pz
,
mass
};
});
return
momenta
;
}
}
// namespace eicd::helpers
#endif
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