 |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #ifndef COLUMNAR_MET_MET_HELPERS_H
9 #define COLUMNAR_MET_MET_HELPERS_H
37 template<ContainerIdConcept CI = ContainerId::met,
typename CM=ColumnarModeDefault>
40 template<ContainerIdConcept CI>
50 return metMap.getXAODObject()[metKey];
55 auto result = metMap.getXAODObject()[metKey];
57 throw std::runtime_error (
"MET object does not have the requested term: " + metKey);
63 if (
met::fillMET(metPtr, &metMap.getXAODObject(), metKey, metSource).isFailure())
64 throw std::runtime_error (
"failed to fill MET term \"" + metKey +
"\"");
69 auto iter = metMap.getXAODObject().find (metKey);
70 if (
iter != metMap.getXAODObject().end() && *
iter !=
nullptr)
71 return StatusCode::SUCCESS;
73 if (
met::fillMET(metPtr, &metMap.getXAODObject(), metKey, metSource).isFailure())
74 return StatusCode::FAILURE;
75 return StatusCode::SUCCESS;
79 template<ContainerIdConcept CI>
105 auto hash = std::hash<std::string>()(metKey);
106 for (
auto metObj : metMap)
108 if (m_nameHashAcc(metObj) ==
hash)
110 if (m_sourceAcc(metObj) != m_nullSource)
123 throw std::runtime_error (
"MET object does not have the requested term: " + metKey);
128 auto hash = std::hash<std::string>()(metKey);
129 for (
auto metObj : metMap)
131 if (m_nameHashAcc(metObj) ==
hash)
133 if (m_sourceAcc(metObj) != m_nullSource)
134 throw std::runtime_error (
"MET object already has the requested term: " + metKey);
135 m_sourceAcc(metObj) = metSource;
139 throw std::runtime_error (
"MET object does not have the requested term pre-placed: " + metKey);
144 auto hash = std::hash<std::string>()(metKey);
145 for (
auto metObj : metMap)
147 if (m_nameHashAcc(metObj) ==
hash)
149 if (m_sourceAcc(metObj) == m_nullSource)
150 m_sourceAcc(metObj) = metSource;
151 return StatusCode::SUCCESS;
154 throw std::runtime_error (
"MET object does not have the requested term pre-placed: " + metKey);
166 template<ContainerIdConcept CI = ContainerId::met,
typename CM=ColumnarModeDefault>
174 :
mpx (columnarBase,
"mpx"),
175 mpy (columnarBase,
"mpy"),
176 sumet (columnarBase,
"sumet")
184 return std::hypot(
mpx(
object),
mpy(
object));}
186 return std::atan2(
mpy(
object),
mpx(
object));}
193 template<ContainerIdConcept CI2,
typename MomAcc>
195 this->
addParticle(
met, momAcc.px(
object), momAcc.py(
object), momAcc.pt(
object));}
196 template<ContainerIdConcept CI2>
198 mpx(
met) += momAcc.mpx(metSource);
mpy(
met) += momAcc.mpy(metSource);
sumet(
met) += momAcc.sumet(metSource);}
AccessorTemplate< CI, MissingETBase::Types::bitmask_t, CI::isMutable?ColumnAccessMode::output:ColumnAccessMode::input, CM > m_sourceAcc
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
a special accessor for the MET momentum
static constexpr ColumnAccessMode CAM
a class representing a single optional object (electron, muons, etc.)
a special "accessor" that allows to do the MET term lookup by name
uint64_t bitmask_t
Type for status word bit mask.
MapLookupAccessor(ColumnarTool< CM > &)
Class providing the definition of the 4-vector interface.
a class representing a continuous sequence of objects (a.k.a. a container)
double met(ObjectId< CI, CM > object) const
std::map< std::string, HypoJetVector >::const_iterator CI
ColumnAccessor< CI, std::size_t, CM > m_nameHashAcc
AccessorTemplate< CI, float, CAM, CM > sumet
ObjectId< CI, CM > getRequired(ObjectRange< CI, CM > metMap, const std::string &metKey) const
AccessorTemplate< CI, float, CAM, CM > mpy
::StatusCode StatusCode
StatusCode definition for legacy code.
Principal data object for Missing ET.
StatusCode tryCreateIfMissing(ObjectRange< CI, CM > metMap, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource) const
AccessorTemplate< CI, float, CAM, CM > mpx
ColumnAccessMode
an enum for the different access modes for a column
MapLookupAccessor(ColumnarTool< CM > &columnBase)
a class representing a single object (electron, muons, etc.)
double phi(ObjectId< CI, CM > object) const
ObjectId< CI > fillMET(ObjectRange< CI, CM > metMap, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource) const
void addMet(ObjectId< CI, CM > met, const MetMomentumAccessors< CI2, CM > &momAcc, ObjectId< CI2, CM > metSource) const requires(isMutable)
StatusCode tryCreateIfMissing(ObjectRange< CI, CM > metMap, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource) const
ObjectId< CI, CM > getRequired(ObjectRange< CI, CM > metMap, const std::string &metKey) const
MetMomentumAccessors(ColumnarTool< CM > &columnarBase)
StatusCode fillMET(xAOD::MissingET *&met, xAOD::MissingETContainer *metCont, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource)
static constexpr bool isMutable
the raw column accessor template class
decltype(auto) operator()(ObjectId< CI, CM > id) const noexcept
ObjectId< CI > fillMET(ObjectRange< CI, CM > metMap, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource) const
void addParticle(ObjectId< CI, CM > met, float px, float py, float pt) const requires(isMutable)
void addParticle(ObjectId< CI, CM > met, const xAOD::IParticle &particle) const requires(isMutable)