|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #ifndef XAODJET_JETACCESSORS_H
8 #define XAODJET_JETACCESSORS_H
29 #include <type_traits>
31 #include "AthLinks/ElementLink.h"
38 namespace JetAttributeAccessor {
112 m_a(
p).assign(
v.begin() ,
v.end() );
116 const std::vector<float> & vecF =
m_a(
p);
117 v.assign( vecF.begin() , vecF.end() );
233 template<
typename Obj,
bool IsIP>
234 struct InternalTypes {
238 static const Obj* fromEL(
const LinkType&
el){
if(
el.isValid())
return *
el;
return NULL;}
241 template<
typename Obj>
242 struct InternalTypes<Obj,true> {
246 static const Obj* fromEL(
const LinkType&
el){
if(
el.isValid())
return dynamic_cast<const Obj*
>(*el);
return NULL;}
249 template<
typename Obj,
bool IsIP>
250 struct InternalVectorTypes :
public InternalTypes<Obj,IsIP> {
251 typedef typename InternalTypes<Obj,IsIP>::LinkType LinkType;
269 el.toIndexedElement( *(
dynamic_cast< const ContainerType*
>( o->container() ) ), o->index() );
275 return InternalType::fromEL(
m_a(
p) );
279 att= InternalType::fromEL(
m_a(
p) );
314 for(
size_t i=0;
i<
vec.size() ;
i++) {
318 elv.back().toPersistent();
323 std::vector<LinkType> &elv =
m_a(
p); elv.clear();elv.reserve(
vec.size());
324 this->vector2vectorEL(
vec, elv);
328 const std::vector<LinkType> &elv =
m_a(
p);
329 v.resize(elv.size());
330 for(
size_t i=0;
i<elv.size();
i++) {
v[
i] = InternalType::fromEL(elv[
i]) ; }
334 const std::vector<LinkType> &elv =
m_a(
p);
335 std::vector<const TYPE*> ipvec(elv.size() );
336 for(
size_t i=0;
i<elv.size();
i++) ipvec[
i] = InternalType::fromEL(elv[
i]) ;
TYPE & operator()(SG::AuxElement &p) const
InternalType::AccessorType AccessorType
std::vector< double > getAttribute(const SG::AuxElement &p) const
SG::AuxElement::Accessor< TYPE > AccessorType
SG::AuxElement::Accessor< float > m_p0
Helper class to provide type-safe access to aux data.
InternalType::ContainerType ContainerType
AccessorWrapper(const std::string &n)
void vector2vectorEL(const std::vector< const TYPE * > &vec, std::vector< LinkType > &elv) const
void setPtEtaPhiM(SG::AuxElement &p, float pt, float eta, float phi, float m)
Base class for elements of a container that can have aux data.
void setAttribute(SG::AuxElement &p, const TYPE &v) const
const TYPE & operator()(const SG::AuxElement &p) const
IParticle::FourMom_t getAttribute(const SG::AuxElement &p) const
void setAttribute(SG::AuxElement &p, const IParticle::FourMom_t &v) const
const float & m(const SG::AuxElement &p) const
void getAttribute(const SG::AuxElement &p, TYPE &v) const
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::vector< size_t > vec
setRcore setEtHad setFside pt
InternalType::ContainerType ContainerType
Class providing the definition of the 4-vector interface.
bool isAvailable(const SG::AuxElement &p) const
const float & phi(const SG::AuxElement &p) const
void setAttribute(SG::AuxElement &p, const std::vector< double > &v) const
InternalType::LinkType LinkType
TLorentzVector FourMom_t
Definition of the 4-momentum type.
void setAttribute(SG::AuxElement &p, const double &v) const
SG::AuxElement::Accessor< float > AccessorType
void getAttribute(const SG::AuxElement &p, std::vector< const TYPE * > &v) const
const TYPE * getAttribute(const SG::AuxElement &p) const
const std::string & name() const
const TYPE & getAttribute(const SG::AuxElement &p) const
bool isAvailable(const SG::AuxElement &e) const
void setAttribute(SG::AuxElement &p, const std::vector< const TYPE * > &vec) const
double getAttribute(const SG::AuxElement &p) const
AccessorWrapper(const std::string &name)
SG::AuxElement::Accessor< float > m_p3
ElementLink implementation for ROOT usage.
void getAttribute(const SG::AuxElement &p, const TYPE *&att) const
#define TYPE(CODE, TYP, IOTYP)
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
A base class holding accessors for 4 floats of a 4-vector.
std::vector< const TYPE * > getAttribute(const SG::AuxElement &p) const
AccessorWrapper(const std::string &name)
void getAttribute(const SG::AuxElement &p, JetFourMom_t &v) const
bool isAvailable(const SG::AuxElement &p) const
InternalType::LinkType LinkType
const TYPE * operator()(const SG::AuxElement &p) const
bool isAvailable(const SG::AuxElement &p) const
ObjectAccessorWrapper(const std::string &n)
const float & eta(const SG::AuxElement &p) const
InternalVectorTypes< TYPE, std::is_base_of< IParticle, TYPE >::value > InternalType
SG::AuxElement::Accessor< float > m_p1
bool isAvailable(const SG::AuxElement &p) const
SG::AuxElement::Accessor< std::vector< float > > AccessorType
JetFourMom_t getAttribute(const SG::AuxElement &p) const
SG::AuxElement::Accessor< float > m_p2
ObjectAccessorWrapper(const std::string &n)
bool isAvailable(const SG::AuxElement &p) const
void setAttribute(SG::AuxElement &p, const JetFourMom_t &v) const
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
AccessorWrapper(const std::string &n)
const float & pt(const SG::AuxElement &p) const
FourMomAccessor(const std::string &name, const std::string &n0, const std::string &n1, const std::string &n2, const std::string &n3)
void getAttribute(const SG::AuxElement &p, std::vector< double > &v) const
InternalType::AccessorType AccessorType
void setAttribute(SG::AuxElement &p, const TYPE *o) const
void getAttribute(const SG::AuxElement &p, IParticle::FourMom_t &v) const
void getAttribute(const SG::AuxElement &p, double &v) const
InternalTypes< TYPE, std::is_base_of< IParticle, TYPE >::value > InternalType
Named(const std::string &n)
Base class for elements of a container that can have aux data.
AccessorWrapper(const std::string &n)