35 return StatusCode::SUCCESS;
45 if (!PV->empty() && PV->at(0)) {
46 ATH_MSG_DEBUG(
"Default PV " << PV->at(0) <<
", type = " << PV->at(0)->vertexType() <<
" , z = " << PV->at(0)->z() );
57 if (not ph1 or ph->
pt() > ph1->
pt())
62 else if (not ph2 or ph->pt() > ph2->pt()) ph2 = ph;
73 std::vector<std::pair<const xAOD::Vertex*, float> > vxResult;
78 for(
const auto *
const fe : *FEHandle) passORDec(*fe) =
true;
83 if(!vxResult.empty()) {
84 newPV = vxResult[0].first;
91 ATH_MSG_DEBUG(
"PhotonVertexSelection returns vertex " << newPV <<
" " << (newPV? Form(
" with z = %g", newPV->
z()) :
"") );
95 HggPV.second->setShallowIO(
false);
99 std::move(HggPV.second)));
110 for (
unsigned int iPV=0; iPV<PV->size(); iPV++) {
111 const auto *vx = PV->at(iPV);
112 auto yyvx = vertexContainer->at(iPV);
122 for (
const auto& vxR: vxResult) {
124 if ( vx == vxR.first ) {
125 vertexScoreAcc(*yyvx) = vxR.second;
126 vertexFailTypeAcc(*yyvx) = vertexFailType;
127 vertexCaseAcc(*yyvx) = yyvertexVtxType;
128 leadingPhotonLinkAcc(*yyvx) =
phlink_t(*photons, ph1->index());
129 subleadingPhotonLinkAcc(*yyvx) =
phlink_t(*photons, ph2->index());
139 for(yyvx_itr = vertexContainer->begin(); yyvx_itr != yyvx_end; ++yyvx_itr ) {
141 vertexScoreAcc(**yyvx_itr) = -9999;
142 vertexFailTypeAcc(**yyvx_itr) = vertexFailType;
143 vertexCaseAcc(**yyvx_itr) = yyvertexVtxType;
144 leadingPhotonLinkAcc(**yyvx_itr) = (
phlink_t()) ;
145 subleadingPhotonLinkAcc(**yyvx_itr) = (
phlink_t());
151 if( !evtStore()->transientContains< xAOD::VertexContainer >(
m_diphotonVertexKey.key() ) ){
155 return StatusCode::SUCCESS;
161 if (!ph)
return false;
163 if (!ph->
isGoodOQ(34214))
return false;
171 val =
static_cast<bool>(DFCommonPhotonsIsEMLooseAcc(*ph));
177 if(!defined || !val)
return false;
184 double eta = std::abs(caloCluster->
etaBE(2));
199 std::vector<const xAOD::FlowElement*> nearbyFE;
200 nearbyFE.reserve(20);
201 for(
const auto *
const fe : *feCont) {
203 if( ( !fe->isCharged() && fe->e() > FLT_MIN )) nearbyFE.push_back(fe);
209 double eg_cl_e = swclus->
e();
214 for(
const auto& fe : nearbyFE) {
217 double fe_e = fe->e();
220 ATH_MSG_VERBOSE(
"Reject topocluster in sum. Ratio vs eg cluster: " << (fe_e/eg_cl_e));
221 if( !bestbadmatch || (std::abs(fe_e/eg_cl_e-1.) < std::abs(bestbadmatch->
e()/eg_cl_e-1.)) ) bestbadmatch = fe;
225 ATH_MSG_VERBOSE(
"E match with new nFE: " << std::abs(sumE_fe+fe_e - eg_cl_e) / eg_cl_e);
226 if( (doSum = std::abs(sumE_fe+fe_e-eg_cl_e) < std::abs(sumE_fe - eg_cl_e)) ) {
227 passORDec(*fe) =
false;
232 if(sumE_fe<FLT_MIN && bestbadmatch) {
233 passORDec(*bestbadmatch) =
false;
236 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
DataVector adapter that acts like it holds const pointers.
Helper class to provide type-safe access to aux data.
ElementLink< xAOD::PhotonContainer > phlink_t
DataVector adapter that acts like it holds const pointers.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
DataModel_detail::iterator< DataVector > iterator
Gaudi::Property< double > m_tcMatch_dR
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonKey
bool PhotonPreselect(const xAOD::Photon *ph) const
static bool greaterPtFlowElement(const xAOD::FlowElement *part1, const xAOD::FlowElement *part2)
Gaudi::Property< double > m_tcMatch_maxRat
Gaudi::Property< double > m_minPhotonPt
SG::ReadHandleKey< xAOD::FlowElementContainer > m_FEContainerHandleKey
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::WriteHandleKey< xAOD::VertexContainer > m_diphotonVertexKey
Gaudi::Property< bool > m_ignoreConv
virtual StatusCode initialize() override final
Gaudi::Property< double > m_maxEta
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexKey
ToolHandle< CP::IPhotonVertexSelectionTool > m_photonVertexSelectionTool
Gaudi::Property< bool > m_removeCrack
StatusCode matchFlowElement(const xAOD::Photon *eg, const xAOD::FlowElementContainer *pfoCont) const
ElementLink implementation for ROOT usage.
Helper class to provide type-safe access to aux data.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
StatusCode recordNonConst(std::unique_ptr< T > data)
Record a non-const object to the store.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
bool isGoodOQ(uint32_t mask) const
Check object quality. Return True is it is Good Object Quality.
bool passSelection(bool &value, const std::string &menu) const
Check if the egamma object pass a selection menu (using the name) If the menu decision is stored in t...
uint16_t author(uint16_t bitmask=EgammaParameters::AuthorALL) const
Get author.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Class providing the definition of the 4-vector interface.
virtual double e() const =0
The total energy of the particle.
float z() const
Returns the z position.
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
const uint16_t AuthorCaloTopo35
Photon reconstructed by SW CaloTopo35 seeded clusters.
bool isInDeltaR(const xAOD::IParticle &p1, const xAOD::IParticle &p2, double dR, bool useRapidity=true)
Check if 2 xAOD::IParticle are in a cone.
FlowElementContainer_v1 FlowElementContainer
Definition of the current "pfo container version".
typename ShallowCopyResult< T >::type ShallowCopyResult_t
Return type of xAOD::shallowCopy.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Vertex_v1 Vertex
Define the latest version of the vertex class.
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
Photon_v1 Photon
Definition of the current "egamma version".