ATLAS Offline Software
Loading...
Searching...
No Matches
met::METElectronAssociator Class Referencefinal

#include <METElectronAssociator.h>

Inheritance diagram for met::METElectronAssociator:
Collaboration diagram for met::METElectronAssociator:

Public Member Functions

 METElectronAssociator (const std::string &name)
 ~METElectronAssociator ()=default
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
StatusCode finalize ()
virtual StatusCode execute (xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const override
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

StatusCode executeTool (xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const final
StatusCode extractTopoClusters (const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &tclist, const met::METAssociator::ConstitHolder &constits) const final
StatusCode extractPFO (const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta) const final
StatusCode extractPFOsFromLinks (const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits) const
StatusCode extractPFOs (const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits) const
StatusCode extractFE (const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta) const final
StatusCode extractFEsFromLinks (const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits) const
StatusCode extractFEs (const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits) const
StatusCode extractFEHR (const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > hardObjs, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta, float &UEcorr) const final
StatusCode extractTracks (const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &constlist, const met::METAssociator::ConstitHolder &constits) const final
StatusCode selectEgammaClusters (const xAOD::CaloCluster *swclus, const std::vector< const xAOD::IParticle * > &inputTC, std::vector< const xAOD::IParticle * > &tclist) const
StatusCode selectEgammaTracks (const xAOD::Egamma *el, const xAOD::TrackParticleContainer *trkCont, std::set< const xAOD::TrackParticle * > &tracklist) const
bool hasUnmatchedClusters (const xAOD::Egamma *eg, const xAOD::PFO *pfo) const
StatusCode retrieveConstituents (met::METAssociator::ConstitHolder &constits) const
bool acceptTrack (const xAOD::TrackParticle *trk, const xAOD::Vertex *pv) const
bool isGoodEoverP (const xAOD::TrackParticle *trk) const
virtual StatusCode fillAssocMap (xAOD::MissingETAssociationMap *metMap, const xAOD::IParticleContainer *hardObjs) const
StatusCode GetUEcorr (const met::METAssociator::ConstitHolder &constits, std::vector< TLorentzVector > &v_clus, TLorentzVector &clus, TLorentzVector &HR, const float Drcone, const float MinDistCone, float &UEcorr) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Static Protected Member Functions

static bool greaterPt (const xAOD::IParticle *part1, const xAOD::IParticle *part2)
static bool greaterPtPFO (const xAOD::PFO *part1, const xAOD::PFO *part2)
static bool greaterPtFE (const xAOD::FlowElement *part1, const xAOD::FlowElement *part2)

Protected Attributes

double m_tcMatch_dR
double m_tcMatch_maxRat
unsigned short m_tcMatch_method
double m_extraTrkMatch_dR
SG::ReadDecorHandleKey< xAOD::PhotonContainerm_photonNeutralPFOReadDecorKey {this,"photonNeutralPFOReadDecorKey","", "Neutral PFO links key"}
SG::ReadDecorHandleKey< xAOD::PhotonContainerm_photonChargedPFOReadDecorKey {this,"photonChargedPFOReadDecorKey","", "Charged PFO links key"}
SG::ReadDecorHandleKey< xAOD::PhotonContainerm_photonNeutralFEReadDecorKey {this,"photonNeutralFEReadDecorKey","", "Neutral FE links key"}
SG::ReadDecorHandleKey< xAOD::PhotonContainerm_photonChargedFEReadDecorKey {this,"photonChargedFEReadDecorKey","", "Charged FE links key"}
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_electronNeutralPFOReadDecorKey {this,"electronNeutralPFOReadDecorKey","", "Neutral PFO links key"}
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_electronChargedPFOReadDecorKey {this,"electronCargedPFOReadDecorKey","", "Charged PFO links key"}
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_electronNeutralFEReadDecorKey {this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"}
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_electronChargedFEReadDecorKey {this,"electronCargedFEReadDecorKey","", "Charged FE links key"}
bool m_checkUnmatched
ToolHandle< InDet::IInDetTrackSelectionToolm_trkseltool
ToolHandle< xAOD::ITrackIsolationToolm_trkIsolationTool
ToolHandle< xAOD::ICaloTopoClusterIsolationToolm_caloIsolationTool
std::string m_neutralFELinksKey
std::string m_chargedFELinksKey
std::string m_neutralPFOLinksKey
std::string m_chargedPFOLinksKey
bool m_usePFOLinks
bool m_useFELinks
SG::ReadHandleKey< xAOD::VertexContainerm_pvcollKey {this,"PrimVxColl","PrimaryVertices","Primary Vertex Collection"}
SG::ReadHandleKey< xAOD::IParticleContainerm_clcollKey {this,"ClusColl","CaloCalTopoClusters","Topo cluster Collection"}
SG::ReadHandleKey< xAOD::TrackParticleContainerm_trkcollKey {this,"TrkColl","InDetTrackParticles","Track particle Collection"}
SG::ReadHandleKey< xAOD::PFOContainerm_pfcollKey {this,"PFlowColl","","PFO Collection"}
SG::ReadHandleKey< xAOD::FlowElementContainerm_fecollKey {this,"FlowElementCollection","","FlowElement Collection (overrides PFO if not empty)"}
SG::ReadHandleKey< xAOD::IParticleContainerm_hybridContKey {this,"HybridKey","","Hybrid Collection"}
Gaudi::Property< boolm_recoil {this, "HRecoil", false, ""}
bool m_pflow
bool m_useTracks
bool m_useRapidity
bool m_useIsolationTools = false
bool m_useModifiedClus
bool m_weight_charged_pfo = false
bool m_cleanChargedPFO
bool m_skipconst
std::string m_forcoll
double m_foreta
double m_cenTrackPtThr
double m_forTrackPtThr

Private Member Functions

 METElectronAssociator ()
 Default constructor:

Private Attributes

SG::ReadHandleKey< xAOD::ElectronContainerm_elContKey {this, "InputCollection", "Electrons", "electrons input key"}

Static Private Attributes

static constexpr float m_Drcone = 0.2
static constexpr float m_MinDistCone = 0.4

Detailed Description

Definition at line 25 of file METElectronAssociator.h.

Constructor & Destructor Documentation

◆ METElectronAssociator() [1/2]

met::METElectronAssociator::METElectronAssociator ( const std::string & name)

Definition at line 28 of file METElectronAssociator.cxx.

28 :
32 {
33 }
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
METEgammaAssociator()
Default constructor:

◆ ~METElectronAssociator()

met::METElectronAssociator::~METElectronAssociator ( )
default

◆ METElectronAssociator() [2/2]

met::METElectronAssociator::METElectronAssociator ( )
private

Default constructor:

Member Function Documentation

◆ acceptTrack()

bool met::METAssociator::acceptTrack ( const xAOD::TrackParticle * trk,
const xAOD::Vertex * pv ) const
protectedinherited

Definition at line 376 of file METAssociator.cxx.

377 {
378
379 if (!vx) return false;//in events with no pv, we will just reject all tracks, and therefore build only the calo MET
380 return static_cast<bool> (m_trkseltool->accept( *trk, vx ));
381 }
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkseltool

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode met::METAssociator::execute ( xAOD::MissingETContainer * metCont,
xAOD::MissingETAssociationMap * metMap ) const
overridevirtualinherited

Implements IMETAssocToolBase.

Definition at line 150 of file METAssociator.cxx.

151 {
152 ATH_MSG_DEBUG ("In execute: " << name() << "...");
153 if(!metCont) {
154 ATH_MSG_WARNING("Invalid pointer to MissingETContainer supplied! Abort.");
155 return StatusCode::FAILURE;
156 }
157
158 if(!metMap) {
159 ATH_MSG_WARNING("Invalid pointer to MissingETAssociationMap supplied! Abort.");
160 return StatusCode::FAILURE;
161 }
162 if(m_pflow && !m_useTracks ){
163 ATH_MSG_WARNING("Attempting to build PFlow MET without a track collection.");
164 return StatusCode::FAILURE;
165 }
166
167 return this->executeTool(metCont, metMap);
168 }
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode executeTool(xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const =0

◆ executeTool()

StatusCode met::METElectronAssociator::executeTool ( xAOD::MissingETContainer * metCont,
xAOD::MissingETAssociationMap * metMap ) const
finalprotectedvirtual

Implements met::METAssociator.

Definition at line 62 of file METElectronAssociator.cxx.

63 {
64 ATH_MSG_VERBOSE ("In execute: " << name() << "...");
65
66 SG::ReadHandle<xAOD::ElectronContainer> elCont(m_elContKey);
67 if (!elCont.isValid()) {
68 ATH_MSG_WARNING("Unable to retrieve input electron container " << m_elContKey.key());
69 return StatusCode::FAILURE;
70 }
71
72 ATH_MSG_DEBUG("Successfully retrieved electron collection");
73 if (fillAssocMap(metMap,elCont.cptr()).isFailure()) {
74 ATH_MSG_WARNING("Unable to fill map with electron container " << m_elContKey.key());
75 return StatusCode::FAILURE;
76 }
77
78 return StatusCode::SUCCESS;
79 }
#define ATH_MSG_VERBOSE(x)
virtual StatusCode fillAssocMap(xAOD::MissingETAssociationMap *metMap, const xAOD::IParticleContainer *hardObjs) const
SG::ReadHandleKey< xAOD::ElectronContainer > m_elContKey

◆ extractFE()

StatusCode met::METEgammaAssociator::extractFE ( const xAOD::IParticle * obj,
std::vector< const xAOD::IParticle * > & felist,
const met::METAssociator::ConstitHolder & constits,
std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > & momenta ) const
finalprotectedvirtualinherited

Implements met::METAssociator.

Definition at line 307 of file METEgammaAssociator.cxx.

311 {
312 const xAOD::Egamma *eg = static_cast<const xAOD::Egamma*>(obj);
313
314 if (m_useFELinks)
315 ATH_CHECK( extractFEsFromLinks(eg, felist,constits) );
316 else
317 ATH_CHECK( extractFEs(eg, felist, constits) );
318
319 return StatusCode::SUCCESS;
320 }
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode extractFEsFromLinks(const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits) const
StatusCode extractFEs(const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits) const
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17

◆ extractFEHR()

StatusCode met::METEgammaAssociator::extractFEHR ( const xAOD::IParticle * obj,
std::vector< const xAOD::IParticle * > hardObjs,
std::vector< const xAOD::IParticle * > & felist,
const met::METAssociator::ConstitHolder & constits,
std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > & momenta,
float & UEcorr ) const
finalprotectedvirtualinherited

Reimplemented from met::METAssociator.

Definition at line 473 of file METEgammaAssociator.cxx.

479 {
480 // Constructing association electron-FE map
482 UEcorr=0.0;
483 felist={};
484 return StatusCode::SUCCESS;
485 }
486 const xAOD::Egamma *eg = static_cast<const xAOD::Egamma*>(obj);
487
488 // Preselect charged and neutral FEs, based on proximity: dR < m_Drcone
489 for(const auto fe : *constits.feCont) {
490 if(eg && P4Helpers::isInDeltaR(*fe, *eg, m_Drcone, m_useRapidity)) {
491 if( ( !fe->isCharged() && fe->e() > FLT_MIN ) ||
492 ( fe->isCharged() && PVMatchedAcc(*fe) && ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(fe->chargedObject(0))) ) ) ) {
493 felist.push_back(fe);
494 } // quality cuts
495 } // DeltaR check
496 } // FE loop
497
498 // Step 2. Calculating Uncorrected HR and UE energy correction
499 if(eg){
500 // Vectoral sum of all FEs
501 TLorentzVector HR; // uncorrected HR (initialized with 0,0,0,0 automatically)
502 for(const auto fe_itr : *constits.feCont) {
503 if( fe_itr->pt() < 0 || fe_itr->e() < 0 ) { // sanity check
504 continue;
505 }
506
507 //remove charged FE that are not matched to the PV
508 if(fe_itr->isCharged() && !PVMatchedAcc(*fe_itr)){
509 continue;
510 }
511 HR += fe_itr->p4();
512 }
513
514 // Create a vector of egamma form hardObjs (all electrons)
515 std::vector<const xAOD::Egamma*> v_eg;
516 for(const auto& obj_i : hardObjs){
517 const xAOD::Egamma* eg_curr = static_cast<const xAOD::Egamma*>(obj_i); // current egamma object
518 v_eg.push_back( eg_curr );
519 }
520
521 // Subtruct FEs which are in the cone around egamma (gives uncorrected HR)
522 for(const auto fe_i : *constits.feCont) { // charged and neutral FEs
523 if( fe_i->pt() < 0 || fe_i->e() < 0 ) { // sanity check
524 continue;
525 }
526 //std::cout << "new eg candidate" << std::endl;
527 for(const auto& eg_i : v_eg) { // loop over v_eg
528 double dR = P4Helpers::deltaR( fe_i->eta(), fe_i->phi(), eg_i->eta(), eg_i->phi() );
529 if( dR < m_Drcone ) {
530 HR -= fe_i->p4();
531 break;
532 }
533 } // over v_eg
534 } // over FEs
535
536 // Save v_eg as a vector TLV (as commonn type for electrons and muons)
537 std::vector<TLorentzVector> v_egTLV;
538 v_egTLV.reserve(v_eg.size());
539 for(const auto& eg_i : v_eg) { // loop over v_eg
540 v_egTLV.push_back( eg_i->p4() );
541 }
542
543 // Save current eg as TLV
544 TLorentzVector egTLV = eg->p4();
545
546 // Get UE correction
547 ATH_CHECK( GetUEcorr(constits, v_egTLV, egTLV, HR, m_Drcone, m_MinDistCone, UEcorr) );
548 } // eg existance requirement
549
550 return StatusCode::SUCCESS;
551 }
bool isGoodEoverP(const xAOD::TrackParticle *trk) const
StatusCode GetUEcorr(const met::METAssociator::ConstitHolder &constits, std::vector< TLorentzVector > &v_clus, TLorentzVector &clus, TLorentzVector &HR, const float Drcone, const float MinDistCone, float &UEcorr) const
static constexpr float m_MinDistCone
static constexpr float m_Drcone
static const SG::ConstAccessor< char > PVMatchedAcc("matchedToPV")
@ Electron
The object is an electron.
Definition ObjectType.h:46
bool isInDeltaR(const xAOD::IParticle &p1, const xAOD::IParticle &p2, double dR, bool useRapidity=true)
Check if 2 xAOD::IParticle are in a cone.
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
TrackParticle_v1 TrackParticle
Reference the current persistent version:
const xAOD::FlowElementContainer * feCont

◆ extractFEs()

StatusCode met::METEgammaAssociator::extractFEs ( const xAOD::Egamma * eg,
std::vector< const xAOD::IParticle * > & felist,
const met::METAssociator::ConstitHolder & constits ) const
protectedinherited

Definition at line 387 of file METEgammaAssociator.cxx.

390 {
391 ATH_MSG_VERBOSE("Extract FEs From DeltaR for " << eg->type() << " with pT " << eg->pt());
392
393 // safe to assume a single SW cluster?
394 // will do so for now...
395 const xAOD::IParticle* swclus = eg->caloCluster();
396
397 // Preselect PFOs based on proximity: dR<0.4
398 std::vector<const xAOD::FlowElement*> nearbyFE;
399 nearbyFE.reserve(20);
400 for(const xAOD::FlowElement* fe : *constits.feCont) {
402 ATH_MSG_ERROR("Attempted to extract non-PFlow FlowElements. This is not supported!");
403 return StatusCode::FAILURE;
404 }
405 if(P4Helpers::isInDeltaR(*fe, *swclus, 0.4, m_useRapidity)) {
406 // We set a small -ve pt for cPFOs that were rejected
407 // by the ChargedHadronSubtractionTool
408 const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV");
409 if( ( !fe->isCharged() && fe->e() > FLT_MIN ) ||
410 ( fe->isCharged() && PVMatchedAcc(*fe)
411 && ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(fe->chargedObject(0))) ) )
412 ) {
413 nearbyFE.push_back(fe);
414 } // retain +ve E neutral PFOs and charged PFOs passing PV association
415 } // DeltaR check
416 } // PFO loop
417 ATH_MSG_VERBOSE("Found " << nearbyFE.size() << " nearby FlowElements (PFOs)");
418
419 std::set<const xAOD::TrackParticle*> trackset; // use a set for duplicate-free retrieval
420 ATH_CHECK( selectEgammaTracks(eg, constits.trkCont, trackset) );
421 for(const xAOD::TrackParticle* track : trackset) {
422 for(const xAOD::FlowElement* fe : nearbyFE) {
423 if(fe->isCharged() && fe->chargedObject(0) == track) {
424 felist.push_back(fe);
425 } // PFO/track match
426 } // PFO loop
427 } // Track loop
428 double eg_cl_e = swclus->e();
429
430 // the matching strategy depends on how the cluster container is sorted
431 // easier if it's sorted in descending pt order
432 // ideally this should be done using cell matching, but we can't use the links from topoclusters reliably
433 // because some PFOs don't correspond to the original TC
434 bool doSum = true;
435 double sumE_pfo = 0.;
436 const IParticle* bestbadmatch = nullptr;
437 std::sort(nearbyFE.begin(),nearbyFE.end(),greaterPtFE);
438 for(const xAOD::FlowElement* fe : nearbyFE) {
439 // Skip charged PFOs, as we already matched them
440 if(fe->isCharged() || !P4Helpers::isInDeltaR(*fe, *swclus, m_tcMatch_dR, m_useRapidity)) continue;
441 // Handle neutral PFOs like topoclusters
442 // TODO: Use EM-scale energy here in the future? No way to access from FlowElement in general.
443 double pfo_e = fe->e();
444 // skip cluster if it's above our bad match threshold or outside the matching radius
445 if(pfo_e > m_tcMatch_maxRat*eg_cl_e) {
446 ATH_MSG_VERBOSE("Reject topocluster in sum. Ratio vs eg cluster: " << (pfo_e/eg_cl_e));
447 if( !bestbadmatch || (fabs(pfo_e/eg_cl_e-1.) < fabs(bestbadmatch->e()/eg_cl_e-1.)) ) bestbadmatch = fe;
448 continue;
449 }
450
451 ATH_MSG_VERBOSE("E match with new nPFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
452 if( (doSum = fabs(sumE_pfo+pfo_e-eg_cl_e) < fabs(sumE_pfo - eg_cl_e)) ) {
453 felist.push_back(fe);
454 sumE_pfo += pfo_e;
455 ATH_MSG_VERBOSE("Accept pfo with pt " << fe->pt() << ", e " << fe->e() << " in sum.");
456 ATH_MSG_VERBOSE("Energy ratio of nPFO to eg: " << pfo_e / eg_cl_e);
457 ATH_MSG_VERBOSE("E match with new PFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
458 } // if we will retain the topocluster
459 else break;
460 } // loop over nearby clusters
461 if(sumE_pfo<FLT_MIN && bestbadmatch) {
462 ATH_MSG_VERBOSE("No better matches found -- add bad match topocluster with pt "
463 << bestbadmatch->pt() << ", e " << bestbadmatch->e() << ".");
464 felist.push_back(bestbadmatch);
465 }
466
467 return StatusCode::SUCCESS;
468 }
#define ATH_MSG_ERROR(x)
virtual double pt() const =0
transverse momentum
virtual double e() const =0
energy
static bool greaterPtFE(const xAOD::FlowElement *part1, const xAOD::FlowElement *part2)
StatusCode selectEgammaTracks(const xAOD::Egamma *el, const xAOD::TrackParticleContainer *trkCont, std::set< const xAOD::TrackParticle * > &tracklist) const
virtual double pt() const override
signal_t signalType() const
const xAOD::IParticle * chargedObject(std::size_t i) const
virtual double e() const override
The total energy of the particle.
virtual double e() const =0
The total energy of the particle.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16
const xAOD::TrackParticleContainer * trkCont

◆ extractFEsFromLinks()

StatusCode met::METEgammaAssociator::extractFEsFromLinks ( const xAOD::Egamma * eg,
std::vector< const xAOD::IParticle * > & felist,
const met::METAssociator::ConstitHolder & constits ) const
protectedinherited

Definition at line 323 of file METEgammaAssociator.cxx.

326 {
327
328 ATH_MSG_DEBUG("Extract FEs From Links for " << eg->type() << " with pT " << eg->pt());
329
330 std::vector<FELink_t> nFELinks;
331 std::vector<FELink_t> cFELinks;
332
333 if (eg->type() == xAOD::Type::Electron){
334 SG::ReadDecorHandle<xAOD::ElectronContainer, std::vector<FELink_t> > neutralFEReadDecorHandle (m_electronNeutralFEReadDecorKey);
335 SG::ReadDecorHandle<xAOD::ElectronContainer, std::vector<FELink_t> > chargedFEReadDecorHandle (m_electronChargedFEReadDecorKey);
336 nFELinks=neutralFEReadDecorHandle(*eg);
337 cFELinks=chargedFEReadDecorHandle(*eg);
338 }
339 if (eg->type() == xAOD::Type::Photon) {
340 SG::ReadDecorHandle<xAOD::PhotonContainer, std::vector<FELink_t> > neutralFEReadDecorHandle (m_photonNeutralFEReadDecorKey);
341 SG::ReadDecorHandle<xAOD::PhotonContainer, std::vector<FELink_t> > chargedFEReadDecorHandle (m_photonChargedFEReadDecorKey);
342 nFELinks=neutralFEReadDecorHandle(*eg);
343 cFELinks=chargedFEReadDecorHandle(*eg);
344 }
345
346
347 // Charged FEs
348 for (const FELink_t& feLink : cFELinks) {
349 if (!feLink.isValid()) continue;
350 const xAOD::FlowElement* fe_init = *feLink;
351 for (const auto *const fe : *constits.feCont){
352 if (fe->index() == fe_init->index() && fe->isCharged()){ //index-based match between JetETmiss and CHSFlowElements collections
353 const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV");
354 if( fe->isCharged() && PVMatchedAcc(*fe)&& ( !m_cleanChargedPFO || isGoodEoverP(static_cast<const xAOD::TrackParticle*>(fe->chargedObject(0))) ) ) {
355 ATH_MSG_DEBUG("Accept cFE with pt " << fe->pt() << ", e " << fe->e() << ", eta " << fe->eta() << ", phi " << fe->phi() );
356 felist.push_back(fe);
357 }
358 }
359 }
360 } // end cFE loop
361
362 // Neutral FEs
363 double eg_cl_e = eg->caloCluster()->e();
364 double sumE_fe = 0.;
365
366 for (const FELink_t& feLink : nFELinks) {
367 if (!feLink.isValid()) continue;
368 const xAOD::FlowElement* fe_init = *feLink;
369 for (const auto *const fe : *constits.feCont){
370 if (fe->index() == fe_init->index() && !fe->isCharged()){ //index-based match between JetETmiss and CHSFlowElements collections
371 double fe_e = fe->e();
372 if( ( !fe->isCharged()&& fe->e() > FLT_MIN ) ){
373 sumE_fe += fe_e;
374 ATH_MSG_DEBUG("E match with new nFE: " << fabs(sumE_fe+fe_e - eg_cl_e) / eg_cl_e);
375 ATH_MSG_DEBUG("Accept nFE with pt " << fe->pt() << ", e " << fe->e() << ", eta " << fe->eta() << ", phi " << fe->phi() << " in sum.");
376 ATH_MSG_DEBUG("Energy ratio of nFE to eg: " << fe_e / eg_cl_e);
377 felist.push_back(fe);
378 }
379 }
380 }
381 } // end nFE links loop
382
383
384 return StatusCode::SUCCESS;
385 }
ElementLink< xAOD::FlowElementContainer > FELink_t
size_t index() const
Return the index of this element within its container.
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photonNeutralFEReadDecorKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronChargedFEReadDecorKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronNeutralFEReadDecorKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photonChargedFEReadDecorKey
@ Photon
The object is a photon.
Definition ObjectType.h:47

◆ extractPFO()

StatusCode met::METEgammaAssociator::extractPFO ( const xAOD::IParticle * obj,
std::vector< const xAOD::IParticle * > & pfolist,
const met::METAssociator::ConstitHolder & constits,
std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > & momenta ) const
finalprotectedvirtualinherited

Implements met::METAssociator.

Definition at line 150 of file METEgammaAssociator.cxx.

154 {
155 const xAOD::Egamma *eg = static_cast<const xAOD::Egamma*>(obj);
156
157 if (m_usePFOLinks)
158 ATH_CHECK( extractPFOsFromLinks(eg, pfolist,constits) );
159 else
160 ATH_CHECK( extractPFOs(eg, pfolist, constits) );
161
162 return StatusCode::SUCCESS;
163 }
StatusCode extractPFOsFromLinks(const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits) const
StatusCode extractPFOs(const xAOD::Egamma *eg, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits) const

◆ extractPFOs()

StatusCode met::METEgammaAssociator::extractPFOs ( const xAOD::Egamma * eg,
std::vector< const xAOD::IParticle * > & pfolist,
const met::METAssociator::ConstitHolder & constits ) const
protectedinherited

Definition at line 229 of file METEgammaAssociator.cxx.

233 {
234 // safe to assume a single SW cluster?
235 // will do so for now...
236 const xAOD::IParticle* swclus = eg->caloCluster();
237 ANA_MSG_VERBOSE("Extract PFOs with DeltaR for " << eg->type() << " with pT " << eg->pt());
238
239 // Preselect PFOs based on proximity: dR<0.4
240 std::vector<const xAOD::PFO*> nearbyPFO;
241 nearbyPFO.reserve(20);
242 for(const auto *const pfo : *constits.pfoCont) {
243 if(P4Helpers::isInDeltaR(*pfo, *swclus, 0.4, m_useRapidity)) {
244 // We set a small -ve pt for cPFOs that were rejected
245 // by the ChargedHadronSubtractionTool
246 const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV");
247 if( ( !pfo->isCharged() && pfo->e() > FLT_MIN ) ||
248 ( pfo->isCharged() && PVMatchedAcc(*pfo)
249 && ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) )
250 ) {
251 nearbyPFO.push_back(pfo);
252 } // retain +ve E neutral PFOs and charged PFOs passing PV association
253 } // DeltaR check
254 } // PFO loop
255 ATH_MSG_VERBOSE("Found " << nearbyPFO.size() << " nearby pfos");
256
257 std::set<const xAOD::TrackParticle*> trackset; // use a set for duplicate-free retrieval
258 ATH_CHECK( selectEgammaTracks(eg, constits.trkCont, trackset) );
259 for(const auto& track : trackset) {
260 for(const auto& pfo : nearbyPFO) {
261 if(pfo->isCharged() && pfo->track(0) == track) {
262 pfolist.push_back(pfo);
263 } // PFO/track match
264 } // PFO loop
265 } // Track loop
266 double eg_cl_e = swclus->e();
267
268 // the matching strategy depends on how the cluster container is sorted
269 // easier if it's sorted in descending pt order
270 // ideally this should be done using cell matching, but we can't use the links from topoclusters reliably
271 // because some PFOs don't correspond to the original TC
272 bool doSum = true;
273 double sumE_pfo = 0.;
274 const IParticle* bestbadmatch = nullptr;
275 std::sort(nearbyPFO.begin(),nearbyPFO.end(),greaterPtPFO);
276 for(const auto& pfo : nearbyPFO) {
277 // Skip charged PFOs, as we already matched them
278 if(pfo->isCharged() || !P4Helpers::isInDeltaR(*pfo, *swclus, m_tcMatch_dR, m_useRapidity)) {continue;}
279 // Handle neutral PFOs like topoclusters
280 double pfo_e = pfo->eEM();
281 // skip cluster if it's above our bad match threshold or outside the matching radius
282 if(pfo_e>m_tcMatch_maxRat*eg_cl_e) {
283 ATH_MSG_VERBOSE("Reject topocluster in sum. Ratio vs eg cluster: " << (pfo_e/eg_cl_e));
284 if( !bestbadmatch || (fabs(pfo_e/eg_cl_e-1.) < fabs(bestbadmatch->e()/eg_cl_e-1.)) ) bestbadmatch = pfo;
285 continue;
286 }
287
288 ATH_MSG_VERBOSE("E match with new nPFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
289 if( (doSum = fabs(sumE_pfo+pfo_e-eg_cl_e) < fabs(sumE_pfo - eg_cl_e)) ) {
290 pfolist.push_back(pfo);
291 sumE_pfo += pfo_e;
292 ATH_MSG_VERBOSE("Accept pfo with pt " << pfo->pt() << ", e " << pfo->e() << " in sum.");
293 ATH_MSG_VERBOSE("Energy ratio of nPFO to eg: " << pfo_e / eg_cl_e);
294 ATH_MSG_VERBOSE("E match with new PFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
295 } // if we will retain the topocluster
296 else {break;}
297 } // loop over nearby clusters
298 if(sumE_pfo<FLT_MIN && bestbadmatch) {
299 ATH_MSG_VERBOSE("No better matches found -- add bad match topocluster with pt "
300 << bestbadmatch->pt() << ", e " << bestbadmatch->e() << ".");
301 pfolist.push_back(bestbadmatch);
302 }
303
304 return StatusCode::SUCCESS;
305 }
#define ANA_MSG_VERBOSE(xmsg)
Macro printing verbose messages.
static bool greaterPtPFO(const xAOD::PFO *part1, const xAOD::PFO *part2)
const xAOD::PFOContainer * pfoCont

◆ extractPFOsFromLinks()

StatusCode met::METEgammaAssociator::extractPFOsFromLinks ( const xAOD::Egamma * eg,
std::vector< const xAOD::IParticle * > & pfolist,
const met::METAssociator::ConstitHolder & constits ) const
protectedinherited

Definition at line 165 of file METEgammaAssociator.cxx.

168 {
169
170 ATH_MSG_DEBUG("Extract PFOs From Links for " << eg->type() << " with pT " << eg->pt());
171
172 std::vector<PFOLink_t> cPFOLinks;
173 std::vector<PFOLink_t> nPFOLinks;
174
175 if (eg->type() == xAOD::Type::Electron){
176 SG::ReadDecorHandle<xAOD::ElectronContainer, std::vector<PFOLink_t> > neutralPFOReadDecorHandle (m_electronNeutralPFOReadDecorKey);
177 SG::ReadDecorHandle<xAOD::ElectronContainer, std::vector<PFOLink_t> > chargedPFOReadDecorHandle (m_electronChargedPFOReadDecorKey);
178 nPFOLinks=neutralPFOReadDecorHandle(*eg);
179 cPFOLinks=chargedPFOReadDecorHandle(*eg);
180 }
181 if (eg->type() == xAOD::Type::Photon) {
182 SG::ReadDecorHandle<xAOD::PhotonContainer, std::vector<PFOLink_t> > neutralPFOReadDecorHandle (m_photonNeutralPFOReadDecorKey);
183 SG::ReadDecorHandle<xAOD::PhotonContainer, std::vector<PFOLink_t> > chargedPFOReadDecorHandle (m_photonChargedPFOReadDecorKey);
184 nPFOLinks=neutralPFOReadDecorHandle(*eg);
185 cPFOLinks=chargedPFOReadDecorHandle(*eg);
186 }
187
188
189 // Charged PFOs
190 for (const PFOLink_t& pfoLink : cPFOLinks) {
191 if (!pfoLink.isValid()) continue;
192 const xAOD::PFO* pfo_init = *pfoLink;
193 for (const auto *const pfo : *constits.pfoCont){
194 if (pfo->index() == pfo_init->index() && pfo->isCharged()){ //index-based match between JetETmiss and CHSParticleFlow collections
195 const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV");
196 if( pfo->isCharged() && PVMatchedAcc(*pfo)&& ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) {
197 ATH_MSG_DEBUG("Accept cPFO with pt " << pfo->pt() << ", e " << pfo->e() << ", eta " << pfo->eta() << ", phi " << pfo->phi() );
198 if (!m_checkUnmatched || !hasUnmatchedClusters(eg,pfo_init)) pfolist.push_back(pfo);
199 }
200 }
201 }
202 } // end cPFO loop
203
204 // Neutral PFOs
205 double eg_cl_e = eg->caloCluster()->e();
206 double sumE_pfo = 0.;
207
208 for (const PFOLink_t& pfoLink : nPFOLinks) {
209 if (!pfoLink.isValid()) continue;
210 const xAOD::PFO* pfo_init = *pfoLink;
211 for (const auto *const pfo : *constits.pfoCont){
212 if (pfo->index() == pfo_init->index() && !pfo->isCharged()){ //index-based match between JetETmiss and CHSParticleFlow collections
213 double pfo_e = pfo->eEM();
214 if( ( !pfo->isCharged()&& pfo->e() > FLT_MIN ) ){
215 sumE_pfo += pfo_e;
216 ATH_MSG_DEBUG("E match with new nPFO: " << fabs(sumE_pfo+pfo_e - eg_cl_e) / eg_cl_e);
217 ATH_MSG_DEBUG("Accept nPFO with pt " << pfo->pt() << ", e " << pfo->e() << ", eta " << pfo->eta() << ", phi " << pfo->phi() << " in sum.");
218 ATH_MSG_DEBUG("Energy ratio of nPFO to eg: " << pfo_e / eg_cl_e);
219 pfolist.push_back(pfo);
220 }
221 }
222 }
223 } // end nPFO links loop
224
225
226 return StatusCode::SUCCESS;
227 }
ElementLink< xAOD::PFOContainer > PFOLink_t
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronNeutralPFOReadDecorKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronChargedPFOReadDecorKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photonNeutralPFOReadDecorKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photonChargedPFOReadDecorKey
bool hasUnmatchedClusters(const xAOD::Egamma *eg, const xAOD::PFO *pfo) const
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17

◆ extractTopoClusters()

StatusCode met::METEgammaAssociator::extractTopoClusters ( const xAOD::IParticle * obj,
std::vector< const xAOD::IParticle * > & tclist,
const met::METAssociator::ConstitHolder & constits ) const
finalprotectedvirtualinherited

Implements met::METAssociator.

Definition at line 87 of file METEgammaAssociator.cxx.

90 {
91 const Egamma *eg = static_cast<const Egamma*>(obj);
92 // safe to assume a single SW cluster?
93 // will do so for now...
94 const CaloCluster* swclus = eg->caloCluster();
95
96 // the matching strategy depends on how the cluster container is sorted
97 // easier if it's sorted in descending pt order
98 // we'll worry about optimisation later
99 std::vector<const IParticle*> inputTC;
100 inputTC.reserve(10);
101
103 for(const auto *const cl : *constits.tcCont) {
104 // this can probably be done more elegantly
105 if(P4Helpers::isInDeltaR(*swclus,*cl,m_tcMatch_dR,m_useRapidity) && cl->e()>FLT_MIN) {
106 // could consider also requirements on the EM fraction or depth
107 inputTC.push_back(cl);
108 } // match TC in a cone around SW cluster
109 }
110 ATH_MSG_VERBOSE("Found " << inputTC.size() << " nearby topoclusters");
111 std::sort(inputTC.begin(),inputTC.end(),greaterPt);
112 } else if(m_tcMatch_method==ClusterLink) {
113 static const SG::AuxElement::ConstAccessor<std::vector<ElementLink<CaloClusterContainer> > > tcLinkAcc("constituentClusterLinks");
114 // Fill a vector of vectors
115 for(const auto& el : tcLinkAcc(*swclus)) {
116 if(el.isValid())
117 inputTC.push_back(*el);
118 else{
119 ATH_MSG_ERROR("Invalid constituentClusterLinks on input electron/photon!");
120 return StatusCode::FAILURE;
121 }
122 }
123 ATH_MSG_VERBOSE("Found " << inputTC.size() << " linked topoclusters");
124 } else {
125 ATH_MSG_WARNING( "Invalid topocluster match method configured!" );
126 return StatusCode::FAILURE;
127 }
128
129 ATH_CHECK( selectEgammaClusters(swclus, inputTC, tclist) );
130
131 return StatusCode::SUCCESS;
132 }
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
static bool greaterPt(const xAOD::IParticle *part1, const xAOD::IParticle *part2)
StatusCode selectEgammaClusters(const xAOD::CaloCluster *swclus, const std::vector< const xAOD::IParticle * > &inputTC, std::vector< const xAOD::IParticle * > &tclist) const
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
@ ClusterLink
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
const xAOD::IParticleContainer * tcCont

◆ extractTracks()

StatusCode met::METEgammaAssociator::extractTracks ( const xAOD::IParticle * obj,
std::vector< const xAOD::IParticle * > & constlist,
const met::METAssociator::ConstitHolder & constits ) const
finalprotectedvirtualinherited

Implements met::METAssociator.

Definition at line 135 of file METEgammaAssociator.cxx.

138 {
139 const xAOD::Egamma *eg = static_cast<const xAOD::Egamma*>(obj);
140 std::set<const xAOD::TrackParticle*> trackset; // use a set for duplicate-free retrieval
141 ATH_CHECK( selectEgammaTracks(eg, constits.trkCont, trackset) );
142 for(const auto& track : trackset) {
143 if(acceptTrack(track,constits.pv) && isGoodEoverP(track)) {
144 constlist.push_back(track);
145 }
146 }
147 return StatusCode::SUCCESS;
148 }
bool acceptTrack(const xAOD::TrackParticle *trk, const xAOD::Vertex *pv) const

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillAssocMap()

StatusCode met::METAssociator::fillAssocMap ( xAOD::MissingETAssociationMap * metMap,
const xAOD::IParticleContainer * hardObjs ) const
protectedvirtualinherited

Reimplemented in met::METTruthAssociator.

Definition at line 304 of file METAssociator.cxx.

306 {
307 ConstitHolder constits;
308
309 if (retrieveConstituents(constits).isFailure()) {
310 ATH_MSG_DEBUG("Unable to retrieve constituent containers");
311 return StatusCode::FAILURE;
312 }
313
314 std::vector<const IParticle*> constlist;
315 constlist.reserve(20);
316 std::vector<const IParticle*> hardObjs_tmp;
317 for(const auto *const obj : *hardObjs) {
318 hardObjs_tmp.push_back(obj);
319 }
320 std::sort(hardObjs_tmp.begin(),hardObjs_tmp.end(),greaterPt);
321
322 for(const auto& obj : hardObjs_tmp) {
323 if(obj->pt()<4e3 && obj->type()!=xAOD::Type::Muon) continue;
324 constlist.clear();
325 ATH_MSG_VERBOSE( "Object type, pt, eta, phi = " << obj->type() << ", " << obj->pt() << ", " << obj->eta() << "," << obj->phi() );
326 if(m_pflow){
327 if(!m_fecollKey.key().empty()){
328 if(!m_useTracks){
329 ATH_MSG_ERROR("Attempting to build FlowElement MET without a track collection.");
330 return StatusCode::FAILURE;
331 }
332 std::map<const IParticle*, MissingETBase::Types::constvec_t> momentumOverride;
333 if(m_recoil){ // HR part:
334 float UEcorr_Pt = 0.; // Underlying event correction for HR
335 ATH_CHECK(extractFEHR(obj,hardObjs_tmp,constlist,constits,momentumOverride, UEcorr_Pt));
336 ATH_MSG_DEBUG("Energy correction is: " << UEcorr_Pt);
337 dec_UEcorr(*obj) = UEcorr_Pt;
338 }
339 else{ // MET part:
340 ATH_CHECK( this->extractFE(obj, constlist, constits, momentumOverride) );
341 }
342 MissingETComposition::insert(metMap, obj, constlist, momentumOverride);
343 }
344 else{
345 // Old PFO EDM
346 if(!m_useTracks){
347 ATH_MSG_DEBUG("Attempting to build PFlow without a track collection.");
348 return StatusCode::FAILURE;
349 }else{
350 std::map<const IParticle*,MissingETBase::Types::constvec_t> momentumOverride;
351 ATH_CHECK( this->extractPFO(obj,constlist,constits,momentumOverride) );
352 MissingETComposition::insert(metMap,obj,constlist,momentumOverride);
353 }
354 }
355 } else {
356 std::vector<const IParticle*> tclist;
357 tclist.reserve(20);
358 ATH_CHECK( this->extractTopoClusters(obj,tclist,constits) );
360 for(const auto& cl : tclist) {
361 // use index-parallelism to identify shallow copied constituents
362 constlist.push_back((*constits.tcCont)[cl->index()]);
363 }
364 } else {
365 constlist = tclist;
366 }
367 if(m_useTracks) ATH_CHECK( this->extractTracks(obj,constlist,constits) );
368 MissingETComposition::insert(metMap,obj,constlist);
369 }
370 }
371 return StatusCode::SUCCESS;
372 }
virtual StatusCode extractFEHR(const xAOD::IParticle *, std::vector< const xAOD::IParticle * >, std::vector< const xAOD::IParticle * > &, const met::METAssociator::ConstitHolder &, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &, float &) const
virtual StatusCode extractPFO(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta) const =0
virtual StatusCode extractFE(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta) const =0
virtual StatusCode extractTopoClusters(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &tclist, const met::METAssociator::ConstitHolder &constits) const =0
virtual StatusCode extractTracks(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &constlist, const met::METAssociator::ConstitHolder &constits) const =0
Gaudi::Property< bool > m_recoil
StatusCode retrieveConstituents(met::METAssociator::ConstitHolder &constits) const
SG::ReadHandleKey< xAOD::FlowElementContainer > m_fecollKey
static const SG::Decorator< float > dec_UEcorr("UEcorr_Pt")
@ Muon
The object is a muon.
Definition ObjectType.h:48
static bool insert(MissingETComponentMap *pMap, const MissingET *pMET, const IParticle *pPart, MissingETBase::Types::weight_t weight=MissingETBase::Types::weight_t())
Insert contributing signal or physics object by pointer, with optional kinematic weight object.

