7#ifndef XAODJET_JETACCESSORS_H
8#define XAODJET_JETACCESSORS_H
31#include "AthLinks/ElementLink.h"
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> {
244 typedef ElementLink< ContainerType > LinkType;
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;
260 typedef InternalTypes<TYPE, std::is_base_of<IParticle, TYPE>::value>
InternalType;
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) );
304 typedef InternalVectorTypes<TYPE, std::is_base_of<IParticle, TYPE>::value>
InternalType;
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());
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]) ;
Base class for elements of a container that can have aux data.
std::vector< size_t > vec
#define TYPE(CODE, TYP, IOTYP)
Base class for elements of a container that can have aux data.
SG::Accessor< T, ALLOC > Accessor
Class providing the definition of the 4-vector interface.
TLorentzVector FourMom_t
Definition of the 4-momentum type.
void setAttribute(SG::AuxElement &p, const IParticle::FourMom_t &v) const
IParticle::FourMom_t getAttribute(const SG::AuxElement &p) const
AccessorWrapper(const std::string &name)
void getAttribute(const SG::AuxElement &p, IParticle::FourMom_t &v) const
const float & eta(const SG::AuxElement &p) const
void setAttribute(SG::AuxElement &p, const JetFourMom_t &v) const
AccessorWrapper(const std::string &name)
JetFourMom_t getAttribute(const SG::AuxElement &p) const
const float & m(const SG::AuxElement &p) const
void setPtEtaPhiM(SG::AuxElement &p, float pt, float eta, float phi, float m)
const float & pt(const SG::AuxElement &p) const
void getAttribute(const SG::AuxElement &p, JetFourMom_t &v) const
const float & phi(const SG::AuxElement &p) const
AccessorWrapper(const std::string &n)
SG::AuxElement::Accessor< float > AccessorType
bool isAvailable(const SG::AuxElement &p) const
void getAttribute(const SG::AuxElement &p, double &v) const
void setAttribute(SG::AuxElement &p, const double &v) const
double getAttribute(const SG::AuxElement &p) const
std::vector< double > getAttribute(const SG::AuxElement &p) const
bool isAvailable(const SG::AuxElement &p) const
AccessorWrapper(const std::string &n)
void setAttribute(SG::AuxElement &p, const std::vector< double > &v) const
void getAttribute(const SG::AuxElement &p, std::vector< double > &v) const
SG::AuxElement::Accessor< std::vector< float > > AccessorType
AccessorWrapper(const std::string &n)
bool isAvailable(const SG::AuxElement &p) const
SG::AuxElement::Accessor< TYPE > AccessorType
void getAttribute(const SG::AuxElement &p, TYPE &v) const
void setAttribute(SG::AuxElement &p, const TYPE &v) const
TYPE & operator()(SG::AuxElement &p) const
const TYPE & getAttribute(const SG::AuxElement &p) const
const TYPE & operator()(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)
SG::AuxElement::Accessor< float > m_p3
SG::AuxElement::Accessor< float > m_p1
bool isAvailable(const SG::AuxElement &e) const
SG::AuxElement::Accessor< float > m_p2
SG::AuxElement::Accessor< float > m_p0
void getAttribute(const SG::AuxElement &p, std::vector< const TYPE * > &v) const
InternalType::ContainerType ContainerType
void setAttribute(SG::AuxElement &p, const std::vector< const TYPE * > &vec) const
bool isAvailable(const SG::AuxElement &p) const
ObjectAccessorWrapper(const std::string &n)
InternalType::AccessorType AccessorType
void vector2vectorEL(const std::vector< const TYPE * > &vec, std::vector< LinkType > &elv) const
std::vector< const TYPE * > getAttribute(const SG::AuxElement &p) const
InternalType::LinkType LinkType
InternalVectorTypes< TYPE, std::is_base_of< IParticle, TYPE >::value > InternalType
ObjectAccessorWrapper(const std::string &n)
const TYPE * operator()(const SG::AuxElement &p) const
InternalType::AccessorType AccessorType
void setAttribute(SG::AuxElement &p, const TYPE *o) const
const TYPE * getAttribute(const SG::AuxElement &p) const
void getAttribute(const SG::AuxElement &p, const TYPE *&att) const
InternalType::LinkType LinkType
InternalType::ContainerType ContainerType
bool isAvailable(const SG::AuxElement &p) const
InternalTypes< TYPE, std::is_base_of< IParticle, TYPE >::value > InternalType
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Named(const std::string &n)
const std::string & name() const