Commit 1e7da824 authored by R D Schaffer's avatar R D Schaffer Committed by Graeme Stewart
Browse files

removing _v1 for electron/photon class defs (xAODEgamma-00-00-81)

parent 19da96b4
/*
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
// 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
/*
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
/*
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
/*
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,