69 return StatusCode::FAILURE;
72 return StatusCode::SUCCESS;
78 return StatusCode::SUCCESS;
85 std::vector<const xAOD::IParticle*>& tclist,
96 std::vector<const IParticle*> inputTC;
100 for(
const auto *
const cl : *constits.
tcCont) {
104 inputTC.push_back(
cl);
108 std::sort(inputTC.begin(),inputTC.end(),
greaterPt);
112 for(
const auto&
el : tcLinkAcc(*swclus)) {
114 inputTC.push_back(*
el);
116 ATH_MSG_ERROR(
"Invalid constituentClusterLinks on input electron/photon!");
117 return StatusCode::FAILURE;
123 return StatusCode::FAILURE;
128 return StatusCode::SUCCESS;
133 std::vector<const xAOD::IParticle*>& constlist,
137 std::set<const xAOD::TrackParticle*> trackset;
139 for(
const auto&
track : trackset) {
141 constlist.push_back(
track);
144 return StatusCode::SUCCESS;
148 std::vector<const xAOD::IParticle*>& pfolist,
150 std::map<const IParticle*,MissingETBase::Types::constvec_t> &)
const
159 return StatusCode::SUCCESS;
163 std::vector<const xAOD::IParticle*>& pfolist,
167 ATH_MSG_DEBUG(
"Extract PFOs From Links for " <<
eg->type() <<
" with pT " <<
eg->pt());
169 std::vector<PFOLink_t> cPFOLinks;
170 std::vector<PFOLink_t> nPFOLinks;
175 nPFOLinks=neutralPFOReadDecorHandle(*
eg);
176 cPFOLinks=chargedPFOReadDecorHandle(*
eg);
181 nPFOLinks=neutralPFOReadDecorHandle(*
eg);
182 cPFOLinks=chargedPFOReadDecorHandle(*
eg);
187 for (
const PFOLink_t& pfoLink : cPFOLinks) {
188 if (!pfoLink.isValid())
continue;
190 for (
const auto *
const pfo : *constits.
pfoCont){
191 if (pfo->index() == pfo_init->
index() && pfo->isCharged()){
194 ATH_MSG_DEBUG(
"Accept cPFO with pt " << pfo->pt() <<
", e " << pfo->e() <<
", eta " << pfo->eta() <<
", phi " << pfo->phi() );
202 double eg_cl_e =
eg->caloCluster()->e();
203 double sumE_pfo = 0.;
205 for (
const PFOLink_t& pfoLink : nPFOLinks) {
206 if (!pfoLink.isValid())
continue;
208 for (
const auto *
const pfo : *constits.
pfoCont){
209 if (pfo->index() == pfo_init->
index() && !pfo->isCharged()){
210 double pfo_e = pfo->
eEM();
211 if( ( !pfo->isCharged()&& pfo->e() > FLT_MIN ) ){
213 ATH_MSG_DEBUG(
"E match with new nPFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
214 ATH_MSG_DEBUG(
"Accept nPFO with pt " << pfo->pt() <<
", e " << pfo->e() <<
", eta " << pfo->eta() <<
", phi " << pfo->phi() <<
" in sum.");
215 ATH_MSG_DEBUG(
"Energy ratio of nPFO to eg: " << pfo_e / eg_cl_e);
216 pfolist.push_back(pfo);
223 return StatusCode::SUCCESS;
227 std::vector<const xAOD::IParticle*>& pfolist,
237 std::vector<const xAOD::PFO*> nearbyPFO;
238 nearbyPFO.reserve(20);
239 for(
const auto *
const pfo : *constits.
pfoCont) {
244 if( ( !pfo->isCharged() && pfo->e() > FLT_MIN ) ||
245 ( pfo->isCharged() && PVMatchedAcc(*pfo)
248 nearbyPFO.push_back(pfo);
254 std::set<const xAOD::TrackParticle*> trackset;
256 for(
const auto&
track : trackset) {
257 for(
const auto& pfo : nearbyPFO) {
258 if(pfo->isCharged() && pfo->track(0) ==
track) {
259 pfolist.push_back(pfo);
263 double eg_cl_e = swclus->
e();
270 double sumE_pfo = 0.;
272 std::sort(nearbyPFO.begin(),nearbyPFO.end(),
greaterPtPFO);
273 for(
const auto& pfo : nearbyPFO) {
277 double pfo_e = pfo->eEM();
280 ATH_MSG_VERBOSE(
"Reject topocluster in sum. Ratio vs eg cluster: " << (pfo_e/eg_cl_e));
281 if( !bestbadmatch || (fabs(pfo_e/eg_cl_e-1.) < fabs(bestbadmatch->
e()/eg_cl_e-1.)) ) bestbadmatch = pfo;
285 ATH_MSG_VERBOSE(
"E match with new nPFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
286 if( (doSum = fabs(sumE_pfo+pfo_e-eg_cl_e) < fabs(sumE_pfo - eg_cl_e)) ) {
287 pfolist.push_back(pfo);
289 ATH_MSG_VERBOSE(
"Accept pfo with pt " << pfo->pt() <<
", e " << pfo->e() <<
" in sum.");
291 ATH_MSG_VERBOSE(
"E match with new PFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
295 if(sumE_pfo<FLT_MIN && bestbadmatch) {
296 ATH_MSG_VERBOSE(
"No better matches found -- add bad match topocluster with pt "
297 << bestbadmatch->
pt() <<
", e " << bestbadmatch->
e() <<
".");
298 pfolist.push_back(bestbadmatch);
301 return StatusCode::SUCCESS;
305 std::vector<const xAOD::IParticle*>& felist,
307 std::map<const IParticle*,MissingETBase::Types::constvec_t> &)
const
316 return StatusCode::SUCCESS;
321 std::vector<const xAOD::IParticle*>& felist,
325 ATH_MSG_DEBUG(
"Extract FEs From Links for " <<
eg->type() <<
" with pT " <<
eg->pt());
327 std::vector<FELink_t> nFELinks;
328 std::vector<FELink_t> cFELinks;
333 nFELinks=neutralFEReadDecorHandle(*
eg);
334 cFELinks=chargedFEReadDecorHandle(*
eg);
339 nFELinks=neutralFEReadDecorHandle(*
eg);
340 cFELinks=chargedFEReadDecorHandle(*
eg);
345 for (
const FELink_t& feLink : cFELinks) {
346 if (!feLink.isValid())
continue;
348 for (
const auto *
const fe : *constits.
feCont){
349 if (fe->index() == fe_init->
index() && fe->isCharged()){
352 ATH_MSG_DEBUG(
"Accept cFE with pt " << fe->pt() <<
", e " << fe->e() <<
", eta " << fe->eta() <<
", phi " << fe->phi() );
353 felist.push_back(fe);
360 double eg_cl_e =
eg->caloCluster()->e();
363 for (
const FELink_t& feLink : nFELinks) {
364 if (!feLink.isValid())
continue;
366 for (
const auto *
const fe : *constits.
feCont){
367 if (fe->index() == fe_init->
index() && !fe->isCharged()){
368 double fe_e = fe->
e();
369 if( ( !fe->isCharged()&& fe->e() > FLT_MIN ) ){
371 ATH_MSG_DEBUG(
"E match with new nFE: " << fabs(sumE_fe+fe_e - eg_cl_e) / eg_cl_e);
372 ATH_MSG_DEBUG(
"Accept nFE with pt " << fe->pt() <<
", e " << fe->e() <<
", eta " << fe->eta() <<
", phi " << fe->phi() <<
" in sum.");
373 ATH_MSG_DEBUG(
"Energy ratio of nFE to eg: " << fe_e / eg_cl_e);
374 felist.push_back(fe);
381 return StatusCode::SUCCESS;
385 std::vector<const xAOD::IParticle*>& felist,
395 std::vector<const xAOD::FlowElement*> nearbyFE;
396 nearbyFE.reserve(20);
399 ATH_MSG_ERROR(
"Attempted to extract non-PFlow FlowElements. This is not supported!");
400 return StatusCode::FAILURE;
406 if( ( !fe->
isCharged() && fe->
e() > FLT_MIN ) ||
410 nearbyFE.push_back(fe);
414 ATH_MSG_VERBOSE(
"Found " << nearbyFE.size() <<
" nearby FlowElements (PFOs)");
416 std::set<const xAOD::TrackParticle*> trackset;
421 felist.push_back(fe);
425 double eg_cl_e = swclus->
e();
432 double sumE_pfo = 0.;
434 std::sort(nearbyFE.begin(),nearbyFE.end(),
greaterPtFE);
440 double pfo_e = fe->
e();
443 ATH_MSG_VERBOSE(
"Reject topocluster in sum. Ratio vs eg cluster: " << (pfo_e/eg_cl_e));
444 if( !bestbadmatch || (fabs(pfo_e/eg_cl_e-1.) < fabs(bestbadmatch->
e()/eg_cl_e-1.)) ) bestbadmatch = fe;
448 ATH_MSG_VERBOSE(
"E match with new nPFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
449 if( (doSum = fabs(sumE_pfo+pfo_e-eg_cl_e) < fabs(sumE_pfo - eg_cl_e)) ) {
450 felist.push_back(fe);
452 ATH_MSG_VERBOSE(
"Accept pfo with pt " << fe->
pt() <<
", e " << fe->
e() <<
" in sum.");
454 ATH_MSG_VERBOSE(
"E match with new PFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
458 if(sumE_pfo<FLT_MIN && bestbadmatch) {
459 ATH_MSG_VERBOSE(
"No better matches found -- add bad match topocluster with pt "
460 << bestbadmatch->
pt() <<
", e " << bestbadmatch->
e() <<
".");
461 felist.push_back(bestbadmatch);
464 return StatusCode::SUCCESS;
472 const std::vector<const IParticle*>& inputTC,
473 std::vector<const xAOD::IParticle*>& tclist)
const
475 double eg_cl_e = swclus->
e();
480 for(
const auto&
cl : inputTC) {
481 double tcl_e =
cl->e();
485 ATH_MSG_VERBOSE(
"Reject topocluster in sum. Ratio vs eg cluster: " << (tcl_e/eg_cl_e));
486 if( !bestbadmatch || (fabs(tcl_e/eg_cl_e-1.) < fabs(bestbadmatch->
e()/eg_cl_e-1.)) ) bestbadmatch =
cl;
490 ATH_MSG_VERBOSE(
"E match with new cluster: " << fabs(sumE_tc+tcl_e - eg_cl_e) / eg_cl_e);
491 if( (doSum = (fabs(sumE_tc+tcl_e - eg_cl_e) < fabs(sumE_tc - eg_cl_e))) ) {
492 ATH_MSG_VERBOSE(
"Accept topocluster with pt " <<
cl->pt() <<
", e " <<
cl->e() <<
" in sum.");
494 ATH_MSG_VERBOSE(
"E match with new cluster: " << fabs(sumE_tc+tcl_e - eg_cl_e) / eg_cl_e);
495 tclist.push_back(
cl);
499 if(sumE_tc<FLT_MIN && bestbadmatch) {
500 ATH_MSG_VERBOSE(
"No better matches found -- add bad match topocluster with pt "
501 << bestbadmatch->
pt() <<
", e " << bestbadmatch->
e() <<
".");
502 tclist.push_back(bestbadmatch);
504 return StatusCode::SUCCESS;
509 std::set<const xAOD::TrackParticle*>& tracklist)
const
514 for(
const auto&
track : egtracks) {
516 tracklist.insert(
track);
523 for(
const auto&
track : egtracks) {
525 tracklist.insert(
track);
530 for(
const auto *
const track : *trkCont) {
533 uint8_t expect_innermostHit(
false);
535 uint8_t expect_nextToInnermostHit(
false);
536 uint8_t N_nextToInnermostHit(
false);
539 ATH_MSG_WARNING(
"Track summary retrieval failed for 'expect(NextTo)InnermostPixelLayerHit'");
540 return StatusCode::FAILURE;
542 if(expect_innermostHit) {
544 ATH_MSG_WARNING(
"Track summary retrieval failed for 'numberOfInnermostPixelLayerHits'");
545 return StatusCode::FAILURE;
546 if(N_innermostHit==0 ) {
548 tracklist.insert(
track);
551 }
else if(expect_nextToInnermostHit) {
553 ATH_MSG_WARNING(
"Track summary retrieval failed for 'numberOfNextToInnermostPixelLayerHits'");
554 return StatusCode::FAILURE;
555 if(N_nextToInnermostHit==0 ) {
557 tracklist.insert(
track);
564 return StatusCode::SUCCESS;
570 bool has_unmatched=
false;
572 float unmatchedSumpt=0;
574 float unmatchedTotEMFrac=0;
585 TLorentzVector totVec(0.,0.,0.,0.), unmatchedVec(0.,0.,0.,0.);
587 std::set<const xAOD::CaloCluster*> cPFOClusters;
590 for (
int cl = 0;
cl < nCluscPFO; ++
cl) {
594 std::vector<const xAOD::CaloCluster*> unmatchedClusters;
596 TLorentzVector tmpVec;
597 tmpVec.SetPtEtaPhiE(pfoclus->pt(),pfoclus->eta(),pfoclus->phi(),pfoclus->e());
598 totSumpt+=pfoclus->pt();
600 bool inEgamma =
false;
602 if (pfoclus == phclus) {
607 unmatchedClusters.push_back(pfoclus);
608 unmatchedSumpt+=pfoclus->pt();
609 unmatchedE+=pfoclus->e();
610 unmatchedVec+=tmpVec;
612 unmatchedTotEMFrac=unmatchedTotEMFrac+emfrac*pfoclus->e();
617 ATH_MSG_DEBUG(
"PFO associated to "<<nCluscPFO<<
" cluster, of which " << unmatchedClusters.size() <<
"unmatched one and unmatched pt "<<unmatchedSumpt);
618 dec_unmatchedFrac(*pfo)=nCluscPFO>0 ?
float(unmatchedClusters.size())/
float(nCluscPFO) : -1;
619 dec_unmatchedFracPt(*pfo)= totVec.Pt()>0 ?
float(unmatchedVec.Pt()/totVec.Pt()): -1;
620 dec_unmatchedFracSumpt(*pfo)= totSumpt>0 ?
float(unmatchedSumpt/totSumpt): -1;
621 dec_unmatchedFracE(*pfo)= totVec.E()>0 ?
float(unmatchedE/totVec.E()): -1;
622 dec_unmatchedTotEMFrac(*pfo)= totVec.E()>0 ?
float(unmatchedTotEMFrac/totVec.E()): -1;
623 dec_unmatchedFracEClusterPFO(*pfo)= pfo->
e()>0 ?
float(unmatchedE/pfo->
e()): -1;
624 dec_unmatchedFracPtClusterPFO(*pfo)= pfo->
pt()>0 ?
float(unmatchedE/pfo->
pt()): -1;
626 return has_unmatched;