◆ finalize()

StatusCode met::METEgammaAssociator::finalize ( )
inherited

Definition at line 78 of file METEgammaAssociator.cxx.

79 {
80 ATH_MSG_VERBOSE ("Finalizing " << name() << "...");
81 return StatusCode::SUCCESS;
82 }

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ GetUEcorr()

StatusCode met::METAssociator::GetUEcorr ( const met::METAssociator::ConstitHolder & constits,
std::vector< TLorentzVector > & v_clus,
TLorentzVector & clus,
TLorentzVector & HR,
const float Drcone,
const float MinDistCone,
float & UEcorr ) const
protectedinherited

Definition at line 446 of file METAssociator.cxx.

453 {
454 // 1. Get random phi
455 unsigned int seed = floor( clus.Pt() * Gaudi::Units::GeV );
456 TRandom3 hole;
457 hole.SetSeed(seed);
458
459 bool isNextToPart(true);
460 bool isNextToHR(true);
461 double phiRnd(0.);
462
463 int numOfRndTrials = 0; // Counter for trials to find random cone without overlaps
464 const int maxNumOfRndTrials = 100; // Max. number of trials to find random cone without overlaps
465
466 while(isNextToPart || isNextToHR ){
467 isNextToPart = false;
468 isNextToHR = true;
469
470 phiRnd = hole.Uniform( -std::numbers::pi, std::numbers::pi);
471 double dR = P4Helpers::deltaR( HR.Eta(), HR.Phi(), clus.Eta(), phiRnd );
472 if(dR > MinDistCone){
473 isNextToHR = false;
474 }
475
476 for(const auto& clus_j : v_clus) { // loop over leptons
477 dR = P4Helpers::deltaR( clus.Eta(), phiRnd, clus_j.Eta(), clus_j.Phi() );
478 if(dR < MinDistCone){
479 isNextToPart = true;
480 break;
481 }
482 } // swclus_j
483
484 numOfRndTrials++;
485 if(numOfRndTrials == maxNumOfRndTrials){ // check number of trials
486 UEcorr = 0.;
487 return StatusCode::SUCCESS;
488 }
489 } // while isNextToPart, isNextToHR
490
491 ATH_MSG_DEBUG("Found rnd phi: " << phiRnd);
492
493
494 // 2. Calculete UE correction
495 TLorentzVector tv_UEcorr; // TLV of UE correction (initialized with 0,0,0,0 automatically)
496 std::pair <double, double> eta_rndphi = std::make_pair(clus.Eta(), phiRnd); // pair of current cluser eta and random phi
497
498
499 // Calculate delta phi -> always the same angle so its sufficient to calculate it only once
500 float dphi_angle=P4Helpers::deltaPhi(clus.Phi(),eta_rndphi.second);
501
502 for(const auto fe_itr : *constits.feCont){ // loop over PFOs
503 if(fe_itr->pt() < 0 || fe_itr->e() < 0){ //sanity check
504 continue;
505 }
506
507 //remove charged FE that are not matched to the PV
508 const static SG::ConstAccessor<char> PVMatchedAcc("matchedToPV");
509 if(fe_itr->isCharged() && !PVMatchedAcc(*fe_itr)){
510 continue;
511 }
512
513 double dR = P4Helpers::deltaR( fe_itr->eta(), fe_itr->phi(), eta_rndphi.first, eta_rndphi.second );
514 if( dR < Drcone ){
515 // Rotate on dphi_angle
516 TLorentzVector tv_fe = fe_itr->p4();
517 tv_fe.RotateZ(dphi_angle);
518 tv_UEcorr += tv_fe; // summing PFOs of UE for correction
519 } // cone requirement
520 } // loop over PFOs
521
522 UEcorr = tv_UEcorr.Pt(); // Pt of UE correction
523
524 return StatusCode::SUCCESS;
525 }
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[

◆ greaterPt()

bool met::METAssociator::greaterPt ( const xAOD::IParticle * part1,
const xAOD::IParticle * part2 )
inlinestaticprotectedinherited

Definition at line 167 of file METAssociator.h.

167 {
168 return part1->pt()>part2->pt();
169 }
virtual double pt() const =0
The transverse momentum ( ) of the particle.

◆ greaterPtFE()

bool met::METAssociator::greaterPtFE ( const xAOD::FlowElement * part1,
const xAOD::FlowElement * part2 )
inlinestaticprotectedinherited

Definition at line 176 of file METAssociator.h.

176 {
177 if (!(part1->isCharged()) && part2->isCharged()) return false;
178 if (part1->isCharged() && !(part2->isCharged())) return true;
179 return part1->pt() > part2->pt();
180 }

◆ greaterPtPFO()

bool met::METAssociator::greaterPtPFO ( const xAOD::PFO * part1,
const xAOD::PFO * part2 )
inlinestaticprotectedinherited

Definition at line 170 of file METAssociator.h.

170 {
171 if (part1->charge()==0 && part2->charge()!=0) return false;
172 if (part1->charge()!=0 && part2->charge()==0) return true;
173 if (part1->charge()==0 && part2->charge()==0) return part1->ptEM()>part2->ptEM();
174 return part1->pt()>part2->pt();
175 }
virtual double ptEM() const
get EM scale pt
Definition PFO_v1.cxx:204
float charge() const
get charge of PFO
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition PFO_v1.cxx:52

◆ hasUnmatchedClusters()

bool met::METEgammaAssociator::hasUnmatchedClusters ( const xAOD::Egamma * eg,
const xAOD::PFO * pfo ) const
protectedinherited

Definition at line 653 of file METEgammaAssociator.cxx.

653 {
654
655 bool has_unmatched=false;
656 float totSumpt=0;
657 float unmatchedSumpt=0;
658 float unmatchedE=0;
659 float unmatchedTotEMFrac=0;
660 double emfrac=0;
661
662 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedFrac("unmatchedFrac");
663 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedFracSumpt("unmatchedFracSumpt");
664 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedFracPt("unmatchedFracPt");
665 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedFracE("unmatchedFracE");
666 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedFracEClusterPFO("unmatchedFracEClusterPFO");
667 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedFracPtClusterPFO("unmatchedFracPtClusterPFO");
668 static const SG::AuxElement::Decorator<Float_t> dec_unmatchedTotEMFrac("unmatchedTotEMFrac");
669
670 TLorentzVector totVec(0.,0.,0.,0.), unmatchedVec(0.,0.,0.,0.);
671 const std::vector<const xAOD::CaloCluster*> egClusters = xAOD::EgammaHelpers::getAssociatedTopoClusters(eg->caloCluster());
672 std::set<const xAOD::CaloCluster*> cPFOClusters;
673 int nCluscPFO = pfo->nCaloCluster();
674
675 for (int cl = 0; cl < nCluscPFO; ++cl) {
676 if (pfo->cluster(cl)) cPFOClusters.insert( pfo->cluster(cl) );
677 }
678
679 std::vector<const xAOD::CaloCluster*> unmatchedClusters;
680 for (const xAOD::CaloCluster* pfoclus : cPFOClusters) {
681 TLorentzVector tmpVec;
682 tmpVec.SetPtEtaPhiE(pfoclus->pt(),pfoclus->eta(),pfoclus->phi(),pfoclus->e());
683 totSumpt+=pfoclus->pt();
684 totVec+=tmpVec;
685 bool inEgamma = false;
686 for (const xAOD::CaloCluster* phclus : egClusters) {
687 if (pfoclus == phclus) {
688 inEgamma = true;
689 }
690 }
691 if (!inEgamma) {
692 unmatchedClusters.push_back(pfoclus);
693 unmatchedSumpt+=pfoclus->pt();
694 unmatchedE+=pfoclus->e();
695 unmatchedVec+=tmpVec;
696 pfoclus->retrieveMoment(xAOD::CaloCluster::ENG_FRAC_EM ,emfrac);
697 unmatchedTotEMFrac=unmatchedTotEMFrac+emfrac*pfoclus->e();
698 }
699
700 }
701
702 ATH_MSG_DEBUG("PFO associated to "<<nCluscPFO<< " cluster, of which " << unmatchedClusters.size() << "unmatched one and unmatched pt "<<unmatchedSumpt);
703 dec_unmatchedFrac(*pfo)=nCluscPFO>0 ? float(unmatchedClusters.size())/float(nCluscPFO) : -1;
704 dec_unmatchedFracPt(*pfo)= totVec.Pt()>0 ? float(unmatchedVec.Pt()/totVec.Pt()): -1;
705 dec_unmatchedFracSumpt(*pfo)= totSumpt>0 ? float(unmatchedSumpt/totSumpt): -1;
706 dec_unmatchedFracE(*pfo)= totVec.E()>0 ? float(unmatchedE/totVec.E()): -1;
707 dec_unmatchedTotEMFrac(*pfo)= totVec.E()>0 ? float(unmatchedTotEMFrac/totVec.E()): -1;
708 dec_unmatchedFracEClusterPFO(*pfo)= pfo->e()>0 ? float(unmatchedE/pfo->e()): -1;
709 dec_unmatchedFracPtClusterPFO(*pfo)= pfo->pt()>0 ? float(unmatchedE/pfo->pt()): -1;
710
711 return has_unmatched;
712 }
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:575
@ ENG_FRAC_EM
Energy fraction in EM calorimeters.
unsigned int nCaloCluster() const
Find out how many CaloCluster are linked.
Definition PFO_v1.cxx:659
virtual double e() const
The total energy of the particle.
Definition PFO_v1.cxx:81
const CaloCluster * cluster(unsigned int index) const
Retrieve a const pointer to a CaloCluster.
Definition PFO_v1.cxx:669
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.

◆ initialize()

StatusCode met::METElectronAssociator::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from met::METEgammaAssociator.

Definition at line 37 of file METElectronAssociator.cxx.

38 {
39 ATH_MSG_VERBOSE ("Initializing " << name() << "...");
40 ATH_CHECK( m_elContKey.initialize());
42
43 if (m_usePFOLinks) {
48 }
49 if (m_useFELinks) {
54 }
55
56 return StatusCode::SUCCESS;
57 }
std::string m_chargedFELinksKey
std::string m_neutralPFOLinksKey
std::string m_chargedPFOLinksKey
std::string m_neutralFELinksKey
StatusCode initialize()
Dummy implementation of the initialisation function.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isGoodEoverP()

bool met::METAssociator::isGoodEoverP ( const xAOD::TrackParticle * trk) const
protectedinherited

Definition at line 384 of file METAssociator.cxx.

385 {
386
387 if( (fabs(trk->eta())<1.5 && trk->pt()>m_cenTrackPtThr) ||
388 (fabs(trk->eta())>=1.5 && trk->pt()>m_forTrackPtThr) ) {
389
390 // Get relative error on qoverp
391 float Rerr = Amg::error(trk->definingParametersCovMatrix(),4)/fabs(trk->qOverP());
392 ATH_MSG_VERBOSE( "Track momentum error (%): " << Rerr*100 );
393
394 // first compute track and calo isolation variables
395 float ptcone20 = 0., isolfrac = 0., etcone10 = 0., EoverP = 0.;
396 // ptcone
397 TrackIsolation trkIsoResult;
398 std::vector<Iso::IsolationType> trkIsoCones;
399 trkIsoCones.push_back(xAOD::Iso::IsolationType::ptcone20);
400 xAOD::TrackCorrection trkIsoCorr;
402 m_trkIsolationTool->trackIsolation(trkIsoResult,
403 *trk,
404 trkIsoCones,
405 trkIsoCorr);
406 ptcone20 = !trkIsoResult.ptcones.empty() ? trkIsoResult.ptcones[0] : 0;
407 isolfrac = ptcone20/trk->pt();
408 // etcone
409 CaloIsolation caloIsoResult;
410 std::vector<Iso::IsolationType> caloIsoCones;
411 // We can't actually configure the tool to give etcone10, so instead we have to compute etcone20,
412 // applying the core cone correction.
413 // Then, we retrieve the correction value, which is etcone10, rather than the isolation value
414 caloIsoCones.push_back(xAOD::Iso::IsolationType::etcone20);
415 xAOD::CaloCorrection caloIsoCorr_coreCone;
416 caloIsoCorr_coreCone.calobitset.set(xAOD::Iso::IsolationCaloCorrection::coreCone); // this is etcone10
417 m_caloIsolationTool->caloTopoClusterIsolation(caloIsoResult,
418 *trk,
419 caloIsoCones,
420 caloIsoCorr_coreCone);
421 if(!caloIsoResult.etcones.empty()) {
422 // retrieve the correction value for the core cone
424 } else {
425 ATH_MSG_WARNING("isGoodEoverP: Failed to retrieve the isolation core correction (etcone10)! Setting etcone10=0");
426 etcone10 = 0.;
427 }
428 EoverP = etcone10/trk->pt();
430 ATH_MSG_VERBOSE( "Track isolation fraction: " << isolfrac );
431 ATH_MSG_VERBOSE( "Track E/P = " << EoverP );
432
433 if(isolfrac<0.1) {
434 // isolated track cuts
435 if(Rerr>0.4) return false;
436 else if (EoverP<0.65 && ((EoverP>0.1 && Rerr>0.05) || Rerr>0.1)) return false;
437 } else {
438 // non-isolated track cuts
439 float trkptsum = ptcone20+trk->pt();
440 if(etcone10/trkptsum<0.6 && trk->pt()/trkptsum>0.6) return false;
441 }
442 }
443 return true;
444 }
ToolHandle< xAOD::ICaloTopoClusterIsolationTool > m_caloIsolationTool
ToolHandle< xAOD::ITrackIsolationTool > m_trkIsolationTool
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float qOverP() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
@ TrackIsolation
tracker isolation (ptcone30)
@ etcone20
Calorimeter isolation.
@ ptcone20
Track isolation.
setRcore setEtHad setFside pt
Iso::IsolationCaloCorrectionBitset calobitset
Iso::IsolationTrackCorrectionBitset trackbitset

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ retrieveConstituents()

StatusCode met::METAssociator::retrieveConstituents ( met::METAssociator::ConstitHolder & constits) const
protectedinherited

Definition at line 170 of file METAssociator.cxx.

171 {
172 ATH_MSG_DEBUG ("In execute: " << name() << "...");
173 if (!m_skipconst || m_forcoll.empty()) {
174
175 SG::ReadHandle<IParticleContainer> topoclusterCont(m_clcollKey);
176 if (!topoclusterCont.isValid()) {
177 ATH_MSG_WARNING("Unable to retrieve topocluster container " << m_clcollKey.key() << " for overlap removal");
178 return StatusCode::FAILURE;
179 }
180 constits.tcCont=topoclusterCont.cptr();
181 ATH_MSG_DEBUG("Successfully retrieved topocluster collection");
182 } else {
183 std::string hybridname = "Etmiss";
184 hybridname += m_clcollKey.key();
185 hybridname += m_foreta;
186 hybridname += m_forcoll;
187
188 SG::ReadHandle<IParticleContainer> hybridCont(m_hybridContKey);
189 if( hybridCont.isValid()) {
190 constits.tcCont=hybridCont.cptr();
191 } else {
192 ATH_MSG_WARNING("Trying to do something currently unsupported- lets abort");
193 return StatusCode::FAILURE;
194 // Trying to do this using write handles (need to get some input here)
195 /*std::unique_ptr<ConstDataVector<IParticleContainer>> hybridCont = std::make_unique<ConstDataVector<IParticleContainer>>();
196 SG::WriteHandle<ConstDataVector<IParticleContainer>> hybridContHandle(hybridname);
197
198 StatusCode sc = hybridContHandle.record(std::make_unique<ConstDataVector<IParticleContainer>>(*hybridCont));
199
200 if (sc.isFailure()) {
201 ATH_MSG_WARNING("Unable to record container");
202 return StatusCode::SUCCESS;
203
204 }*/
205
206 /*SG::ReadHandle<IParticleContainer> centCont(m_clcoll);
207 if (!centCont.isValid()) {
208 ATH_MSG_WARNING("Unable to retrieve central container " << m_clcoll << " for overlap removal");
209 return StatusCode::FAILURE;
210 }
211
212 SG::ReadHandle<IParticleContainer> forCont(m_forcoll);
213 if (!forCont.isValid()) {
214 ATH_MSG_WARNING("Unable to retrieve forward container " << m_forcoll << " for overlap removal");
215 return StatusCode::FAILURE;
216 }
217 ConstDataVector<IParticleContainer> *hybridCont = new ConstDataVector<IParticleContainer>(SG::VIEW_ELEMENTS);
218
219 const IParticleContainer* centCont=0;
220 if( evtStore()->retrieve(centCont, m_clcoll).isFailure() ) {
221 ATH_MSG_WARNING("Unable to retrieve central container " << m_clcoll << " for overlap removal");
222 return StatusCode::FAILURE;
223 }
224
225 const IParticleContainer* forCont=0;
226 if( evtStore()->retrieve(forCont, m_forcoll).isFailure() ) {
227 ATH_MSG_WARNING("Unable to retrieve forward container " << m_forcoll << " for overlap removal");
228 return StatusCode::FAILURE;
229 }
230
231 for(const auto clus : *centCont) if (fabs(clus->eta())<m_foreta) hybridCont->push_back(clus);
232 for(const auto clus : *forCont) if (fabs(clus->eta())>=m_foreta) hybridCont->push_back(clus);
233 ATH_CHECK( evtStore()->record(hybridCont,hybridname));
234 constits.tcCont = hybridCont->asDataVector();
235 */
236 }
237 }
238
239 if( !m_useTracks){
240 //if you want to skip tracks, set the track collection empty manually
241 ATH_MSG_DEBUG("Skipping tracks");
242 }else{
243 SG::ReadHandle<VertexContainer> vxCont(m_pvcollKey);
244 if (!vxCont.isValid()) {
245 ATH_MSG_WARNING("Unable to retrieve primary vertex container " << m_pvcollKey.key());
246 //this is actually really bad. If it's empty that's okay
247 return StatusCode::FAILURE;
248 }
249
250 ATH_MSG_DEBUG("Successfully retrieved primary vertex container");
251 ATH_MSG_DEBUG("Container holds " << vxCont->size() << " vertices");
252
253 for(const auto *const vx : *vxCont) {
254 ATH_MSG_VERBOSE( "Testing vertex " << vx->index() );
255 if(vx->vertexType()==VxType::PriVtx)
256 {constits.pv = vx; break;}
257 }
258 if(!constits.pv) {
259 ATH_MSG_DEBUG("Failed to find primary vertex! Reject all tracks.");
260 } else {
261 ATH_MSG_VERBOSE("Primary vertex has z = " << constits.pv->z());
262 }
263
264 constits.trkCont=nullptr;
265 ATH_MSG_DEBUG("Retrieving Track collection " << m_trkcollKey.key());
266 SG::ReadHandle<TrackParticleContainer> trCont(m_trkcollKey);
267 if (!trCont.isValid()) {
268 ATH_MSG_WARNING("Unable to retrieve track particle container");
269 return StatusCode::FAILURE;
270 }
271 constits.trkCont=trCont.cptr();
272
273 if(m_pflow){
274 if(!m_fecollKey.key().empty()){
275 ATH_MSG_DEBUG("Retrieving FlowElement collection " << m_fecollKey.key());
276 constits.feCont = nullptr;
277 SG::ReadHandle<xAOD::FlowElementContainer> feCont(m_fecollKey);
278 if (!feCont.isValid()) {
279 ATH_MSG_ERROR("Unable to retrieve FlowElement container "<< m_fecollKey.key());
280 return StatusCode::FAILURE;
281 }
282 constits.feCont=feCont.cptr();
283 }
284 else{
285 ATH_MSG_DEBUG("Retrieving PFlow collection " << m_pfcollKey.key());
286 constits.pfoCont = nullptr;
287 SG::ReadHandle<PFOContainer> pfCont(m_pfcollKey);
288 if (!pfCont.isValid()) {
289 ATH_MSG_WARNING("Unable to PFlow object container");
290 return StatusCode::FAILURE;
291 }
292 constits.pfoCont=pfCont.cptr();
293 }
294 }//pflow
295 }//retrieve track/pfo containers
296
297 return StatusCode::SUCCESS;
298 }
SG::ReadHandleKey< xAOD::PFOContainer > m_pfcollKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkcollKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvcollKey
std::string m_forcoll
SG::ReadHandleKey< xAOD::IParticleContainer > m_hybridContKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_clcollKey
float z() const
Returns the z position.
@ PriVtx
Primary vertex.

◆ selectEgammaClusters()

StatusCode met::METEgammaAssociator::selectEgammaClusters ( const xAOD::CaloCluster * swclus,
const std::vector< const xAOD::IParticle * > & inputTC,
std::vector< const xAOD::IParticle * > & tclist ) const
protectedinherited

Definition at line 556 of file METEgammaAssociator.cxx.

559 {
560 double eg_cl_e = swclus->e();
561
562 bool doSum = true;
563 double sumE_tc = 0.;
564 const IParticle* bestbadmatch = nullptr;
565 for(const auto& cl : inputTC) {
566 double tcl_e = cl->e();
567 // skip cluster if it's above our bad match threshold
568 // retain pointer of the closest matching cluster in case no better is found
569 if(tcl_e>m_tcMatch_maxRat*eg_cl_e) {
570 ATH_MSG_VERBOSE("Reject topocluster in sum. Ratio vs eg cluster: " << (tcl_e/eg_cl_e));
571 if( !bestbadmatch || (fabs(tcl_e/eg_cl_e-1.) < fabs(bestbadmatch->e()/eg_cl_e-1.)) ) bestbadmatch = cl;
572 continue;
573 }
574
575 ATH_MSG_VERBOSE("E match with new cluster: " << fabs(sumE_tc+tcl_e - eg_cl_e) / eg_cl_e);
576 if( (doSum = (fabs(sumE_tc+tcl_e - eg_cl_e) < fabs(sumE_tc - eg_cl_e))) ) {
577 ATH_MSG_VERBOSE("Accept topocluster with pt " << cl->pt() << ", e " << cl->e() << " in sum.");
578 ATH_MSG_VERBOSE("Energy ratio of nPFO to eg: " << tcl_e / eg_cl_e);
579 ATH_MSG_VERBOSE("E match with new cluster: " << fabs(sumE_tc+tcl_e - eg_cl_e) / eg_cl_e);
580 tclist.push_back(cl);
581 sumE_tc += tcl_e;
582 } // if we will retain the topocluster
583 } // loop over nearby clusters
584 if(sumE_tc<FLT_MIN && bestbadmatch) {
585 ATH_MSG_VERBOSE("No better matches found -- add bad match topocluster with pt "
586 << bestbadmatch->pt() << ", e " << bestbadmatch->e() << ".");
587 tclist.push_back(bestbadmatch);
588 }
589 return StatusCode::SUCCESS;
590 }
virtual double e() const
The total energy of the particle.

◆ selectEgammaTracks()

StatusCode met::METEgammaAssociator::selectEgammaTracks ( const xAOD::Egamma * el,
const xAOD::TrackParticleContainer * trkCont,
std::set< const xAOD::TrackParticle * > & tracklist ) const
protectedinherited

Definition at line 592 of file METEgammaAssociator.cxx.

595 {
596 // switch to using egamma helpers for track extraction
597 // set ensures that there's no duplication
598 const std::set<const xAOD::TrackParticle*> egtracks = EgammaHelpers::getTrackParticles(eg);
599 for(const auto& track : egtracks) {
600 ATH_MSG_VERBOSE("Accept " << eg->type() << " track " << track << " px, py = " << track->p4().Px() << ", " << track->p4().Py());
601 tracklist.insert(track);
602 } // end initial egamma track loop
603
604 // for objects with ambiguous author, grab the tracks matched to the counterpart ambiguous object too
605 // set ensures that there's no duplication
606 if (eg->author() & xAOD::EgammaParameters::AuthorAmbiguous && eg->ambiguousObject()) {
607 const std::set<const xAOD::TrackParticle*> ambitracks = EgammaHelpers::getTrackParticles(eg->ambiguousObject());
608 for(const auto& track : egtracks) {
609 ATH_MSG_VERBOSE("Accept ambiguous " << eg->type() << " track " << track << " px, py = " << track->p4().Px() << ", " << track->p4().Py());
610 tracklist.insert(track);
611 }
612 } // end ambiguous track case
613
614 // in a small dR window, also accept tracks without an IBL hit
615 for(const auto *const track : *trkCont) {
617 // dR check should be faster than track summary retrieval
618 uint8_t expect_innermostHit(false);
619 uint8_t N_innermostHit(false);
620 uint8_t expect_nextToInnermostHit(false);
621 uint8_t N_nextToInnermostHit(false);
622 if( !track->summaryValue(expect_innermostHit, expectInnermostPixelLayerHit)
623 || !track->summaryValue(expect_nextToInnermostHit, expectNextToInnermostPixelLayerHit)) {
624 ATH_MSG_WARNING("Track summary retrieval failed for 'expect(NextTo)InnermostPixelLayerHit'");
625 return StatusCode::FAILURE;
626 }
627 if(expect_innermostHit) {
628 if( !track->summaryValue(N_innermostHit, numberOfInnermostPixelLayerHits) ) {
629 ATH_MSG_WARNING("Track summary retrieval failed for 'numberOfInnermostPixelLayerHits'");
630 return StatusCode::FAILURE;
631 if(N_innermostHit==0 ) {
632 ATH_MSG_VERBOSE("Accept nearby track w/o innermost hit");
633 tracklist.insert(track);
634 }
635 }
636 } else if(expect_nextToInnermostHit) {
637 if( !track->summaryValue(N_nextToInnermostHit, numberOfNextToInnermostPixelLayerHits) ) {
638 ATH_MSG_WARNING("Track summary retrieval failed for 'numberOfNextToInnermostPixelLayerHits'");
639 return StatusCode::FAILURE;
640 if(N_nextToInnermostHit==0 ) {
641 ATH_MSG_VERBOSE("Accept nearby track w/o next-to-innermost hit");
642 tracklist.insert(track);
643 }
644 }
645 }
646
647 } // end dR check
648 } // end extra track loop
649 return StatusCode::SUCCESS;
650 }
std::set< const xAOD::TrackParticle * > getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc=true, bool allParticles=true)
Return a list of all or only the best TrackParticle associated to the object.
const uint16_t AuthorAmbiguous
Object Reconstructed by standard cluster-based algorithm.
Definition EgammaDefs.h:32
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloIsolationTool

ToolHandle<xAOD::ICaloTopoClusterIsolationTool> met::METAssociator::m_caloIsolationTool
protectedinherited

Definition at line 87 of file METAssociator.h.

◆ m_cenTrackPtThr

double met::METAssociator::m_cenTrackPtThr
protectedinherited

Definition at line 118 of file METAssociator.h.

◆ m_chargedFELinksKey

std::string met::METAssociator::m_chargedFELinksKey
protectedinherited

Definition at line 90 of file METAssociator.h.

◆ m_chargedPFOLinksKey

std::string met::METAssociator::m_chargedPFOLinksKey
protectedinherited

Definition at line 92 of file METAssociator.h.

◆ m_checkUnmatched

bool met::METEgammaAssociator::m_checkUnmatched
protectedinherited

Definition at line 121 of file METEgammaAssociator.h.

◆ m_clcollKey

SG::ReadHandleKey<xAOD::IParticleContainer> met::METAssociator::m_clcollKey {this,"ClusColl","CaloCalTopoClusters","Topo cluster Collection"}
protectedinherited

Definition at line 97 of file METAssociator.h.

97{this,"ClusColl","CaloCalTopoClusters","Topo cluster Collection"};

◆ m_cleanChargedPFO

bool met::METAssociator::m_cleanChargedPFO
protectedinherited

