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() );
56 if (!PhotonPreselect(ph))
continue;
57 if (not ph1 or ph->
pt() > ph1->
pt())
62 else if (not ph2 or ph->pt() > ph2->pt()) ph2 = ph;
70 ATH_CHECK( m_photonVertexSelectionTool->decorateInputs(*(vertexPhotons.
asDataVector()), &vertexFailType) );
73 std::vector<std::pair<const xAOD::Vertex*, float> > vxResult;
78 for(
const auto *
const fe : *FEHandle) passORDec(*fe) =
true;
82 vxResult = m_photonVertexSelectionTool->getVertex( *( vertexPhotons.
asDataVector()) , m_ignoreConv,
true, &yyvertexVtxType, &vertexFailType );
83 if(!vxResult.empty()) {
84 newPV = vxResult[0].first;
86 ATH_CHECK(matchFlowElement(ph1,&*FEHandle));
87 ATH_CHECK(matchFlowElement(ph2,&*FEHandle));
91 ATH_MSG_DEBUG(
"PhotonVertexSelection returns vertex " << newPV <<
" " << (newPV? Form(
" with z = %g", newPV->
z()) :
"") );
94 HggPV.second->setShallowIO(
false);
98 std::unique_ptr< xAOD::ShallowAuxContainer >(HggPV.second)));
109 for (
unsigned int iPV=0; iPV<PV->
size(); iPV++) {
110 const auto *vx = PV->
at(iPV);
111 auto yyvx = (HggPV.first)->at(iPV);
121 for (
const auto& vxR: vxResult) {
123 if ( vx == vxR.first ) {
124 vertexScoreAcc(*yyvx) = vxR.second;
125 vertexFailTypeAcc(*yyvx) = vertexFailType;
126 vertexCaseAcc(*yyvx) = yyvertexVtxType;
127 leadingPhotonLinkAcc(*yyvx) =
phlink_t(*photons, ph1->
index());
128 subleadingPhotonLinkAcc(*yyvx) =
phlink_t(*photons, ph2->index());
138 for(yyvx_itr = (HggPV.first)->begin(); yyvx_itr != yyvx_end; ++yyvx_itr ) {
140 vertexScoreAcc(**yyvx_itr) = -9999;
141 vertexFailTypeAcc(**yyvx_itr) = vertexFailType;
142 vertexCaseAcc(**yyvx_itr) = yyvertexVtxType;
143 leadingPhotonLinkAcc(**yyvx_itr) = (
phlink_t()) ;
144 subleadingPhotonLinkAcc(**yyvx_itr) = (
phlink_t());
151 ATH_MSG_WARNING(
"Unable to find transient xAOD::VertexContainer, \"" << m_diphotonVertexKey.key() <<
"\"");
154 return StatusCode::SUCCESS;
160 if (!ph)
return false;
162 if (!ph->
isGoodOQ(34214))
return false;
170 val =
static_cast<bool>(DFCommonPhotonsIsEMLooseAcc(*ph));
176 if(!defined || !
val)
return false;
183 double eta = std::abs(caloCluster->
etaBE(2));
185 if (
eta > m_maxEta)
return false;
186 if (m_removeCrack && 1.37 <=
eta &&
eta <= 1.52)
return false;
188 if (ph->
pt() < m_minPhotonPt)
return false;
198 std::vector<const xAOD::FlowElement*> nearbyFE;
199 nearbyFE.reserve(20);
200 for(
const auto *
const fe : *feCont) {
202 if( ( !fe->isCharged() && fe->e() > FLT_MIN )) nearbyFE.push_back(fe);
208 double eg_cl_e = swclus->
e();
212 std::sort(nearbyFE.begin(),nearbyFE.end(),greaterPtFlowElement);
213 for(
const auto& fe : nearbyFE) {
216 double fe_e = fe->e();
218 if(fe_e>m_tcMatch_maxRat*eg_cl_e) {
219 ATH_MSG_VERBOSE(
"Reject topocluster in sum. Ratio vs eg cluster: " << (fe_e/eg_cl_e));
220 if( !bestbadmatch || (std::abs(fe_e/eg_cl_e-1.) < std::abs(bestbadmatch->
e()/eg_cl_e-1.)) ) bestbadmatch = fe;
224 ATH_MSG_VERBOSE(
"E match with new nFE: " << std::abs(sumE_fe+fe_e - eg_cl_e) / eg_cl_e);
225 if( (doSum = std::abs(sumE_fe+fe_e-eg_cl_e) < std::abs(sumE_fe - eg_cl_e)) ) {
226 passORDec(*fe) =
false;
231 if(sumE_fe<FLT_MIN && bestbadmatch) {
232 passORDec(*bestbadmatch) =
false;
235 return StatusCode::SUCCESS;