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 340 of file MetAssociation.h.

Member Typedef Documentation

◆ AssocId

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

Definition at line 348 of file MetAssociation.h.

◆ bitmask_t

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

Definition at line 354 of file MetAssociation.h.

◆ ConstVec

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

Definition at line 353 of file MetAssociation.h.

◆ constvec_t

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

Definition at line 352 of file MetAssociation.h.

◆ JetId

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

Definition at line 347 of file MetAssociation.h.

◆ ObjectLinkType

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

Definition at line 350 of file MetAssociation.h.

◆ OptAssocId

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

Definition at line 349 of file MetAssociation.h.

◆ PartId

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

Public Members

Definition at line 346 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 360 of file MetAssociation.h.

362 {}
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 364 of file MetAssociation.h.

366 {}

Member Function Documentation

◆ getAssociations() [1/2]

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

Definition at line 503 of file MetAssociation.h.

503 {
504 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 506 of file MetAssociation.h.

506 {
507 // In the original xAOD code, this returned a `std::vector` by
508 // value. In columnar code we prefer not to pass vectors by
509 // value, so we return a filtered range instead.
510 return FilterRange (m_map.begin(), m_map.end(),
512 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 521 of file MetAssociation.h.

521 {
522 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 523 of file MetAssociation.h.

523 {
525 for (decltype(auto) assoc : getAssociations(pPart)) {
527 totalvec += m_accessors->trkVec(assoc, pPart);
528 } else {
529 totalvec += m_accessors->calVec(assoc, pPart);
530 }
531 }
532 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 491 of file MetAssociation.h.

491 {
492 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 493 of file MetAssociation.h.

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

◆ getMiscAssociation()

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

Definition at line 514 of file MetAssociation.h.

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

◆ getObjSelectionFlags()

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

Definition at line 410 of file MetAssociation.h.

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

◆ getXAODObject()

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

Definition at line 369 of file MetAssociation.h.

369 {
370 if constexpr (useMissingETAssociationHelper)
371 return *m_xaodHelper;
372 else
373 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 442 of file MetAssociation.h.

442 {
443 if ( objIdx == invalidIndex ) return false;
444 auto indices = m_accessors->overlapIndices(assocId, objIdx);
445 auto types = m_accessors->overlapTypes(assocId, objIdx);
446 for(size_t iOL=0; iOL<indices.size(); ++iOL) {
448 // printf("Test object %lu for overlaps: OL type %i\n",indices[iOL],(int)types[iOL]);
449 switch(p) {
452 else {continue;}
454 if(types[iOL] & 1<<xAOD::Type::CaloCluster) {break;}
455 else {continue;}
457 if(types[iOL] & 1<<xAOD::Type::TrackParticle) {break;}
458 else {continue;}
460 if(types[iOL] & 1<<xAOD::Type::ParticleFlow) {break;}
461 else {continue;}
463 if(types[iOL] & 1) {break;}
464 else {continue;}
466 if(types[iOL] & ~(1<<xAOD::Type::TrackParticle)) {break;}
467 else {continue;}
468 default: continue;
469 }
470 return true;
471 }
472 }
473 return false;
474 }
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 377 of file MetAssociation.h.

377 {
378 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 401 of file MetAssociation.h.

401 {
402 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 404 of file MetAssociation.h.

404 {
405 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 406 of file MetAssociation.h.

406 {
407 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 393 of file MetAssociation.h.

393 {
394 if constexpr (useMissingETAssociationHelper)
395 return m_xaodHelper->objSelected(&assocId.getXAODObject(), objIdx);
396 else {
397 if (objIdx >= sizeof(bitmask_t)*8) return false;
398 return bool(m_accessors->useObjectFlagsAcc(assocId) & (static_cast<MissingETBase::Types::bitmask_t>(1)<<objIdx));
399 }
400 }
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 384 of file MetAssociation.h.

384 {
385 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 387 of file MetAssociation.h.

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

◆ objSelected() [7/7]

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

Definition at line 390 of file MetAssociation.h.

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

◆ overlapCalVec()

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

Definition at line 534 of file MetAssociation.h.

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

◆ overlapTrkVec()

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

Definition at line 542 of file MetAssociation.h.

542 {
544 for (size_t iKey = 0; iKey < m_accessors->sizeTrk(assoc); iKey++) {
545 bool selector = (getObjSelectionFlags(assoc) & m_accessors->trkkey(assoc)[iKey]) ? !m_accessors->isMisc(assoc) : m_accessors->isMisc(assoc);
547 }
548 return trkvec;
549 }
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 476 of file MetAssociation.h.

476 {
477 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 478 of file MetAssociation.h.

478 {
479 auto assocs = getAssociations(obj);
480 bool overlaps(false);
481 for(decltype(auto) assoc : assocs) overlaps |= hasOverlaps(assoc,m_accessors->findIndex(assoc,obj),p);
482 if (overlaps) return false;
483 for(decltype(auto) assoc : assocs) setObjSelectionFlag(assoc,obj,true);
484 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 434 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 429 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 432 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 418 of file MetAssociation.h.

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

Member Data Documentation

◆ invalidIndex

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

Definition at line 357 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 565 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 562 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 559 of file MetAssociation.h.

◆ useMissingETAssociationHelper

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

Definition at line 356 of file MetAssociation.h.


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