Definition at line 112 of file METAssociator.h.

◆ m_Drcone

float met::METEgammaAssociator::m_Drcone = 0.2
staticconstexprprivateinherited

Definition at line 125 of file METEgammaAssociator.h.

◆ m_elContKey

SG::ReadHandleKey<xAOD::ElectronContainer> met::METElectronAssociator::m_elContKey {this, "InputCollection", "Electrons", "electrons input key"}
private

Definition at line 56 of file METElectronAssociator.h.

56{this, "InputCollection", "Electrons", "electrons input key"};

◆ m_electronChargedFEReadDecorKey

SG::ReadDecorHandleKey<xAOD::ElectronContainer> met::METEgammaAssociator::m_electronChargedFEReadDecorKey {this,"electronCargedFEReadDecorKey","", "Charged FE links key"}
protectedinherited

Definition at line 119 of file METEgammaAssociator.h.

119{this,"electronCargedFEReadDecorKey","", "Charged FE links key"};

◆ m_electronChargedPFOReadDecorKey

SG::ReadDecorHandleKey<xAOD::ElectronContainer> met::METEgammaAssociator::m_electronChargedPFOReadDecorKey {this,"electronCargedPFOReadDecorKey","", "Charged PFO links key"}
protectedinherited

Definition at line 117 of file METEgammaAssociator.h.

117{this,"electronCargedPFOReadDecorKey","", "Charged PFO links key"};

◆ m_electronNeutralFEReadDecorKey

SG::ReadDecorHandleKey<xAOD::ElectronContainer> met::METEgammaAssociator::m_electronNeutralFEReadDecorKey {this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"}
protectedinherited

Definition at line 118 of file METEgammaAssociator.h.

118{this,"electronNeutralFEReadDecorKey","", "Neutral FE links key"};

◆ m_electronNeutralPFOReadDecorKey

SG::ReadDecorHandleKey<xAOD::ElectronContainer> met::METEgammaAssociator::m_electronNeutralPFOReadDecorKey {this,"electronNeutralPFOReadDecorKey","", "Neutral PFO links key"}
protectedinherited

Definition at line 116 of file METEgammaAssociator.h.

116{this,"electronNeutralPFOReadDecorKey","", "Neutral PFO links key"};

◆ m_extraTrkMatch_dR

double met::METEgammaAssociator::m_extraTrkMatch_dR
protectedinherited

Definition at line 109 of file METEgammaAssociator.h.

◆ m_fecollKey

SG::ReadHandleKey<xAOD::FlowElementContainer> met::METAssociator::m_fecollKey {this,"FlowElementCollection","","FlowElement Collection (overrides PFO if not empty)"}
protectedinherited

Definition at line 100 of file METAssociator.h.

100{this,"FlowElementCollection","","FlowElement Collection (overrides PFO if not empty)"};

◆ m_forcoll

std::string met::METAssociator::m_forcoll
protectedinherited

Definition at line 115 of file METAssociator.h.

◆ m_foreta

double met::METAssociator::m_foreta
protectedinherited

Definition at line 116 of file METAssociator.h.

◆ m_forTrackPtThr

double met::METAssociator::m_forTrackPtThr
protectedinherited

Definition at line 119 of file METAssociator.h.

◆ m_hybridContKey

SG::ReadHandleKey<xAOD::IParticleContainer> met::METAssociator::m_hybridContKey {this,"HybridKey","","Hybrid Collection"}
protectedinherited

Definition at line 101 of file METAssociator.h.

101{this,"HybridKey","","Hybrid Collection"};

◆ m_MinDistCone

float met::METEgammaAssociator::m_MinDistCone = 0.4
staticconstexprprivateinherited

Definition at line 126 of file METEgammaAssociator.h.

◆ m_neutralFELinksKey

std::string met::METAssociator::m_neutralFELinksKey
protectedinherited

Definition at line 89 of file METAssociator.h.

◆ m_neutralPFOLinksKey

std::string met::METAssociator::m_neutralPFOLinksKey
protectedinherited

Definition at line 91 of file METAssociator.h.

◆ m_pfcollKey

SG::ReadHandleKey<xAOD::PFOContainer> met::METAssociator::m_pfcollKey {this,"PFlowColl","","PFO Collection"}
protectedinherited

Definition at line 99 of file METAssociator.h.

99{this,"PFlowColl","","PFO Collection"};

◆ m_pflow

bool met::METAssociator::m_pflow
protectedinherited

Definition at line 106 of file METAssociator.h.

◆ m_photonChargedFEReadDecorKey

SG::ReadDecorHandleKey<xAOD::PhotonContainer> met::METEgammaAssociator::m_photonChargedFEReadDecorKey {this,"photonChargedFEReadDecorKey","", "Charged FE links key"}
protectedinherited

Definition at line 114 of file METEgammaAssociator.h.

114{this,"photonChargedFEReadDecorKey","", "Charged FE links key"};

◆ m_photonChargedPFOReadDecorKey

SG::ReadDecorHandleKey<xAOD::PhotonContainer> met::METEgammaAssociator::m_photonChargedPFOReadDecorKey {this,"photonChargedPFOReadDecorKey","", "Charged PFO links key"}
protectedinherited

Definition at line 112 of file METEgammaAssociator.h.

112{this,"photonChargedPFOReadDecorKey","", "Charged PFO links key"};

◆ m_photonNeutralFEReadDecorKey

SG::ReadDecorHandleKey<xAOD::PhotonContainer> met::METEgammaAssociator::m_photonNeutralFEReadDecorKey {this,"photonNeutralFEReadDecorKey","", "Neutral FE links key"}
protectedinherited

Definition at line 113 of file METEgammaAssociator.h.

113{this,"photonNeutralFEReadDecorKey","", "Neutral FE links key"};

◆ m_photonNeutralPFOReadDecorKey

SG::ReadDecorHandleKey<xAOD::PhotonContainer> met::METEgammaAssociator::m_photonNeutralPFOReadDecorKey {this,"photonNeutralPFOReadDecorKey","", "Neutral PFO links key"}
protectedinherited

Definition at line 111 of file METEgammaAssociator.h.

111{this,"photonNeutralPFOReadDecorKey","", "Neutral PFO links key"};

◆ m_pvcollKey

SG::ReadHandleKey<xAOD::VertexContainer> met::METAssociator::m_pvcollKey {this,"PrimVxColl","PrimaryVertices","Primary Vertex Collection"}
protectedinherited

Definition at line 96 of file METAssociator.h.

96{this,"PrimVxColl","PrimaryVertices","Primary Vertex Collection"};

◆ m_recoil

Gaudi::Property<bool> met::METAssociator::m_recoil {this, "HRecoil", false, ""}
protectedinherited

Definition at line 104 of file METAssociator.h.

104{this, "HRecoil", false, ""};

◆ m_skipconst

bool met::METAssociator::m_skipconst
protectedinherited

Definition at line 114 of file METAssociator.h.

◆ m_tcMatch_dR

double met::METEgammaAssociator::m_tcMatch_dR
protectedinherited

Definition at line 105 of file METEgammaAssociator.h.

◆ m_tcMatch_maxRat

double met::METEgammaAssociator::m_tcMatch_maxRat
protectedinherited

Definition at line 106 of file METEgammaAssociator.h.

◆ m_tcMatch_method

unsigned short met::METEgammaAssociator::m_tcMatch_method
protectedinherited

Definition at line 107 of file METEgammaAssociator.h.

◆ m_trkcollKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> met::METAssociator::m_trkcollKey {this,"TrkColl","InDetTrackParticles","Track particle Collection"}
protectedinherited

Definition at line 98 of file METAssociator.h.

98{this,"TrkColl","InDetTrackParticles","Track particle Collection"};

◆ m_trkIsolationTool

ToolHandle<xAOD::ITrackIsolationTool> met::METAssociator::m_trkIsolationTool
protectedinherited

Definition at line 86 of file METAssociator.h.

◆ m_trkseltool

ToolHandle<InDet::IInDetTrackSelectionTool> met::METAssociator::m_trkseltool
protectedinherited

Definition at line 85 of file METAssociator.h.

◆ m_useFELinks

bool met::METAssociator::m_useFELinks
protectedinherited

Definition at line 94 of file METAssociator.h.

◆ m_useIsolationTools

bool met::METAssociator::m_useIsolationTools = false
protectedinherited

Definition at line 109 of file METAssociator.h.

◆ m_useModifiedClus

bool met::METAssociator::m_useModifiedClus
protectedinherited

Definition at line 110 of file METAssociator.h.

◆ m_usePFOLinks

bool met::METAssociator::m_usePFOLinks
protectedinherited

Definition at line 93 of file METAssociator.h.

◆ m_useRapidity

bool met::METAssociator::m_useRapidity
protectedinherited

Definition at line 108 of file METAssociator.h.

◆ m_useTracks

bool met::METAssociator::m_useTracks
protectedinherited

Definition at line 107 of file METAssociator.h.

◆ m_weight_charged_pfo

bool met::METAssociator::m_weight_charged_pfo = false
protectedinherited

Definition at line 111 of file METAssociator.h.


The documentation for this class was generated from the following files: