1 // Dear emacs, this is -*- c++ -*-
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
7 // $Id: Jet_v1.h 569930 2013-11-12 14:50:19Z delsart $
9 #include "JetAccessorMap_v1.h"
12 //////////////////////////////////////////////////
16 bool Jet_v1::getAttribute(const std::string &name, T& value) const{
17 // build an accessor. AccessorWrapper is nothing more than a standard SG::AuxElement::Accessor for simpe types
18 const JetAttributeAccessor::AccessorWrapper<T> a(name);
19 if(! a.isAvailable( *this) ) { return false;}
20 a.getAttribute(*this,value);
25 T Jet_v1::getAttribute(const std::string &name) const {
26 // build an accessor. AccessorWrapper is nothing more than a standard SG::AuxElement::Accessor for simpe types
27 const JetAttributeAccessor::AccessorWrapper<T> a(name);
28 return a.getAttribute(*this);
32 bool Jet_v1::getAttribute( AttributeID type, T & value ) const {
33 // Get the moment accessor by asking the map :
34 const JetAttributeAccessor::AccessorWrapper< T >* acc = xAOD::JetAttributeAccessor::AccessorMap_v1<T>::accessor( type );
35 if( ! acc ) { return false ;}
37 // Check if the moment is available:
38 if( ! acc->isAvailable( *this ) ) return false;
40 // Retrieve the moment:
41 acc->getAttribute(*this,value);
42 //value =( *acc )( *this );
47 T Jet_v1::getAttribute(AttributeID type) const {
48 const JetAttributeAccessor::AccessorWrapper< T >* acc = xAOD::JetAttributeAccessor::AccessorMap_v1<T>::accessor( type );
49 if( ! acc ) {throw std::string("Jet_v1::getAttribute(type) with unknown type");} // need a better exception
50 return acc->getAttribute(*this);
52 //////////////////////////////////////////////////
57 //////////////////////////////////////////////////
60 void Jet_v1::setAttribute(const std::string &name, const T& v){
61 // build an accessor. AccessorWrapper is nothing more than a standard SG::AuxElement::Accessor for simpe types
62 JetAttributeAccessor::AccessorWrapper<T> a(name);
63 a.setAttribute(*this,v);
67 void Jet_v1::setAttribute( AttributeID type, const T& value ){
68 xAOD::JetAttributeAccessor::AccessorMap_v1<T>::accessor( type )->setAttribute(*this,value);
71 //////////////////////////////////////////////////
78 //////////////////////////////////////////////////
82 std::vector<const T*> Jet_v1::getAssociatedObjects( const std::string &name) const {
83 const JetAttributeAccessor::ObjectAccessorWrapper<std::vector<const T*> > a(name);
84 return a.getAttribute(*this);
88 std::vector<const T*> Jet_v1::getAssociatedObjects( AssoParticlesID type) const {
89 const JetAttributeAccessor::ObjectAccessorWrapper<std::vector<const T*> > * acc = JetAttributeAccessor::ObjectAccessorMap_v1< std::vector<const T*> >::accessor(type) ;
92 return acc->getAttribute(*this);
94 return std::vector<const T*>();
99 bool Jet_v1::getAssociatedObjects( const std::string &name, std::vector<const T*>& vec) const {
100 const JetAttributeAccessor::ObjectAccessorWrapper<std::vector<const T*> > a(name);
101 if(! a.isAvailable(*this) ) return false;
102 a.getAttribute(*this, vec );
107 bool Jet_v1::getAssociatedObjects( AssoParticlesID type, std::vector<const T*>& vec) const {
108 const JetAttributeAccessor::ObjectAccessorWrapper<std::vector<const T*> > * acc = JetAttributeAccessor::ObjectAccessorMap_v1< std::vector<const T*> >::accessor(type) ;
109 if(!acc) return false;
110 if(! acc->isAvailable(*this) ) return false;
111 acc->getAttribute(*this, vec );
117 void Jet_v1::setAssociatedObjects( const std::string &name, const std::vector<const T*>& vec) {
118 JetAttributeAccessor::ObjectAccessorWrapper<std::vector<const T*> > a(name);
119 a.setAttribute(*this, vec);
123 void Jet_v1::setAssociatedObjects( AssoParticlesID type, const std::vector<const T*>& vec) {
124 JetAttributeAccessor::ObjectAccessorWrapper<std::vector<const T*> > * acc = JetAttributeAccessor::ObjectAccessorMap_v1< std::vector<const T*> >::accessor(type) ;
125 if(acc) acc->setAttribute(*this, vec);
131 const T* Jet_v1::getAssociatedObject( const std::string &name) const {
132 const JetAttributeAccessor::ObjectAccessorWrapper< T > a(name);
133 return a.getAttribute(*this);
137 const T* Jet_v1::getAssociatedObject( AssoParticlesID type) const {
138 const JetAttributeAccessor::ObjectAccessorWrapper<T > * acc = JetAttributeAccessor::ObjectAccessorMap_v1< T >::accessor(type) ;
141 return acc->getAttribute(*this);
147 bool Jet_v1::getAssociatedObject( const std::string &name, const T*& vec) const {
148 const JetAttributeAccessor::ObjectAccessorWrapper<T > a(name);
149 if(! a.isAvailable(*this) ) return false;
150 a.getAttribute(*this, vec );
155 bool Jet_v1::getAssociatedObject( AssoParticlesID type, const T*& vec) const {
156 const JetAttributeAccessor::ObjectAccessorWrapper<T > * acc = JetAttributeAccessor::ObjectAccessorMap_v1< T >::accessor(type) ;
157 if(!acc) return false;
158 if(! acc->isAvailable(*this) ) return false;
159 acc->getAttribute(*this, vec );
164 void Jet_v1::setAssociatedObject( const std::string &name, const T* vec) {
165 JetAttributeAccessor::ObjectAccessorWrapper<T > a(name);
166 a.setAttribute(*this, vec);
170 void Jet_v1::setAssociatedObject( AssoParticlesID type, const T* vec) {
171 JetAttributeAccessor::ObjectAccessorWrapper<T > * acc = JetAttributeAccessor::ObjectAccessorMap_v1< T >::accessor(type) ;
172 if(acc) acc->setAttribute(*this, vec);