|
ATLAS Offline Software
|
Tool for proton reconstruction by directly using transport parameterisation.
More...
#include <AFP_ProtonRecoAnalytical.h>
|
using | Momentum = std::array< double, 3 > |
| 3-momentum of reconstructed proton More...
|
|
|
Gaudi::Property< std::vector< double > > | m_detectorPositions {this, "detectorPositions", {}, "absolute values of detector positions for each station on one side"} |
|
Gaudi::Property< int > | m_side {this, "side", 0, "side id, A=0, C=1"} |
|
Gaudi::Property< double > | m_trackDistance {this, "trackDistance", 2.0, "Maximum distance between tracks in the near and the far station on xy-plane"} |
|
Gaudi::Property< bool > | m_allowSingleStationReco {this, "allowSingleStationReco", false, "Switch for allowing proton reconstruction using only far station"} |
|
SG::ReadHandleKey< xAOD::AFPTrackContainer > | m_trackContainerKey {this, "AFPTrackContainerKey", "AFPTrackContainer", "Name of the container with tracks of hits from which protons are to be reconstructed"} |
|
Gaudi::Property< std::string > | m_protonsContainerName {this, "protonsContainerName", "AFPProtonContainer", "Name of the container in which protons are saved"} |
|
double | m_detectorPositionNear = 0.0 |
| Default position of AFP near station. More...
|
|
double | m_detectorPositionFar = 0.0 |
| Default position of AFP far station. More...
|
|
const std::vector< double > | m_vertexIP = {0, 0, 0} |
| Vertex position. More...
|
|
|
StatusCode | configInfo () const |
|
virtual xAOD::AFPProton * | reco (const xAOD::AFPTrack *trkNear, const xAOD::AFPTrack *trkFar, std::unique_ptr< xAOD::AFPProtonContainer > &outputContainer) const override |
| Reconstructs single proton from pair of tracks. More...
|
|
virtual xAOD::AFPProton * | reco (const xAOD::AFPTrack *trkFar, std::unique_ptr< xAOD::AFPProtonContainer > &outputContainer) const override |
| Reconstructs single proton using only one track from far station. More...
|
|
virtual double | chi2 (double energy, double sx, double sy, const Measurement &my_measAFP) const override |
| Calculates chi2 for reconstructed proton. More...
|
|
double | bisection (double(AFP_ProtonRecoAnalytical::*fun)(double, const Measurement &, std::vector< double > &, std::vector< double > &) const, const Measurement &my_measAFP, std::vector< double > &my_slopeCalculated, std::vector< double > &my_positionCalculated) const |
| Calculates root of given function. More...
|
|
double | bothStations (double energy, const Measurement &my_measAFP, std::vector< double > &my_slopeCalculated, std::vector< double > &my_positionCalculated) const |
| Function obtained from parameterization equation. More...
|
|
double | singleStation (double energy, const Measurement &my_measAFP, std::vector< double > &my_slopeCalculated, std::vector< double > &my_positionCalculated) const |
| Function obtained from parameterization equation. More...
|
|
double | calculateSlope (double energy, int XorY, std::vector< double > &my_slopeCalculated) const |
| Calculates ininial slope based on measurements and reconstructed energy. More...
|
|
double | calculateXslope (double energy, std::vector< double > &my_slopeCalculated) const |
| Calculates initial horizontal slope Calls calculateSlope(energy, 0) More...
|
|
double | calculateYslope (double energy, std::vector< double > &my_slopeCalculated) const |
| Calculates initial vertical slope Calls calculateSlope(energy, 1) More...
|
|
Tool for proton reconstruction by directly using transport parameterisation.
Definition at line 31 of file AFP_ProtonRecoAnalytical.h.
◆ Momentum
◆ AFP_ProtonRecoAnalytical()
AFP_ProtonRecoAnalytical::AFP_ProtonRecoAnalytical |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~AFP_ProtonRecoAnalytical()
AFP_ProtonRecoAnalytical::~AFP_ProtonRecoAnalytical |
( |
| ) |
|
|
default |
◆ bisection()
double AFP_ProtonRecoAnalytical::bisection |
( |
double(AFP_ProtonRecoAnalytical::*)(double, const Measurement &, std::vector< double > &, std::vector< double > &) const |
fun, |
|
|
const Measurement & |
my_measAFP, |
|
|
std::vector< double > & |
my_slopeCalculated, |
|
|
std::vector< double > & |
my_positionCalculated |
|
) |
| const |
|
private |
Calculates root of given function.
Definition at line 92 of file AFP_ProtonRecoAnalytical.cxx.
95 auto fn = [
this,
fun, my_slopeCalculated, my_positionCalculated](
double x,
const Measurement&
m, std::vector<double>&
s, std::vector<double>&
p) {
return (this->*
fun)(
x,
m,
s,
p); };
97 constexpr
double tol = 1
e-3;
101 if (
fn(eMax, my_measAFP, my_slopeCalculated, my_positionCalculated) *
fn(eMin, my_measAFP, my_slopeCalculated, my_positionCalculated) >= 0) {
106 return (
fn(eMin, my_measAFP, my_slopeCalculated, my_positionCalculated) < 0) ?
std::max(
fn(eMin, my_measAFP, my_slopeCalculated, my_positionCalculated),
fn(eMax, my_measAFP, my_slopeCalculated, my_positionCalculated)) : std::
min(
fn(eMin, my_measAFP, my_slopeCalculated, my_positionCalculated),
fn(eMax, my_measAFP, my_slopeCalculated, my_positionCalculated));
109 ATH_MSG_VERBOSE(
"==== eMin\teMax\te\tfun(eMin)\tfun(eMax)\tfun(E) ====");
114 while (eMax - eMin > tol) {
115 e = (eMin + eMax)/2.0;
116 ATH_MSG_VERBOSE(
"* " << eMin <<
"\t" << eMax <<
"\t" <<
e <<
"\t" <<
fn(
e, my_measAFP, my_slopeCalculated, my_positionCalculated) <<
"\t" <<
fn(eMin, my_measAFP, my_slopeCalculated, my_positionCalculated) <<
"\t" <<
fn(eMax, my_measAFP, my_slopeCalculated, my_positionCalculated));
117 if (
fn(eMax, my_measAFP, my_slopeCalculated, my_positionCalculated) *
fn(
e, my_measAFP, my_slopeCalculated, my_positionCalculated) < 0)
119 else if (
fn(eMin, my_measAFP, my_slopeCalculated, my_positionCalculated) *
fn(
e, my_measAFP, my_slopeCalculated, my_positionCalculated) < 0)
◆ bothStations()
double AFP_ProtonRecoAnalytical::bothStations |
( |
double |
energy, |
|
|
const Measurement & |
my_measAFP, |
|
|
std::vector< double > & |
my_slopeCalculated, |
|
|
std::vector< double > & |
my_positionCalculated |
|
) |
| const |
|
private |
Function obtained from parameterization equation.
Used in bisection method.
Definition at line 178 of file AFP_ProtonRecoAnalytical.cxx.
183 (my_positionCalculated.at(0)
193 my_slopeCalculated.at(0)
◆ calculateSlope()
double AFP_ProtonRecoAnalytical::calculateSlope |
( |
double |
energy, |
|
|
int |
XorY, |
|
|
std::vector< double > & |
my_slopeCalculated |
|
) |
| const |
|
private |
Calculates ininial slope based on measurements and reconstructed energy.
Definition at line 218 of file AFP_ProtonRecoAnalytical.cxx.
222 const double Ax =
m_parametrization->getEquation(2 + XorY)->getPolynomial(0)->Eval(xi);
223 const double Bx =
m_parametrization->getEquation(2 + XorY)->getPolynomial(4 + XorY)->Eval(xi);
224 const double Cx =
m_parametrization->getEquation(2 + XorY)->getPolynomial(1 + XorY)->Eval(xi);
225 const double Dx =
m_parametrization->getEquation(2 + XorY)->getPolynomial(6 + XorY)->Eval(xi);
226 const double Ex =
m_parametrization->getEquation(2 + XorY)->getPolynomial(3)->Eval(xi);
228 const double Fx = my_slopeCalculated.at(0 + XorY) - Ax - Cx*
m_vertexIP.at(0 + XorY) - Ex*
m_vertexIP.at(2);
230 const double slp = (Gx == 0) ? 0. :
Fx/Gx;
◆ calculateXslope()
double AFP_ProtonRecoAnalytical::calculateXslope |
( |
double |
energy, |
|
|
std::vector< double > & |
my_slopeCalculated |
|
) |
| const |
|
private |
◆ calculateYslope()
double AFP_ProtonRecoAnalytical::calculateYslope |
( |
double |
energy, |
|
|
std::vector< double > & |
my_slopeCalculated |
|
) |
| const |
|
private |
◆ chi2()
double AFP_ProtonRecoAnalytical::chi2 |
( |
double |
energy, |
|
|
double |
sx, |
|
|
double |
sy, |
|
|
const Measurement & |
my_measAFP |
|
) |
| const |
|
overrideprivatevirtual |
Calculates chi2 for reconstructed proton.
Reimplemented from AFP_ProtonRecoBase.
Definition at line 248 of file AFP_ProtonRecoAnalytical.cxx.
260 const double dx2 = my_measAFP.xF - xFar;
261 const double dy2 = my_measAFP.yF - yFar;
266 return chi2x2 + chi2y2;
269 const double dx1 = my_measAFP.xN - xNear;
270 const double dx2 = my_measAFP.xF - xFar;
271 const double dy1 = my_measAFP.yN - yNear;
272 const double dy2 = my_measAFP.yF - yFar;
279 return chi2x1 + chi2y1 + chi2x2 + chi2y2;
◆ configInfo()
StatusCode AFP_ProtonRecoAnalytical::configInfo |
( |
| ) |
const |
|
private |
◆ createProton()
Creates and sets up a proton.
Definition at line 94 of file AFP_ProtonRecoBase.cxx.
103 auto *
proton = outputContainer->
push_back(std::make_unique<xAOD::AFPProton>());
106 constexpr
double protonMass = 0.938;
111 proton->setMethodID(algID);
◆ doProtonReco()
Definition at line 16 of file AFP_ProtonRecoBase.cxx.
20 if(!trackContainer.isValid())
23 return StatusCode::SUCCESS;
29 std::vector<const xAOD::AFPTrack*> trackNearContainer;
30 const int nearId =
m_side + 1;
31 std::copy_if(trackContainer->begin(), trackContainer->end(), std::back_inserter(trackNearContainer),
32 [&nearId](
auto track) { return track->stationID() == nearId; });
35 std::vector<const xAOD::AFPTrack*> trackFarContainer;
36 const int farId = 3 *
m_side;
37 std::copy_if(trackContainer->begin(), trackContainer->end(), std::back_inserter(trackFarContainer),
38 [&farId](
auto track) { return track->stationID() == farId; });
45 bool foundMatchingTrack =
false;
49 const double dx = trackFar->xLocal() - trackNear->xLocal();
50 const double dy = trackFar->yLocal() - trackNear->yLocal();
53 if (r2 > trackDistanceRadiusSq) {
55 "Tracks too far away from each other (xNear, yNear; xFar, yFar; distance) [mm]: "
56 << trackNear->xLocal() <<
", " << trackNear->yLocal() <<
"; "
57 << trackFar->xLocal() <<
", " << trackFar->yLocal() <<
"; " << r2);
68 foundMatchingTrack =
true;
90 return StatusCode::SUCCESS;
◆ initialize()
StatusCode AFP_ProtonRecoAnalytical::initialize |
( |
| ) |
|
|
override |
Loads parameterization.
Definition at line 33 of file AFP_ProtonRecoAnalytical.cxx.
53 return StatusCode::FAILURE;
72 return StatusCode::FAILURE;
88 return StatusCode::SUCCESS;
◆ linkTracksToProton()
◆ outputContainerName()
const std::string& AFP_ProtonRecoBase::outputContainerName |
( |
| ) |
const |
|
inlineoverrideinherited |
◆ reco() [1/2]
Reconstructs single proton using only one track from far station.
Reimplemented from AFP_ProtonRecoBase.
Definition at line 162 of file AFP_ProtonRecoAnalytical.cxx.
166 ATH_MSG_DEBUG(
"Reconstructing proton with bisection method (single station)...");
167 ATH_MSG_DEBUG(
"Tracks (xFar, yFar): " << my_measAFP.xF <<
", " << my_measAFP.yF);
169 std::vector<double> my_slopeCalculated = {0, 0};
170 std::vector<double> my_positionCalculated = {0, 0};
◆ reco() [2/2]
Reconstructs single proton from pair of tracks.
- Sets up measurement and calculates slopes and postitions
- Reconstructs energy of proton with bisection method
- Calculates initial proton slopes
- Adds proton to outputContainer and sets its properties
- Returns
- Pointer to reconstructed AFPProton
AFP measurement
Reimplemented from AFP_ProtonRecoBase.
Definition at line 133 of file AFP_ProtonRecoAnalytical.cxx.
136 const Measurement my_measAFP =
Measurement(trackNear->xLocal(), trackNear->yLocal(), trackFar->xLocal(), trackFar->yLocal());
138 std::vector<double> my_slopeCalculated = {0, 0};
139 std::vector<double> my_positionCalculated = {0, 0};
146 ATH_MSG_DEBUG(
"Reconstructing proton with bisection method...");
147 ATH_MSG_DEBUG(
"Tracks (xNear, yNear; xFar, yFar): " << my_measAFP.xN <<
", " << my_measAFP.yN <<
"; "
148 << my_measAFP.xF <<
", " << my_measAFP.yF);
156 const double pz =
energy * sqrt(1. - slopeX*slopeX - slopeY*slopeY);
◆ singleStation()
double AFP_ProtonRecoAnalytical::singleStation |
( |
double |
energy, |
|
|
const Measurement & |
my_measAFP, |
|
|
std::vector< double > & |
my_slopeCalculated, |
|
|
std::vector< double > & |
my_positionCalculated |
|
) |
| const |
|
private |
Function obtained from parameterization equation.
Used in bisection method for single station reconstruction.
Definition at line 205 of file AFP_ProtonRecoAnalytical.cxx.
◆ m_allowSingleStationReco
Gaudi::Property<bool> AFP_ProtonRecoBase::m_allowSingleStationReco {this, "allowSingleStationReco", false, "Switch for allowing proton reconstruction using only far station"} |
|
protectedinherited |
◆ m_detectorPositionFar
double AFP_ProtonRecoBase::m_detectorPositionFar = 0.0 |
|
protectedinherited |
◆ m_detectorPositionNear
double AFP_ProtonRecoBase::m_detectorPositionNear = 0.0 |
|
protectedinherited |
◆ m_detectorPositions
Gaudi::Property<std::vector<double> > AFP_ProtonRecoBase::m_detectorPositions {this, "detectorPositions", {}, "absolute values of detector positions for each station on one side"} |
|
protectedinherited |
◆ m_distanceBetweenStations
double AFP_ProtonRecoAnalytical::m_distanceBetweenStations = 0.0 |
|
private |
◆ m_parametrization
◆ m_parametrizationEnergy
double AFP_ProtonRecoAnalytical::m_parametrizationEnergy = 0.0 |
|
private |
◆ m_parametrizationFileName
Gaudi::Property<std::string> AFP_ProtonRecoAnalytical::m_parametrizationFileName {this, "parametrizationFileName", "none.txt", "Name of the file containing parameterization"} |
|
private |
◆ m_parametrizationPosition
double AFP_ProtonRecoAnalytical::m_parametrizationPosition = 0.0 |
|
private |
◆ m_protonsContainerName
Gaudi::Property<std::string> AFP_ProtonRecoBase::m_protonsContainerName {this, "protonsContainerName", "AFPProtonContainer", "Name of the container in which protons are saved"} |
|
protectedinherited |
◆ m_side
Gaudi::Property<int> AFP_ProtonRecoBase::m_side {this, "side", 0, "side id, A=0, C=1"} |
|
protectedinherited |
◆ m_trackContainerKey
SG::ReadHandleKey<xAOD::AFPTrackContainer> AFP_ProtonRecoBase::m_trackContainerKey {this, "AFPTrackContainerKey", "AFPTrackContainer", "Name of the container with tracks of hits from which protons are to be reconstructed"} |
|
protectedinherited |
◆ m_trackDistance
Gaudi::Property<double> AFP_ProtonRecoBase::m_trackDistance {this, "trackDistance", 2.0, "Maximum distance between tracks in the near and the far station on xy-plane"} |
|
protectedinherited |
◆ m_vertexIP
const std::vector<double> AFP_ProtonRecoBase::m_vertexIP = {0, 0, 0} |
|
protectedinherited |
◆ m_xSigma
constexpr double AFP_ProtonRecoBase::m_xSigma = 10e-6 |
|
staticconstexprprotectedinherited |
◆ m_ySigma
constexpr double AFP_ProtonRecoBase::m_ySigma = 30e-6 |
|
staticconstexprprotectedinherited |
The documentation for this class was generated from the following files:
std::unique_ptr< AFP::Parameterization > m_parametrization
Pointer to parameterization.
double calculateYslope(double energy, std::vector< double > &my_slopeCalculated) const
Calculates initial vertical slope Calls calculateSlope(energy, 1)
double m_parametrizationPosition
Position for which parameterization was performed.
Class representing a track reconstructed in AFP.
double calculateXslope(double energy, std::vector< double > &my_slopeCalculated) const
Calculates initial horizontal slope Calls calculateSlope(energy, 0)
double bisection(double(AFP_ProtonRecoAnalytical::*fun)(double, const Measurement &, std::vector< double > &, std::vector< double > &) const, const Measurement &my_measAFP, std::vector< double > &my_slopeCalculated, std::vector< double > &my_positionCalculated) const
Calculates root of given function.
virtual xAOD::AFPProton * reco(const xAOD::AFPTrack *, const xAOD::AFPTrack *, std::unique_ptr< xAOD::AFPProtonContainer > &) const
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
AFP_ProtonRecoBase(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< double > m_trackDistance
double bothStations(double energy, const Measurement &my_measAFP, std::vector< double > &my_slopeCalculated, std::vector< double > &my_positionCalculated) const
Function obtained from parameterization equation.
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_trackContainerKey
virtual double chi2(double, double, double, const Measurement &) const
Gaudi::Property< std::string > m_parametrizationFileName
Name of the file containing parameterization.
static constexpr int analytical
analytical algorithm id=0
xAOD::AFPProton * createProton(const Momentum &momentum, const Measurement &my_measAFP, const int algID, std::unique_ptr< xAOD::AFPProtonContainer > &outputContainer) const
Creates and sets up a proton.
double m_detectorPositionNear
Default position of AFP near station.
Out copy_if(In first, const In &last, Out res, const Pred &p)
double calculateSlope(double energy, int XorY, std::vector< double > &my_slopeCalculated) const
Calculates ininial slope based on measurements and reconstructed energy.
double m_distanceBetweenStations
Distance between near and far station.
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Property< bool > m_allowSingleStationReco
Gaudi::Property< std::vector< double > > m_detectorPositions
double m_parametrizationEnergy
Parameterization energy.
ElementLink implementation for ROOT usage.
static constexpr double m_xSigma
x-Sigma value
Gaudi::Property< int > m_side
static constexpr double m_ySigma
y-Sigma value
value_type push_back(value_type pElem)
Add an element to the end of the collection.
double singleStation(double energy, const Measurement &my_measAFP, std::vector< double > &my_slopeCalculated, std::vector< double > &my_positionCalculated) const
Function obtained from parameterization equation.
Gaudi::Property< std::string > m_protonsContainerName
const std::vector< double > m_vertexIP
Vertex position.
void linkTracksToProton(const xAOD::AFPTrack *track, SG::ReadHandle< xAOD::AFPTrackContainer > &trackContainer, xAOD::AFPProton *proton) const
Links track pair to reconstructed proton.
Class representing a proton reconstructed in AFP.
double m_detectorPositionFar
Default position of AFP far station.