ATLAS Offline Software
AFP_ProtonRecoBase.h
Go to the documentation of this file.
1 /*
2 Copyright (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
17 #include "xAODForward/AFPProton.h"
20 #include "xAODForward/AFPTrack.h"
24 
25 #include <string>
26 #include <vector>
27 #include <iterator>
28 #include <algorithm>
29 
30 
31 
34 class 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 
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
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AFPTrackContainer.h
AFP_ProtonRecoBase::Measurement::xN
double xN
Definition: AFP_ProtonRecoBase.h:60
xAOD::AFPTrack_v2
Class representing a track reconstructed in AFP.
Definition: AFPTrack_v2.h:37
AFP_ProtonRecoBase::reco
virtual xAOD::AFPProton * reco(const xAOD::AFPTrack *, const xAOD::AFPTrack *, std::unique_ptr< xAOD::AFPProtonContainer > &) const
Definition: AFP_ProtonRecoBase.h:108
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AFP_ProtonRecoBase::doProtonReco
StatusCode doProtonReco(std::unique_ptr< xAOD::AFPProtonContainer > &outputContainer, const EventContext &ctx) const override
Definition: AFP_ProtonRecoBase.cxx:16
AFP_ProtonRecoBase::outputContainerName
const std::string & outputContainerName() const override
Definition: AFP_ProtonRecoBase.h:41
AFP_ProtonRecoBase::AFP_ProtonRecoBase
AFP_ProtonRecoBase(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition: AFP_ProtonRecoBase.cxx:9
AFP_ProtonRecoBase::m_trackDistance
Gaudi::Property< double > m_trackDistance
Definition: AFP_ProtonRecoBase.h:74
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
AFP_ProtonRecoBase::Measurement::Measurement
Measurement(double xNear, double yNear, double xFar, double yFar)
Takes xy positions of two tracks in [mm] and stores them in [m].
Definition: AFP_ProtonRecoBase.h:55
AFP_ProtonRecoBase::Measurement
Local class for storing tracks positions.
Definition: AFP_ProtonRecoBase.h:49
AFP_ProtonRecoBase::m_trackContainerKey
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_trackContainerKey
Definition: AFP_ProtonRecoBase.h:78
AFP_ProtonRecoBase::chi2
virtual double chi2(double, double, double, const Measurement &) const
Definition: AFP_ProtonRecoBase.h:120
IAFP_ProtonRecoTool.h
Header file for interface IAFP_ProtonRecoTool.
AFP_ProtonRecoBase
Base class for all proton reconstruction tools.
Definition: AFP_ProtonRecoBase.h:34
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
AFP_ProtonRecoBase::Measurement::xF
double xF
Definition: AFP_ProtonRecoBase.h:65
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AFP_ProtonRecoBase::createProton
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.
Definition: AFP_ProtonRecoBase.cxx:94
AFPProton.h
AthAlgTool.h
AFP_ProtonRecoBase::m_detectorPositionNear
double m_detectorPositionNear
Default position of AFP near station.
Definition: AFP_ProtonRecoBase.h:92
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AFPProtonContainer.h
AFP_ProtonRecoBase::m_allowSingleStationReco
Gaudi::Property< bool > m_allowSingleStationReco
Definition: AFP_ProtonRecoBase.h:76
AFP_ProtonRecoBase::m_detectorPositions
Gaudi::Property< std::vector< double > > m_detectorPositions
Definition: AFP_ProtonRecoBase.h:70
AFP_ProtonRecoBase::reco
virtual xAOD::AFPProton * reco(const xAOD::AFPTrack *, std::unique_ptr< xAOD::AFPProtonContainer > &) const
Definition: AFP_ProtonRecoBase.h:113
AFP_ProtonRecoBase::Measurement::yN
double yN
Definition: AFP_ProtonRecoBase.h:60
AFP_ProtonRecoBase::m_xSigma
static constexpr double m_xSigma
x-Sigma value
Definition: AFP_ProtonRecoBase.h:98
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AFP_ProtonRecoBase::m_side
Gaudi::Property< int > m_side
Definition: AFP_ProtonRecoBase.h:72
xAOD::proton
@ proton
Definition: TrackingPrimitives.h:198
AFP_ProtonRecoBase::m_ySigma
static constexpr double m_ySigma
y-Sigma value
Definition: AFP_ProtonRecoBase.h:101
AFPTrack.h
AFPProtonRecoAlgID.h
Definitions of identification numbers of AFP proton reconstruction algorithms.
AFP_ProtonRecoBase::m_protonsContainerName
Gaudi::Property< std::string > m_protonsContainerName
Definition: AFP_ProtonRecoBase.h:80
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFP_ProtonRecoBase::m_vertexIP
const std::vector< double > m_vertexIP
Vertex position.
Definition: AFP_ProtonRecoBase.h:105
AFP_ProtonRecoBase::linkTracksToProton
void linkTracksToProton(const xAOD::AFPTrack *track, SG::ReadHandle< xAOD::AFPTrackContainer > &trackContainer, xAOD::AFPProton *proton) const
Links track pair to reconstructed proton.
Definition: AFP_ProtonRecoBase.cxx:120
xAOD::AFPProton_v1
Class representing a proton reconstructed in AFP.
Definition: AFPProton_v1.h:36
AFPProtonAuxContainer.h
AFP_ProtonRecoBase::Momentum
std::array< double, 3 > Momentum
3-momentum of reconstructed proton
Definition: AFP_ProtonRecoBase.h:83
AFP_ProtonRecoBase::Measurement::Measurement
Measurement()
Default constructor - sets everything to zero.
Definition: AFP_ProtonRecoBase.h:51
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AFP_ProtonRecoBase::Measurement::yF
double yF
Definition: AFP_ProtonRecoBase.h:65
AFP_ProtonRecoBase::m_detectorPositionFar
double m_detectorPositionFar
Default position of AFP far station.
Definition: AFP_ProtonRecoBase.h:95
AFPTrackAuxContainer.h