22#include "GaudiKernel/EventContext.h"
54 if (convType1 != convType2) {
78 const std::string&
name,
79 const IInterface* parent)
84 declareInterface<IEMConversionBuilder>(
this);
98 return StatusCode::FAILURE;
102 return StatusCode::SUCCESS;
116 std::vector<ElementLink<xAOD::VertexContainer>> vertices;
119 return StatusCode::SUCCESS;
124 const EventContext& ctx,
129 if (!egRec || !conversions) {
131 "trackExecute: NULL pointer to egammaRec or VertexContainer");
132 return StatusCode::SUCCESS;
140 for (
unsigned int iVtx = 0; iVtx < conversions->
size(); ++iVtx) {
146 etaAtCalo = accetaAtCalo(*vertex);
147 phiAtCalo = accphiAtCalo(*vertex);
151 ctx, vertex, &etaAtCalo, &phiAtCalo)) {
159 cluster, vertex, etaAtCalo, phiAtCalo)) {
167 ConvVxSorter(*vertex, *egRec->
vertex())) {
175 return StatusCode::SUCCESS;
185 float pt = momentum.perp();
186 float EoverP = cluster.
e() / momentum.mag();
198 ATH_MSG_DEBUG(
"Conversion failed cut on TRT tube hit fraction: "
206 (isSingle && EoverP > EoverPcut) ||
225 ? 1. * nTRTTube / nTRT
229 float maxTubeHitFraction = 0.;
230 for (
unsigned int i = 0; i < vertex.nTrackParticles(); ++i) {
231 if (!vertex.trackParticle(i)) {
232 ATH_MSG_WARNING(
"NULL pointer to track particle in conversion vertex");
234 float tubeHitFraction = getTRTTubeHitFraction(vertex.trackParticle(i));
235 if (tubeHitFraction > maxTubeHitFraction) {
236 maxTubeHitFraction = tubeHitFraction;
240 return maxTubeHitFraction;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Handle class for reading from StoreGate.
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Property< float > m_minPt_singleTrack
minimum pT for single-track conversion vertices
float getMaxTRTTubeHitFraction(const xAOD::Vertex &vertex) const
Return the maximum fraction of TRT tube hits among the tracks.
StatusCode vertexExecute(const EventContext &ctx, egammaRec *egRec, const xAOD::VertexContainer *conversions) const
actual implementation method
bool passPtAndEoverP(const EventContext &ctx, const xAOD::Vertex &, const xAOD::CaloCluster &) const
Return true if vertex and cluster pass Pt and E/p cuts.
Gaudi::Property< float > m_maxEoverP_singleTrack
maximum E/p for single track conversion vertices (E is not calibrated)
StatusCode initialize() override final
initialize method
Gaudi::Property< float > m_minSumPt_doubleTRT
minimum sum pT for double TRT track conversion vertices
Gaudi::Property< bool > m_rejectAllTRT
Ignore all conversion vertices that contain exclusively TRT-only tracks.
EMConversionBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Gaudi::Property< float > m_minSumPt_double
minimum sum pT for double track conversion vertices
Gaudi::Property< float > m_minPt_singleTRT
minimum pT for TRT-only single-track conversion vertices
SG::ReadHandleKey< xAOD::VertexContainer > m_conversionContainerKey
Name of conversion container.
Gaudi::Property< float > m_maxTRTTubeHitFraction
"Maximum fraction of tube hits for vertices with TRT tracks
ToolHandle< IEMExtrapolationTools > m_extrapolationTool
EMExtrapolationTools.
Gaudi::Property< float > m_maxEoverP_singleTrack_EtSf
Scale maxEoverP_singleTrack by 1+sf*Et(cluster)/GeV.
virtual StatusCode executeRec(const EventContext &ctx, egammaRec *egRec) const override final
execute method
ElementLink implementation for ROOT usage.
SG::Accessor< T, ALLOC > Accessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Represent an egamma object for internal egamma usage during reconstruction.
void pushBackVertex(const ElementLink< xAOD::VertexContainer > &vertexElementLink)
Push back another vertex.
void pushFrontVertex(const ElementLink< xAOD::VertexContainer > &vertexElementLink)
Push front another vertex.
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
void setDeltaPhiVtx(float value)
set deltaPhiVtx
void setVertices(const std::vector< ElementLink< xAOD::VertexContainer > > &links)
set Pointer to the xAOD::vertex/vertices that match the photon candidate
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
void setDeltaEtaVtx(float value)
set deltaEtaVtx
size_t getNumberOfVertices() const
Return the number xAOD::Vertex/vertices that match the photon candidate.
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
virtual double e() const
The total energy of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
const Amg::Vector3D & position() const
Returns the 3-pos.
Eigen::Matrix< double, 3, 1 > Vector3D
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
std::size_t numberOfSiTracks(const xAOD::Photon *eg)
return the number of Si tracks in the conversion
xAOD::EgammaParameters::ConversionType conversionType(const xAOD::Photon *ph)
return the photon conversion type (see EgammaEnums)
@ singleSi
one track only, with Si hits
@ doubleTRT
two tracks, none with Si hits (TRT only)
@ singleTRT
one track only, no Si hits (TRT only)
@ doubleSiTRT
two tracks, only one with Si hits
setRcore setEtHad setFside pt
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfTRTTubeHits
number of TRT tube hits [unit8_t].