ATLAS Offline Software
Loading...
Searching...
No Matches
AFP_ProtonRecoBase.h
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef AFP_GLOBRECO_AFP_PROTONRECOBASE_H
6#define AFP_GLOBRECO_AFP_PROTONRECOBASE_H
7
9
10// FrameWork includes
12#include "GaudiKernel/ServiceHandle.h"
13#include "Gaudi/Property.h"
15
16// xAOD includes
24
25#include <string>
26#include <vector>
27#include <iterator>
28#include <algorithm>
29
30
31
34class AFP_ProtonRecoBase : public extends<AthAlgTool, IAFP_ProtonRecoTool> {
35
36 public:
38 AFP_ProtonRecoBase(const std::string& type, const std::string& name, const IInterface* parent);
39
40 // return name of the output container; needed by AFP_GlobRecoTool to make write handle keys
41 const std::string& outputContainerName () const override {return m_protonsContainerName;}
42
43 // find proton candidates and save them; fitting is done in the derived class
44 StatusCode doProtonReco(std::unique_ptr<xAOD::AFPProtonContainer>& outputContainer, const EventContext& ctx) const override;
45
46 protected:
47
49 struct Measurement {
51 Measurement() : xN {0.}, yN {0.}, xF {0.}, yF {0.} {}
52
55 Measurement(double xNear, double yNear, double xFar, double yFar)
56 : xN {xNear * 1e-3}, yN {yNear * 1e-3}, xF {xFar * 1e-3}, yF {yFar * 1e-3} {}
57
60 double xN, yN;
62
65 double xF, yF;
67 };
68
69
70 Gaudi::Property<std::vector<double> > m_detectorPositions{this, "detectorPositions", {}, "absolute values of detector positions for each station on one side"};
71
72 Gaudi::Property<int> m_side{this, "side", 0, "side id, A=0, C=1"};
73
74 Gaudi::Property<double> m_trackDistance{this, "trackDistance", 2.0, "Maximum distance between tracks in the near and the far station on xy-plane"};
75
76 Gaudi::Property<bool> m_allowSingleStationReco{this, "allowSingleStationReco", false, "Switch for allowing proton reconstruction using only far station"};
77
78 SG::ReadHandleKey<xAOD::AFPTrackContainer> m_trackContainerKey{this, "AFPTrackContainerKey", "AFPTrackContainer", "Name of the container with tracks of hits from which protons are to be reconstructed"};
79
80 Gaudi::Property<std::string> m_protonsContainerName{this, "protonsContainerName", "AFPProtonContainer", "Name of the container in which protons are saved"};
81
83 using Momentum = std::array<double, 3>;
84
86 xAOD::AFPProton * createProton (const Momentum& momentum, const Measurement& my_measAFP, const int algID, std::unique_ptr<xAOD::AFPProtonContainer>& outputContainer) const;
87
89 void linkTracksToProton (const xAOD::AFPTrack* track, SG::ReadHandle<xAOD::AFPTrackContainer>& trackContainer, xAOD::AFPProton * proton) const;
90
92 double m_detectorPositionNear = 0.0; // [m]
93
95 double m_detectorPositionFar = 0.0; // [m]
96
98 static constexpr double m_xSigma = 10e-6; // [m]
99
101 static constexpr double m_ySigma = 30e-6;
102
104 // TODO: get it from PV or BS?
105 const std::vector<double> m_vertexIP = {0, 0, 0};
106
107 // the reco methods should be defined in the derived class
108 virtual xAOD::AFPProton * reco(const xAOD::AFPTrack* /*trkNear*/, const xAOD::AFPTrack* /*trkFar*/, std::unique_ptr<xAOD::AFPProtonContainer>& /*outputContainer*/) const
109 {
110 ATH_MSG_ERROR("this is reco(trkNear, trkFar, outputContainer) in AFP_ProtonRecoBase, shall not be used, returning 0");
111 return 0;
112 }
113 virtual xAOD::AFPProton * reco (const xAOD::AFPTrack* /*trkFar*/, std::unique_ptr<xAOD::AFPProtonContainer>& /*outputContainer*/) const
114 {
115 ATH_MSG_ERROR("this is reco(trkFar, outputContainer) in AFP_ProtonRecoBase, shall not be used, returning 0");
116 return 0;
117 }
118
119 // chi2 method should be defined in the derived class
120 virtual double chi2 (double /*energy*/, double /*sx*/, double /*sy*/, const Measurement& /*my_measAFP*/) const
121 {
122 ATH_MSG_ERROR("this is chi2(energy, sx, sy, sz, my_measAFP) in AFP_ProtonRecoBase, shall not be used, returning 0");
123 return 0.;
124 }
125
126};
127
128
129#endif
Definitions of identification numbers of AFP proton reconstruction algorithms.
#define ATH_MSG_ERROR(x)
Header file for interface IAFP_ProtonRecoTool.
Property holding a SG store/key/clid from which a ReadHandle is made.
double m_detectorPositionFar
Default position of AFP far station.
const std::string & outputContainerName() const override
std::array< double, 3 > Momentum
3-momentum of reconstructed proton
Gaudi::Property< std::string > m_protonsContainerName
StatusCode doProtonReco(std::unique_ptr< xAOD::AFPProtonContainer > &outputContainer, const EventContext &ctx) const override
double m_detectorPositionNear
Default position of AFP near station.
void linkTracksToProton(const xAOD::AFPTrack *track, SG::ReadHandle< xAOD::AFPTrackContainer > &trackContainer, xAOD::AFPProton *proton) const
Links track pair to reconstructed proton.
Gaudi::Property< double > m_trackDistance
Gaudi::Property< bool > m_allowSingleStationReco
const std::vector< double > m_vertexIP
Vertex position.
virtual xAOD::AFPProton * reco(const xAOD::AFPTrack *, const xAOD::AFPTrack *, std::unique_ptr< xAOD::AFPProtonContainer > &) const
Gaudi::Property< int > m_side
AFP_ProtonRecoBase(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
static constexpr double m_ySigma
y-Sigma value
virtual double chi2(double, double, double, const Measurement &) const
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_trackContainerKey
Gaudi::Property< std::vector< double > > m_detectorPositions
virtual xAOD::AFPProton * reco(const xAOD::AFPTrack *, std::unique_ptr< xAOD::AFPProtonContainer > &) const
static constexpr double m_xSigma
x-Sigma value
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.
Property holding a SG store/key/clid from which a ReadHandle is made.
AFPTrack_v2 AFPTrack
Definition AFPTrack.h:12
AFPProton_v1 AFPProton
Definition AFPProton.h:11
Local class for storing tracks positions.
Measurement(double xNear, double yNear, double xFar, double yFar)
Takes xy positions of two tracks in [mm] and stores them in [m].
Measurement()
Default constructor - sets everything to zero.