-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utility function to calculate tracks momentum
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef UTIL_TrackTools_H | ||
#define UTIL_TrackTools_H 1 | ||
|
||
#include "EVENT/Track.h" | ||
#include <array> | ||
|
||
namespace UTIL{ | ||
/** Extract track momentum from its track parameters and magnetic field | ||
* @author Bohdan Dudar | ||
* @version August 2022 | ||
*/ | ||
std::array<double, 3> getTrackMomentum(const EVENT::Track* track, double bz); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "UTIL/TrackTools.h" | ||
#include <cmath> | ||
|
||
namespace UTIL{ | ||
std::array<double, 3> getTrackMomentum(const EVENT::Track* track, double bz){ | ||
std::array<double, 3> mom; | ||
double omega = track->getOmega(); | ||
double phi = track->getPhi(); | ||
double tanL = track->getTanLambda(); | ||
double c_light = 299.792458; // mm/ns | ||
double pt = (1e-6 * c_light * bz) / std::abs(omega); | ||
mom[0] = pt*std::cos(phi); | ||
mom[1] = pt*std::sin(phi); | ||
mom[2] = pt*tanL; | ||
return mom; | ||
} | ||
} |