Skip to content
Snippets Groups Projects
Commit 21306b51 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'xAODPFlow_ATLJETMET_834_Nov18_V2' into 'master'

X aodp flow atljetmet 834 nov18 v2

See merge request atlas/athena!16782
parents 35e636bf a03551ee
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
......@@ -52,7 +51,7 @@ namespace xAOD {
double PFO_v1::pt() const {
const static Accessor<float> accPt("pt");
const static ConstAccessor<float> accPt("pt");
float pt = accPt(*this);
return pt;
......@@ -60,28 +59,28 @@ namespace xAOD {
double PFO_v1::eta() const {
const static Accessor<float> accEta("eta");
const static ConstAccessor<float> accEta("eta");
float eta = accEta(*this);
return eta;
}
double PFO_v1::phi() const {
const static Accessor<float> accPhi("phi");
const static ConstAccessor<float> accPhi("phi");
float phi = accPhi(*this);
return phi;
}
double PFO_v1::m() const {
const static Accessor<float> accM("m");
const static ConstAccessor<float> accM("m");
float M = accM(*this);
return M;
}
double PFO_v1::e() const {
const static Accessor<float> accPt("pt");
const static ConstAccessor<float> accPt("pt");
float pt = accPt(*this);
if (pt < 0.0) return -genvecP4().E();
......@@ -149,10 +148,10 @@ namespace xAOD {
FourMom_t p4EM;
//change to use pt, eta, phi ,e
const static Accessor<float> accPt("ptEM");
const static Accessor<float> accEta("eta");
const static Accessor<float> accPhi("phi");
const static Accessor<float> accM("mEM");
const static ConstAccessor<float> accPt("ptEM");
const static ConstAccessor<float> accEta("eta");
const static ConstAccessor<float> accPhi("phi");
const static ConstAccessor<float> accM("mEM");
p4EM.SetPtEtaPhiM(accPt(*this), accEta(*this), accPhi(*this), accM(*this));
return p4EM;
......@@ -163,10 +162,10 @@ namespace xAOD {
if (fabs(this->charge()) > FLT_MIN) return genvecP4();
//change to use pt, eta, phi ,e
const static Accessor<float> accPt("ptEM");
const static Accessor<float> accEta("eta");
const static Accessor<float> accPhi("phi");
const static Accessor<float> accM("mEM");
const static ConstAccessor<float> accPt("ptEM");
const static ConstAccessor<float> accEta("eta");
const static ConstAccessor<float> accPhi("phi");
const static ConstAccessor<float> accM("mEM");
return GenVecFourMom_t(accPt(*this), accEta(*this), accPhi(*this), accM(*this));
}
......@@ -206,7 +205,7 @@ namespace xAOD {
if (fabs(this->charge()) > FLT_MIN) return this->pt();
const static Accessor<float> accPt("ptEM");
const static ConstAccessor<float> accPt("ptEM");
float pt = accPt(*this);
return pt;
......@@ -225,7 +224,7 @@ namespace xAOD {
double PFO_v1::mEM() const {
if (fabs(this->charge()) > FLT_MIN) return this->m();
const static Accessor<float> accM("mEM");
const static ConstAccessor<float> accM("mEM");
float M = accM(*this);
return M;
......@@ -235,7 +234,7 @@ namespace xAOD {
if (fabs(this->charge()) > FLT_MIN) return this->e();
const static Accessor<float> accPt("ptEM");
const static ConstAccessor<float> accPt("ptEM");
float pt = accPt(*this);
if (pt < 0.0) return -p4EM().E();
......@@ -295,7 +294,7 @@ namespace xAOD {
return isValid;
}
else{
Accessor<float>* p_acc = PFOAttributesAccessor_v1<float>::accessor(AttributeType);
const static ConstAccessor<float>* p_acc = PFOAttributesAccessor_v1<float>::constAccessor(AttributeType);
//check if accessor pointer is NULL
if( ! p_acc ) { return false ;}
//check if variable is avaialable
......@@ -579,7 +578,7 @@ namespace xAOD {
void PFO_v1::addAssociatedParticleLink(const std::string& ParticleType, const ElementLink<IParticleContainer>& theParticle) {
Accessor<std::vector<ElementLink<IParticleContainer > > > acc(ParticleType);
const static Accessor<std::vector<ElementLink<IParticleContainer > > > acc(ParticleType);
std::vector<ElementLink<IParticleContainer> > storedContainer = acc(*this);
ElementLink<xAOD::IParticleContainer> newLink;
......@@ -604,7 +603,7 @@ namespace xAOD {
bool PFO_v1::associatedParticles(PFODetails::PFOParticleType ParticleType, std::vector<const IParticle*>& theParticles ) const{
const Accessor<std::vector<ElementLink<IParticleContainer > > >* p_acc = PFOParticleTypeMapper_temp::getAccessor(ParticleType);
const ConstAccessor<std::vector<ElementLink<IParticleContainer > > >* p_acc = PFOParticleTypeMapper_temp::getAccessor(ParticleType);
if (!p_acc) return false;
else{
if (!p_acc->isAvailable(*this)) return false;
......@@ -633,12 +632,12 @@ namespace xAOD {
storedContainer.push_back( myLink );
}
Accessor<std::vector<ElementLink<IParticleContainer > > > acc(ParticleType);
const static Accessor<std::vector<ElementLink<IParticleContainer > > > acc(ParticleType);
acc(*this) = storedContainer;
}
bool PFO_v1::associatedParticles(const std::string& ParticleType, std::vector<const IParticle*>& theParticles ) const{
Accessor<std::vector<ElementLink<IParticleContainer > > > acc(ParticleType);
const static ConstAccessor<std::vector<ElementLink<IParticleContainer > > > acc(ParticleType);
if (!acc.isAvailable(*this)) return false;
else{
const std::vector<ElementLink<IParticleContainer> >& theLinks = acc(*this);
......@@ -653,7 +652,7 @@ namespace xAOD {
const CaloCluster* PFO_v1::cluster(unsigned int index) const {
const Accessor<std::vector<ElementLink<IParticleContainer > > >* p_acc = PFOParticleTypeMapper_temp::getAccessor(PFODetails::CaloCluster);
const ConstAccessor<std::vector<ElementLink<IParticleContainer > > >* p_acc = PFOParticleTypeMapper_temp::getAccessor(PFODetails::CaloCluster);
if (!p_acc) return nullptr;
else if (!p_acc->isAvailable(*this)) {return nullptr;}
else {
......@@ -675,7 +674,7 @@ namespace xAOD {
const TrackParticle* PFO_v1::track(unsigned int index) const {
const Accessor<std::vector<ElementLink<IParticleContainer > > >* p_acc = PFOParticleTypeMapper_temp::getAccessor(PFODetails::Track);
const ConstAccessor<std::vector<ElementLink<IParticleContainer > > >* p_acc = PFOParticleTypeMapper_temp::getAccessor(PFODetails::Track);
if (!p_acc) return nullptr;
else if (!p_acc->isAvailable(*this)) {return nullptr;}
else {
......@@ -695,7 +694,7 @@ namespace xAOD {
}
const xAOD::Vertex* PFO_v1::vertex() const{
const static Accessor<ElementLink<xAOD::VertexContainer> > acc("pfo_vertex");
const static ConstAccessor<ElementLink<xAOD::VertexContainer> > acc("pfo_vertex");
if (!acc.isAvailable(*this)) return nullptr;
else{
ElementLink<xAOD::VertexContainer> tempVertexLink = acc(*this);
......@@ -764,7 +763,7 @@ namespace xAOD {
//clusters
const Accessor<std::vector<ElementLink<IParticleContainer > > >* p_accClusters = PFOParticleTypeMapper_temp::getAccessor(PFODetails::CaloCluster);
if (p_accClusters){
const Accessor<std::vector<ElementLink<IParticleContainer > > >& accClusters = *p_accClusters;
const static Accessor<std::vector<ElementLink<IParticleContainer > > >& accClusters = *p_accClusters;
if ( accClusters.isAvailableWritable(*this) ){
std::vector<ElementLink<IParticleContainer> >& theClusterLinks = accClusters(*this);
std::vector< ElementLink< IParticleContainer > >::iterator firstClus = theClusterLinks.begin();
......@@ -776,7 +775,7 @@ namespace xAOD {
//tracks
const Accessor<std::vector<ElementLink<IParticleContainer > > >* p_accTracks = PFOParticleTypeMapper_temp::getAccessor(PFODetails::Track);
if (p_accTracks){
const Accessor<std::vector<ElementLink<IParticleContainer > > >& accTracks = *p_accTracks;
const static Accessor<std::vector<ElementLink<IParticleContainer > > >& accTracks = *p_accTracks;
if ( accTracks.isAvailableWritable(*this) ){
std::vector<ElementLink<IParticleContainer> >& theTrackLinks = accTracks(*this);
std::vector< ElementLink< IParticleContainer > >::iterator firstTrack = theTrackLinks.begin();
......@@ -789,7 +788,7 @@ namespace xAOD {
//shots
const Accessor<std::vector<ElementLink<IParticleContainer > > >* p_accShots = PFOParticleTypeMapper_temp::getAccessor(PFODetails::TauShot);
if (p_accShots){
const Accessor<std::vector<ElementLink<IParticleContainer > > >& accShots = *p_accShots;
const static Accessor<std::vector<ElementLink<IParticleContainer > > >& accShots = *p_accShots;
if ( accShots.isAvailableWritable(*this) ){
std::vector<ElementLink<IParticleContainer> >& theShotLinks = accShots(*this);
std::vector< ElementLink< IParticleContainer > >::iterator firstShot = theShotLinks.begin();
......
......@@ -26,6 +26,14 @@ This is pretty much based on the class xAODJets/JetMomentsAccessor.h - i.e I cop
} \
break
#define DEFINE_PFO_CONSTACCESSOR( NAME ) \
case xAOD::PFODetails::NAME: \
{ \
static const SG::AuxElement::Accessor< T > a( #NAME ); \
return &a; \
} \
break
namespace xAOD{
template<class T> struct PFOAttributesAccessor_v1 {
......@@ -165,6 +173,128 @@ namespace xAOD{
return 0;
}//switch on variable names
}//accessor
static const SG::AuxElement::Accessor<T>* constAccessor (xAOD::PFODetails::PFOAttributes variable){
switch (variable){
DEFINE_PFO_CONSTACCESSOR(nPi0);
DEFINE_PFO_CONSTACCESSOR(nPi0Proto);
DEFINE_PFO_CONSTACCESSOR(eflowRec_EM_FRAC_ENHANCED);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_FRAC_CORE);
DEFINE_PFO_CONSTACCESSOR(eflowRec_FIRST_ENG_DENS);
DEFINE_PFO_CONSTACCESSOR(eflowRec_CENTER_LAMBDA);
DEFINE_PFO_CONSTACCESSOR(eflowRec_SECOND_R);
DEFINE_PFO_CONSTACCESSOR(eflowRec_DELTA_ALPHA);
DEFINE_PFO_CONSTACCESSOR(eflowRec_HOT_STRIP_FRAC);
DEFINE_PFO_CONSTACCESSOR(eflowRec_THREE_CELL_STRIP_FRAC);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LATERAL);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LONGITUDINAL);
DEFINE_PFO_CONSTACCESSOR(eflowRec_SECOND_LAMBDA);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ISOLATION);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_FRAC_MAX);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_BAD_CELLS);
DEFINE_PFO_CONSTACCESSOR(eflowRec_N_BAD_CELLS);
DEFINE_PFO_CONSTACCESSOR(eflowRec_BADLARQ_FRAC);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_POS);
DEFINE_PFO_CONSTACCESSOR(eflowRec_SIGNIFICANCE);
DEFINE_PFO_CONSTACCESSOR(eflowRec_CELL_SIGNIFICANCE);
DEFINE_PFO_CONSTACCESSOR(eflowRec_CELL_SIG_SAMPLING);
DEFINE_PFO_CONSTACCESSOR(eflowRec_AVG_LAR_Q);
DEFINE_PFO_CONSTACCESSOR(eflowRec_AVG_TILE_Q);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EM3);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_HEC0);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_Tile0);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_HEC);
DEFINE_PFO_CONSTACCESSOR(eflowRec_TIMING);
DEFINE_PFO_CONSTACCESSOR(eflowRec_tracksExpectedEnergyDeposit);
DEFINE_PFO_CONSTACCESSOR(eflowRec_isInDenseEnvironment);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EM);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_PreSamplerB);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EMB1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EMB2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EMB3);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_PreSamplerE);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EME1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EME2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_EME3);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_HEC1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_HEC2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_HEC3);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileBar0);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileBar1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileBar2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileGap1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileGap2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileGap3);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileExt0);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileExt1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_TileExt2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_FCAL0);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_FCAL1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_FCAL2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_MINIFCAL0);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_MINIFCAL1);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_MINIFCAL2);
DEFINE_PFO_CONSTACCESSOR(eflowRec_LAYERENERGY_MINIFCAL3);
DEFINE_PFO_CONSTACCESSOR(eflowRec_layerVectorCellOrdering);
DEFINE_PFO_CONSTACCESSOR(eflowRec_radiusVectorCellOrdering);
DEFINE_PFO_CONSTACCESSOR(eflowRec_avgEdensityVectorCellOrdering);
DEFINE_PFO_CONSTACCESSOR(eflowRec_layerHED);
DEFINE_PFO_CONSTACCESSOR(eflowRec_EM_PROBABILITY);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_CALIB_TOT);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_CALIB_FRAC_EM);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_CALIB_FRAC_HAD);
DEFINE_PFO_CONSTACCESSOR(eflowRec_ENG_CALIB_FRAC_REST);
DEFINE_PFO_CONSTACCESSOR(cellBased_FIRST_ETA);
DEFINE_PFO_CONSTACCESSOR(cellBased_SECOND_R);
DEFINE_PFO_CONSTACCESSOR(cellBased_SECOND_LAMBDA);
DEFINE_PFO_CONSTACCESSOR(cellBased_DELTA_PHI);
DEFINE_PFO_CONSTACCESSOR(cellBased_DELTA_THETA);
DEFINE_PFO_CONSTACCESSOR(cellBased_CENTER_LAMBDA);
DEFINE_PFO_CONSTACCESSOR(cellBased_LATERAL);
DEFINE_PFO_CONSTACCESSOR(cellBased_LONGITUDINAL);
DEFINE_PFO_CONSTACCESSOR(cellBased_ENG_FRAC_EM);
DEFINE_PFO_CONSTACCESSOR(cellBased_ENG_FRAC_MAX);
DEFINE_PFO_CONSTACCESSOR(cellBased_ENG_FRAC_CORE);
DEFINE_PFO_CONSTACCESSOR(cellBased_SECOND_ENG_DENS);
DEFINE_PFO_CONSTACCESSOR(cellBased_EM1CoreFrac);
DEFINE_PFO_CONSTACCESSOR(cellBased_asymmetryInEM1WRTTrk);
DEFINE_PFO_CONSTACCESSOR(cellBased_NHitsInEM1);
DEFINE_PFO_CONSTACCESSOR(cellBased_NPosECells_PS);
DEFINE_PFO_CONSTACCESSOR(cellBased_NPosECells_EM1);
DEFINE_PFO_CONSTACCESSOR(cellBased_NPosECells_EM2);
DEFINE_PFO_CONSTACCESSOR(cellBased_firstEtaWRTClusterPosition_EM1);
DEFINE_PFO_CONSTACCESSOR(cellBased_firstEtaWRTClusterPosition_EM2);
DEFINE_PFO_CONSTACCESSOR(cellBased_secondEtaWRTClusterPosition_EM1);
DEFINE_PFO_CONSTACCESSOR(cellBased_secondEtaWRTClusterPosition_EM2);
DEFINE_PFO_CONSTACCESSOR(cellBased_energy_EM1);
DEFINE_PFO_CONSTACCESSOR(cellBased_energy_EM2);
DEFINE_PFO_CONSTACCESSOR(tauShots_nCellsInEta);
DEFINE_PFO_CONSTACCESSOR(tauShots_pt1);
DEFINE_PFO_CONSTACCESSOR(tauShots_pt3);
DEFINE_PFO_CONSTACCESSOR(tauShots_pt5);
DEFINE_PFO_CONSTACCESSOR(tauShots_ws5);
DEFINE_PFO_CONSTACCESSOR(tauShots_sdevEta5_WRTmean);
DEFINE_PFO_CONSTACCESSOR(tauShots_sdevEta5_WRTmode);
DEFINE_PFO_CONSTACCESSOR(tauShots_sdevPt5);
DEFINE_PFO_CONSTACCESSOR(tauShots_deltaPt12_min);
DEFINE_PFO_CONSTACCESSOR(tauShots_Fside_3not1);
DEFINE_PFO_CONSTACCESSOR(tauShots_Fside_5not1);
DEFINE_PFO_CONSTACCESSOR(tauShots_Fside_5not3);
DEFINE_PFO_CONSTACCESSOR(tauShots_fracSide_3not1);
DEFINE_PFO_CONSTACCESSOR(tauShots_fracSide_5not1);
DEFINE_PFO_CONSTACCESSOR(tauShots_fracSide_5not3);
DEFINE_PFO_CONSTACCESSOR(tauShots_pt1OverPt3);
DEFINE_PFO_CONSTACCESSOR(tauShots_pt3OverPt5);
DEFINE_PFO_CONSTACCESSOR(tauShots_mergedScore);
DEFINE_PFO_CONSTACCESSOR(tauShots_signalScore);
DEFINE_PFO_CONSTACCESSOR(tauShots_nPhotons);
DEFINE_PFO_CONSTACCESSOR(tauShots_seedHash);
default:
std::cerr << "xAOD::PFO_v1 ERROR Unknown float/double variable (" << static_cast<int>(variable) << ") requested" << std::endl;
return 0;
}//switch on variable names
}//const accessor
}//struct
;
......
......@@ -15,7 +15,7 @@ namespace xAOD{
template<class T> bool PFO_v1::attribute(PFODetails::PFOAttributes AttributeType, T& anAttribute) const {
Accessor<T>* acc = PFOAttributesAccessor_v1<T>::accessor(AttributeType);
const ConstAccessor<T>* acc = PFOAttributesAccessor_v1<T>::accessor(AttributeType);
//check if accessor pointer is NULL
if( ! acc ) { return false ;}
//check if variable is avaialable
......@@ -27,13 +27,13 @@ namespace xAOD{
template<class T> void PFO_v1::setAttribute(const std::string& AttributeType, const T& anAttribute) {
Accessor<T> acc(AttributeType);
const static Accessor<T> acc(AttributeType);
acc(*this) = anAttribute;
}
template<class T> bool PFO_v1::attribute(const std::string& AttributeType, T& anAttribute) const {
Accessor<T> acc(AttributeType);
const static ConstAccessor<T> acc(AttributeType);
//Check if variable is available
if( !acc.isAvailable( *this ) ) return false;
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment