ATLAS Offline Software
Loading...
Searching...
No Matches
columnar::MetAssociationHelper< CM > Class Template Reference

a columnar version of xAOD::MissingETAssociationHelper More...

#include <MetAssociation.h>

Collaboration diagram for columnar::MetAssociationHelper< CM >:

Public Types

using PartId = ObjectId<ContainerId::particle,CM>
using JetId = ObjectId<ContainerId::jet,CM>
using AssocId = ObjectId<ContainerId::metAssociation,CM>
using OptAssocId = OptObjectId<ContainerId::metAssociation,CM>
using ObjectLinkType = MetAssocationAccessors<CM>::ObjectLinkType
using constvec_t = MissingETBase::Types::constvec_t
using ConstVec = xAOD::MissingETAssociation::ConstVec
using bitmask_t = MissingETBase::Types::bitmask_t

Public Member Functions

 MetAssociationHelper (xAOD::MissingETAssociationHelper &val_helper, const columnar::MetAssocationAccessors< CM > &val_accessors)
 MetAssociationHelper (ObjectRange< ContainerId::metAssociation, CM > map, const columnar::MetAssocationAccessors< CM > &val_accessors)
xAOD::MissingETAssociationHelpergetXAODObject () const
ObjectRange< ContainerId::metAssociation, CM > map () const noexcept
 the underlying association map
bool objSelected (const xAOD::IParticle *obj) const
template<ContainerIdConcept CI>
bool objSelected (ObjectId< CI, CM > obj) const
bool objSelected (ObjectLinkType obj) const
bool objSelected (AssocId assocId, std::size_t objIdx) const
bool objSelected (AssocId assocId, const xAOD::IParticle *pPart) const
template<ContainerIdConcept CI>
bool objSelected (AssocId assocId, ObjectId< CI, CM > pPart) const
bool objSelected (AssocId assocId, ObjectLinkType pPart) const
bitmask_t getObjSelectionFlags (AssocId assocId) const
void setObjSelectionFlag (AssocId assocId, size_t objIdx, bool status)
void setObjSelectionFlag (AssocId assocId, const xAOD::IParticle *pPart, bool status)
template<ContainerIdConcept CI>
void setObjSelectionFlag (AssocId assocId, ObjectId< CI, CM > pPart, bool status)
void setObjSelectionFlag (AssocId assocId, const ObjectLinkType &pPart, bool status)
bool hasOverlaps (AssocId assocId, size_t objIdx, MissingETBase::UsageHandler::Policy p) const
bool selectIfNoOverlaps (const xAOD::IParticle *obj, MissingETBase::UsageHandler::Policy p)
bool selectIfNoOverlaps (PartId obj, MissingETBase::UsageHandler::Policy p)
OptAssocId getJetAssociation (const xAOD::Jet *pJet) const
OptAssocId getJetAssociation (JetId pJet) const
auto getAssociations (const xAOD::IParticle *pPart) const
template<ContainerIdConcept CI>
auto getAssociations (ObjectId< CI, CM > pPart) const
auto getMiscAssociation () const
constvec_t getConstVec (const xAOD::IParticle *pPart, MissingETBase::UsageHandler::Policy p) const
constvec_t getConstVec (PartId pPart, MissingETBase::UsageHandler::Policy p) const
ConstVec overlapCalVec (AssocId assoc) const
ConstVec overlapTrkVec (AssocId assoc) const

Static Public Attributes

static constexpr bool useMissingETAssociationHelper = std::is_same_v<CM,ColumnarModeXAOD>
static constexpr std::size_t invalidIndex = MissingETBase::Constants::invalidIndex

Private Attributes

xAOD::MissingETAssociationHelperm_xaodHelper = nullptr
 the xAOD helper object, only used in xAOD mode, but its easier to define it in both modes regardless
ObjectRange< ContainerId::metAssociation, CM > m_map
 the underlying MET association map
const MetAssocationAccessors< CM > * m_accessors = nullptr
 the accessors for the members of the MET association map

Detailed Description

template<typename CM>
class columnar::MetAssociationHelper< CM >

a columnar version of xAOD::MissingETAssociationHelper

Definition at line 339 of file MetAssociation.h.

Member Typedef Documentation

◆ AssocId

template<typename CM>
using columnar::MetAssociationHelper< CM >::AssocId = ObjectId<ContainerId::metAssociation,CM>

Definition at line 347 of file MetAssociation.h.

◆ bitmask_t

template<typename CM>
using columnar::MetAssociationHelper< CM >::bitmask_t = MissingETBase::Types::bitmask_t

Definition at line 353 of file MetAssociation.h.

◆ ConstVec

template<typename CM>
using columnar::MetAssociationHelper< CM >::ConstVec = xAOD::MissingETAssociation::ConstVec

Definition at line 352 of file MetAssociation.h.

◆ constvec_t

template<typename CM>
using columnar::MetAssociationHelper< CM >::constvec_t = MissingETBase::Types::constvec_t

Definition at line 351 of file MetAssociation.h.

◆ JetId

template<typename CM>
using columnar::MetAssociationHelper< CM >::JetId = ObjectId<ContainerId::jet,CM>

Definition at line 346 of file MetAssociation.h.

◆ ObjectLinkType

template<typename CM>
using columnar::MetAssociationHelper< CM >::ObjectLinkType = MetAssocationAccessors<CM>::ObjectLinkType

Definition at line 349 of file MetAssociation.h.

◆ OptAssocId

template<typename CM>
using columnar::MetAssociationHelper< CM >::OptAssocId = OptObjectId<ContainerId::metAssociation,CM>

Definition at line 348 of file MetAssociation.h.

◆ PartId

template<typename CM>
using columnar::MetAssociationHelper< CM >::PartId = ObjectId<ContainerId::particle,CM>

Public Members

Definition at line 345 of file MetAssociation.h.

Constructor & Destructor Documentation

◆ MetAssociationHelper() [1/2]

template<typename CM>
columnar::MetAssociationHelper< CM >::MetAssociationHelper ( xAOD::MissingETAssociationHelper & val_helper,
const columnar::MetAssocationAccessors< CM > & val_accessors )
inline

Definition at line 359 of file MetAssociation.h.

361 {}
a columnar version of xAOD::MissingETAssociationHelper
ObjectRange< ContainerId::metAssociation, CM > map() const noexcept
the underlying association map
const MetAssocationAccessors< CM > * m_accessors
the accessors for the members of the MET association map
ObjectRange< ContainerId::metAssociation, CM > m_map
the underlying MET association map
xAOD::MissingETAssociationHelper * m_xaodHelper
the xAOD helper object, only used in xAOD mode, but its easier to define it in both modes regardless

◆ MetAssociationHelper() [2/2]

template<typename CM>
columnar::MetAssociationHelper< CM >::MetAssociationHelper ( ObjectRange< ContainerId::metAssociation, CM > map,
const columnar::MetAssocationAccessors< CM > & val_accessors )
inline

Definition at line 363 of file MetAssociation.h.

365 {}

Member Function Documentation

◆ getAssociations() [1/2]

template<typename CM>
auto columnar::MetAssociationHelper< CM >::getAssociations ( const xAOD::IParticle * pPart) const
inlinenodiscard

Definition at line 502 of file MetAssociation.h.

502 {
503 return getAssociations(PartId(*pPart));}
ObjectId< ContainerId::particle, CM > PartId
auto getAssociations(const xAOD::IParticle *pPart) const

◆ getAssociations() [2/2]

template<typename CM>
template<ContainerIdConcept CI>
auto columnar::MetAssociationHelper< CM >::getAssociations ( ObjectId< CI, CM > pPart) const
inlinenodiscard

Definition at line 505 of file MetAssociation.h.

505 {
506 // In the original xAOD code, this returned a `std::vector` by
507 // value. In columnar code we prefer not to pass vectors by
508 // value, so we return a filtered range instead.
509 return FilterRange (m_map.begin(), m_map.end(),
511 return (accessors->findIndex(assoc,pPart) != invalidIndex);});}
ObjectId< ContainerId::metAssociation, CM > AssocId

◆ getConstVec() [1/2]

template<typename CM>
constvec_t columnar::MetAssociationHelper< CM >::getConstVec ( const xAOD::IParticle * pPart,
MissingETBase::UsageHandler::Policy p ) const
inlinenodiscard

Other Members

Definition at line 520 of file MetAssociation.h.

520 {
521 return getConstVec(PartId(*pPart), p);}
constvec_t getConstVec(const xAOD::IParticle *pPart, MissingETBase::UsageHandler::Policy p) const

◆ getConstVec() [2/2]

template<typename CM>
constvec_t columnar::MetAssociationHelper< CM >::getConstVec ( PartId pPart,
MissingETBase::UsageHandler::Policy p ) const
inlinenodiscard

Definition at line 522 of file MetAssociation.h.

522 {
524 for (decltype(auto) assoc : getAssociations(pPart)) {
526 totalvec += m_accessors->trkVec(assoc, pPart);
527 } else {
528 totalvec += m_accessors->calVec(assoc, pPart);
529 }
530 }
531 return totalvec;}
MissingETBase::Types::constvec_t constvec_t

◆ getJetAssociation() [1/2]

template<typename CM>
OptAssocId columnar::MetAssociationHelper< CM >::getJetAssociation ( const xAOD::Jet * pJet) const
inlinenodiscard

Object Association Members

Definition at line 490 of file MetAssociation.h.

490 {
491 return getJetAssociation(JetId(*pJet));}
ObjectId< ContainerId::jet, CM > JetId
OptAssocId getJetAssociation(const xAOD::Jet *pJet) const

◆ getJetAssociation() [2/2]

template<typename CM>
OptAssocId columnar::MetAssociationHelper< CM >::getJetAssociation ( JetId pJet) const
inlinenodiscard

Definition at line 492 of file MetAssociation.h.

492 {
493 // this uses a linear search, which is the same as the original
494 // xAOD code, but was flagged there as potentially inefficient
495 for (auto assoc : m_map) {
496 if (m_accessors->jetLink(assoc) == pJet) {
497 return assoc;
498 }
499 }
500 return std::nullopt;}

◆ getMiscAssociation()

template<typename CM>
auto columnar::MetAssociationHelper< CM >::getMiscAssociation ( ) const
inlinenodiscard

Definition at line 513 of file MetAssociation.h.

513 {
514 return m_accessors->getMiscAssociation(m_map);}

◆ getObjSelectionFlags()

template<typename CM>
bitmask_t columnar::MetAssociationHelper< CM >::getObjSelectionFlags ( AssocId assocId) const
inlinenodiscard

Definition at line 409 of file MetAssociation.h.

409 {
410 if constexpr (useMissingETAssociationHelper)
411 return m_xaodHelper->getObjSelectionFlags(&assocId.getXAODObject());
412 else
413 return m_accessors->useObjectFlagsAcc(assocId);
414 }
static constexpr bool useMissingETAssociationHelper
xAOD::MissingETAssociationHelper & getXAODObject() const

◆ getXAODObject()

template<typename CM>
xAOD::MissingETAssociationHelper & columnar::MetAssociationHelper< CM >::getXAODObject ( ) const
inlinenodiscard

Definition at line 368 of file MetAssociation.h.

368 {
369 if constexpr (useMissingETAssociationHelper)
370 return *m_xaodHelper;
371 else
372 throw std::logic_error ("can't call xAOD function in columnar mode");}

◆ hasOverlaps()

template<typename CM>
bool columnar::MetAssociationHelper< CM >::hasOverlaps ( AssocId assocId,
size_t objIdx,
MissingETBase::UsageHandler::Policy p ) const
inlinenodiscard

Object Overlap Members

Definition at line 441 of file MetAssociation.h.

441 {
442 if ( objIdx == invalidIndex ) return false;
443 auto indices = m_accessors->overlapIndices(assocId, objIdx);
444 auto types = m_accessors->overlapTypes(assocId, objIdx);
445 for(size_t iOL=0; iOL<indices.size(); ++iOL) {
447 // printf("Test object %lu for overlaps: OL type %i\n",indices[iOL],(int)types[iOL]);
448 switch(p) {
451 else {continue;}
453 if(types[iOL] & 1<<xAOD::Type::CaloCluster) {break;}
454 else {continue;}
456 if(types[iOL] & 1<<xAOD::Type::TrackParticle) {break;}
457 else {continue;}
459 if(types[iOL] & 1<<xAOD::Type::ParticleFlow) {break;}
460 else {continue;}
462 if(types[iOL] & 1) {break;}
463 else {continue;}
465 if(types[iOL] & ~(1<<xAOD::Type::TrackParticle)) {break;}
466 else {continue;}
467 default: continue;
468 }
469 return true;
470 }
471 }
472 return false;
473 }
bool objSelected(const xAOD::IParticle *obj) const
static constexpr std::size_t invalidIndex

◆ map()

template<typename CM>
ObjectRange< ContainerId::metAssociation, CM > columnar::MetAssociationHelper< CM >::map ( ) const
inlinenodiscardnoexcept

the underlying association map

Definition at line 376 of file MetAssociation.h.

376 {
377 return m_map;}

◆ objSelected() [1/7]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::objSelected ( AssocId assocId,
const xAOD::IParticle * pPart ) const
inlinenodiscard

Definition at line 400 of file MetAssociation.h.

400 {
401 return objSelected(assocId, PartId(*pPart));}

◆ objSelected() [2/7]

template<typename CM>
template<ContainerIdConcept CI>
bool columnar::MetAssociationHelper< CM >::objSelected ( AssocId assocId,
ObjectId< CI, CM > pPart ) const
inlinenodiscard

Definition at line 403 of file MetAssociation.h.

403 {
404 return objSelected(assocId, m_accessors->findIndex(assocId,pPart));}

◆ objSelected() [3/7]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::objSelected ( AssocId assocId,
ObjectLinkType pPart ) const
inlinenodiscard

Definition at line 405 of file MetAssociation.h.

405 {
406 return objSelected(assocId, m_accessors->findIndex(assocId,pPart));}

◆ objSelected() [4/7]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::objSelected ( AssocId assocId,
std::size_t objIdx ) const
inlinenodiscard

Definition at line 392 of file MetAssociation.h.

392 {
393 if constexpr (useMissingETAssociationHelper)
394 return m_xaodHelper->objSelected(&assocId.getXAODObject(), objIdx);
395 else {
396 if (objIdx >= sizeof(bitmask_t)*8) return false;
397 return bool(m_accessors->useObjectFlagsAcc(assocId) & (static_cast<MissingETBase::Types::bitmask_t>(1)<<objIdx));
398 }
399 }
MissingETBase::Types::bitmask_t bitmask_t

◆ objSelected() [5/7]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::objSelected ( const xAOD::IParticle * obj) const
inlinenodiscard

Object Selection Flag Members

Definition at line 383 of file MetAssociation.h.

383 {
384 return objSelected(PartId(*obj));}

◆ objSelected() [6/7]

template<typename CM>
template<ContainerIdConcept CI>
bool columnar::MetAssociationHelper< CM >::objSelected ( ObjectId< CI, CM > obj) const
inlinenodiscard

Definition at line 386 of file MetAssociation.h.

386 {
387 for (decltype(auto) assoc : getAssociations(obj)) if(objSelected(assoc,obj)) return true;
388 return false;}

◆ objSelected() [7/7]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::objSelected ( ObjectLinkType obj) const
inlinenodiscard

Definition at line 389 of file MetAssociation.h.

389 {
390 for (decltype(auto) assoc : getAssociations(obj)) if(objSelected(assoc,obj)) return true;
391 return false;}

◆ overlapCalVec()

template<typename CM>
ConstVec columnar::MetAssociationHelper< CM >::overlapCalVec ( AssocId assoc) const
inlinenodiscard

Definition at line 533 of file MetAssociation.h.

533 {
535 for (size_t iKey = 0; iKey < m_accessors->sizeCal(assoc); iKey++) {
536 bool selector = (getObjSelectionFlags(assoc) & m_accessors->calkey(assoc)[iKey]) ? !m_accessors->isMisc(assoc) : m_accessors->isMisc(assoc);
537 if (selector) calvec+=m_accessors->calVec(assoc,iKey);
538 }
539 return calvec;}
bitmask_t getObjSelectionFlags(AssocId assocId) const

◆ overlapTrkVec()

template<typename CM>
ConstVec columnar::MetAssociationHelper< CM >::overlapTrkVec ( AssocId assoc) const
inlinenodiscard

Definition at line 541 of file MetAssociation.h.

541 {
543 for (size_t iKey = 0; iKey < m_accessors->sizeTrk(assoc); iKey++) {
544 bool selector = (getObjSelectionFlags(assoc) & m_accessors->trkkey(assoc)[iKey]) ? !m_accessors->isMisc(assoc) : m_accessors->isMisc(assoc);
546 }
547 return trkvec;
548 }
xAOD::MissingETAssociation::ConstVec ConstVec

◆ selectIfNoOverlaps() [1/2]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::selectIfNoOverlaps ( const xAOD::IParticle * obj,
MissingETBase::UsageHandler::Policy p )
inlinenodiscard

Definition at line 475 of file MetAssociation.h.

475 {
476 return selectIfNoOverlaps(PartId(*obj), p);}
bool selectIfNoOverlaps(const xAOD::IParticle *obj, MissingETBase::UsageHandler::Policy p)

◆ selectIfNoOverlaps() [2/2]

template<typename CM>
bool columnar::MetAssociationHelper< CM >::selectIfNoOverlaps ( PartId obj,
MissingETBase::UsageHandler::Policy p )
inlinenodiscard

Definition at line 477 of file MetAssociation.h.

477 {
478 auto assocs = getAssociations(obj);
479 bool overlaps(false);
480 for(decltype(auto) assoc : assocs) overlaps |= hasOverlaps(assoc,m_accessors->findIndex(assoc,obj),p);
481 if (overlaps) return false;
482 for(decltype(auto) assoc : assocs) setObjSelectionFlag(assoc,obj,true);
483 return true;}
bool hasOverlaps(AssocId assocId, size_t objIdx, MissingETBase::UsageHandler::Policy p) const
void setObjSelectionFlag(AssocId assocId, size_t objIdx, bool status)

◆ setObjSelectionFlag() [1/4]

template<typename CM>
void columnar::MetAssociationHelper< CM >::setObjSelectionFlag ( AssocId assocId,
const ObjectLinkType & pPart,
bool status )
inline

Definition at line 433 of file MetAssociation.h.

◆ setObjSelectionFlag() [2/4]

template<typename CM>
void columnar::MetAssociationHelper< CM >::setObjSelectionFlag ( AssocId assocId,
const xAOD::IParticle * pPart,
bool status )
inline

Definition at line 428 of file MetAssociation.h.

◆ setObjSelectionFlag() [3/4]

template<typename CM>
template<ContainerIdConcept CI>
void columnar::MetAssociationHelper< CM >::setObjSelectionFlag ( AssocId assocId,
ObjectId< CI, CM > pPart,
bool status )
inline

Definition at line 431 of file MetAssociation.h.

◆ setObjSelectionFlag() [4/4]

template<typename CM>
void columnar::MetAssociationHelper< CM >::setObjSelectionFlag ( AssocId assocId,
size_t objIdx,
bool status )
inline

Definition at line 417 of file MetAssociation.h.

417 {
418 if constexpr (useMissingETAssociationHelper)
419 m_xaodHelper->setObjSelectionFlag(&assocId.getXAODObject(), objIdx, status);
420 else
421 {
422 if (objIdx >= sizeof(bitmask_t)*8) return;
423 bitmask_t mask = static_cast<bitmask_t>(1) << objIdx;
424 if (status) m_accessors->useObjectFlagsAcc(assocId) |= mask;
425 else m_accessors->useObjectFlagsAcc(assocId) &= ~mask;
426 }
427 }

Member Data Documentation

◆ invalidIndex

template<typename CM>
std::size_t columnar::MetAssociationHelper< CM >::invalidIndex = MissingETBase::Constants::invalidIndex
staticconstexpr

Definition at line 356 of file MetAssociation.h.

◆ m_accessors

template<typename CM>
const MetAssocationAccessors<CM>* columnar::MetAssociationHelper< CM >::m_accessors = nullptr
private

the accessors for the members of the MET association map

Definition at line 564 of file MetAssociation.h.

◆ m_map

template<typename CM>
ObjectRange<ContainerId::metAssociation,CM> columnar::MetAssociationHelper< CM >::m_map
private

the underlying MET association map

Definition at line 561 of file MetAssociation.h.

◆ m_xaodHelper

template<typename CM>
xAOD::MissingETAssociationHelper* columnar::MetAssociationHelper< CM >::m_xaodHelper = nullptr
private

the xAOD helper object, only used in xAOD mode, but its easier to define it in both modes regardless

Private Members

Definition at line 558 of file MetAssociation.h.

◆ useMissingETAssociationHelper

template<typename CM>
bool columnar::MetAssociationHelper< CM >::useMissingETAssociationHelper = std::is_same_v<CM,ColumnarModeXAOD>
staticconstexpr

Definition at line 355 of file MetAssociation.h.


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