diff --git a/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx b/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..dc06bbc7dbccb3a5092fcf72c27afb6ea699a658
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx
@@ -0,0 +1,118 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaAccessors_v1.cxx 582601 2014-02-11 15:46:49Z christos $
+
+// System include(s):
+#include <iostream>
+
+// Local include(s):
+#include "EgammaAccessors_v1.h"
+
+/// Helper macro for Accessor objects
+#define DEFINE_ACCESSOR(TYPE, NAME )                               \
+   case xAOD::EgammaParameters::NAME:                              \
+   {                                                               \
+     static SG::AuxElement::Accessor< TYPE > a( #NAME );	   \
+     return &a;							   \
+   }                                                               \
+   break;
+
+namespace xAOD {
+
+  /// Explicit Instantiation  of Template
+   SG::AuxElement::Accessor< float >*
+   showerShapeAccessorV1( xAOD::EgammaParameters::ShowerShapeType type ) 
+   {   
+      switch( type ) {
+        DEFINE_ACCESSOR( float, e011 );     
+        DEFINE_ACCESSOR( float, e033 );     
+        DEFINE_ACCESSOR( float, e132 );     
+        DEFINE_ACCESSOR( float, e1152 );    
+        DEFINE_ACCESSOR( float, ethad1 );   
+        DEFINE_ACCESSOR( float, ethad );    
+        DEFINE_ACCESSOR( float, ehad1 );    
+        DEFINE_ACCESSOR( float, f1 );       
+        DEFINE_ACCESSOR( float, f3 );       
+        DEFINE_ACCESSOR( float, f1core );   
+        DEFINE_ACCESSOR( float, f3core );   
+        DEFINE_ACCESSOR( float, e233 );     
+        DEFINE_ACCESSOR( float, e235 );     
+        DEFINE_ACCESSOR( float, e255 );     
+        DEFINE_ACCESSOR( float, e237 );     
+        DEFINE_ACCESSOR( float, e277 );     
+        DEFINE_ACCESSOR( float, e333 );     
+        DEFINE_ACCESSOR( float, e335 );     
+        DEFINE_ACCESSOR( float, e337 );     
+        DEFINE_ACCESSOR( float, e377 );     
+        DEFINE_ACCESSOR( float, weta1 );    
+        DEFINE_ACCESSOR( float, weta2 );    
+        DEFINE_ACCESSOR( float, e2ts1 );    
+        DEFINE_ACCESSOR( float, e2tsts1 );  
+        DEFINE_ACCESSOR( float, fracs1 );   
+        DEFINE_ACCESSOR( float, widths1 );  
+        DEFINE_ACCESSOR( float, widths2 );  
+        DEFINE_ACCESSOR( float, poscs1 );   
+        DEFINE_ACCESSOR( float, poscs2 );   
+        DEFINE_ACCESSOR( float, asy1 );     
+        DEFINE_ACCESSOR( float, pos ); 
+        DEFINE_ACCESSOR( float, pos7 ); 
+        DEFINE_ACCESSOR( float, barys1 );   
+        DEFINE_ACCESSOR( float, wtots1 );   
+        DEFINE_ACCESSOR( float, emins1 );   
+        DEFINE_ACCESSOR( float, emaxs1 );   
+        DEFINE_ACCESSOR( float, r33over37allcalo );     
+        DEFINE_ACCESSOR( float, ecore );
+        DEFINE_ACCESSOR( float, zvertex );
+        DEFINE_ACCESSOR( float, errz );
+        DEFINE_ACCESSOR( float, etap ); 
+        DEFINE_ACCESSOR( float, depth );
+      default:                  
+         std::cerr << "xAOD::Egamma_v1 ERROR Unknown float ShowerShapeType ("
+                   << type << ") requested" << std::endl;
+         return 0;
+      }
+   
+   }  
+
+   SG::AuxElement::Accessor< float >*
+   isolationAccessorV1( xAOD::EgammaParameters::IsolationType type ) 
+   {
+      switch( type ) {
+        DEFINE_ACCESSOR( float, etcone );
+        DEFINE_ACCESSOR( float, etcone15 );
+        DEFINE_ACCESSOR( float, etcone20 );
+        DEFINE_ACCESSOR( float, etcone25 );
+        DEFINE_ACCESSOR( float, etcone30 );
+        DEFINE_ACCESSOR( float, etcone35 );
+        DEFINE_ACCESSOR( float, etcone40 );
+        DEFINE_ACCESSOR( float, ptcone20 );
+        DEFINE_ACCESSOR( float, ptcone30 );
+        DEFINE_ACCESSOR( float, ptcone40 );
+        DEFINE_ACCESSOR( float, etcone15_ptcorrected );
+        DEFINE_ACCESSOR( float, etcone20_ptcorrected );
+        DEFINE_ACCESSOR( float, etcone25_ptcorrected );
+        DEFINE_ACCESSOR( float, etcone30_ptcorrected );
+        DEFINE_ACCESSOR( float, etcone35_ptcorrected );
+        DEFINE_ACCESSOR( float, etcone40_ptcorrected );
+        DEFINE_ACCESSOR( float, etcone20_corrected );
+        DEFINE_ACCESSOR( float, etcone30_corrected );
+        DEFINE_ACCESSOR( float, etcone40_corrected );
+        DEFINE_ACCESSOR( float, topoetcone20 );
+        DEFINE_ACCESSOR( float, topoetcone30 );
+        DEFINE_ACCESSOR( float, topoetcone40 );
+        DEFINE_ACCESSOR( float, topoetcone40_ptcorrected );
+        DEFINE_ACCESSOR( float, topoetcone40_corrected );
+        DEFINE_ACCESSOR( float, nucone20 );
+        DEFINE_ACCESSOR( float, nucone30 );
+        DEFINE_ACCESSOR( float, nucone40 );
+      default:
+         std::cerr << "xAOD::Egamma_v1 ERROR Unknown float IsolationType ("
+                   << type << ") requested" << std::endl;
+         return 0;
+      }
+
+   }
+
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.h b/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..52f7bcf4c9becc1913004150cd42c142235f0018
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.h
@@ -0,0 +1,32 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaAccessors_v1.h 582601 2014-02-11 15:46:49Z christos $
+#ifndef XAOD_EGAMMAACCESSORS_V1_H
+#define XAOD_EGAMMAACCESSORS_V1_H
+
+// EDM include(s):
+#include "AthContainers/AuxElement.h"
+// Local include(s):
+#include "xAODEgamma/EgammaEnums.h"
+
+namespace xAOD {
+
+   /// Helper function for managing Egamma Accessor objects
+   ///
+   /// This function holds on to Accessor objects that can be used by each
+   /// Egamma_v1 object at runtime to get/set detail values on themselves.
+
+
+   SG::AuxElement::Accessor< float >*
+   showerShapeAccessorV1( xAOD::EgammaParameters::ShowerShapeType type );
+
+   SG::AuxElement::Accessor< float >*
+   isolationAccessorV1( xAOD::EgammaParameters::IsolationType type );
+
+} // namespace xAOD
+
+#endif // XAOD_EGAMMAACCESSORS_V1_H
diff --git a/Event/xAOD/xAODEgamma/Root/EgammaAuxContainer_v1.cxx b/Event/xAOD/xAODEgamma/Root/EgammaAuxContainer_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c497069b5241b85bbbc55abd48d0859a080befc9
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/EgammaAuxContainer_v1.cxx
@@ -0,0 +1,109 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaAuxContainer_v1.cxx 596434 2014-05-11 17:30:02Z krasznaa $
+
+// Local include(s):
+#include "xAODEgamma/versions/EgammaAuxContainer_v1.h"
+
+namespace xAOD {
+  
+  EgammaAuxContainer_v1::EgammaAuxContainer_v1()
+    : AuxContainerBase() {
+
+    ///@name links to calo clusters 
+    AUX_VARIABLE(caloClusterLinks);
+
+
+    ///@name IParticle variables
+    AUX_VARIABLE(pt);             
+    AUX_VARIABLE(eta);           
+    AUX_VARIABLE(phi); 
+    AUX_VARIABLE(m);          
+
+    ///@name Covariance Matrix
+    AUX_VARIABLE(EgammaCovarianceMatrix);
+
+    ///@name Author    
+    AUX_VARIABLE( author );
+
+    ///@name Data Quality flag
+    AUX_VARIABLE( OQ );
+    
+    ///@name Shower Shape Details
+    AUX_VARIABLE( e011 );     
+    AUX_VARIABLE( e033 );     
+    AUX_VARIABLE( e132 );     
+    AUX_VARIABLE( e1152 );    
+    AUX_VARIABLE( ethad1 );   
+    AUX_VARIABLE( ethad );    
+    AUX_VARIABLE( ehad1 );    
+    AUX_VARIABLE( f1 );       
+    AUX_VARIABLE( f3 );       
+    AUX_VARIABLE( f1core );   
+    AUX_VARIABLE( f3core );   
+    AUX_VARIABLE( e233 );     
+    AUX_VARIABLE( e235 );     
+    AUX_VARIABLE( e255 );     
+    AUX_VARIABLE( e237 );     
+    AUX_VARIABLE( e277 );     
+    AUX_VARIABLE( e333 );     
+    AUX_VARIABLE( e335 );     
+    AUX_VARIABLE( e337 );     
+    AUX_VARIABLE( e377 );     
+    AUX_VARIABLE( weta1 );    
+    AUX_VARIABLE( weta2 );    
+    AUX_VARIABLE( e2ts1 );    
+    AUX_VARIABLE( e2tsts1 );  
+    AUX_VARIABLE( fracs1 );   
+    AUX_VARIABLE( widths1 );  
+    AUX_VARIABLE( widths2 );  
+    AUX_VARIABLE( poscs1 );   
+    AUX_VARIABLE( poscs2 );   
+    AUX_VARIABLE( asy1 );     
+    AUX_VARIABLE( pos ); 
+    AUX_VARIABLE( pos7 ); 
+    AUX_VARIABLE( barys1 );   
+    AUX_VARIABLE( wtots1 );   
+    AUX_VARIABLE( emins1 );   
+    AUX_VARIABLE( emaxs1 );   
+    AUX_VARIABLE( r33over37allcalo );     
+    AUX_VARIABLE( ecore );
+    AUX_VARIABLE( zvertex );
+    AUX_VARIABLE( errz );
+    AUX_VARIABLE( etap ); 
+    AUX_VARIABLE( depth );
+
+    ///@name ISoalation Variables
+    AUX_VARIABLE( etcone );   
+    AUX_VARIABLE( etcone15 ); 
+    AUX_VARIABLE( etcone20 ); 
+    AUX_VARIABLE( etcone25 ); 
+    AUX_VARIABLE( etcone30 ); 
+    AUX_VARIABLE( etcone35 ); 
+    AUX_VARIABLE( etcone40 ); 
+    AUX_VARIABLE( ptcone20 );
+    AUX_VARIABLE( ptcone30 );
+    AUX_VARIABLE( ptcone40 );
+    AUX_VARIABLE( nucone20 );
+    AUX_VARIABLE( nucone30 );
+    AUX_VARIABLE( nucone40 );
+    AUX_VARIABLE( etcone15_ptcorrected );
+    AUX_VARIABLE( etcone20_ptcorrected );
+    AUX_VARIABLE( etcone25_ptcorrected );
+    AUX_VARIABLE( etcone30_ptcorrected );
+    AUX_VARIABLE( etcone35_ptcorrected );
+    AUX_VARIABLE( etcone40_ptcorrected );
+    AUX_VARIABLE( etcone20_corrected );
+    AUX_VARIABLE( etcone30_corrected );
+    AUX_VARIABLE( etcone40_corrected );
+    AUX_VARIABLE( topoetcone20 );
+    AUX_VARIABLE( topoetcone30 );
+    AUX_VARIABLE( topoetcone40 );
+    AUX_VARIABLE( topoetcone40_ptcorrected );
+    AUX_VARIABLE( topoetcone40_corrected );
+   
+  }
+  
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..9bbea57bd2c307963a301c5f1f04c060beb63826
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx
@@ -0,0 +1,266 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Egamma_v1$
+
+// EDM include(s):
+#include "xAODCore/AuxStoreAccessorMacros.h"
+// Local include(s):
+#include "xAODEgamma/versions/Egamma_v1.h"
+#include "EgammaAccessors_v1.h"
+
+namespace xAOD {
+
+  Egamma_v1::Egamma_v1()
+    : IParticle(), m_p4(), m_p4Cached( false ) {
+  }
+  
+  Egamma_v1::Egamma_v1(const Egamma_v1& eg) : IParticle(eg), m_p4(eg.m_p4), m_p4Cached(eg.m_p4Cached) {
+  }
+
+ Egamma_v1& Egamma_v1::operator=(const Egamma_v1& eg ){
+
+    if (this != &eg){ // protect against invalid self-assignment      
+
+      if (!this->container() && !this->hasStore() ) {      
+	  makePrivateStore();
+      }
+      this->IParticle::operator=( eg );
+      this->m_p4 = eg.m_p4;
+      this->m_p4Cached = eg.m_p4Cached;
+    }
+    // by convention, always return *this
+    return *this;
+ }
+
+
+  double Egamma_v1::pt() const {
+    static Accessor< float > acc( "pt" );
+    return acc( *this );
+  }
+  
+  double Egamma_v1::eta() const {
+    static Accessor<float > acc( "eta" );
+    return acc( *this );
+  }
+  
+  double Egamma_v1::phi() const {
+    static Accessor< float > acc( "phi" );
+    return acc( *this );
+  }
+  
+  double Egamma_v1::m() const {
+    static Accessor< float> acc( "m" );
+    return acc( *this );
+  }
+  
+  double Egamma_v1::e() const{
+    return p4().E(); 
+  }
+  
+  double Egamma_v1::rapidity() const {
+    return p4().Rapidity();	
+  }
+  
+  const Egamma_v1::FourMom_t& Egamma_v1::p4() const {
+    if( ! m_p4Cached ) {
+      m_p4.SetPtEtaPhiM( pt(), eta(), phi(),m()); 
+      m_p4Cached=true;
+    }
+    return m_p4;	
+  }
+  
+  void Egamma_v1::setP4(float pt, float eta, float phi, float m){
+    static Accessor< float > acc1( "pt" );
+    acc1( *this ) = pt;
+    static Accessor< float > acc2( "eta" );
+    acc2( *this ) = eta;
+    static Accessor< float > acc3( "phi" );
+    acc3( *this ) = phi;
+    static Accessor< float > acc4( "m" );
+    acc4( *this ) = m;
+    //Need to recalculate m_p4 if requested after update
+    m_p4Cached=false;
+  }
+  
+  void Egamma_v1::setPt(float pt){
+    static Accessor< float > acc( "pt" );
+    acc( *this ) = pt;
+    //Need to recalculate m_p4 if requested after update
+    m_p4Cached=false;
+  }
+  
+  void Egamma_v1::setEta(float eta){
+    static Accessor< float > acc( "eta" );
+    acc( *this ) = eta;
+    //Need to recalculate m_p4 if requested after update
+    m_p4Cached=false;
+  }
+
+  void Egamma_v1::setPhi(float phi){
+    static Accessor< float > acc( "phi" );
+    acc( *this ) = phi;
+    //Need to recalculate m_p4 if requested after update
+    m_p4Cached=false;
+  }
+
+  void Egamma_v1::setM(float m){
+    static Accessor< float > acc( "m" );
+    acc( *this ) = m;
+    //Need to recalculate m_p4 if requested after update
+    m_p4Cached=false;
+  }
+
+  Egamma_v1::EgammaCovMatrix_t Egamma_v1::covMatrix() const{
+    static Accessor< std::vector<float> > acc( "EgammaCovarianceMatrix" );
+    const std::vector<float>& v = acc(*this);
+    return Eigen::Map<const EgammaCovMatrix_t> (v.data());
+  }
+
+  void Egamma_v1::setCovMatrix(const Egamma_v1::EgammaCovMatrix_t& cov){
+    //The internal storage is an std::vector
+    static Accessor< std::vector < float > > acc( "EgammaCovarianceMatrix" );
+    const std::vector<float> v(cov.data(),cov.data()+16);
+    acc(*this)=v;
+  }
+  
+  uint16_t Egamma_v1::author(uint16_t mask) const {
+    static Accessor< uint16_t > acc( "author" );
+    uint16_t author = acc( *this );
+    return author & mask;
+  }
+  
+  void Egamma_v1::addAuthor(uint16_t newAuthor) {
+    static Accessor< uint16_t > acc( "author" );
+    uint16_t author = acc( *this );
+    acc( *this) = author | newAuthor;
+  }
+  
+  void Egamma_v1::setAuthor(uint16_t newAuthor) {
+    static Accessor< uint16_t > acc( "author" );
+    acc( *this) = newAuthor;
+  }
+  
+
+  
+  ///////////////
+  bool Egamma_v1::showerShapeValue(float& value, const EgammaParameters::ShowerShapeType information)  const {
+    xAOD::Egamma_v1::Accessor< float >* acc = showerShapeAccessorV1( information );
+    if( ! acc ) {
+      return false;
+    }
+    if(! acc->isAvailable( *this) ) { 
+      return  false;
+    }
+    // Retrieve the value:
+    value = ( *acc )( *this );
+    return true;
+  }
+  
+  bool Egamma_v1::setShowerShapeValue(float& value, const EgammaParameters::ShowerShapeType information){
+    xAOD::Egamma_v1::Accessor< float >* acc = showerShapeAccessorV1( information );
+     if( ! acc ) return false;
+    // Set the value:
+    ( *acc )( *this ) = value;
+    return true;
+
+  }
+   
+  
+  ///////////////
+  bool  Egamma_v1::isolationValue(float& value, const EgammaParameters::IsolationType information)  const {
+
+    xAOD::Egamma_v1::Accessor< float >* acc = isolationAccessorV1( information );
+    if( ! acc ) {
+      return false;
+    }
+    if(! acc->isAvailable( *this) ) {
+      return  false;
+    }
+    // Retrieve the value:
+    value = ( *acc )( *this );
+    return true;
+  }
+
+  bool Egamma_v1::setIsolationValue(float& value, const EgammaParameters::IsolationType information) {
+
+     xAOD::Egamma_v1::Accessor< float >* acc = isolationAccessorV1( information );
+     if( ! acc ) return false;
+     // Set the value:
+     ( *acc )( *this ) = value;
+     return true;
+
+  }
+
+
+  ////////////////////////////////////////////////////
+  /// Implementation of the CaloCluster accessor functions
+
+  size_t Egamma_v1::nCaloClusters() const {
+
+     static SG::AuxElement::Accessor< Egamma_v1::CLELVec_t >
+        clusterAcc( "caloClusterLinks" );
+
+     if( clusterAcc.isAvailable( *this ) ) {
+        return clusterAcc( *this ).size();
+     }
+     return 0;
+  }
+
+  const xAOD::CaloCluster* Egamma_v1::caloCluster( size_t index ) const {
+    
+     if( index >= nCaloClusters() ) {
+        return 0;
+     }
+     const CLELVec_t& cls = caloClusterLinks();
+     if( ! cls[ index ].isValid() ) {
+        return 0;
+     }
+     return *( cls[ index ] );
+  }
+
+  const ElementLink< CaloClusterContainer >&
+  Egamma_v1::caloClusterLink( size_t index ) const {
+
+     if( index >= nCaloClusters() ) {
+        static const ElementLink< CaloClusterContainer > dummy;
+        return dummy;
+     }
+     return caloClusterLinks()[ index ];
+  }
+
+  AUXSTORE_OBJECT_SETTER_AND_GETTER( Egamma_v1, Egamma_v1::CLELVec_t,
+                                     caloClusterLinks, setCaloClusterLinks )
+
+  ///////////
+
+  bool Egamma_v1::isGoodOQ(uint32_t mask) const {
+    static Accessor< uint32_t > acc( "OQ" );
+    uint32_t OQ = acc( *this );
+    return OQ & mask;
+  }
+  
+  void Egamma_v1::setOQ(uint32_t newOQ) {
+    static Accessor< uint32_t > acc( "OQ" );
+    acc( *this) = newOQ;
+  }
+
+  ///////////
+  bool Egamma_v1::passSelection(bool&  value, const std::string& menu ) const {
+    SG::AuxElement::Accessor< char > acc( menu );
+    if(! acc.isAvailable( *this) ) { return  false;}
+    value= (acc)( *this );
+    return true;
+  }
+
+  void Egamma_v1::setPassSelection(bool value, const std::string& menu){
+    SG::AuxElement::Accessor< char > acc( menu );
+    ( acc )( *this )=value;
+    return;
+  }
+  
+
+} // namespace xAOD
+
+//  LocalWords:  const el hasStore makePrivateStore
diff --git a/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..6c453b6881b777dec049b862cccaceb3b7f6e659
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx
@@ -0,0 +1,130 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "xAODEgamma/EgammaxAODHelpers.h"
+
+#include "xAODEgamma/Egamma.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/Photon.h"
+
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/PhotonContainer.h"
+
+
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/TrackParticle.h"
+#include "xAODCaloEvent/CaloCluster.h"
+
+bool xAOD::EgammaHelpers::isElectron(const xAOD::Egamma *eg){
+  return ( (eg->type()==xAOD::Type::Electron) && 
+	   (!eg->author(xAOD::EgammaParameters::AuthorFwdElectron)));
+}
+
+
+bool xAOD::EgammaHelpers::isFwdElectron(const xAOD::Egamma *eg){
+  return eg->author(xAOD::EgammaParameters::AuthorFwdElectron);
+}
+
+bool xAOD::EgammaHelpers::isPhoton(const xAOD::Egamma *eg){
+  return (eg->type()==xAOD::Type::Photon);
+}
+
+bool xAOD::EgammaHelpers::isConvertedPhoton(const xAOD::Egamma *eg){
+  const xAOD::Photon *ph = dynamic_cast<const xAOD::Photon*>(eg);
+  return (ph && (ph->nVertices()>0) );
+}
+
+// ==================================================================
+size_t xAOD::EgammaHelpers::numberOfSiHits(const xAOD::TrackParticle *tp)
+{
+  if (!tp) return 0;
+  
+  uint8_t dummy(0), nSiHits(0);
+  if (tp->summaryValue(dummy, xAOD::numberOfPixelHits))
+    nSiHits += dummy;
+  if (tp->summaryValue(dummy, xAOD::numberOfSCTHits))
+    nSiHits += dummy;
+  return nSiHits;
+}  
+
+// ==================================================================
+bool xAOD::EgammaHelpers::isBarrel(const xAOD::Egamma *eg)
+{
+  return (eg ? isBarrel(eg->caloCluster()) : false);
+}
+
+bool xAOD::EgammaHelpers::isBarrel(const xAOD::CaloCluster *cluster)
+{
+  if (cluster->inBarrel() &&  cluster->inEndcap()){
+    return  cluster->eSample(CaloSampling::EMB2) >= cluster->eSample(CaloSampling::EME2);
+  }
+  return cluster->inBarrel();
+}
+
+// ==================================================================
+const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Egamma *eg, 
+  bool useBremAssoc /* = true */, bool allParticles /* = true */)
+{  
+  if (!eg) return std::set<const xAOD::TrackParticle*>();
+
+  if (eg->type()==xAOD::Type::Electron) {
+    const xAOD::Electron* el = static_cast<const xAOD::Electron*> (eg);
+    if (el) return getTrackParticles(el, useBremAssoc, allParticles);
+  }
+  if (eg->type()==xAOD::Type::Photon) {
+    const xAOD::Photon* ph = static_cast<const xAOD::Photon*> (eg);  
+    if (ph) return getTrackParticles(ph, useBremAssoc);
+  }
+
+  std::cerr << "egamma object not electron nor photon" << std::endl;
+  return std::set<const xAOD::TrackParticle*>();
+}
+
+// ==================================================================
+const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Electron* el, 
+  bool useBremAssoc /* = true */, bool allParticles /* = true */)
+{
+  std::set<const xAOD::TrackParticle*> tps;
+  for (unsigned int i = 0; i < el->nTrackParticles(); ++i)
+  {
+    const xAOD::TrackParticle* tp = el->trackParticle(i);
+    if (useBremAssoc) tp = xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(tp);
+    if (tp) tps.insert( tp );
+    if (!allParticles) break; // break after first particle
+  }
+  return tps;
+}
+
+// ==================================================================
+const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Photon* ph,
+  bool useBremAssoc /* = true */)
+{
+  std::set<const xAOD::TrackParticle*> tps;
+  if (!ph) return tps;
+  const xAOD::Vertex* vx = ph->vertex();
+  for (unsigned int i=0; vx && i < vx->nTrackParticles(); ++i)
+  {
+    const xAOD::TrackParticle *tp = vx->trackParticle(i);
+    tps.insert( useBremAssoc ? xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(tp) : tp );
+  }
+  return tps;
+}
+
+// ==================================================================
+
+const xAOD::TruthParticle* xAOD::EgammaHelpers::getTruthParticle(const xAOD::IParticle* particle, bool debug)
+{
+  return getLink<xAOD::TruthParticle>(particle, "truthParticleLink", debug);
+}
+
+const xAOD::Electron* xAOD::EgammaHelpers::getRecoElectron(const xAOD::TruthParticle* particle, bool debug)
+{
+  return getLink<xAOD::Electron>(particle, "recoElectronLink", debug);
+}
+
+const xAOD::Photon* xAOD::EgammaHelpers::getRecoPhoton(const xAOD::TruthParticle* particle, bool debug)
+{
+  return getLink<xAOD::Photon>(particle, "recoPhotonLink", debug);
+}
+
diff --git a/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx b/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..1db29d36c2a609306c531cc3ba008b66166b60c7
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx
@@ -0,0 +1,48 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAccessors_v1.cxx 575466 2013-12-13 16:40:29Z amorley $
+
+// System include(s):
+#include <iostream>
+
+// Local include(s):
+#include "ElectronAccessors_v1.h"
+
+/// Helper macro for Accessor objects
+#define DEFINE_ACCESSOR(TYPE, NAME )                               \
+  case xAOD::EgammaParameters::NAME:				   \
+   {                                                               \
+     static SG::AuxElement::Accessor< TYPE > a( #NAME );	   \
+     return &a;							   \
+   }                                                               \
+   break;
+
+namespace xAOD {
+
+   SG::AuxElement::Accessor< float >*
+   trackCaloMatchAccessorV1( xAOD::EgammaParameters::TrackCaloMatchType type ) 
+   {   
+      switch( type ) {
+        DEFINE_ACCESSOR( float,deltaEta0);
+        DEFINE_ACCESSOR( float,deltaEta1);
+        DEFINE_ACCESSOR( float,deltaEta2);
+        DEFINE_ACCESSOR( float,deltaEta3);
+        DEFINE_ACCESSOR( float,deltaPhi0);
+        DEFINE_ACCESSOR( float,deltaPhi1);
+        DEFINE_ACCESSOR( float,deltaPhi2);
+        DEFINE_ACCESSOR( float,deltaPhi3);
+        DEFINE_ACCESSOR( float,deltaPhiFromLastMeasurement);
+        DEFINE_ACCESSOR( float,deltaPhiRescaled0);
+        DEFINE_ACCESSOR( float,deltaPhiRescaled1);
+        DEFINE_ACCESSOR( float,deltaPhiRescaled2);
+        DEFINE_ACCESSOR( float,deltaPhiRescaled3);;
+      default:                  
+         std::cerr << "xAOD::Electron_v1 ERROR Unknown float TrackCaloMatchType ("
+                   << type << ") requested" << std::endl;
+         return 0;
+      }
+   
+   }     
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.h b/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..702dc303ec267a50262ad230f2646946b5acdaa7
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.h
@@ -0,0 +1,29 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAccessors_v1.h 575464 2013-12-13 16:28:44Z christos $
+#ifndef XAOD_ELECTRONACCESSORS_V1_H
+#define XAOD_ELECTRONACCESSORS_V1_H
+
+// EDM include(s):
+#include "AthContainers/AuxElement.h"
+// Local include(s):
+#include "xAODEgamma/EgammaEnums.h"
+
+namespace xAOD {
+
+   /// Helper function for managing Egamma Accessor objects
+   ///
+   /// This function holds on to Accessor objects that can be used by each
+   /// Electron_v1 object at runtime to get/set detail values on themselves.
+
+   SG::AuxElement::Accessor< float >*
+   trackCaloMatchAccessorV1( xAOD::EgammaParameters::TrackCaloMatchType type );
+
+
+} // namespace xAOD
+
+#endif // XAOD_ELECTRONACCESSORS_V1_H
diff --git a/Event/xAOD/xAODEgamma/Root/ElectronAuxContainer_v1.cxx b/Event/xAOD/xAODEgamma/Root/ElectronAuxContainer_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..4d63a22804b16c58b52e258576306dac7bfa08f6
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/ElectronAuxContainer_v1.cxx
@@ -0,0 +1,47 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAuxContainer_v1.cxx 597503 2014-05-16 16:34:05Z christos $
+
+// Local include(s):
+#include "xAODEgamma/versions/ElectronAuxContainer_v1.h"
+
+
+namespace xAOD {
+  
+  ElectronAuxContainer_v1::ElectronAuxContainer_v1()
+    : EgammaAuxContainer_v1() {
+
+
+    ///@links to track Particles
+    AUX_VARIABLE(trackParticleLinks);
+
+    ///@name Electron Charge
+    ///@{
+    AUX_VARIABLE(charge);
+    ///@}
+
+    /// @name Track Match details
+    /// @{
+    AUX_VARIABLE(deltaEta0);
+    AUX_VARIABLE(deltaEta1);
+    AUX_VARIABLE(deltaEta2);
+    AUX_VARIABLE(deltaEta3);
+    AUX_VARIABLE(deltaPhi0);
+    AUX_VARIABLE(deltaPhi1);
+    AUX_VARIABLE(deltaPhi2);
+    AUX_VARIABLE(deltaPhi3);
+    AUX_VARIABLE(deltaPhiRescaled0);
+    AUX_VARIABLE(deltaPhiRescaled1);
+    AUX_VARIABLE(deltaPhiRescaled2);
+    AUX_VARIABLE(deltaPhiRescaled3);
+    AUX_VARIABLE(deltaPhiFromLastMeasurement);
+    ///@}
+
+
+
+
+    }
+  
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/ElectronAuxContainer_v2.cxx b/Event/xAOD/xAODEgamma/Root/ElectronAuxContainer_v2.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5ac193c09c1493fbc98290e9d2ad97dd708e398c
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/ElectronAuxContainer_v2.cxx
@@ -0,0 +1,46 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAuxContainer_v2.cxx 614829 2014-09-03 09:39:36Z krasznaa $
+
+// Local include(s):
+#include "xAODEgamma/versions/ElectronAuxContainer_v2.h"
+
+namespace xAOD {
+  
+   ElectronAuxContainer_v2::ElectronAuxContainer_v2()
+      : AuxContainerBase() {
+
+/// Include the egamma variables:
+#define EGAMMA_AUX_VARIABLE( TYPE, NAME ) AUX_VARIABLE( NAME )
+#include "xAODEgamma/versions/EgammaAuxVariables_v2.def"
+#undef EGAMMA_AUX_VARIABLE
+
+      ///@links to track Particles
+      AUX_VARIABLE(trackParticleLinks);
+
+      ///@name Electron Charge
+      ///@{
+      AUX_VARIABLE(charge);
+      ///@}
+
+      /// @name Track Match details
+      /// @{
+      AUX_VARIABLE(deltaEta0);
+      AUX_VARIABLE(deltaEta1);
+      AUX_VARIABLE(deltaEta2);
+      AUX_VARIABLE(deltaEta3);
+      AUX_VARIABLE(deltaPhi0);
+      AUX_VARIABLE(deltaPhi1);
+      AUX_VARIABLE(deltaPhi2);
+      AUX_VARIABLE(deltaPhi3);
+      AUX_VARIABLE(deltaPhiRescaled0);
+      AUX_VARIABLE(deltaPhiRescaled1);
+      AUX_VARIABLE(deltaPhiRescaled2);
+      AUX_VARIABLE(deltaPhiRescaled3);
+      AUX_VARIABLE(deltaPhiFromLastMeasurement);
+      ///@}
+   }
+  
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx b/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..fa2fb1cbe7e175ea7df849424efe54442e90b490
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx
@@ -0,0 +1,128 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Electron_v1$
+
+// EDM include(s):
+#include "xAODCore/AuxStoreAccessorMacros.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/Electron_v1.h"
+#include "ElectronAccessors_v1.h"
+
+namespace xAOD {
+
+  Electron_v1::Electron_v1() : Egamma_v1() {
+
+  }
+
+  Electron_v1::Electron_v1(const Electron_v1& el) : Egamma_v1(el){
+    this->makePrivateStore(el);  
+  }
+ 
+  Electron_v1& Electron_v1::operator=(const Electron_v1& el ){
+
+    if (this != &el){ // protect against invalid self-assignment      
+      this->Egamma_v1::operator=( el );
+    }
+    // by convention, always return *this
+    return *this;
+  }
+
+  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( Electron_v1, float, charge, setCharge )
+
+  Type::ObjectType Electron_v1::type() const {
+
+    return Type::Electron;
+  }
+
+  /////////////////////////////////////////////////////////////////////////////
+  //
+  //         Implementation of the TrackParticle accessor functions
+  //
+
+  size_t xAOD::Electron_v1::nTrackParticles() const {
+
+     static SG::AuxElement::Accessor< Electron_v1::TPELVec_t >
+        trackAcc( "trackParticleLinks" );
+
+     if( trackAcc.isAvailable( *this ) ) {
+        return trackAcc( *this ).size();
+     }
+     return 0;
+  }
+
+  const xAOD::TrackParticle* Electron_v1::trackParticle( size_t index ) const {
+
+     if( index >= nTrackParticles() ) {
+        return 0;
+     }
+     const TPELVec_t& links = trackParticleLinks();
+     if( ! links[ index ].isValid() ) {
+        return 0;
+     }
+     return *( links[ index ] );
+  }
+
+  const ElementLink< TrackParticleContainer >&
+  Electron_v1::trackParticleLink( size_t index ) const {
+
+     if( index >= nTrackParticles() ) {
+        static const ElementLink< TrackParticleContainer > dummy;
+        return dummy;
+     }
+     return trackParticleLinks()[ index ];
+  }
+
+  AUXSTORE_OBJECT_SETTER_AND_GETTER( Electron_v1, Electron_v1::TPELVec_t,
+                                     trackParticleLinks, setTrackParticleLinks )
+
+  //
+  //////////////////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////////////////
+  //Implementation of the summary value accessor functions
+  
+  bool Electron_v1::trackCaloMatchValue( float& value, const EgammaParameters::TrackCaloMatchType information ) const {
+
+    xAOD::Electron_v1::Accessor< float >* acc = trackCaloMatchAccessorV1( information );
+    if( ! acc ) { 
+      return false;
+    }
+    if(! acc->isAvailable( *this) ){
+      return  false;
+    }
+    // Retrieve the value:
+    value = ( *acc )( *this );
+    return true;
+  }
+
+  bool Electron_v1::setTrackCaloMatchValue( float& value, const EgammaParameters::TrackCaloMatchType information ) {
+
+    xAOD::Electron_v1::Accessor< float >* acc = trackCaloMatchAccessorV1( information );
+     if( ! acc ) return false;
+    // Set the value:
+    ( *acc )( *this ) = value;
+    return true;
+  }
+
+
+  bool Electron_v1::trackParticleSummaryValue( uint8_t& value, const SummaryType information, int index ) const {
+
+    const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
+    if (!tempTrackParticle) return false;
+    return tempTrackParticle->summaryValue(value,information);
+  }
+
+  bool Electron_v1::trackParticleSummaryValue( float& value, const SummaryType information, int index ) const {
+    
+    const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
+    if (!tempTrackParticle) return false;
+    return tempTrackParticle->summaryValue(value,information);
+  }
+
+  /////////////////////////////////////////////////////////////////////////////
+
+
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..62f718d9e8238d7de0d113474fef7b91aaf2cd0a
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx
@@ -0,0 +1,29 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "xAODEgamma/ElectronxAODHelpers.h"
+#include "xAODTracking/TrackParticle.h"
+#include "xAODTracking/TrackParticleContainer.h"
+
+const xAOD::TrackParticle* xAOD::EgammaHelpers::getOriginalTrackParticle(const xAOD::Electron* el){
+
+ if(el){
+    const xAOD::TrackParticle* trkPar= el->trackParticle();
+    if(trkPar){
+      return getOriginalTrackParticleFromGSF(trkPar);
+    }
+  }
+  return 0;
+}
+
+const xAOD::TrackParticle* xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(const xAOD::TrackParticle* trkPar){
+
+  if(! trkPar) return 0;
+  static SG::AuxElement::Accessor<ElementLink<xAOD::TrackParticleContainer> > orig ("originalTrackParticle");
+
+  if (!orig.isAvailable(*trkPar) || !orig(*trkPar).isValid()) return 0;
+
+  return (*orig(*trkPar));
+}
+
diff --git a/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx b/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..0bb3eacd313d063b3ec62525d826ee01ecae81b4
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx
@@ -0,0 +1,39 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAccessors_v1.cxx 582601 2014-02-11 15:46:49Z christos $
+
+// System include(s):
+#include <iostream>
+
+// Local include(s):
+#include "PhotonAccessors_v1.h"
+
+/// Helper macro for Accessor objects
+#define DEFINE_ACCESSOR(TYPE, NAME )                               \
+  case xAOD::EgammaParameters::NAME:				   \
+   {                                                               \
+     static SG::AuxElement::Accessor< TYPE > a( #NAME );	   \
+     return &a;							   \
+   }                                                               \
+   break;
+
+namespace xAOD {
+
+   SG::AuxElement::Accessor< float >*
+   vertexCaloMatchAccessorV1( xAOD::EgammaParameters::VertexCaloMatchType type ) 
+   {   
+      switch( type ) {
+	DEFINE_ACCESSOR( float,convMatchDeltaEta1);
+	DEFINE_ACCESSOR( float,convMatchDeltaEta2);    
+	DEFINE_ACCESSOR( float,convMatchDeltaPhi1);    
+	DEFINE_ACCESSOR( float,convMatchDeltaPhi2);
+      default:                  
+         std::cerr << "xAOD::Photon_v1 ERROR Unknown float VertexCaloMatchType ("
+                   << type << ") requested" << std::endl;
+         return 0;
+      }
+   
+   }     
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.h b/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7d0ad684ad4f073727b8eecbd21328b8cec946b
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.h
@@ -0,0 +1,29 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAccessors_v1.h 582601 2014-02-11 15:46:49Z christos $
+#ifndef XAOD_PHOTONACCESSORS_V1_H
+#define XAOD_PHOTONACCESSORS_V1_H
+
+// EDM include(s):
+#include "AthContainers/AuxElement.h"
+// Local include(s):
+#include "xAODEgamma/EgammaEnums.h"
+
+namespace xAOD {
+
+   /// Helper function for managing Egamma Accessor objects
+   ///
+   /// This function holds on to Accessor objects that can be used by each
+   /// Photon_v1 object at runtime to get/set detail values on themselves.
+
+   SG::AuxElement::Accessor< float >*
+   vertexCaloMatchAccessorV1( xAOD::EgammaParameters::VertexCaloMatchType type );
+
+
+} // namespace xAOD
+
+#endif // XAOD_PHOTONACCESSORS_V1_H
diff --git a/Event/xAOD/xAODEgamma/Root/PhotonAuxContainer_v1.cxx b/Event/xAOD/xAODEgamma/Root/PhotonAuxContainer_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5e221162a85190f14fd79d819688c7d706cb2a23
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/PhotonAuxContainer_v1.cxx
@@ -0,0 +1,34 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAuxContainer_v1.cxx 596434 2014-05-11 17:30:02Z krasznaa $
+
+// xAOD include(s):
+#include "xAODTracking/TrackParticleContainer.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/PhotonAuxContainer_v1.h"
+
+namespace xAOD {
+
+   PhotonAuxContainer_v1::PhotonAuxContainer_v1()
+      : EgammaAuxContainer_v1() {
+
+      ///@links to track Particles
+      AUX_VARIABLE(vertexLinks);
+
+      /// @name Vertex Match details
+      /// @{
+
+      AUX_VARIABLE(convMatchDeltaEta1);
+      AUX_VARIABLE(convMatchDeltaEta2);    
+      AUX_VARIABLE(convMatchDeltaPhi1);    
+      AUX_VARIABLE(convMatchDeltaPhi2);
+      
+      ///@}
+
+
+   }
+
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/PhotonAuxContainer_v2.cxx b/Event/xAOD/xAODEgamma/Root/PhotonAuxContainer_v2.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..59ef267330892fc847d5de2e074bbea5b3e3277e
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/PhotonAuxContainer_v2.cxx
@@ -0,0 +1,34 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAuxContainer_v2.cxx 614853 2014-09-03 11:40:46Z krasznaa $
+
+// Local include(s):
+#include "xAODEgamma/versions/PhotonAuxContainer_v2.h"
+
+namespace xAOD {
+
+   PhotonAuxContainer_v2::PhotonAuxContainer_v2()
+      : AuxContainerBase() {
+
+/// Include the egamma variables:
+#define EGAMMA_AUX_VARIABLE( TYPE, NAME ) AUX_VARIABLE( NAME )
+#include "xAODEgamma/versions/EgammaAuxVariables_v2.def"
+#undef EGAMMA_AUX_VARIABLE
+
+      /// Links to track particles
+      AUX_VARIABLE(vertexLinks);
+
+      /// @name Vertex Match details
+      /// @{
+
+      AUX_VARIABLE(convMatchDeltaEta1);
+      AUX_VARIABLE(convMatchDeltaEta2);    
+      AUX_VARIABLE(convMatchDeltaPhi1);    
+      AUX_VARIABLE(convMatchDeltaPhi2);
+      
+      /// @}
+   }
+
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx b/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..f1ea671344ebff814c5ae67fa07a871f18c611cc
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx
@@ -0,0 +1,112 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Photon_v1.cxx 612240 2014-08-18 11:04:15Z christos $
+
+// EDM include(s):
+#include "xAODCore/AuxStoreAccessorMacros.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/Photon_v1.h"
+#include "PhotonAccessors_v1.h"
+
+namespace xAOD {
+
+   Photon_v1::Photon_v1()
+      : Egamma_v1() {
+
+   }
+
+  Photon_v1::Photon_v1(const Photon_v1& ph) : Egamma_v1(ph){
+    makePrivateStore(ph);  
+  }
+
+  Photon_v1& Photon_v1::operator=(const Photon_v1& ph ){
+
+    if (this != &ph){ // protect against invalid self-assignment      
+      this->Egamma_v1::operator=( ph );
+    }
+    // by convention, always return *this
+    return *this;
+  }  
+
+
+   Type::ObjectType Photon_v1::type() const {
+
+      return Type::Photon;
+   }
+
+   /////////////////////////////////////////////////////////////////////////////
+   //
+   //       Implementation of the vertex handling functions
+   //
+
+   const xAOD::Vertex* Photon_v1::vertex( size_t index ) const {
+
+      if( index >= nVertices() ) {
+         return 0;
+      }
+      const VxELVec_t& links = vertexLinks();
+      if( ! links[ index ].isValid() ) {
+         return 0;
+      }
+      return *( links[ index ] );
+   }
+
+   const ElementLink< VertexContainer >&
+   Photon_v1::vertexLink( size_t index ) const {
+
+      if( index >= nVertices() ) {
+         static const ElementLink< VertexContainer > dummy;
+         return dummy;
+      }
+      return vertexLinks()[ index ];
+   }
+
+   AUXSTORE_OBJECT_SETTER_AND_GETTER( Photon_v1, Photon_v1::VxELVec_t,
+                                      vertexLinks, setVertexLinks )
+
+   size_t xAOD::Photon_v1::nVertices() const {
+
+      static SG::AuxElement::Accessor< Photon_v1::VxELVec_t >
+         vertexAcc( "vertexLinks" );
+
+      if( vertexAcc.isAvailable( *this ) ) {
+         return vertexAcc( *this ).size();
+      }
+      return 0;
+   }
+
+   //
+   /////////////////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////////////////
+  //Implementation of the summary value accessor functions
+
+  bool Photon_v1::vertexCaloMatchValue( float& value, const EgammaParameters::VertexCaloMatchType information ) const {
+
+    xAOD::Photon_v1::Accessor< float >* acc = vertexCaloMatchAccessorV1( information );
+    if( ! acc ) { 
+      return false;
+    }
+    if(! acc->isAvailable( *this) ) {
+      return  false;
+    }
+    // Retrieve the value:
+    value = ( *acc )( *this );
+    return true;
+  }
+
+  bool Photon_v1::setVertexCaloMatchValue( float& value, const EgammaParameters::VertexCaloMatchType information ) {
+
+    xAOD::Photon_v1::Accessor< float >* acc =  vertexCaloMatchAccessorV1( information );
+    if( ! acc ) return false;
+    // Set the value:
+    ( *acc )( *this ) = value;
+    return true;
+  }
+   /////////////////////////////////////////////////////////////////////////////
+
+
+} // namespace xAOD
diff --git a/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c5bc0d83de9e44a2359b029c6262c69dac31b129
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx
@@ -0,0 +1,106 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "xAODEgamma/PhotonxAODHelpers.h"
+#include "xAODEgamma/EgammaxAODHelpers.h"
+#include "xAODEgamma/Photon.h"
+#include<cmath>
+
+// ==================================================================
+
+bool xAOD::EgammaHelpers::isConvertedPhoton(const xAOD::Photon *ph){
+  return (ph && (ph->nVertices()>0) );
+}
+
+xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType(const xAOD::Photon *ph){
+  if (!ph) return xAOD::EgammaParameters::NumberOfVertexConversionTypes;
+  return conversionType(ph->vertex());
+}
+
+xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType(const xAOD::Vertex *vx){
+  if (!vx) return xAOD::EgammaParameters::unconverted;
+
+  const TrackParticle *trk1 = ( vx->nTrackParticles() ? vx->trackParticle(0) : 0 );
+  const TrackParticle *trk2 = ( vx->nTrackParticles() > 1 ? vx->trackParticle(1) : 0 );
+  uint8_t nSiHits1 = numberOfSiHits(trk1);
+  uint8_t nSiHits2 = numberOfSiHits(trk2);
+
+  if (!trk1) return xAOD::EgammaParameters::unconverted;
+
+  if (!trk2)
+    return nSiHits1 ? xAOD::EgammaParameters::singleSi : xAOD::EgammaParameters::singleTRT;
+  
+  if (nSiHits1 && nSiHits2)
+    return xAOD::EgammaParameters::doubleSi;
+  else if (nSiHits1 || nSiHits2)
+    return xAOD::EgammaParameters::doubleSiTRT;  
+  else
+    return xAOD::EgammaParameters::doubleTRT;
+}
+
+// ==================================================================
+
+size_t xAOD::EgammaHelpers::numberOfSiTracks(const xAOD::Photon *ph){
+  if (!ph || !ph->vertex()) return 0;
+  return numberOfSiTracks(ph->vertex());
+}
+
+size_t xAOD::EgammaHelpers::numberOfSiTracks(const xAOD::Vertex *vx)
+{
+  if (!vx) return 0;
+  return numberOfSiTracks(conversionType(vx));
+}
+
+size_t xAOD::EgammaHelpers::numberOfSiTracks(const xAOD::EgammaParameters::ConversionType convType)
+{
+  if (convType == xAOD::EgammaParameters::doubleSi) return 2;
+  if (convType == xAOD::EgammaParameters::singleSi ||
+      convType == xAOD::EgammaParameters::doubleSiTRT) return 1;
+  return 0;
+}
+
+// ==================================================================
+
+float xAOD::EgammaHelpers::conversionRadius(const xAOD::Vertex* vx)
+{
+  if (!vx) return 9999.;
+  return sqrt( vx->x()*vx->x() + vx->y()*vx->y() );
+}
+
+float xAOD::EgammaHelpers::conversionRadius(const xAOD::Photon* ph)
+{
+  if (!ph || !ph->vertex()) return 9999.;
+  return conversionRadius(ph->vertex());
+}
+
+// ==================================================================
+
+Amg::Vector3D xAOD::EgammaHelpers::momentumAtVertex(const xAOD::Photon *photon, bool debug)
+{
+  if (!photon || !photon->vertex()) return Amg::Vector3D(0., 0., 0.);
+  return momentumAtVertex(*photon->vertex(), debug);
+}
+  
+
+Amg::Vector3D xAOD::EgammaHelpers::momentumAtVertex(const xAOD::Vertex& vertex, bool debug)
+{  
+  if (isAvailable(vertex, "px") && 
+      isAvailable(vertex, "py") && 
+      isAvailable(vertex, "pz") )
+  {
+    return Amg::Vector3D( vertex.auxdata<float>("px"),
+                          vertex.auxdata<float>("py"),
+                          vertex.auxdata<float>("pz") );
+  }
+  else if (debug)
+    std::cout << "Vertex not decorated with momentum" << std::endl;
+  
+  return Amg::Vector3D(0., 0., 0.);
+}
+
+bool xAOD::EgammaHelpers::isAvailable(const xAOD::Vertex& vertex, std::string name)
+{
+  SG::AuxElement::Accessor<float> acc(name, "");
+  return acc.isAvailable(vertex); 
+}
diff --git a/Event/xAOD/xAODEgamma/Root/dict/ContainerProxies.cxx b/Event/xAOD/xAODEgamma/Root/dict/ContainerProxies.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..355abd9b395a2ebf314e73da2469da55a94adc20
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/Root/dict/ContainerProxies.cxx
@@ -0,0 +1,16 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ContainerProxies.cxx 575944 2013-12-17 15:07:13Z christos $
+
+// EDM include(s):
+#include "xAODCore/AddDVProxy.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/ElectronContainer_v1.h"
+#include "xAODEgamma/versions/PhotonContainer_v1.h"
+
+// Set up the collection proxies:
+ADD_NS_DV_PROXY( xAOD, ElectronContainer_v1 );
+ADD_NS_DV_PROXY( xAOD, PhotonContainer_v1 );
diff --git a/Event/xAOD/xAODEgamma/cmt/Makefile.RootCore b/Event/xAOD/xAODEgamma/cmt/Makefile.RootCore
new file mode 100644
index 0000000000000000000000000000000000000000..5f1f2955788d413ee1a195df4059ecf5dcb3c905
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/cmt/Makefile.RootCore
@@ -0,0 +1,24 @@
+# this makefile also gets parsed by shell scripts
+# therefore it does not support full make syntax and features
+# edit with care
+
+# for full documentation check:
+# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile
+
+PACKAGE          = xAODEgamma
+PACKAGE_PRELOAD  =
+PACKAGE_CXXFLAGS = 
+PACKAGE_OBJFLAGS = 
+PACKAGE_LDFLAGS  = 
+PACKAGE_BINFLAGS = 
+PACKAGE_LIBFLAGS = 
+PACKAGE_DEP      = AthContainers AthLinks EventPrimitives GeoPrimitives xAODBase xAODCore xAODTracking xAODCaloEvent xAODTruth
+PACKAGE_TRYDEP   = 
+PACKAGE_CLEAN    = 
+PACKAGE_NOGRID   = 
+PACKAGE_PEDANTIC = 0
+PACKAGE_NOOPT    = 0
+PACKAGE_NOCC     = 0
+PACKAGE_REFLEX   = 1
+
+include $(ROOTCOREDIR)/Makefile-common
diff --git a/Event/xAOD/xAODEgamma/cmt/requirements b/Event/xAOD/xAODEgamma/cmt/requirements
new file mode 100644
index 0000000000000000000000000000000000000000..57ed3266d5ed2ac9d2ae6d74db365554e137e323
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/cmt/requirements
@@ -0,0 +1,43 @@
+package xAODEgamma
+
+author Jovan Mitrevski <Jovan.Mitrevski@cern.ch>
+author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
+author Christos Anastopoulos <Christos.Anastopoulos@cern.ch>
+author Anthony Morley <Anthony.Morley@cern.ch>
+author Bruno Lenzi <Bruno.Lenzi@cern.ch>
+
+public
+
+# Central package(s):
+use AtlasPolicy   AtlasPolicy-*
+use SGTools       SGTools-*       Control
+use AthContainers AthContainers-* Control
+use AtlasROOT     AtlasROOT-*     External
+use AthLinks      AthLinks-*      Control
+
+# The code needs libGenVector.so...
+macro xAODEgamma_extra_libs "-lGenVector"
+macro_append xAODEgammalinkopts   " $(xAODEgamma_extra_libs) "
+macro_append xAODEgamma_shlibflags " $(xAODEgamma_extra_libs) "
+
+# EDM package(s):
+use xAODBase		xAODBase-*		Event/xAOD
+use xAODCore      	xAODCore-*		Event/xAOD
+use xAODCaloEvent       xAODCaloEvent-*         Event/xAOD
+use xAODTracking        xAODTracking-*          Event/xAOD
+use xAODTruth           xAODTruth-*             Event/xAOD
+
+#Eigen/Amg includes
+use EventPrimitives      EventPrimitives-*      Event
+use GeoPrimitives        GeoPrimitives-*        DetectorDescription
+
+library xAODEgamma ../Root/*.cxx
+apply_pattern installed_library
+
+private
+
+use AtlasReflex   AtlasReflex-*   External
+
+apply_pattern lcgdict dict=xAODEgamma selectionfile=selection.xml \
+                      headerfiles="../xAODEgamma/xAODEgammaDict.h" \
+                      extralibfiles=../Root/dict/*.cxx
diff --git a/Event/xAOD/xAODEgamma/doc/mainpage.h b/Event/xAOD/xAODEgamma/doc/mainpage.h
new file mode 100644
index 0000000000000000000000000000000000000000..16b7bf31ff10dde1ddcc3e928a722bb36f89909d
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/doc/mainpage.h
@@ -0,0 +1,43 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+   @mainpage xAODEgamma package
+
+   @author Jovan Mitrevski <Jovan.Mitrevski@cern.h>
+   @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
+   @author Christos Anastopoulos <Christos.Anastopoulos@cern.h>
+   @author Anthony Morley <Anthony.Morley@cern.ch>
+
+   $Revision: 575885 $
+   $Date: 2013-12-17 14:23:39 +0100 (Tue, 17 Dec 2013) $
+
+   @section xAODEgammaOverivew Overview
+
+   This package holds the EDM classes describing the output of ATLAS's
+   egamma reconstruction.
+
+   @section xAODEgammaClasses Main Classes
+
+   The main class(es) of the package are the following:
+      - xAOD::Egamma: Typedef to the latest <code>Egamma_vX</code> class
+        version.
+      - xAOD::EgammaContainer: Typedef to the latest egamma container
+        version.
+      - xAOD::EgammaAuxContainer: Typedef to the latest egamma auxiliray 
+        container version.
+      - xAOD::Egamma_v1: The current latest egamma implementation.
+
+      - xAOD::Electron: Typedef to the latest <code>Electron_vX</code> class
+        version.
+      - xAOD::ElectronContainer: Typedef to the latest egamma container
+        version.
+      - xAOD::ElectronAuxContainer: Typedef to the latest egamma auxiliray 
+        container version.
+      - xAOD::Electron_v1: The current latest egamma implementation.
+
+   @htmlinclude used_packages.html
+
+   @include requirements
+*/
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/Egamma.h b/Event/xAOD/xAODEgamma/xAODEgamma/Egamma.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae72645501fd6daeda89ced666060204245a8519
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/Egamma.h
@@ -0,0 +1,21 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Egamma.h 568873 2013-11-06 13:58:06Z krasznaa $
+#ifndef XAODEGAMMA_EGAMMA_H
+#define XAODEGAMMA_EGAMMA_H
+
+// Local include(s):
+#include "xAODEgamma/versions/Egamma_v1.h"
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+  /// Definition of the current "egamma version"
+  typedef Egamma_v1 Egamma;
+
+}
+
+#endif // XAODEGAMMA_EGAMMA_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaAuxContainer.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaAuxContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..f605ad3f4001a55a8da09a62a43e07d5a2665349
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaAuxContainer.h
@@ -0,0 +1,25 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id $
+#ifndef XAODEGAMMA_EGAMMAAUXCONTAINER_H
+#define XAODEGAMMA_EGAMMAAUXCONTAINER_H
+
+// Local include(s):
+#include "xAODEgamma/versions/EgammaAuxContainer_v1.h"
+
+namespace xAOD {
+   /// Definition of the current egamma auxiliary container
+   ///
+   /// All reconstruction code should attach the typedefed auxiliary
+   /// container to the xAOD::EgammaContainer, so it will be easy to change
+   /// the container type as we get new I/O technologies for these
+   /// objects.
+   ///
+   typedef EgammaAuxContainer_v1 EgammaAuxContainer;
+}
+
+#endif // XAODEGAMMA_EGAMMAAUXCONTAINER_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaContainer.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5a3a7603bbd505fc10740cea11852dca09c1cb1
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaContainer.h
@@ -0,0 +1,20 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaContainer.h 568873 2013-11-06 13:58:06Z krasznaa $
+#ifndef XAODEGAMMA_EGAMMACONTAINER_H
+#define XAODEGAMMA_EGAMMACONTAINER_H
+
+// Local include(s):
+#include "xAODEgamma/Egamma.h"
+#include "xAODEgamma/versions/EgammaContainer_v1.h"
+
+namespace xAOD {
+   /// Definition of the current "egamma container version"
+   typedef EgammaContainer_v1 EgammaContainer;
+}
+
+#endif // XAODEGAMMA_EGAMMACONTAINER_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaDefs.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaDefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..77a0710e7035b483551cb50e6c6fc1f08257df0a
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaDefs.h
@@ -0,0 +1,134 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaDefs.h 600675 2014-06-06 17:19:57Z christos $
+#ifndef XAODEGAMMA_EGAMMADEFS_H
+#define XAODEGAMMA_EGAMMADEFS_H
+
+#include <stdint.h>
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+
+
+  namespace EgammaParameters {
+     /// for the Authors of the egammas
+    /** @brief Default author */
+    const uint16_t AuthorUnknown=0x0;
+    /** @brief Electron reconstructed by standard cluster-based algorithm */
+    const uint16_t AuthorElectron=0x1;
+    /** @brief Electron reconstructed by the track-based algorithm */
+    const uint16_t AuthorSofte =0x2;
+    /** @brief Photon reconstructed by standard cluster-based algorithm */
+    const uint16_t AuthorPhoton=0x4;
+    /** @brief Electron reconstructed by the Forward cluster-based algorithm */
+    const uint16_t AuthorFwdElectron=0x8;
+    /** @brief Ambiguous object */
+    const uint16_t AuthorAmbiguous=0x10; 
+    /** @brief trigger Electrons */
+    const uint16_t AuthorTrigElectron=0x20;
+    /** @brief trigger Photons */
+    const uint16_t AuthorTrigPhoton=0x40;
+    /** @brief Photon reconstructed by SW CaloTopo35 seeded clusters */
+    const uint16_t AuthorCaloTopo35=0x80;
+    /** @brief not an actual author, but used as default in some functions */
+    const uint16_t AuthorALL = 0xFFFF;
+
+  //
+  // for object quality flags
+  //
+
+  enum BitDefOQ {
+    /** @brief Dead High Voltage in the EM Presampler */
+    DeadHVPS = 0,
+    /** @brief Dead High Voltage in the EM strips, middle and back affecting the core of the cluster*/
+    DeadHVS1S2S3Core = 1,
+    /** @brief Dead High Voltage in the EM strips, middle and back affecting the edge of the cluster*/
+    DeadHVS1S2S3Edge = 2,
+
+    /** @brief Non Nominal High Voltage in the EM Presampler */
+    NonNominalHVPS = 3,
+   /** @brief Non Nominal High Voltage in the EM strips, middle and back*/
+    NonNominalHVS1S2S3 = 4,
+
+    /** @brief Missing FEB in the core of the cluster */
+    MissingFEBCellCore = 5,
+    /** @brief Missing FEB in the edge of the cluster */
+    MissingFEBCellEdgePS = 6,
+    /** @brief Missing FEB in the edge of the cluster */
+    MissingFEBCellEdgeS1 = 7,
+    /** @brief Missing FEB in the edge of the cluster */
+    MissingFEBCellEdgeS2 = 8,
+    /** @brief Missing FEB in the edge of the cluster */
+    MissingFEBCellEdgeS3 = 9,
+
+    /** @brief Masked cell in the core of the cluster */
+    MaskedCellCore = 10,
+    /** @brief Masked presampler cell in the edge of the cluster */
+    MaskedCellEdgePS = 11,
+    /** @brief Masked strip cell in the edge of the cluster */
+    MaskedCellEdgeS1 = 12,
+    /** @brief Masked middle cell in the edge of the cluster */
+    MaskedCellEdgeS2 = 13,
+    /** @brief Masked back cell in the edge of the cluster */
+    MaskedCellEdgeS3 = 14,
+   /** @brief Missing FEB or masked cell in S1 core (corresponding to the 8 strips in front of the core of the cluster)*/
+    BadS1Core = 15,
+    /** @brief Sporadic noisy cell in the core of the cluster */
+    SporadicNoiseLowQCore = 16,
+    /** @brief Sporadic noisy cell in the edge of the cluster */
+    SporadicNoiseLowQEdge = 17,
+    /** @brief High quality factor cell in the core of the cluster */
+    HighQCore = 18,
+    /** @brief High quality factor cell in the edge of the cluster */
+    HighQEdge = 19,
+    /** @brief Affected cell in the core of the cluster */
+    AffectedCellCore = 20,
+    /** @brief Affected presampler cell in the edge of the cluster */
+    AffectedCellEdgePS = 21,
+    /** @brief Affected strip cell in the edge of the cluster */
+    AffectedCellEdgeS1 = 22,
+    /** @brief Affected middle cell in the edge of the cluster */
+    AffectedCellEdgeS2 = 23,
+    /** @brief Affected back cell in the edge of the cluster */
+    AffectedCellEdgeS3 = 24,
+    /** @brief High quality factor cell in the HEC */
+    HECHighQ = 25,
+    /** @brief Out of time cell */
+    OutTime =26,
+    /** @brief Cleaning based on LArQ factor--> sum[ E(Q>4000)/E]*/
+    LArQCleaning=27,
+    /** @brief Dead cell in the Tile Calorimeter S0 affecting the hadronic leakage calculation*/
+    DeadCellTileS0=28,
+    /** @brief Dead cell in the Tile Calorimeter S1,2,3 affecting the hadronic leakage calculation*/
+    DeadCellTileS1S2=29
+  };
+
+  /** @brief */
+  
+  const uint32_t BADCLUSELECTRON = 
+    0x1 << MaskedCellCore |
+    0x1 << MissingFEBCellCore |
+    0x1 << MissingFEBCellEdgeS1 |
+    0x1 << MissingFEBCellEdgeS2 |
+    0x1 << DeadHVS1S2S3Core | 
+    0x1 << DeadHVS1S2S3Edge ; 
+  
+ const uint32_t BADCLUSPHOTON = 
+    0x1 << MaskedCellCore |
+    0x1 << MissingFEBCellCore |
+    0x1 << MissingFEBCellEdgeS1 |
+    0x1 << MissingFEBCellEdgeS2 |
+    0x1 << DeadHVS1S2S3Core | 
+    0x1 << DeadHVS1S2S3Edge |
+    0x1 << BadS1Core; 
+  
+  const uint32_t ALLOQ= 0xFFFFFFFF;
+
+  }
+}
+
+#endif // XAODEGAMMA_EGAMMADEFS_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaEnums.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaEnums.h
new file mode 100644
index 0000000000000000000000000000000000000000..0bb28f09f13494df8658a87335a7a7020ea69f78
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaEnums.h
@@ -0,0 +1,299 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id$
+#ifndef XAODEGAMMA_EGAMMAENUMS_H
+#define XAODEGAMMA_EGAMMAENUMS_H
+
+
+namespace xAOD {
+
+  namespace EgammaParameters {
+    
+    /// @name egamma types
+    enum EgammaType {
+      electron = 0,
+      unconvertedPhoton = 1,
+      convertedPhoton = 2,
+      NumberOfEgammaTypes = 3
+    };
+
+    /// @name Shower shape types
+    /// @{
+    enum ShowerShapeType{
+      /// @brief uncalibrated energy (sum of cells) in presampler in a 1x1 window in cells in eta X phi
+      e011 = 0,      
+      /// @brief uncalibrated energy (sum of cells) in presampler in a 3x3 window in cells in eta X phi
+      e033 = 1,     
+      /// @brief uncalibrated energy (sum of cells) in strips in a 3x2 window in cells in eta X phi
+      e132 = 2,     
+      /// @brief uncalibrated energy (sum of cells) in strips in a 15x2 window in cells in eta X phi
+      e1152 = 3,    
+      /// @brief transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated from ehad1
+      ethad1 = 4,   
+      /// @brief ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling::TileGap3
+      ethad = 5,    
+      /// @brief E leakage into 1st sampling of had calo (CaloSampling::HEC0 + CaloSampling::TileBar0 + CaloSampling::TileExt0)
+      ehad1 = 6,    
+      /// @brief E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belonging to the cluster and E is the total energy reconstructed in the electromagnetic calorimeter cluster
+      f1 = 7,       
+      /// @brief fraction of energy reconstructed in 3rd sampling
+      f3 = 8,      
+      /// @brief E1(3x1)/E = fraction of the energy reconstructed in the first longitudinal compartment of the electromagnetic calorimeter, where E1(3x1) the energy reconstructed in +/-3 strips in eta, centered around the maximum energy strip and E is the energy reconstructed in the electromagnetic calorimeter
+      f1core = 9,   
+      /// @brief E3(3x3)/E fraction of the energy reconstructed in the third compartment of the electromagnetic calorimeter, where E3(3x3), energy in the back sampling, is the sum of the energy contained in a 3x3 window around the maximum energy cell
+      f3core = 10,   
+      /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x3 (in cell units eta X phi)
+      e233 = 11,     
+      /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x5
+      e235 = 12,     
+      /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 5x5
+      e255 = 13,     
+      /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
+      e237 = 14,     
+      /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
+      e277 = 15,    
+      /// @brief uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x3
+      e333 = 16,     
+      /// @brief uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x5
+      e335 = 17,     
+      /// @brief uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x7
+      e337 = 18,     
+      /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
+      e377 = 19,     
+      /// @brief shower width using +/-3 strips around the one with the maximal energy deposit: 
+      ///	w3 strips = sqrt{sum(Ei)x(i-imax)^2/sum(Ei)}, where i is the number of the strip and imax the strip number of the most energetic one 
+      weta1 = 20,    
+      /// @brief the lateral width is calculated with a window of 3x5 cells using the energy weighted  sum over all cells, which depends on the particle impact point inside the cell: weta2 = 
+      ///	sqrt(sum Ei x eta^2)/(sum Ei) -((sum Ei x eta)/(sum Ei))^2, where Ei is the energy of the i-th cell 
+      weta2 = 21,    
+      /// @brief 2nd max in strips calc by summing 3 strips
+      e2ts1 = 22,   
+      /// @brief energy of the cell corresponding to second energy maximum in the first sampling
+      e2tsts1 = 23,  
+      /// @brief shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n) is the energy in ± n strips around the strip with highest energy
+      fracs1 = 24,   
+      /// @brief same as egammaParameters::weta1 but without corrections  on particle impact point inside the cell
+      widths1 = 25,  
+      /// @brief same as egammaParameters::weta2 but without corrections on particle impact point inside the cell
+      widths2 = 26,  
+      /// @brief relative position in eta within cell in 1st sampling 
+      poscs1 = 27,  
+      /// @brief relative position in eta within cell in 2nd sampling
+      poscs2= 28,   
+      /// @brief uncorr asymmetry in 3 strips in the 1st sampling 
+      asy1 = 29,    
+      /// @brief difference between shower cell and predicted track in +/- 1 cells
+      pos = 30, 
+      /// @brief Difference between the track and the shower positions: 
+      ///	sum_{i=i_m-7}^{i=i_m+7}E_i x (i-i_m) / sum_{i=i_m-7}^{i=i_m+7}E_i, 
+      ///	The difference between the track and the shower positions measured 
+      ///	in units of distance between the strips, where i_m is the impact cell 
+      ///	for the track reconstructed in the inner detector and E_i is the energy 
+      ///	reconstructed in the i-th cell in the eta direction for constant phi given by the track parameters
+      pos7 = 31, 
+      /// @brief  barycentre in sampling 1 calculated in 3 strips
+      barys1 =32,   
+      /// @brief shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips in eta : wtot1=sqrt{sum Ei x ( i-imax)^2 / sum Ei}, where i is the strip number and imax the strip number of the first local maximum
+      wtots1 = 33,   
+      /// @brief energy reconstructed in the strip with the minimal value between the first and second maximum
+      emins1 = 34,   
+      /// @brief energy of strip with maximal energy deposit
+      emaxs1 = 35,    
+      /// @brief  1-ratio of energy in 3x3 over 3x7 cells; 
+      ///	E(3x3) = E0(1x1) + E1(3x1) + E2(3x3) + E3(3x3); E(3x7) = E0(3x3) + E1(15x3) + E2(3x7) + E3(3x7)
+      r33over37allcalo = 36,     
+      /// @brief core energy in em calo  E(core) = E0(3x3) + E1(15x2) + E2(5x5) + E3(3x5)
+      ecore = 37,
+      /// @brief pointing z at vertex reconstructed from the cluster
+      zvertex = 38,
+      /// @brief error associated to zvertex 
+      errz = 39,
+      /// @brief pointing eta reconstructed from the cluster (first and second sampling)
+      etap = 40, 
+      /// @brief pointing depth of the shower as calculated in egammaqgcld
+      depth = 41,
+      ///maximum number of enums 
+      NumberOfShowerShapes = 42 
+    };
+    /// @}  
+    
+    /// @name Isolation variable types
+    /// @{
+    enum IsolationType{
+      /// @brief ET in a cone of R=0.45 in calo, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+      etcone   = 0,   
+      /// @brief ET in a cone with half-opening angle 0.15, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+      etcone15 = 1, 
+      /// @brief ET in a cone with half-opening angle 0.2, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+      etcone20 = 2, 
+      /// @brief ET in a cone with half-opening angle 0.25, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+      etcone25 = 3, 
+      /// @brief ET in a cone with half-opening angle 0.3, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3 
+      etcone30 = 4, 
+      /// @brief ET in a cone with half-opening angle 0.35, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+      etcone35 = 5, 
+      /// @brief ET in a cone with half-opening angle 0.4, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+      etcone40 = 6, 
+      /// @brief summed pt of tracks in a cone with half-opening angle 0.2 (no zvx cut photons, 1mm electrons) 
+      ptcone20 = 7,
+      /// @brief summed pt of tracks in a cone with half-opening angle 0.3
+      ptcone30 = 8,
+      /// @brief summed pt of tracks in a cone with half-opening angle 0.4
+      ptcone40 = 9,
+      /// @brief number of tracks in a cone with half-opening angle 0.2
+      nucone20 = 10,
+      /// @brief number of tracks in a cone with half-opening angle 0.3
+      nucone30 = 11,
+      /// @brief number of tracks in a cone with half-opening angle 0.4
+      nucone40 = 12,
+      /// @brief pt corrected ET in a cone with half-opening angle 0.15 
+      etcone15_ptcorrected = 13,
+      /// @brief pt corrected ET in a cone with half-opening angle 0.2 
+      etcone20_ptcorrected = 14,
+      /// @brief pt corrected ET in a cone with half-opening angle 0.25 
+      etcone25_ptcorrected = 15,
+      /// @brief pt corrected ET in a cone with half-opening angle 0.3 
+      etcone30_ptcorrected = 16,
+      /// @brief pt corrected ET in a cone with half-opening angle 0.35 
+      etcone35_ptcorrected = 17,
+      /// @brief ptcorrected ET in a cone with half-opening angle 0.4 
+      etcone40_ptcorrected = 18,
+      /// @brief pt + ED corrected ET in a cone with half-opening angle 0.2 
+      etcone20_corrected = 19,
+      /// @brief pt + ED corrected ET in a cone with half-opening angle 0.3 
+      etcone30_corrected = 20,
+      /// @brief pt + ED corrected ET in a cone with half-opening angle 0.4 
+      etcone40_corrected = 21,
+      //et cone for topo cluster 
+      /// @brief ET in a cone with half-opening angle 0.20 
+      topoetcone20 = 22,
+      /// @brief ET in a cone with half-opening angle 0.30 
+      topoetcone30 = 23,
+      /// @brief ET in a cone with half-opening angle 0.40 
+      topoetcone40 = 24,
+      /// @brief pt corrected ET in a cone with half-opening angle 0.40 
+      topoetcone40_ptcorrected = 25,
+      /// @brief fully corrected ET in a cone with half-opening angle 0.40 
+      topoetcone40_corrected = 26,
+      ///maximum number of enums 
+      NumberOfIsolationProperties= 27
+    };
+    /// @}
+  
+    
+    /// @name Track Match variable types
+    /// @{
+    enum TrackCaloMatchType{
+      /// @brief difference between the cluster eta (presampler) and
+      ///the eta of the track extrapolated to the presampler 
+      deltaEta0 = 0,
+      ///@brief difference between the cluster eta (first sampling) and the eta of the track extrapolated to the first sampling: |eta_stripscluster -eta_ID|, where eta_stripscluster is computed 
+      ///in the first sampling of the electromagnetic calorimeter, where the granularity is very fine, and eta_ID is the pseudo-rapidity of the track extrapolated to the calorimeter 
+      deltaEta1 = 1,
+      /// @brief difference between the cluster eta (second sampling) and the eta of the track extrapolated to the second sampling 
+      deltaEta2 = 2,
+      /// @brief difference between the cluster eta (3rd sampling) and
+      ///	  the eta of the track extrapolated to the 3rd sampling 
+      deltaEta3 = 3,
+      /// @brief difference between the cluster phi (presampler) and
+      ///	  the eta of the track extrapolated to the presampler 
+      deltaPhi0 = 4,
+      /// @brief difference between the cluster eta (1st sampling) and
+      ///	  the eta of the track extrapolated to the 1st sampling (strips) 
+      deltaPhi1 = 5,
+      /// @brief difference between the cluster phi (second sampling) and the phi of the track
+      ///	  extrapolated to the second sampling : |phi_middlecluster -phi_ID|, where phi_middlecluster
+      ///	  is computed in the second compartment of the electromagnetic calorimeter and phi_ID is the
+      ///  azimuth of the track extrapolated to the calorimeter 
+      deltaPhi2 = 6,
+      ///@brief difference between the cluster eta (3rd sampling) and
+      ///	  the eta of the track extrapolated to the 3rd sampling 
+      deltaPhi3 = 7,
+      /// @brief difference between the cluster phi (sampling 2) and the
+      /// eta of the track extrapolated from the last measurement point.
+      deltaPhiFromLastMeasurement = 8,
+      /// @brief difference between the cluster phi (sampling 2) and the
+      /// phi of the track extrapolated from the perigee with a rescaled
+      /// momentum. 
+      deltaPhiRescaled = 9,
+      /// @brief difference between the cluster phi (presampler) and
+      ///	  the eta of the track extrapolated to the presampler  from the perigee with a rescaled
+      /// momentum. 
+      deltaPhiRescaled0 = 10,
+      /// @brief difference between the cluster eta (1st sampling) and
+      ///	  the eta of the track extrapolated to the 1st sampling (strips) from the perigee with a rescaled
+      /// momentum. 
+      deltaPhiRescaled1 = 11,
+      /// @brief difference between the cluster phi (second sampling) and the phi of the track
+      ///	  extrapolated to the second sampling from the perigee with a rescaled
+      /// momentum. 
+      deltaPhiRescaled2 = 12,
+      ///@brief difference between the cluster eta (3rd sampling) and
+      /// the eta of the track extrapolated to the 3rd sampling from the perigee with a rescaled
+      /// momentum. 
+      deltaPhiRescaled3 = 13,
+      ///maximum number of enums 
+      NumberOfTrackMatchProperties= 14
+    };
+    ///@}
+
+
+    /// @name Vertex Match variable types
+    /// @{
+    enum VertexCaloMatchType{
+      /// @brief difference between the cluster eta  and
+      ///the eta of the first track of the vertex extrapolated to the second sampling.
+      convMatchDeltaEta1 = 0,
+
+      /// @brief difference between the cluster eta  and
+      ///the eta of the second track of the vertex extrapolated to the second sampling.
+      convMatchDeltaEta2 = 1,
+    
+      /// @brief difference between the cluster phi  and
+      ///the phi of the first track of the vertex extrapolated to the second sampling.
+      convMatchDeltaPhi1 = 2,
+    
+      /// @brief difference between the cluster phi  and
+      ///the phi of the second track of the vertex extrapolated to the second sampling.
+      convMatchDeltaPhi2 = 3,
+
+      ///maximum number of enums 
+      NumberOfVertexMatchProperties= 4
+    };
+    ///@}
+
+    /// @name Conversion types
+    /// @{
+    enum ConversionType{
+      /// @brief unconverted photon
+      unconverted = 0,
+
+      /// @brief one track only, with Si hits
+      singleSi = 1,
+
+      /// @brief one track only, no Si hits (TRT only)
+      singleTRT = 2,
+    
+      /// @brief two tracks, both with Si hits
+      doubleSi = 3,
+    
+      /// @brief two tracks, none with Si hits (TRT only)
+      doubleTRT = 4,
+
+      /// @brief two tracks, only one with Si hits
+      doubleSiTRT = 5,
+
+      ///maximum number of types
+      NumberOfVertexConversionTypes
+    };
+    ///@}
+
+
+  }// End namespace EgammaParameters
+
+}// End namespace xAOD
+#endif // XAODEGAMMA_EGAMMAENUMS_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaFwd.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaFwd.h
new file mode 100644
index 0000000000000000000000000000000000000000..6d9e1ddb1b1709575f223deea97ceb802c89db8c
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaFwd.h
@@ -0,0 +1,20 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaFwd.h 582853 2014-02-12 17:41:25Z christos $
+
+#ifndef XAODEGAMMA_EGAMMAFWD_H
+#define XAODEGAMMA_EGAMMAFWD_H
+
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+  /// Definition of the current "egamma version"
+  class Egamma_v1;
+  typedef Egamma_v1 Egamma;
+}
+
+#endif // XAODEGAMMA_EGAMMAFWD_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f2e316abe48ef684d5a7f270410fdcb4c4656fe
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h
@@ -0,0 +1,101 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaxAODHelpers.h 607445 2014-07-18 22:43:08Z christos $
+#ifndef XAOD_EGAMMAXAODHELPERS_H
+#define XAOD_EGAMMAXAODHELPERS_H
+
+#include "xAODEgamma/EgammaFwd.h"
+#include "xAODEgamma/ElectronFwd.h"
+#include "xAODEgamma/PhotonFwd.h"
+#include "xAODTracking/TrackParticleFwd.h"
+#include "xAODTracking/VertexFwd.h"
+#include "xAODCaloEvent/CaloClusterFwd.h"
+
+//Truth Includes
+#include "xAODTruth/TruthParticleContainer.h"
+#include "xAODTruth/TruthParticle.h"
+
+// Include helpers for electrons and photons: the user only needs to include this file
+#include "xAODEgamma/ElectronxAODHelpers.h"
+#include "xAODEgamma/PhotonxAODHelpers.h"
+
+#include <cstddef>
+#include <set>
+
+namespace xAOD {
+
+  namespace EgammaHelpers{
+    
+    using std::size_t;
+
+    ///@brief is the object an electron (not Fwd) 
+    bool isElectron(const xAOD::Egamma *eg);
+
+    ///@brief is the object a Fwd  electron
+    bool isFwdElectron(const xAOD::Egamma *eg);
+
+    ///@brief  is the object a photon
+    bool isPhoton(const xAOD::Egamma *eg);    
+
+    ///@brief is the object a converted photon
+    bool isConvertedPhoton(const xAOD::Egamma *eg);
+    
+    ///@brief return the number of Si hits in the track particle
+    size_t numberOfSiHits(const xAOD::TrackParticle *tp);
+    
+    ///@brief return true if the cluster is in the barrel
+    bool isBarrel(const xAOD::Egamma *eg);
+    
+    ///@brief return true if the cluster (or the majority of its energy) is in the barrel
+    bool isBarrel(const xAOD::CaloCluster *cluster);
+
+    /** Return a list of all or only the best TrackParticle associated to the object. 
+      * (used for track isolation)
+      * If useBremAssoc is set, get the original TrackParticle **/
+    const std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Egamma *eg,
+      bool useBremAssoc = true, bool allParticles = true);
+
+    const std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Electron* el,
+      bool useBremAssoc = true, bool allParticles = true);
+
+    const std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Photon* ph,
+      bool useBremAssoc = true);
+    
+    // @brief Access to element link to object of type T stored in auxdata
+    template<class T>
+    const T* getLink(const xAOD::IParticle* particle, std::string name, bool debug=false){
+      if (!particle) return 0;
+      typedef ElementLink< DataVector<T> > Link_t;
+      
+      if (!particle->isAvailable< Link_t >(name) ) 
+	{ 
+	  if (debug) std::cerr<< "Link not available" << std::endl; 
+	  return 0; 
+	}  
+      const Link_t link = particle->auxdata<Link_t>(name);
+      if (!link.isValid()) 
+	{ 
+	  if (debug) std::cerr << "Invalid link" << std::endl; 
+	  return 0; 
+	}
+      return *link;
+    }
+    
+    ///@brief return the truthParticle associated to the given IParticle (if any)
+    const xAOD::TruthParticle* getTruthParticle(const xAOD::IParticle*, bool debug = false);
+
+    ///@brief return the reco electron associated to the given TruthParticle (if any)
+    const xAOD::Electron* getRecoElectron(const xAOD::TruthParticle*, bool debug = false);
+    
+    ///@brief return the reco photon associated to the given TruthParticle (if any)
+   const xAOD::Photon* getRecoPhoton(const xAOD::TruthParticle* particle, bool debug = false);
+        
+  }// EgammaHelpers
+
+} // namespace xAOD
+  
+#endif // XAOD_EGAMMAXAODHELPERS_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/Electron.h b/Event/xAOD/xAODEgamma/xAODEgamma/Electron.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2bcf6e4eda8e748398655e2dd3889939b0255f1
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/Electron.h
@@ -0,0 +1,21 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Electron.h 615476 2014-09-07 15:56:30Z schaffer $
+#ifndef XAODEGAMMA_ELECTRON_H
+#define XAODEGAMMA_ELECTRON_H
+
+// Local include(s):
+#include "xAODEgamma/versions/Electron_v1.h"
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+  /// Definition of the current "egamma version"
+  typedef Electron_v1 Electron;
+
+}
+
+#endif // XAODEGAMMA_ELECTRON_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/ElectronAuxContainer.h b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronAuxContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..e6b6a9a5e54b00ccec9684751d3f7fab9750d7d6
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronAuxContainer.h
@@ -0,0 +1,29 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAuxContainer.h 614829 2014-09-03 09:39:36Z krasznaa $
+#ifndef XAODEGAMMA_ELECTRONAUXCONTAINER_H
+#define XAODEGAMMA_ELECTRONAUXCONTAINER_H
+
+// Local include(s):
+#include "xAODEgamma/versions/ElectronAuxContainer_v2.h"
+
+namespace xAOD {
+   /// Definition of the current electron auxiliary container
+   ///
+   /// All reconstruction code should attach the typedefed auxiliary
+   /// container to the xAOD::ElectronContainer, so it will be easy to change
+   /// the container type as we get new I/O technologies for these
+   /// objects.
+   ///
+   typedef ElectronAuxContainer_v2 ElectronAuxContainer;
+}
+
+// Set up a CLID for the class:
+#include "xAODCore/CLASS_DEF.h"
+CLASS_DEF( xAOD::ElectronAuxContainer, 1115737378, 1 )
+
+#endif // XAODEGAMMA_ELECTRONAUXCONTAINER_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..15a792a12367a3ada9240c8519fb87bded94c086
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h
@@ -0,0 +1,26 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronContainer.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_ELECTRONCONTAINER_H
+#define XAODEGAMMA_ELECTRONCONTAINER_H
+
+// Local include(s):
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/versions/ElectronContainer_v1.h"
+
+namespace xAOD {
+   /// Definition of the current "electron container version"
+   typedef ElectronContainer_v1 ElectronContainer;
+}
+
+// Set up a CLID for the container:
+#ifndef XAOD_STANDALONE
+#include "SGTools/CLASS_DEF.h"
+CLASS_DEF( xAOD::ElectronContainer , 1087532415 , 1 )
+#endif // XAOD_STANDALONE
+
+#endif // XAODEGAMMA_ELECTRONCONTAINER_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/ElectronFwd.h b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronFwd.h
new file mode 100644
index 0000000000000000000000000000000000000000..acddf523d776bb1d6c0d17151b74cf2ab67ba6f4
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronFwd.h
@@ -0,0 +1,19 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronFwd.h 582853 2014-02-12 17:41:25Z christos $
+#ifndef XAODEGAMMA_ELECTRONFWD_H
+#define XAODEGAMMA_ELECTRONFWD_H
+
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+  /// Definition of the current "egamma version"
+  class Electron_v1;
+  typedef Electron_v1 Electron;
+}
+
+#endif // XAODEGAMMA_ELECTRONFWD_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..0a8d4b862e9fb268cbddff8051fdf69a0227f542
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h
@@ -0,0 +1,25 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronxAODHelpers.h 611048 2014-08-09 01:48:26Z christos $
+#ifndef XAOD_ELECTRONXAODHELPERS_H
+#define XAOD_ELECTRONXAODHELPERS_H
+
+#include "xAODEgamma/Electron.h"
+
+namespace xAOD {
+
+  namespace EgammaHelpers{
+  /// Helper functions for getting the "Original" Track Particles (i.e before GSF)
+
+    const xAOD::TrackParticle* getOriginalTrackParticle(const xAOD::Electron* el);
+    const xAOD::TrackParticle* getOriginalTrackParticleFromGSF(const xAOD::TrackParticle* trkPar);
+    
+  } //namaspace EgammaHelpers
+
+} // namespace xAOD
+
+#endif // XAOD_ELECTRONXAODHELPERS_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/Photon.h b/Event/xAOD/xAODEgamma/xAODEgamma/Photon.h
new file mode 100644
index 0000000000000000000000000000000000000000..04ddb94fda282dd7d33ebeee5949ee3a9697f0cb
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/Photon.h
@@ -0,0 +1,21 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Photon.h 615476 2014-09-07 15:56:30Z schaffer $
+#ifndef XAODEGAMMA_PHOTON_H
+#define XAODEGAMMA_PHOTON_H
+
+// Local include(s):
+#include "xAODEgamma/versions/Photon_v1.h"
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+  /// Definition of the current "egamma version"
+  typedef Photon_v1 Photon;
+
+}
+
+#endif // XAODEGAMMA_PHOTON_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/PhotonAuxContainer.h b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonAuxContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..0da0c5d7a254b0e4d21a15ea7c52e43b6e06c5b8
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonAuxContainer.h
@@ -0,0 +1,29 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAuxContainer.h 614853 2014-09-03 11:40:46Z krasznaa $
+#ifndef XAODEGAMMA_PHOTONAUXCONTAINER_H
+#define XAODEGAMMA_PHOTONAUXCONTAINER_H
+
+// Local include(s):
+#include "xAODEgamma/versions/PhotonAuxContainer_v2.h"
+
+namespace xAOD {
+   /// Definition of the current photon auxiliary container
+   ///
+   /// All reconstruction code should attach the typedefed auxiliary
+   /// container to the xAOD::PhotonContainer, so it will be easy to change
+   /// the container type as we get new I/O technologies for these
+   /// objects.
+   ///
+   typedef PhotonAuxContainer_v2 PhotonAuxContainer;
+}
+
+// Set up a CLID for the class:
+#include "xAODCore/CLASS_DEF.h"
+CLASS_DEF( xAOD::PhotonAuxContainer, 1250139444, 1 )
+
+#endif // XAODEGAMMA_PHOTONAUXCONTAINER_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..3b9335c8632bd8cd9032827bdac4188c1f98c40a
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h
@@ -0,0 +1,26 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonContainer.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_PHOTONCONTAINER_H
+#define XAODEGAMMA_PHOTONCONTAINER_H
+
+// Local include(s):
+#include "xAODEgamma/Photon.h"
+#include "xAODEgamma/versions/PhotonContainer_v1.h"
+
+namespace xAOD {
+   /// Definition of the current "photon container version"
+   typedef PhotonContainer_v1 PhotonContainer;
+}
+
+// Set up a CLID for the container:
+#ifndef XAOD_STANDALONE
+#include "SGTools/CLASS_DEF.h"
+CLASS_DEF( xAOD::PhotonContainer , 1105575213 , 1 )
+#endif // XAOD_STANDALONE
+
+#endif // XAODEGAMMA_PHOTONCONTAINER_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/PhotonFwd.h b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonFwd.h
new file mode 100644
index 0000000000000000000000000000000000000000..938b8ed3852b9b88f06223b63aba3410c651a768
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonFwd.h
@@ -0,0 +1,19 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonFwd.h 582853 2014-02-12 17:41:25Z christos $
+#ifndef XAODEGAMMA_PHOTONFWD_H
+#define XAODEGAMMA_PHOTONFWD_H
+
+
+/// Namespace holding all the xAOD EDM classes
+namespace xAOD {
+  /// Definition of the current "egamma version"
+  class Photon_v1;
+  typedef Photon_v1 Photon;
+}
+
+#endif // XAODEGAMMA_PHOTONFWD_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..211397c516f297117fd1ddc0ce708d12e22e35e8
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h
@@ -0,0 +1,60 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef XAOD_PHOTONXAODHELPERS_H
+#define XAOD_PHOTONXAODHELPERS_H
+
+#include "xAODTracking/Vertex.h"
+#include "xAODEgamma/PhotonFwd.h"
+#include "xAODEgamma/EgammaEnums.h"
+#include "GeoPrimitives/GeoPrimitives.h"
+
+#include <cstddef>
+
+namespace xAOD {
+
+  namespace EgammaHelpers{
+
+    using std::size_t;
+
+    ///@brief is the object a converted photon
+    bool isConvertedPhoton(const xAOD::Photon *ph);
+
+    ///@brief return the photon conversion type (see EgammaEnums)
+    xAOD::EgammaParameters::ConversionType conversionType(const xAOD::Photon *ph);
+
+    ///@brief return the photon conversion type (see EgammaEnums)
+    xAOD::EgammaParameters::ConversionType conversionType(const xAOD::Vertex *vx);
+    
+    ///@brief return the number of Si tracks in the conversion
+    size_t numberOfSiTracks(const xAOD::Photon *eg);
+
+    ///@brief return the number of Si tracks in the conversion
+    size_t numberOfSiTracks(const xAOD::Vertex *vx);
+
+    ///@brief return the number of Si tracks in the conversion
+    size_t numberOfSiTracks(const xAOD::EgammaParameters::ConversionType convType);
+
+    ///@brief return the conversion radius or 9999.
+    float conversionRadius(const xAOD::Vertex* vx);
+
+    ///@brief return the conversion radius or 9999.
+    float conversionRadius(const xAOD::Photon* ph);
+    
+    ///@brief return the momentum at the vertex (which can be 0)
+    Amg::Vector3D momentumAtVertex(const xAOD::Photon*, bool debug = false);
+
+    ///@brief return the momentum at the vertex (which can be 0)
+    Amg::Vector3D momentumAtVertex(const xAOD::Vertex&, bool debug = false);
+
+    // xAOD::Vertex does not have method isAvailable for the moment
+    bool isAvailable(const xAOD::Vertex& vertex, std::string name);
+    
+  } //namaspace EgammaHelpers
+
+} // namespace xAOD
+
+#endif // XAOD_PHOTONXAODHELPERS_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml b/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1f35b0bcb5aab0eef251e4041f56b61d5c443eee
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml
@@ -0,0 +1,97 @@
+<!-- $Id: selection.xml 614853 2014-09-03 11:40:46Z krasznaa $ -->
+<lcgdict>
+
+  <!-- Egamma_v1 dictionaries: -->
+  <class name="xAOD::Egamma_v1">
+    <field name="m_p4" transient="true" />
+    <field name="m_p4Cached" transient="true" />
+  </class>
+  <class name="xAOD::EgammaContainer_v1"
+         id="CE53CD7A-0B8E-44F5-9AB1-997E87713BC5" />
+  <read sourceClass="xAOD::Egamma_v1" version="[1-]"
+        targetClass="xAOD::Egamma_v1" source="" target="m_p4Cached" >
+    <![CDATA[
+       m_p4Cached = false;
+    ]]>
+  </read>
+
+  <class name="xAOD::EgammaAuxContainer_v1"
+         id="01A7F3AA-D5CA-4FCF-A314-20F822FF6CA0" />
+
+  <!-- Smart pointers to Egamma_v1: -->
+  <class name="DataLink<xAOD::EgammaContainer_v1>" />
+  <class name="std::vector<DataLink<xAOD::EgammaContainer_v1> >" />
+  <class name="ElementLink<xAOD::EgammaContainer_v1>" />
+  <class name="std::vector<ElementLink<xAOD::EgammaContainer_v1> >" />
+  <class name="ElementLinkVector<xAOD::EgammaContainer_v1>" />
+  <class name="std::vector<ElementLinkVector<xAOD::EgammaContainer_v1> >" />
+
+
+  <!-- Electron_v1 dictionaries: -->
+  <class name="xAOD::Electron_v1" >
+  </class>
+  <class name="xAOD::ElectronContainer_v1"
+         id="9CA52CF4-E219-45B8-9971-6DAA89125952" />
+  <class name="xAOD::ElectronAuxContainer_v1"
+         id="85A46300-3F57-454C-8B7E-94B653AA70CF" />
+
+  <!-- Electron_v2 dictionaries: -->
+  <class name="xAOD::ElectronAuxContainer_v2"
+         id="7160FC1C-937D-474C-909B-2C0FCE1DD755" />
+
+  <!-- Smart pointers to Electron_v1: -->
+  <class name="DataLink<xAOD::ElectronContainer_v1>" />
+  <class name="std::vector<DataLink<xAOD::ElectronContainer_v1> >" />
+  <class name="ElementLink<xAOD::ElectronContainer_v1>" />
+  <class name="std::vector<ElementLink<xAOD::ElectronContainer_v1> >" />
+  <class name="ElementLinkVector<xAOD::ElectronContainer_v1>" />
+  <class name="std::vector<ElementLinkVector<xAOD::ElectronContainer_v1> >" />
+
+  <!-- Photon_v1 dictionaries: -->
+  <class name="xAOD::Photon_v1" >
+  </class>
+  <class name="xAOD::PhotonContainer_v1"
+         id="5F045AAE-DBD8-47E4-90AC-9162530A9565" />
+  <class name="xAOD::PhotonAuxContainer_v1"
+         id="67A1818E-4591-4100-B8BD-9A3C9E0D4EBB" />
+
+  <!-- Photon_v2 dictionaries: -->
+  <class name="xAOD::PhotonAuxContainer_v2"
+         id="CAE4C9A6-B3D0-429B-9A4F-1F174D892CA5" />
+
+  <!-- Smart pointers to Photon_v1: -->
+  <class name="DataLink<xAOD::PhotonContainer_v1>" />
+  <class name="std::vector<DataLink<xAOD::PhotonContainer_v1> >" />
+  <class name="ElementLink<xAOD::PhotonContainer_v1>" />
+  <class name="std::vector<ElementLink<xAOD::PhotonContainer_v1> >" />
+  <class name="ElementLinkVector<xAOD::PhotonContainer_v1>" />
+  <class name="std::vector<ElementLinkVector<xAOD::PhotonContainer_v1> >" />
+
+  <!-- Objects from the namespace -->
+  <variable pattern="xAOD::EgammaParameters::*" />
+  
+  <!-- Enums -->
+  <enum pattern="xAOD::EgammaParameters::*" />
+  
+  <!--Add Helper Functions -->
+  <function pattern="xAOD::EgammaHelpers::*" />  
+
+  <!-- Suppress the unwanted classes found by ROOT 6. -->
+  <!-- Hopefully we can remove these extra lines at one point... -->
+  <exclusion>
+    <class name="SG::IConstAuxStore" />
+    <class name="DataLink<SG::IConstAuxStore>" />
+    <class name="DataVector<xAOD::IParticle>" />
+    <class pattern="xAOD::TrackParticle*" />
+    <class pattern="DataVector<xAOD::TrackParticle*" />
+    <class pattern="ElementLink<DataVector<xAOD::TrackParticle*" />
+    <class pattern="xAOD::Vertex*" />
+    <class pattern="DataVector<xAOD::Vertex*" />
+    <class pattern="ElementLink<DataVector<xAOD::Vertex*" />
+    <class pattern="xAOD::CaloCluster*" />
+    <class pattern="DataVector<xAOD::CaloCluster*" />
+    <class pattern="ElementLink<DataVector<xAOD::CaloCluster*" />
+    <function pattern="xAOD::EgammaHelpers::getLink" />  
+  </exclusion>
+
+</lcgdict>
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaAuxContainer_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaAuxContainer_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..f6174e114d26e1504f6c16e3416cff7a5a997a52
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaAuxContainer_v1.h
@@ -0,0 +1,251 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaAuxContainer_v1.h 600675 2014-06-06 17:19:57Z christos $
+#ifndef XAODEGAMMA_VERSIONS_EGAMMAAUXCONTAINER_V1_H
+#define XAODEGAMMA_VERSIONS_EGAMMAAUXCONTAINER_V1_H
+
+// System include(s):
+#include <vector>
+#include "xAODEgamma/EgammaDefs.h"
+#include "AthLinks/ElementLink.h"
+#include "xAODCaloEvent/CaloClusterContainer.h" 
+
+#include <stdint.h>
+
+// EDM include(s):
+#include "xAODCore/AuxContainerBase.h"
+
+namespace xAOD {
+
+
+  /// Temporary container used until we have I/O for AuxStoreInternal
+  ///
+  /// This class is meant to serve as a temporary way to provide an auxiliary
+  /// store with Athena I/O capabilities for the egamma EDM. Will be exchanged for
+  /// a generic auxiliary container type (AuxStoreInternal) later on.
+  ///
+  /// @author Christos Anastopoulos
+  /// @author Anthony Morley
+  /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
+  /// @author Jovan Mitrevski <Jovan.Mitrevski@cern.ch>
+  ///
+  /// $Revision: 600675 $
+  /// $Date: 2014-06-06 19:19:57 +0200 (Fri, 06 Jun 2014) $
+  ///
+
+  class EgammaAuxContainer_v1 : public AuxContainerBase {
+
+
+  protected:
+
+    /// @name xAOD::EgammaAuxContainer constructors
+    /// The xAOD::EgammaAuxContainer is supposed to be used only via the ElectronAuxContainter and PhotonAuxContainer.
+    EgammaAuxContainer_v1();
+
+  private:
+
+    ///@name vector of links to cluster 
+    /// @{
+
+    std::vector< std::vector< ElementLink< CaloClusterContainer > > > caloClusterLinks;
+
+    /// @}
+
+
+    ///@name IParticle variables
+    /// @{
+    std::vector<float> pt;             
+    std::vector<float> eta;           
+    std::vector<float> phi;           
+    std::vector<float> m;           
+    /// @}
+
+    ///@name Covariance Matrix
+    /// @{
+    std::vector< std::vector<float> >   EgammaCovarianceMatrix;
+    /// @}
+    
+    ///@name Author
+    /// @{
+    std::vector< uint16_t > author;
+    /// @}
+
+
+    ///@name Data Quality flag
+    /// @{
+    std::vector< uint32_t > OQ;
+    /// @}
+    
+    /// @name Shower shape details
+    /// @{
+    /// @brief uncalibrated energy (sum of cells) in presampler in a 1x1 window in cells in eta X phi
+    std::vector< float >  e011;     
+    /// @brief uncalibrated energy (sum of cells) in presampler in a 3x3 window in cells in eta X phi
+    std::vector< float >  e033;     
+    /// @brief uncalibrated energy (sum of cells) in strips in a 3x2 window in cells in eta X phi
+    std::vector< float >  e132;     
+    /// @brief uncalibrated energy (sum of cells) in strips in a 15x2 window in cells in eta X phi
+    std::vector< float >  e1152;    
+    /// @brief transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated from ehad1
+    std::vector< float >  ethad1;   
+    /// @brief ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling::TileGap3
+    std::vector< float >  ethad;    
+    /// @brief E leakage into 1st sampling of had calo (CaloSampling::HEC0 + CaloSampling::TileBar0 + CaloSampling::TileExt0)
+    std::vector< float >  ehad1;    
+    /// @brief E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belonging to the cluster and E is the total energy reconstructed in the electromagnetic calorimeter cluster
+    std::vector< float >  f1;       
+    /// @brief fraction of energy reconstructed in 3rd sampling
+    std::vector< float >  f3;       
+    /// @brief E1(3x1)/E = fraction of the energy reconstructed in the first longitudinal compartment of the electromagnetic calorimeter, where E1(3x1) the energy reconstructed in +/-3 strips in eta, centered around the maximum energy strip and E is the energy reconstructed in the electromagnetic calorimeter
+    std::vector< float >  f1core;   
+    /// @brief E3(3x3)/E fraction of the energy reconstructed in the third compartment of the electromagnetic calorimeter, where E3(3x3), energy in the back sampling, is the sum of the energy contained in a 3x3 window around the maximum energy cell
+    std::vector< float >  f3core;   
+    /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x3 (in cell units eta X phi)
+    std::vector< float >  e233;     
+    /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x5
+    std::vector< float >  e235;     
+    /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 5x5
+    std::vector< float >  e255;     
+    /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
+    std::vector< float >  e237;     
+    /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
+    std::vector< float >  e277;     
+    /// @brief uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x3
+    std::vector< float >  e333;     
+    /// @brief uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x5
+    std::vector< float >  e335;     
+    /// @brief uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x7
+    std::vector< float >  e337;     
+    /// @brief uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
+    std::vector< float >  e377;     
+    /// @brief shower width using +/-3 strips around the one with the maximal energy deposit: 
+    ///	w3 strips = sqrt{sum(Ei)x(i-imax)^2/sum(Ei)}, where i is the number of the strip and imax the strip number of the most energetic one 
+    std::vector< float >  weta1;    
+    /// @brief the lateral width is calculated with a window of 3x5 cells using the energy weighted  sum over all cells, which depends on the particle impact point inside the cell: weta2 = 
+    ///	sqrt(sum Ei x eta^2)/(sum Ei) -((sum Ei x eta)/(sum Ei))^2, where Ei is the energy of the i-th cell 
+    std::vector< float >  weta2;    
+    /// @brief 2nd max in strips calc by summing 3 strips
+    std::vector< float >  e2ts1;    
+    /// @brief energy of the cell corresponding to second energy maximum in the first sampling
+    std::vector< float >  e2tsts1;  
+    /// @brief shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n) is the energy in ± n strips around the strip with highest energy
+    std::vector< float >  fracs1;   
+    /// @brief same as egammaParameters::weta1 but without corrections  on particle impact point inside the cell
+    std::vector< float >  widths1;  
+    /// @brief same as egammaParameters::weta2 but without corrections on particle impact point inside the cell
+    std::vector< float >  widths2;  
+    /// @brief relative position in eta within cell in 1st sampling 
+    std::vector< float >  poscs1;   
+    /// @brief relative position in eta within cell in 2nd sampling
+    std::vector< float >  poscs2;   
+    /// @brief uncorr asymmetry in 3 strips in the 1st sampling 
+    std::vector< float >  asy1;     
+    /// @brief difference between shower cell and predicted track in +/- 1 cells
+    std::vector< float >  pos; 
+    /// @brief Difference between the track and the shower positions: 
+    ///	sum_{i=i_m-7}^{i=i_m+7}E_i x (i-i_m) / sum_{i=i_m-7}^{i=i_m+7}E_i, 
+    ///	The difference between the track and the shower positions measured 
+    ///	in units of distance between the strips, where i_m is the impact cell 
+    ///	for the track reconstructed in the inner detector and E_i is the energy 
+    ///	reconstructed in the i-th cell in the eta direction for constant phi given by the track parameters
+    std::vector< float >  pos7; 
+    /// @brief  barycentre in sampling 1 calculated in 3 strips
+    std::vector< float >  barys1;   
+    /// @brief shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips in eta : wtot1=sqrt{sum Ei x ( i-imax)^2 / sum Ei}, where i is the strip number and imax the strip number of the first local maximum
+    std::vector< float >  wtots1;   
+    /// @brief energy reconstructed in the strip with the minimal value between the first and second maximum
+    std::vector< float >  emins1;   
+    /// @brief energy of strip with maximal energy deposit
+    std::vector< float >  emaxs1;     
+    /// @brief  1-ratio of energy in 3x3 over 3x7 cells; 
+    ///	E(3x3) = E0(1x1) + E1(3x1) + E2(3x3) + E3(3x3); E(3x7) = E0(3x3) + E1(15x3) + E2(3x7) + E3(3x7)
+    std::vector< float > r33over37allcalo;     
+    /// @brief core energy in em calo  E(core) = E0(3x3) + E1(15x2) + E2(5x5) + E3(3x5)
+    std::vector< float > ecore;
+    /// @brief pointing z at vertex reconstructed from the cluster
+    std::vector< float > zvertex;
+    /// @brief error associated to zvertex 
+    std::vector< float > errz;
+    /// @brief pointing eta reconstructed from the cluster (first and second sampling)
+    std::vector< float > etap; 
+    /// @brief pointing depth of the shower as calculated in egammaqgcld
+    std::vector< float > depth;
+    /// @}
+
+  
+    /// @name Isolation variables
+    /// @{
+    /// @brief ET in a cone of R=0.45 in calo, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+    std::vector< float >  etcone;   
+    /// @brief ET in a cone with half-opening angle 0.15, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+    std::vector< float >  etcone15; 
+    /// @brief ET in a cone with half-opening angle 0.2, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+    std::vector< float >  etcone20; 
+    /// @brief ET in a cone with half-opening angle 0.25, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+    std::vector< float >  etcone25; 
+    /// @brief ET in a cone with half-opening angle 0.3, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3 
+    std::vector< float >  etcone30; 
+    /// @brief ET in a cone with half-opening angle 0.35, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+    std::vector< float >  etcone35; 
+    /// @brief ET in a cone with half-opening angle 0.4, with exclusion of a window of size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+    std::vector< float >  etcone40; 
+    /// @brief summed pt of tracks in a cone with half-opening angle 0.2 (no zvx cut photons, 1mm electrons) 
+    std::vector< float > ptcone20;
+    /// @brief summed pt of tracks in a cone with half-opening angle 0.3
+    std::vector< float > ptcone30;
+    /// @brief summed pt of tracks in a cone with half-opening angle 0.4
+    std::vector< float > ptcone40;
+    /// @brief number of tracks in a cone with half-opening angle 0.2
+    std::vector< float > nucone20;
+    /// @brief number of tracks in a cone with half-opening angle 0.3
+    std::vector< float > nucone30;
+    /// @brief number of tracks in a cone with half-opening angle 0.4
+    std::vector< float > nucone40;
+    /// @brief pt corrected ET in a cone with half-opening angle 0.15 
+    std::vector< float >  etcone15_ptcorrected;
+    /// @brief pt corrected ET in a cone with half-opening angle 0.2 
+    std::vector< float >  etcone20_ptcorrected;
+    /// @brief pt corrected ET in a cone with half-opening angle 0.25 
+    std::vector< float >  etcone25_ptcorrected;
+    /// @brief pt corrected ET in a cone with half-opening angle 0.3 
+    std::vector< float >  etcone30_ptcorrected;
+    /// @brief pt corrected ET in a cone with half-opening angle 0.35 
+    std::vector< float >  etcone35_ptcorrected;
+    /// @brief ptcorrected ET in a cone with half-opening angle 0.4 
+    std::vector< float >  etcone40_ptcorrected;
+    /// @brief pt + ED corrected ET in a cone with half-opening angle 0.2 
+    std::vector< float >  etcone20_corrected;
+    /// @brief pt + ED corrected ET in a cone with half-opening angle 0.3 
+    std::vector< float >  etcone30_corrected;
+    /// @brief pt + ED corrected ET in a cone with half-opening angle 0.4 
+    std::vector< float >  etcone40_corrected;
+    //et cone for topo cluster 
+    /// @brief ET in a cone with half-opening angle 0.20 
+    std::vector< float >  topoetcone20;
+    /// @brief ET in a cone with half-opening angle 0.30 
+    std::vector< float >  topoetcone30;
+    /// @brief ET in a cone with half-opening angle 0.40 
+    std::vector< float >  topoetcone40;
+    /// @brief pt corrected ET in a cone with half-opening angle 0.40 
+    std::vector< float >  topoetcone40_ptcorrected;
+    /// @brief fully corrected ET in a cone with half-opening angle 0.40 
+    std::vector< float >  topoetcone40_corrected;
+    /// @}
+
+  }; // class EgammaAuxContainer_v1
+
+} // namespace xAOD
+
+// Set up a CLID and StoreGate inheritance for the class:
+#ifndef XAOD_STANDALONE
+#include "SGTools/CLASS_DEF.h"
+CLASS_DEF( xAOD::EgammaAuxContainer_v1 , 1239597298 , 1 )
+#include "SGTools/BaseInfo.h"
+SG_BASE( xAOD::EgammaAuxContainer_v1, xAOD::AuxContainerBase );
+#endif // not XAOD_STANDALONE
+
+#endif // XAODEGAMMA_VERSIONS_EGAMMAAUXCONTAINER_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaAuxVariables_v2.def b/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaAuxVariables_v2.def
new file mode 100644
index 0000000000000000000000000000000000000000..73d784dd21b31196c245079905372189e40409d7
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaAuxVariables_v2.def
@@ -0,0 +1,268 @@
+// Dear emacs, this is -*- c++ -*-
+//
+// This file is used to describe the common variables used by
+// ElectronAuxContainer_v1 and PhotonAuxContainer_v1. It's not a
+// standalone header! It only becomes meaningful C++ code when a
+// proper definition of EGAMMA_AUX_VARIABLE(...) is available.
+//
+// There are no header guards protecting the file against multiple
+// inclusion, as in some cases it may need to be included multiple
+// times. (For instance when one piece of code ends up using both
+// ElectronAuxContainer and PhotonAuxContainer at the same time.)
+//
+
+///@name vector of links to cluster 
+/// @{
+
+EGAMMA_AUX_VARIABLE( std::vector< std::vector< ElementLink< CaloClusterContainer > > >,
+                     caloClusterLinks );
+
+/// @}
+
+///@name IParticle variables
+/// @{
+
+EGAMMA_AUX_VARIABLE( std::vector< float >, pt );
+EGAMMA_AUX_VARIABLE( std::vector< float >, eta );
+EGAMMA_AUX_VARIABLE( std::vector< float >, phi );
+EGAMMA_AUX_VARIABLE( std::vector< float >, m );
+
+/// @}
+
+///@name Covariance Matrix
+/// @{
+
+EGAMMA_AUX_VARIABLE( std::vector< std::vector< float > >,
+                     EgammaCovarianceMatrix );
+
+/// @}
+    
+///@name Author
+/// @{
+
+EGAMMA_AUX_VARIABLE( std::vector< uint16_t >, author );
+
+/// @}
+
+///@name Data Quality flag
+/// @{
+
+EGAMMA_AUX_VARIABLE( std::vector< uint32_t >, OQ );
+
+/// @}
+    
+/// @name Shower shape details
+/// @{
+
+/// Uncalibrated energy (sum of cells) in presampler in a 1x1 window in
+/// cells in eta X phi
+EGAMMA_AUX_VARIABLE( std::vector< float >, e011 );
+/// Uncalibrated energy (sum of cells) in presampler in a 3x3 window in
+/// cells in eta X phi
+EGAMMA_AUX_VARIABLE( std::vector< float >, e033 );
+/// Uncalibrated energy (sum of cells) in strips in a 3x2 window in cells
+/// in eta X phi
+EGAMMA_AUX_VARIABLE( std::vector< float >, e132 );
+/// Uncalibrated energy (sum of cells) in strips in a 15x2 window in cells
+/// in eta X phi
+EGAMMA_AUX_VARIABLE( std::vector< float >, e1152 );
+/// Transverse energy in the first sampling of the hadronic calorimeters
+/// behind the cluster calculated from ehad1
+EGAMMA_AUX_VARIABLE( std::vector< float >, ethad1 );
+/// E<sub>T</sub> leakage into hadronic calorimeter with exclusion of energy
+/// in CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, ethad );
+/// E leakage into 1st sampling of had calo (CaloSampling::HEC0 +
+/// CaloSampling::TileBar0 + CaloSampling::TileExt0)
+EGAMMA_AUX_VARIABLE( std::vector< float >, ehad1 );
+/// E1/E = fraction of energy reconstructed in the first sampling, where E1 is
+/// energy in all strips belonging to the cluster and E is the total energy
+/// reconstructed in the electromagnetic calorimeter cluster
+EGAMMA_AUX_VARIABLE( std::vector< float >, f1 );
+/// Fraction of energy reconstructed in 3rd sampling
+EGAMMA_AUX_VARIABLE( std::vector< float >, f3 );
+/// E1(3x1)/E = fraction of the energy reconstructed in the first longitudinal
+/// compartment of the electromagnetic calorimeter, where E1(3x1) the energy
+/// reconstructed in +/-3 strips in eta, centered around the maximum energy
+/// strip and E is the energy reconstructed in the electromagnetic calorimeter
+EGAMMA_AUX_VARIABLE( std::vector< float >, f1core );
+/// E3(3x3)/E fraction of the energy reconstructed in the third compartment of
+/// the electromagnetic calorimeter, where E3(3x3), energy in the back
+/// sampling, is the sum of the energy contained in a 3x3 window around the
+/// maximum energy cell
+EGAMMA_AUX_VARIABLE( std::vector< float >, f3core );
+/// Uncalibrated energy (sum of cells) of the middle sampling in a rectangle
+/// of size 3x3 (in cell units eta X phi)
+EGAMMA_AUX_VARIABLE( std::vector< float >, e233 );
+/// Uncalibrated energy (sum of cells) of the middle sampling in a rectangle
+/// of size 3x5
+EGAMMA_AUX_VARIABLE( std::vector< float >, e235 );
+/// Uncalibrated energy (sum of cells) of the middle sampling in a rectangle
+/// of size 5x5
+EGAMMA_AUX_VARIABLE( std::vector< float >, e255 );
+/// Uncalibrated energy (sum of cells) of the middle sampling in a rectangle
+/// of size 3x7
+EGAMMA_AUX_VARIABLE( std::vector< float >, e237 );
+/// Uncalibrated energy (sum of cells) of the middle sampling in a rectangle
+/// of size 7x7
+EGAMMA_AUX_VARIABLE( std::vector< float >, e277 );
+/// Uncalibrated energy (sum of cells) of the third sampling in a rectangle
+/// of size 3x3
+EGAMMA_AUX_VARIABLE( std::vector< float >, e333 );
+/// Uncalibrated energy (sum of cells) of the third sampling in a rectangle
+/// of size 3x5
+EGAMMA_AUX_VARIABLE( std::vector< float >, e335 );
+/// Uncalibrated energy (sum of cells) of the third sampling in a rectangle
+/// of size 3x7
+EGAMMA_AUX_VARIABLE( std::vector< float >, e337 );
+/// Uncalibrated energy (sum of cells) of the middle sampling in a rectangle
+/// of size 7x7
+EGAMMA_AUX_VARIABLE( std::vector< float >, e377 );
+/// Shower width using +/-3 strips around the one with the maximal energy
+/// deposit: 
+///	w3 strips = sqrt{sum(Ei)x(i-imax)^2/sum(Ei)},
+/// where i is the number of the strip and imax the strip number of the most
+/// energetic one 
+EGAMMA_AUX_VARIABLE( std::vector< float >, weta1 );
+/// The lateral width is calculated with a window of 3x5 cells using the
+/// energy weighted  sum over all cells, which depends on the particle impact
+/// point inside the cell:
+///   weta2 = sqrt(sum Ei x eta^2)/(sum Ei) -((sum Ei x eta)/(sum Ei))^2,
+/// where Ei is the energy of the i-th cell 
+EGAMMA_AUX_VARIABLE( std::vector< float >, weta2 );
+/// 2nd max in strips calc by summing 3 strips
+EGAMMA_AUX_VARIABLE( std::vector< float >, e2ts1 );
+/// Energy of the cell corresponding to second energy maximum in the first
+/// sampling
+EGAMMA_AUX_VARIABLE( std::vector< float >, e2tsts1 );
+/// Shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n)
+/// is the energy in ± n strips around the strip with highest energy
+EGAMMA_AUX_VARIABLE( std::vector< float >, fracs1 );
+/// Same as egammaParameters::weta1 but without corrections on particle impact
+/// point inside the cell
+EGAMMA_AUX_VARIABLE( std::vector< float >, widths1 );
+/// Same as egammaParameters::weta2 but without corrections on particle impact
+/// point inside the cell
+EGAMMA_AUX_VARIABLE( std::vector< float >, widths2 );
+/// Relative position in eta within cell in 1st sampling 
+EGAMMA_AUX_VARIABLE( std::vector< float >,  poscs1 );
+/// Relative position in eta within cell in 2nd sampling
+EGAMMA_AUX_VARIABLE( std::vector< float >, poscs2 );
+/// Uncorr asymmetry in 3 strips in the 1st sampling 
+EGAMMA_AUX_VARIABLE( std::vector< float >, asy1 );
+/// Difference between shower cell and predicted track in +/- 1 cells
+EGAMMA_AUX_VARIABLE( std::vector< float >, pos );
+/// Difference between the track and the shower positions: 
+///	sum_{i=i_m-7}^{i=i_m+7}E_i x (i-i_m) / sum_{i=i_m-7}^{i=i_m+7}E_i, 
+///	The difference between the track and the shower positions measured 
+///	in units of distance between the strips, where i_m is the impact cell 
+///	for the track reconstructed in the inner detector and E_i is the energy
+///	reconstructed in the i-th cell in the eta direction for constant phi
+///   given by the track parameters
+EGAMMA_AUX_VARIABLE( std::vector< float >, pos7 );
+/// Barycentre in sampling 1 calculated in 3 strips
+EGAMMA_AUX_VARIABLE( std::vector< float >, barys1 );
+/// Shower width is determined in a window detaxdphi = 0,0625 ×~0,2,
+/// corresponding typically to 20 strips in eta :
+///   wtot1=sqrt{sum Ei x ( i-imax)^2 / sum Ei},
+/// where i is the strip number and imax the strip number of the first local
+/// maximum
+EGAMMA_AUX_VARIABLE( std::vector< float >, wtots1 );
+/// Energy reconstructed in the strip with the minimal value between the first
+/// and second maximum
+EGAMMA_AUX_VARIABLE( std::vector< float >, emins1 );
+/// Energy of strip with maximal energy deposit
+EGAMMA_AUX_VARIABLE( std::vector< float >, emaxs1 );
+/// 1-ratio of energy in 3x3 over 3x7 cells; 
+///	E(3x3) = E0(1x1) + E1(3x1) + E2(3x3) + E3(3x3); E(3x7) =
+///      E0(3x3) + E1(15x3) + E2(3x7) + E3(3x7)
+EGAMMA_AUX_VARIABLE( std::vector< float >, r33over37allcalo );
+/// Core energy in em calo  E(core) = E0(3x3) + E1(15x2) + E2(5x5) + E3(3x5)
+EGAMMA_AUX_VARIABLE( std::vector< float >, ecore );
+/// Pointing z at vertex reconstructed from the cluster
+EGAMMA_AUX_VARIABLE( std::vector< float >, zvertex );
+/// Error associated to zvertex 
+EGAMMA_AUX_VARIABLE( std::vector< float >, errz );
+/// Pointing eta reconstructed from the cluster (first and second sampling)
+EGAMMA_AUX_VARIABLE( std::vector< float >, etap );
+/// Pointing depth of the shower as calculated in egammaqgcld
+EGAMMA_AUX_VARIABLE( std::vector< float >, depth );
+
+/// @}
+
+/// @name Isolation variables
+/// @{
+
+/// E<sub>T</sub> in a cone of R=0.45 in calo, with exclusion of a window of
+/// size 7x5 in electromagnetic calorimeter and exclude CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone );
+/// E<sub>T</sub> in a cone with half-opening angle 0.15, with exclusion of a
+/// window of size 7x5 in electromagnetic calorimeter and exclude
+/// CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone15 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.2, with exclusion of a
+/// window of size 7x5 in electromagnetic calorimeter and exclude
+/// CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone20 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.25, with exclusion of a
+/// window of size 7x5 in electromagnetic calorimeter and exclude
+/// CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone25 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.3, with exclusion of a
+/// window of size 7x5 in electromagnetic calorimeter and exclude
+/// CaloSampling::TileGap3 
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone30 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.35, with exclusion of a
+/// window of size 7x5 in electromagnetic calorimeter and exclude
+/// CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone35 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.4, with exclusion of a
+/// window of size 7x5 in electromagnetic calorimeter and exclude
+/// CaloSampling::TileGap3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone40 );
+/// Summed p<sub>T</sub> of tracks in a cone with half-opening angle 0.2
+/// (no zvx cut photons, 1mm electrons) 
+EGAMMA_AUX_VARIABLE( std::vector< float >, ptcone20 );
+/// Summed p<sub>T</sub> of tracks in a cone with half-opening angle 0.3
+EGAMMA_AUX_VARIABLE( std::vector< float >, ptcone30 );
+/// Summed p<sub>T</sub> of tracks in a cone with half-opening angle 0.4
+EGAMMA_AUX_VARIABLE( std::vector< float >, ptcone40 );
+/// Number of tracks in a cone with half-opening angle 0.2
+EGAMMA_AUX_VARIABLE( std::vector< float >, nucone20 );
+/// Number of tracks in a cone with half-opening angle 0.3
+EGAMMA_AUX_VARIABLE( std::vector< float >, nucone30 );
+/// Number of tracks in a cone with half-opening angle 0.4
+EGAMMA_AUX_VARIABLE( std::vector< float >, nucone40 );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.15
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone15_ptcorrected );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.2 
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone20_ptcorrected );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.25 
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone25_ptcorrected );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.3 
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone30_ptcorrected );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.35 
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone35_ptcorrected );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.4
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone40_ptcorrected );
+/// p<sub>T</sub> + ED corrected E<sub>T</sub> in a cone with half-opening
+/// angle 0.2
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone20_corrected );
+/// p<sub>T</sub> + ED corrected E<sub>T</sub> in a cone with half-opening
+/// angle 0.3
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone30_corrected );
+/// p<sub>T</sub> + ED corrected E<sub>T</sub> in a cone with half-opening
+/// angle 0.4
+EGAMMA_AUX_VARIABLE( std::vector< float >, etcone40_corrected );
+/// E<sub>T</sub> in a cone with half-opening angle 0.20 
+EGAMMA_AUX_VARIABLE( std::vector< float >, topoetcone20 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.30 
+EGAMMA_AUX_VARIABLE( std::vector< float >, topoetcone30 );
+/// E<sub>T</sub> in a cone with half-opening angle 0.40 
+EGAMMA_AUX_VARIABLE( std::vector< float >, topoetcone40 );
+/// p<sub>T</sub> corrected E<sub>T</sub> in a cone with half-opening angle 0.4
+EGAMMA_AUX_VARIABLE( std::vector< float >, topoetcone40_ptcorrected );
+/// Fully corrected E<sub>T</sub> in a cone with half-opening angle 0.4
+EGAMMA_AUX_VARIABLE( std::vector< float >, topoetcone40_corrected );
+
+/// @}
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaContainer_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaContainer_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..9fa63ff23f5e3dc65abb4c467e29f4cbc6d5a515
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/EgammaContainer_v1.h
@@ -0,0 +1,32 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: EgammaContainer_v1.h 581559 2014-02-05 10:54:05Z krasznaa $
+#ifndef XAODEGAMMA_VERSIONS_EGAMMACONTAINER_V1_H
+#define XAODEGAMMA_VERSIONS_EGAMMACONTAINER_V1_H
+
+// Core include(s):
+#include "AthContainers/DataVector.h"
+#include "xAODBase/IParticleContainer.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/Egamma_v1.h"
+
+// Declare IParticle as a base class of Egamma_v1:
+DATAVECTOR_BASE( xAOD::Egamma_v1, xAOD::IParticle );
+
+namespace xAOD {
+   /// The container is a simple typedef for now
+   typedef DataVector< xAOD::Egamma_v1 > EgammaContainer_v1;
+}
+
+// Set up a CLID for the container:
+#ifndef XAOD_STANDALONE
+#include "SGTools/CLASS_DEF.h"
+CLASS_DEF( xAOD::EgammaContainer_v1 , 1087548811 , 1 )
+#endif // XAOD_STANDALONE
+
+#endif // XAODEGAMMA_VERSIONS_EGAMMACONTAINER_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/Egamma_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/Egamma_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..c45cc5bec6393433a3793e6353294a269d31c30c
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/Egamma_v1.h
@@ -0,0 +1,253 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Egamma_v1.h 612532 2014-08-19 14:07:39Z christos $
+#ifndef XAODEGAMMA_VERSIONS_EGAMMA_V1_H
+#define XAODEGAMMA_VERSIONS_EGAMMA_V1_H
+
+// Core include(s):
+#include "AthLinks/ElementLink.h"
+
+// ROOT include(s):
+#include <Math/SMatrix.h>
+
+// xAOD include(s):
+#include "xAODBase/IParticle.h"
+
+//Egamma includes
+#include "xAODEgamma/EgammaDefs.h"
+#include "xAODEgamma/EgammaEnums.h"
+//CaloCluster include
+#include  "xAODCaloEvent/CaloCluster.h" 
+#include  "xAODCaloEvent/CaloClusterContainer.h" 
+
+#include <stdint.h>
+
+//Eigen/Amg includes , prefer to do it via EventPrimitives for now
+#include "EventPrimitives/EventPrimitives.h"
+
+namespace xAOD {
+
+  /// @class xAOD::Egamma
+  /// @brief  Class describing an e/gamma 
+  /// @name xAOD::Egamma provides a  public interface.
+  /// @name xAOD::Electron and xAOD::Photon inherit from this class
+  ///
+  /// @author Christos Anastopoulos
+  /// @author Anthony Morley
+  /// @author Jovan Mitrevski
+  ///
+  /// $Revision: 612532 $
+  /// $Date: 2014-08-19 16:07:39 +0200 (Tue, 19 Aug 2014) $
+  ///
+  class Egamma_v1 :public IParticle {
+
+  protected:
+    /// @name xAOD::Egamma constructors
+    /// The xAOD::Egamma is not supposed to be created directly, only via xAOD::Electron and xAOD::Photon.
+    /// xAOD::Egamma is an abstract class. It does not define the type() pure virtual function from IParticle 
+    /// The default constructors is protected
+
+    /// @{
+
+    /// Default constructor
+    Egamma_v1();
+
+    /// Copy constructor (default implementation)
+    Egamma_v1(const Egamma_v1& eg );
+    /// @}
+
+  public:
+
+    /// @name xAOD::Egamma Assignment operator
+    /// @{
+
+    /// Assignment Operator. Using the assignment of SG::AuxElement.
+    Egamma_v1& operator=(const Egamma_v1& eg);
+
+    /// @}
+
+
+    /// @name xAOD::IParticle functions
+    /// These are already virtual due to IParticle
+    /// @{
+    
+    /// @brief The transverse momentum (\f$p_T\f$) of the particle
+    virtual double           pt() const  /*override*/;
+
+    /// @brief The pseudorapidity (\f$\eta\f$) of the particle
+    virtual double           eta() const /*override*/;
+
+    /// @brief The azimuthal angle (\f$\phi\f$) of the particle
+    virtual double           phi() const /*override*/;
+
+    /// @brief The invariant mass of the particle
+    virtual double           m() const /*override*/;
+
+    /// The total energy of the particle
+    virtual double           e() const  /*override*/;
+
+    /// @brief The true rapidity (y) of the particle
+    virtual double           rapidity() const /*override*/;
+    
+    /// @brief Definition of the 4-momentum type
+    typedef IParticle::FourMom_t FourMom_t;
+
+    /// @brief The full 4-momentum of the particle as a TLoretzVector
+    virtual const FourMom_t& p4() const /*override*/;
+
+    /// @brief The type of the object as a simple enumeration, remains pure virtual in e/gamma.
+    virtual Type::ObjectType type() const /*override*/ =0 ; 
+    
+    /// @}
+
+
+    /// @name xAOD::Egamma 4-Mom functions
+    /// @{
+    
+    /// @brief set the 4-vec
+    void setP4(float pt, float eta, float phi, float m);
+
+    /// @brief set the Pt
+    void setPt(float pt);
+
+    ///  @brief set the eta
+    void setEta(float eta);
+
+    /// @brief set the phi
+    void setPhi(float phi);
+
+    /// @brief set the Mass
+    void setM(float m);
+    
+    /// @}
+   
+    /// @name xAOD::Egamma 4x4 Covariance Matrix
+    /// @{ 
+
+    ///4x4 Covariance Matrix in EtEtaPhiM (needs decision)
+    typedef Eigen::Matrix<float,4,4>    EgammaCovMatrix_t;
+
+    /// Returns the 4x4 symmetric covariance matrix .
+    EgammaCovMatrix_t covMatrix() const;  
+
+    /// set the 4x4 symmetric covariance matrix .
+    void setCovMatrix(const EgammaCovMatrix_t& cov);
+    /// @} 
+
+    /// @name xAOD::Egamma Pointer to CaloClusters
+    /// @{ 
+
+    /// @brief Return the number of xAOD::CaloClusters that define the electron
+    ///        candidate
+    size_t nCaloClusters() const; 
+
+    /// @brief  Pointer to the xAOD::CaloCluster/s that define the electron
+    ///         candidate
+    const xAOD::CaloCluster* caloCluster( size_t index = 0 ) const;
+
+    /// @brief ElementLink to the xAOD::CaloCluster/s that match the electron
+    ///        candidate
+    const ElementLink< CaloClusterContainer >&
+    caloClusterLink( size_t index = 0 ) const; 
+
+    /// Helper type definition
+    typedef std::vector< ElementLink< CaloClusterContainer > > CLELVec_t;
+
+    /// @brief Get all cluster links
+    const CLELVec_t& caloClusterLinks() const;
+    /// @brief set Pointer to the xAOD::CaloCluster  
+    void setCaloClusterLinks( const CLELVec_t& links );
+
+    /// @}
+
+
+    /// @name xAOD::Egamma author (i.e. which reco algorithm was used)
+    /// @{
+
+    /// @brief Get author 
+    uint16_t author(uint16_t bitmask=EgammaParameters::AuthorALL) const;
+
+    /// @brief add author 
+    void addAuthor( uint16_t );
+
+    /// @brief set author 
+    void setAuthor( uint16_t );
+
+    /// @}
+
+   
+    /// @name xAOD::Egamma Shower shape and Isolation Accesors
+    /// If 'information' is stored in this xAOD::Egamma and is of the correct type,
+    /// then the function fills 'value' and returns 'true', otherwise it returns 'false', and does not touch 'value'.
+    ///
+    /// @{    
+
+    /// @brief Accessor for ShowerShape values.
+    bool showerShapeValue(float& value,   const EgammaParameters::ShowerShapeType information) const;
+
+    /// @brief Set method for Shower Shape values.
+    bool setShowerShapeValue(float& value, const EgammaParameters::ShowerShapeType information) ;
+
+    /// @brief Accessor for Isolation values.
+    bool isolationValue(float& value,   const EgammaParameters::IsolationType information) const;
+
+    /// @method for Isolation values.
+    bool setIsolationValue(float& value, const EgammaParameters::IsolationType information);
+
+    /// @}
+    
+    /// @name xAOD::Egamma  object quality of the calorimeter cluster 
+    /// @{    
+    
+    /// @brief  Check object quality
+    bool isGoodOQ(uint32_t mask ) const;
+
+    /// @brief Set the object quality
+    void setOQ(uint32_t newOQ);
+    
+    ///@}
+
+    /// @name xAOD::Egamma selector methods
+    /// @{    
+
+    /// @brief  Check if the egamma object pass a selection menu
+    ///If the menu decision is stored in this xAOD::Egamma,
+    /// then the function fills 'value' and returns 'true', otherwise it returns 'false', 
+    //and does not touch 'value'.
+    bool passSelection(bool& value, const std::string& menu ) const;
+
+    /// @brief Set  if the egamma object pass a selection menu
+    void setPassSelection(bool value, const std::string& menu);
+
+    ///@}
+
+
+
+  private:
+    ///
+
+    /// Cached 4-momentum object
+    mutable FourMom_t m_p4;
+    ///
+
+    /// Cache state of the internal 4-momentum (reset from the streamer)
+    mutable bool m_p4Cached;
+
+      
+    
+  }; // class Egamma
+
+
+} // namespace xAOD
+
+// Set up a CLID for the class:
+#ifndef XAOD_STANDALONE
+#include "SGTools/CLASS_DEF.h"
+CLASS_DEF( xAOD::Egamma_v1 , 237874247 , 1 )
+#endif // not XAOD_STANDALONE
+
+#endif // XAODEGAMMA_VERSIONS_EGAMMA_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronAuxContainer_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronAuxContainer_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..b40bf59deac1aa5ac5ec68084339e7cfd0e2a6ca
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronAuxContainer_v1.h
@@ -0,0 +1,113 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAuxContainer_v1.h 614829 2014-09-03 09:39:36Z krasznaa $
+#ifndef XAODEGAMMA_VERSIONS_ELECTRONAUXCONTAINER_V1_H
+#define XAODEGAMMA_VERSIONS_ELECTRONAUXCONTAINER_V1_H
+
+// System include(s):
+#include <vector>
+#include "xAODEgamma/EgammaDefs.h"
+#include "xAODEgamma/versions/EgammaAuxContainer_v1.h"
+#include "xAODTracking/TrackParticleContainer.h" 
+
+
+namespace xAOD {
+
+
+  /// Temporary container used until we have I/O for AuxStoreInternal
+  ///
+  /// This class is meant to serve as a temporary way to provide an auxiliary
+  /// store with Athena I/O capabilities for the electron EDM. Will be exchanged for
+  /// a generic auxiliary container type (AuxStoreInternal) later on.
+  ///
+  /// @author Christos Anastopoulos
+  /// @author Anthony Morley
+  ///
+  /// $Revision: 614829 $
+  /// $Date: 2014-09-03 11:39:36 +0200 (Wed, 03 Sep 2014) $
+  ///
+
+  class ElectronAuxContainer_v1 : public EgammaAuxContainer_v1 {
+
+
+  public :
+    /// @name xAOD::ElectronAuxContainer constructors
+    ElectronAuxContainer_v1();
+
+  private:
+
+    ///@name vector of links to trackParticles 
+    /// @{
+
+    std::vector< std::vector< ElementLink< TrackParticleContainer > > > trackParticleLinks;   
+
+    /// @}
+
+    ///@name Electron Charge
+    ///@{
+	std::vector<float> charge;
+    ///@}
+
+    /// @name Track Match details
+    /// @{
+
+    /// @brief difference between the cluster eta (presampler) and
+    ///the eta of the track extrapolated to the presampler 
+    std::vector< float > deltaEta0;
+    ///@brief difference between the cluster eta (first sampling) and the eta of the track extrapolated to the first sampling: |eta_stripscluster -eta_ID|, where eta_stripscluster is computed 
+    ///in the first sampling of the electromagnetic calorimeter, where the granularity is very fine, and eta_ID is the pseudo-rapidity of the track extrapolated to the calorimeter 
+    std::vector< float > deltaEta1 ;
+    /// @brief difference between the cluster eta (second sampling) and the eta of the track extrapolated to the second sampling 
+    std::vector< float > deltaEta2 ;
+    /// @brief difference between the cluster eta (3rd sampling) and
+    ///	  the eta of the track extrapolated to the 3rd sampling 
+    std::vector< float >  deltaEta3 ;
+    /// @brief difference between the cluster phi (presampler) and
+    ///	  the eta of the track extrapolated to the presampler 
+    std::vector< float >    deltaPhi0;
+    /// @brief difference between the cluster eta (1st sampling) and
+    ///	  the eta of the track extrapolated to the 1st sampling (strips) 
+    std::vector< float >   deltaPhi1 ;
+    /// @brief difference between the cluster phi (second sampling) and the phi of the track
+    ///	  extrapolated to the second sampling : |phi_middlecluster -phi_ID|, where phi_middlecluster
+    ///	  is computed in the second compartment of the electromagnetic calorimeter and phi_ID is the
+    ///  azimuth of the track extrapolated to the calorimeter 
+    std::vector< float >    deltaPhi2 ;
+    ///@brief difference between the cluster eta (3rd sampling) and
+    ///	  the eta of the track extrapolated to the 3rd sampling 
+    std::vector< float >    deltaPhi3 ;
+    /// @brief difference between the cluster phi (sampling 2) and the
+    /// eta of the track extrapolated from the last measurement point.
+    std::vector< float >  deltaPhiFromLastMeasurement;
+    /// @brief difference between the cluster phi (presampler) and
+    ///	  the eta of the track extrapolated to the presampler  from the perigee with a rescaled
+    /// momentum. 
+    std::vector< float >    deltaPhiRescaled0;
+    /// @brief difference between the cluster eta (1st sampling) and
+    ///	  the eta of the track extrapolated to the 1st sampling (strips) from the perigee with a rescaled
+    /// momentum. 
+    std::vector< float >   deltaPhiRescaled1 ;
+    /// @brief difference between the cluster phi (second sampling) and the phi of the track
+    ///	  extrapolated to the second sampling from the perigee with a rescaled
+    /// momentum. 
+    std::vector< float >    deltaPhiRescaled2 ;
+    ///@brief difference between the cluster eta (3rd sampling) and
+    /// the eta of the track extrapolated to the 3rd sampling from the perigee with a rescaled
+    /// momentum. 
+    std::vector< float >    deltaPhiRescaled3 ;
+
+    ///@}
+
+  }; // class ElectronAuxContainer_v1
+
+} // namespace xAOD
+
+// Set up the StoreGate inheritance for the class:
+#include "xAODCore/BaseInfo.h"
+SG_BASE( xAOD::ElectronAuxContainer_v1, xAOD::EgammaAuxContainer_v1 );
+
+#endif // XAODEGAMMA_VERSIONS_ELECTRONAUXCONTAINER_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronAuxContainer_v2.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronAuxContainer_v2.h
new file mode 100644
index 0000000000000000000000000000000000000000..d69e3859c17f0b928eca1e296f021c1c5efb4f3b
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronAuxContainer_v2.h
@@ -0,0 +1,129 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronAuxContainer_v2.h 614853 2014-09-03 11:40:46Z krasznaa $
+#ifndef XAODEGAMMA_VERSIONS_ELECTRONAUXCONTAINER_V2_H
+#define XAODEGAMMA_VERSIONS_ELECTRONAUXCONTAINER_V2_H
+
+// System include(s):
+#include <vector>
+
+// Core EDM include(s):
+#include "AthLinks/ElementLink.h"
+#include "xAODCore/AuxContainerBase.h"
+
+// xAOD include(s):
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODCaloEvent/CaloClusterContainer.h"
+
+namespace xAOD {
+
+   /// Container holding the payload of the electron container
+   ///
+   /// This is a specific container for xAOD::ElectronCollection, holding all
+   /// the "usual" properties of electron reconstructed in the offline
+   /// software
+   ///
+   /// @author Christos Anastopoulos
+   /// @author Anthony Morley
+   ///
+   /// $Revision: 614853 $
+   /// $Date: 2014-09-03 13:40:46 +0200 (Wed, 03 Sep 2014) $
+   ///
+   class ElectronAuxContainer_v2 : public AuxContainerBase {
+
+   public :
+      /// @name xAOD::ElectronAuxContainer constructor
+      ElectronAuxContainer_v2();
+
+   private:
+      /// Include the egamma variables:
+#define EGAMMA_AUX_VARIABLE( TYPE, NAME ) TYPE NAME
+#include "xAODEgamma/versions/EgammaAuxVariables_v2.def"
+#undef EGAMMA_AUX_VARIABLE
+
+      ///@name vector of links to trackParticles 
+      /// @{
+
+      std::vector< std::vector< ElementLink< TrackParticleContainer > > >
+      trackParticleLinks;   
+
+      /// @}
+
+      ///@name Electron Charge
+      ///@{
+
+      std::vector< float > charge;
+
+      ///@}
+
+      /// @name Track Match details
+      /// @{
+
+      /// Difference between the cluster eta (presampler) and
+      /// the eta of the track extrapolated to the presampler 
+      std::vector< float > deltaEta0;
+      /// Difference between the cluster eta (first sampling) and the eta of
+      /// the track extrapolated to the first sampling:
+      ///   |eta_stripscluster - eta_ID|,
+      /// where eta_stripscluster is computed in the first sampling of the
+      /// electromagnetic calorimeter, where the granularity is very fine,
+      /// and eta_ID is the pseudo-rapidity of the track extrapolated to the
+      /// calorimeter 
+      std::vector< float > deltaEta1;
+      /// Difference between the cluster eta (second sampling) and the eta of
+      /// the track extrapolated to the second sampling 
+      std::vector< float > deltaEta2;
+      /// Difference between the cluster eta (3rd sampling) and
+      /// the eta of the track extrapolated to the 3rd sampling 
+      std::vector< float > deltaEta3;
+      /// Difference between the cluster phi (presampler) and
+      /// the eta of the track extrapolated to the presampler 
+      std::vector< float > deltaPhi0;
+      /// Difference between the cluster eta (1st sampling) and
+      /// the eta of the track extrapolated to the 1st sampling (strips) 
+      std::vector< float > deltaPhi1;
+      /// Difference between the cluster phi (second sampling) and the phi
+      /// of the track extrapolated to the second sampling:
+      ///   |phi_middlecluster - phi_ID|,
+      /// where phi_middlecluster is computed in the second compartment of
+      /// the electromagnetic calorimeter and phi_ID is the
+      /// azimuth of the track extrapolated to the calorimeter 
+      std::vector< float > deltaPhi2;
+      /// Difference between the cluster eta (3rd sampling) and
+      /// the eta of the track extrapolated to the 3rd sampling 
+      std::vector< float > deltaPhi3;
+      /// Difference between the cluster phi (sampling 2) and the
+      /// eta of the track extrapolated from the last measurement point.
+      std::vector< float > deltaPhiFromLastMeasurement;
+      /// Difference between the cluster phi (presampler) and
+      /// the eta of the track extrapolated to the presampler from the
+      /// perigee with a rescaled momentum. 
+      std::vector< float > deltaPhiRescaled0;
+      /// Difference between the cluster eta (1st sampling) and
+      /// the eta of the track extrapolated to the 1st sampling (strips)
+      /// from the perigee with a rescaled momentum. 
+      std::vector< float > deltaPhiRescaled1;
+      /// Difference between the cluster phi (second sampling) and the phi
+      /// of the track extrapolated to the second sampling from the perigee
+      /// with a rescaled momentum. 
+      std::vector< float > deltaPhiRescaled2;
+      /// Difference between the cluster eta (3rd sampling) and
+      /// the eta of the track extrapolated to the 3rd sampling from the
+      /// perigee with a rescaled momentum. 
+      std::vector< float > deltaPhiRescaled3;
+
+      /// @}
+
+   }; // class ElectronAuxContainer_v2
+
+} // namespace xAOD
+
+// Set up the StoreGate inheritance for the class:
+#include "xAODCore/BaseInfo.h"
+SG_BASE( xAOD::ElectronAuxContainer_v2, xAOD::AuxContainerBase );
+
+#endif // XAODEGAMMA_VERSIONS_ELECTRONAUXCONTAINER_V2_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronContainer_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronContainer_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..37ef3c6b3d0548ccc56f9ee9314f01de9c5f6b4b
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/ElectronContainer_v1.h
@@ -0,0 +1,26 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ElectronContainer_v1.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_VERSIONS_ELECTRONCONTAINER_V1_H
+#define XAODEGAMMA_VERSIONS_ELECTRONCONTAINER_V1_H
+
+// Core include(s):
+#include "AthContainers/DataVector.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/Electron_v1.h"
+#include "xAODEgamma/versions/EgammaContainer_v1.h"
+
+// Declare EGamma_v1 as a base class of Electron_v1:
+DATAVECTOR_BASE( xAOD::Electron_v1, xAOD::Egamma_v1 );
+
+namespace xAOD {
+   /// The container is a simple typedef for now
+   typedef DataVector< xAOD::Electron_v1 > ElectronContainer_v1;
+}
+
+#endif // XAODEGAMMA_VERSIONS_ELECTRONCONTAINER_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/Electron_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/Electron_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..241dacc9286d85bdd27ee4d877ff52e776c4b78d
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/Electron_v1.h
@@ -0,0 +1,126 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Electron_v1.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_VERSIONS_ELECTRON_V1_H
+#define XAODEGAMMA_VERSIONS_ELECTRON_V1_H
+	
+// Core include(s):
+#include "AthLinks/ElementLink.h"
+
+// xAOD include(s):
+#include "xAODEgamma/versions/Egamma_v1.h"
+//Egamma includes
+#include "xAODEgamma/EgammaEnums.h"
+//Tracking includes
+#include "xAODTracking/TrackingPrimitives.h"
+//TrackParticle Includes
+#include "xAODTracking/TrackParticle.h"
+#include "xAODTracking/TrackParticleContainer.h"
+
+namespace xAOD {
+
+  /// @class xAOD::Electron
+  /// @brief  Class describing an electron  
+  ///
+  /// @author Christos Anastopoulos
+  /// @author Anthony Morley
+  ///
+  /// $Revision: 615077 $
+  /// $Date: 2014-09-04 15:42:41 +0200 (Thu, 04 Sep 2014) $
+  ///
+  class Electron_v1 :public xAOD::Egamma_v1{
+
+  public:
+    /// @name xAOD::Electron constructors
+    /// @{
+
+    /// Default constructor. No store is attached.
+    Electron_v1();
+
+    /// Copy ctor. This involves copying the entire Auxilary store (Deep copy).
+    Electron_v1(const Electron_v1& el);
+
+
+    /// @}
+
+    /// @name xAOD::Electron Assignment
+    /// @{
+
+    /// Assignment Operator. Ends up using the assignment of AuxElement for the store.
+    Electron_v1& operator=(const Electron_v1& el );
+
+    /// @}
+
+    /// @name xAOD::Electron Charge
+    /// @{
+
+    /// @brief  Obtain the charge of the object
+    float charge() const;
+
+    /// @brief set the charge of the object
+    void setCharge(float charge);
+
+    /// @}
+
+    /// @name xAOD::Electron ObjectType
+    /// @{
+
+    /// @brief The type of the object as a simple enumeration
+    virtual Type::ObjectType type() const /*final*/; //Always an Electron.
+
+    /// @}
+
+    /// @name xAOD::Electron Pointers to  TrackParticles
+    /// @{ 
+
+    /// @brief Return the number xAOD::TrackParticles that match the electron
+    /// candidate
+    size_t nTrackParticles() const;
+    
+    /// @brief Pointer to the xAOD::TrackParticle/s that match the electron
+    /// candidate
+    const xAOD::TrackParticle* trackParticle( size_t index = 0 ) const;
+
+    /// @brief ElementLink to the xAOD::TrackParticle/s that match the electron
+    /// candidate
+    const ElementLink< TrackParticleContainer >&
+    trackParticleLink( size_t index = 0 ) const; 
+
+    /// Helper type definition
+    typedef std::vector< ElementLink< TrackParticleContainer > > TPELVec_t;
+
+    /// @brief Get all the track particles
+    const TPELVec_t& trackParticleLinks() const;
+    /// @brief Set the ElementLinks to the xAOD::TrackParticle/s that match the
+    /// electron candidate
+    void setTrackParticleLinks( const TPELVec_t& links );
+
+    /// @}
+
+    /// @name xAOD::Electron to cluster matching values.
+    /// @{ 
+
+    /// Accessor to CaloMatch Values    
+    bool trackCaloMatchValue( float& value, const EgammaParameters::TrackCaloMatchType information ) const;
+    
+    /// Set method for CaloMatch values.
+    bool  setTrackCaloMatchValue( float& value, const EgammaParameters::TrackCaloMatchType information );
+
+    /// Accessor to best matching tracks information
+    bool trackParticleSummaryValue( uint8_t& value, const SummaryType information, int index = 0) const;
+    bool trackParticleSummaryValue( float& value, const SummaryType information, int index =  0) const;
+
+    /// @}
+
+
+  }; // Electron Class
+
+}//  xAOD namespace
+
+
+#endif // XAODEGAMMA_VERSIONS_ELECTRON_V1_H
+
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonAuxContainer_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonAuxContainer_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0b8abd28dd69cefb5d4d1a45b8d33bf525958dc
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonAuxContainer_v1.h
@@ -0,0 +1,80 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAuxContainer_v1.h 614853 2014-09-03 11:40:46Z krasznaa $
+#ifndef XAODEGAMMA_VERSIONS_PHOTONAUXCONTAINER_V1_H
+#define XAODEGAMMA_VERSIONS_PHOTONAUXCONTAINER_V1_H
+
+// System include(s):
+#include <vector>
+
+// EDM include(s):
+#include "AthLinks/ElementLink.h"
+
+// xAOD include(s):
+#include "xAODTracking/VertexContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/EgammaAuxContainer_v1.h"
+
+namespace xAOD {
+
+  /// Auxiliary store for offline photons
+  ///
+  /// This class is used as the auxiliary store for offline reconstructed
+  /// photons.
+  ///
+  /// @author Christos Anastopoulos
+  /// @author Anthony Morley
+  ///
+  /// $Revision: 614853 $
+  /// $Date: 2014-09-03 13:40:46 +0200 (Wed, 03 Sep 2014) $
+  ///
+  class PhotonAuxContainer_v1 : public EgammaAuxContainer_v1 {
+
+  public :
+    /// @name xAOD::PhotonAuxContainer constructors
+    PhotonAuxContainer_v1();
+
+  private:
+    ///@name vector of links to vertexes
+    /// @{
+
+    std::vector< std::vector< ElementLink< VertexContainer > > > vertexLinks;
+
+    /// @}
+
+    /// @name Track Match details
+    /// @{
+    
+    /// @brief difference between the cluster eta  and
+    ///the eta of the first track of the vertex extrapolated to the second sampling.
+    std::vector< float > convMatchDeltaEta1;
+    
+    /// @brief difference between the cluster eta  and
+    ///the eta of the second track of the vertex extrapolated to the second sampling.
+    std::vector< float > convMatchDeltaEta2;
+    
+    /// @brief difference between the cluster phi  and
+    ///the phi of the first track of the vertex extrapolated to the second sampling.
+    std::vector< float > convMatchDeltaPhi1 ;
+    
+    /// @brief difference between the cluster phi  and
+    ///the phi of the second track of the vertex extrapolated to the second sampling.
+    std::vector< float > convMatchDeltaPhi2;
+    
+    ///@}
+
+  }; // class PhotonAuxContainer_v1
+
+} // namespace xAOD
+
+// Set up the StoreGate inheritance for the class:
+#include "xAODCore/BaseInfo.h"
+SG_BASE( xAOD::PhotonAuxContainer_v1, xAOD::EgammaAuxContainer_v1 );
+
+#endif // XAODEGAMMA_VERSIONS_PHOTONAUXCONTAINER_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonAuxContainer_v2.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonAuxContainer_v2.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f240e690b645698ad2cbc6562f1d81a6d962157
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonAuxContainer_v2.h
@@ -0,0 +1,84 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonAuxContainer_v2.h 614853 2014-09-03 11:40:46Z krasznaa $
+#ifndef XAODEGAMMA_VERSIONS_PHOTONAUXCONTAINER_V2_H
+#define XAODEGAMMA_VERSIONS_PHOTONAUXCONTAINER_V2_H
+
+// System include(s):
+#include <vector>
+
+// EDM include(s):
+#include "AthLinks/ElementLink.h"
+
+// xAOD include(s):
+#include "xAODCore/AuxContainerBase.h"
+#include "xAODTracking/VertexContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODCaloEvent/CaloClusterContainer.h"
+
+namespace xAOD {
+
+   /// Auxiliary store for offline photons
+   ///
+   /// This class is used as the auxiliary store for offline reconstructed
+   /// photons.
+   ///
+   /// @author Christos Anastopoulos
+   /// @author Anthony Morley
+   ///
+   /// $Revision: 614853 $
+   /// $Date: 2014-09-03 13:40:46 +0200 (Wed, 03 Sep 2014) $
+   ///
+   class PhotonAuxContainer_v2 : public AuxContainerBase {
+
+   public:
+      /// @name xAOD::PhotonAuxContainer constructors
+      PhotonAuxContainer_v2();
+
+   private:
+      /// Include the egamma variables:
+#define EGAMMA_AUX_VARIABLE( TYPE, NAME ) TYPE NAME
+#include "xAODEgamma/versions/EgammaAuxVariables_v2.def"
+#undef EGAMMA_AUX_VARIABLE
+
+      ///@name vector of links to vertexes
+      /// @{
+
+      std::vector< std::vector< ElementLink< VertexContainer > > > vertexLinks;
+
+      /// @}
+
+      /// @name Track Match details
+      /// @{
+
+      /// Difference between the cluster eta and the eta of the first track of
+      /// the vertex extrapolated to the second sampling.
+      std::vector< float > convMatchDeltaEta1;
+
+      /// Difference between the cluster eta and the eta of the second track of
+      /// the vertex extrapolated to the second sampling.
+      std::vector< float > convMatchDeltaEta2;
+
+      /// Difference between the cluster phi and the phi of the first track of
+      /// the vertex extrapolated to the second sampling.
+      std::vector< float > convMatchDeltaPhi1;
+
+      /// Difference between the cluster phi and the phi of the second track of
+      /// the vertex extrapolated to the second sampling.
+      std::vector< float > convMatchDeltaPhi2;
+
+      ///@}
+
+   }; // class PhotonAuxContainer_v2
+
+} // namespace xAOD
+
+// Set up the StoreGate inheritance for the class:
+#include "xAODCore/BaseInfo.h"
+SG_BASE( xAOD::PhotonAuxContainer_v2, xAOD::AuxContainerBase );
+
+#endif // XAODEGAMMA_VERSIONS_PHOTONAUXCONTAINER_V2_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonContainer_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonContainer_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..1437362f90a6f842157381d5b9e04be5f0710bbb
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/PhotonContainer_v1.h
@@ -0,0 +1,26 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: PhotonContainer_v1.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_VERSIONS_PHOTONCONTAINER_V1_H
+#define XAODEGAMMA_VERSIONS_PHOTONCONTAINER_V1_H
+
+// Core include(s):
+#include "AthContainers/DataVector.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/Photon_v1.h"
+#include "xAODEgamma/versions/EgammaContainer_v1.h"
+
+// Declare the inheritance of Photon_v1:
+DATAVECTOR_BASE( xAOD::Photon_v1, xAOD::Egamma_v1 );
+
+namespace xAOD {
+   /// The container is a simple typedef for now
+   typedef DataVector< xAOD::Photon_v1 > PhotonContainer_v1;
+}
+
+#endif // XAODEGAMMA_VERSIONS_PHOTONCONTAINER_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/versions/Photon_v1.h b/Event/xAOD/xAODEgamma/xAODEgamma/versions/Photon_v1.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8f6a518e3e31e6a18f05d10ec92c04da4d4cd67
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/versions/Photon_v1.h
@@ -0,0 +1,103 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: Photon_v1.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_VERSIONS_PHOTON_V1_H
+#define XAODEGAMMA_VERSIONS_PHOTON_V1_H
+
+// Core include(s):
+#include "AthLinks/ElementLink.h"
+
+// xAOD include(s):
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/Egamma_v1.h"
+
+namespace xAOD {
+
+  /// @class xAOD::Photon
+  /// @brief  Class describing an photon  
+  ///
+  /// @author Christos Anastopoulos
+  /// @author Anthony Morley
+  ///
+  /// $Revision: 615077 $
+  /// $Date: 2014-09-04 15:42:41 +0200 (Thu, 04 Sep 2014) $
+  ///
+  class Photon_v1 :public xAOD::Egamma_v1 {
+
+  public:
+    /// @name xAOD::Photon constructors
+    /// @{
+
+    /// Default constructor
+    Photon_v1();
+
+    /// Copy ctor. This involves copying the entire Auxilary store (Deep copy), and is a slow operation which should be used sparingly.
+    Photon_v1(const Photon_v1& ph);
+
+    /// @}
+
+    /// @name xAOD::Photon Assignment
+    /// @{
+
+    /// Assignment Operator. Ends up using the assignment of AuxElement for the store.
+    Photon_v1& operator=(const Photon_v1& el );
+
+    /// @}
+
+    /// @name xAOD::Photon ObjectType
+    /// @{
+
+    /// @brief The type of the object as a simple enumeration
+    virtual Type::ObjectType type() const /*final*/; //Always a Photon .
+    /// @}
+
+    /// @name xAOD::vertex Pointers to  vertices
+    /// @{
+
+    /// @brief Pointer to the xAOD::Vertex/es that match the photon candidate
+    const xAOD::Vertex* vertex( size_t index = 0 ) const; 
+
+    /// @brief ElementLink to the xAOD::vertex/es that match the electron
+    ///        candidate
+    const ElementLink< VertexContainer >& vertexLink( size_t index = 0 ) const;
+
+    /// Helper type definition
+    typedef std::vector< ElementLink< VertexContainer > > VxELVec_t;
+
+    /// @brief Get all vertex links
+    const VxELVec_t& vertexLinks() const;
+    /// @brief set Pointer to the xAOD::vertex/vertices that match  the
+    ///        photon candidate
+    void setVertexLinks( const VxELVec_t& links );
+
+    /// @brief Return the number xAOD::Vertex/vertices  that match the photon
+    ///        candidate
+    size_t nVertices() const;
+
+    /// @}
+
+    /// @name xAOD::Photon to cluster matching values.
+    /// @{ 
+
+    /// Accessor to CaloMatch Values
+    bool vertexCaloMatchValue( float& value, const EgammaParameters::VertexCaloMatchType information ) const;
+    
+    /// Set method for CaloMatch values.
+    bool  setVertexCaloMatchValue( float& value, const EgammaParameters::VertexCaloMatchType information );
+    /// @}
+
+
+  }; // Photon Class
+
+}//  xAOD namespace
+
+
+#endif // XAODEGAMMA_VERSIONS_PHOTON_V1_H
diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h b/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h
new file mode 100644
index 0000000000000000000000000000000000000000..09decccf2f28c118629bebdeae4c94d6eac91dc9
--- /dev/null
+++ b/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h
@@ -0,0 +1,80 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: xAODEgammaDict.h 615077 2014-09-04 13:42:41Z schaffer $
+#ifndef XAODEGAMMA_XAODEGAMMADICT_H
+#define XAODEGAMMA_XAODEGAMMADICT_H
+
+// Needed to successfully generate the dictionary in standalone mode:
+#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE)
+#   define EIGEN_DONT_VECTORIZE
+#endif // __GCCXML__
+
+// STL include(s):
+#include <vector>
+
+// EDM include(s):
+#include "AthLinks/DataLink.h"
+#include "AthLinks/ElementLink.h"
+#include "AthLinks/ElementLinkVector.h"
+
+// Local include(s):
+#include "xAODEgamma/versions/EgammaContainer_v1.h"
+#include "xAODEgamma/versions/EgammaAuxContainer_v1.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/versions/ElectronContainer_v1.h"
+#include "xAODEgamma/versions/ElectronAuxContainer_v1.h"
+#include "xAODEgamma/versions/ElectronAuxContainer_v2.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODEgamma/versions/PhotonContainer_v1.h"
+#include "xAODEgamma/versions/PhotonAuxContainer_v1.h"
+#include "xAODEgamma/versions/PhotonAuxContainer_v2.h"
+#include "xAODEgamma/EgammaxAODHelpers.h"
+#include "xAODEgamma/ElectronxAODHelpers.h"
+#include "xAODEgamma/EgammaEnums.h"
+#include "xAODEgamma/EgammaDefs.h"
+
+namespace {
+   struct GCCXML_DUMMY_INSTANTIATION_XAODEGAMMA {
+      xAOD::EgammaContainer_v1 eg_c1;
+      DataLink< xAOD::EgammaContainer_v1 > eg_l1;
+      ElementLink< xAOD::EgammaContainer_v1 > eg_l2;
+      ElementLinkVector< xAOD::EgammaContainer_v1 > eg_l3;
+      std::vector< DataLink< xAOD::EgammaContainer_v1 > > eg_l4;
+      std::vector< ElementLink< xAOD::EgammaContainer_v1 > > eg_l5;
+      std::vector< ElementLinkVector< xAOD::EgammaContainer_v1 > > eg_l6;
+
+      xAOD::ElectronContainer_v1 el_c1;
+      DataLink< xAOD::ElectronContainer_v1 > el_l1;
+      ElementLink< xAOD::ElectronContainer_v1 > el_l2;
+      ElementLinkVector< xAOD::ElectronContainer_v1 > el_l3;
+      std::vector< DataLink< xAOD::ElectronContainer_v1 > > el_l4;
+      std::vector< ElementLink< xAOD::ElectronContainer_v1 > > el_l5;
+      std::vector< ElementLinkVector< xAOD::ElectronContainer_v1 > > el_l6;
+
+      xAOD::PhotonContainer_v1 ph_c1;
+      DataLink< xAOD::PhotonContainer_v1 > ph_l1;
+      ElementLink< xAOD::PhotonContainer_v1 > ph_l2;
+      ElementLinkVector< xAOD::PhotonContainer_v1 > ph_l3;
+      std::vector< DataLink< xAOD::PhotonContainer_v1 > > ph_l4;
+      std::vector< ElementLink< xAOD::PhotonContainer_v1 > > ph_l5;
+      std::vector< ElementLinkVector< xAOD::PhotonContainer_v1 > > ph_l6;
+
+     // Instantiate the classes used by xAOD::Electron, xAODPhoton so that
+     // Reflex would see them with their "correct type". Note that the
+     // dictionary for these types comes from other places. This instantiation
+     // is just needed for "Reflex related technical reasons"...
+     ElementLink< xAOD::TrackParticleContainer > auxlink1;
+     std::vector< ElementLink< xAOD::TrackParticleContainer > > auxlink2;
+     ElementLink< xAOD::CaloClusterContainer > auxlink3;
+     std::vector< ElementLink< xAOD::CaloClusterContainer > > auxlink4;
+     ElementLink< xAOD::VertexContainer > auxlink5;
+     std::vector< ElementLink< xAOD::VertexContainer > > auxlink6;
+
+   };
+}
+
+#endif // XAODEGAMMA_XAODEGAMMADICT_H