Commit 7abd2dc9 authored by Walter Lampl's avatar Walter Lampl Committed by Graeme Stewart
Browse files

coverity fix in CaloClusterChangeSignalState (xAODCaloEvent-00-01-08)

	* coverity fix in CaloClusterChangeSignalState
	* tag xAODCaloEvent-00-01-08

2014-12-17  scott snyder  <snyder@bnl.gov>

	* Tagging xAODCaloEvent-00-01-07.
	* xAODCaloEvent/xAODCaloEventDict.h: Fix dictionary generation in
	standalone build.

2014-12-15 Walter Lampl <walter.lampl@ cern.ch>
	* avoid potential leak of attached CaloClusterCellLink object
	* tag xAODCaloEvent-00-01-06

2014-12-12  scott snyder  <snyder@bnl.gov>

	* Tagging xAODCaloEvent-00-01-05.
	* Moving CaloVertexedTopoCluster here from CaloUtils.

2014-12-02 Sven Menke <menke@mppmu.mpg.de>
	* New ClusterMoments ENG_BAD_HV_CELLS and N_BAD_HV_CELLS for energy
...
(Long ChangeLog diff - truncated)
parent 374adfe9
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: CaloClusterAccessors_v1.cxx 593083 2014-04-16 07:55:40Z wlampl $
// $Id: CaloClusterAccessors_v1.cxx 633006 2014-12-02 13:36:25Z menke $
// System include(s):
#include <iostream>
......@@ -51,6 +51,8 @@ namespace xAOD {
DEFINE_ACCESSOR( BAD_CELLS_CORR_E );
DEFINE_ACCESSOR( BADLARQ_FRAC );
DEFINE_ACCESSOR( ENG_POS );
DEFINE_ACCESSOR( ENG_BAD_HV_CELLS );
DEFINE_ACCESSOR( N_BAD_HV_CELLS );
DEFINE_ACCESSOR( SIGNIFICANCE );
DEFINE_ACCESSOR( CELL_SIGNIFICANCE );
DEFINE_ACCESSOR( CELL_SIG_SAMPLING );
......
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: CaloClusterAuxContainer_v1.cxx 585678 2014-02-28 14:20:54Z wlampl $
// $Id: CaloClusterAuxContainer_v1.cxx 628097 2014-11-13 09:24:54Z krasznaa $
// Local include(s):
#include "xAODCaloEvent/versions/CaloClusterAuxContainer_v1.h"
......@@ -12,125 +12,27 @@ namespace xAOD {
CaloClusterAuxContainer_v1::CaloClusterAuxContainer_v1()
: AuxContainerBase() {
AUX_VARIABLE( time );
//AUX_VARIABLE( samplingPattern );
AUX_VARIABLE( clusterSize );
AUX_VARIABLE( eta0 );
AUX_VARIABLE( phi0 );
AUX_VARIABLE( rawE );
AUX_VARIABLE( rawEta );
AUX_VARIABLE( rawPhi );
AUX_VARIABLE( rawM );
AUX_VARIABLE( altE );
AUX_VARIABLE( altEta );
AUX_VARIABLE( altPhi );
AUX_VARIABLE( time );
AUX_VARIABLE( clusterSize );
AUX_VARIABLE( eta0 );
AUX_VARIABLE( phi0 );
AUX_VARIABLE( rawE );
AUX_VARIABLE( rawEta );
AUX_VARIABLE( rawPhi );
AUX_VARIABLE( rawM );
AUX_VARIABLE( altE );
AUX_VARIABLE( altEta );
AUX_VARIABLE( altPhi );
AUX_VARIABLE( altM );
AUX_VARIABLE( calE );
AUX_VARIABLE( calEta );
AUX_VARIABLE( calPhi );
AUX_VARIABLE( calE );
AUX_VARIABLE( calEta );
AUX_VARIABLE( calPhi );
AUX_VARIABLE( calM );
/*
// The cluster moments:
AUX_VARIABLE( FIRST_PHI );
AUX_VARIABLE( FIRST_ETA );
AUX_VARIABLE( SECOND_R );
AUX_VARIABLE( SECOND_LAMBDA );
AUX_VARIABLE( DELTA_PHI );
AUX_VARIABLE( DELTA_THETA );
AUX_VARIABLE( DELTA_ALPHA );
AUX_VARIABLE( CENTER_X );
AUX_VARIABLE( CENTER_Y );
AUX_VARIABLE( CENTER_Z );
AUX_VARIABLE( CENTER_MAG );
AUX_VARIABLE( CENTER_LAMBDA );
AUX_VARIABLE( LATERAL );
AUX_VARIABLE( LONGITUDINAL );
*/
// Energies in various samplings
// Energies in various samplings
AUX_VARIABLE ( e_sampl );
AUX_VARIABLE ( eta_sampl );
AUX_VARIABLE ( phi_sampl );
/*
AUX_VARIABLE( E_PreSamplerB );
AUX_VARIABLE( E_PreSamplerE );
AUX_VARIABLE( E_EMB1 );
AUX_VARIABLE( E_EMB2 );
AUX_VARIABLE( E_EMB3 );
AUX_VARIABLE( E_EME1 );
AUX_VARIABLE( E_EME2 );
AUX_VARIABLE( E_EME3 );
AUX_VARIABLE( E_HEC0 );
AUX_VARIABLE( E_HEC1 );
AUX_VARIABLE( E_HEC2 );
AUX_VARIABLE( E_HEC3 );
AUX_VARIABLE( E_TileBar0 );
AUX_VARIABLE( E_TileBar1 );
AUX_VARIABLE( E_TileBar2 );
AUX_VARIABLE( E_TileGap1 );
AUX_VARIABLE( E_TileGap2 );
AUX_VARIABLE( E_TileGap3 );
AUX_VARIABLE( E_TileExt0 );
AUX_VARIABLE( E_TileExt1 );
AUX_VARIABLE( E_TileExt2 );
AUX_VARIABLE( E_FCAL0 );
AUX_VARIABLE( E_FCAL1 );
AUX_VARIABLE( E_FCAL2 );
// Pseudorapidities in various samplings
AUX_VARIABLE( eta_PreSamplerB );
AUX_VARIABLE( eta_PreSamplerE );
AUX_VARIABLE( eta_EMB1 );
AUX_VARIABLE( eta_EMB2 );
AUX_VARIABLE( eta_EMB3 );
AUX_VARIABLE( eta_EME1 );
AUX_VARIABLE( eta_EME2 );
AUX_VARIABLE( eta_EME3 );
AUX_VARIABLE( eta_HEC0 );
AUX_VARIABLE( eta_HEC1 );
AUX_VARIABLE( eta_HEC2 );
AUX_VARIABLE( eta_HEC3 );
AUX_VARIABLE( eta_TileBar0 );
AUX_VARIABLE( eta_TileBar1 );
AUX_VARIABLE( eta_TileBar2 );
AUX_VARIABLE( eta_TileGap1 );
AUX_VARIABLE( eta_TileGap2 );
AUX_VARIABLE( eta_TileGap3 );
AUX_VARIABLE( eta_TileExt0 );
AUX_VARIABLE( eta_TileExt1 );
AUX_VARIABLE( eta_TileExt2 );
AUX_VARIABLE( eta_FCAL0 );
AUX_VARIABLE( eta_FCAL1 );
AUX_VARIABLE( eta_FCAL2 );
// Azimuthal angles in various samplings
AUX_VARIABLE( phi_PreSamplerB );
AUX_VARIABLE( phi_PreSamplerE );
AUX_VARIABLE( phi_EMB1 );
AUX_VARIABLE( phi_EMB2 );
AUX_VARIABLE( phi_EMB3 );
AUX_VARIABLE( phi_EME1 );
AUX_VARIABLE( phi_EME2 );
AUX_VARIABLE( phi_EME3 );
AUX_VARIABLE( phi_HEC0 );
AUX_VARIABLE( phi_HEC1 );
AUX_VARIABLE( phi_HEC2 );
AUX_VARIABLE( phi_HEC3 );
AUX_VARIABLE( phi_TileBar0 );
AUX_VARIABLE( phi_TileBar1 );
AUX_VARIABLE( phi_TileBar2 );
AUX_VARIABLE( phi_TileGap1 );
AUX_VARIABLE( phi_TileGap2 );
AUX_VARIABLE( phi_TileGap3 );
AUX_VARIABLE( phi_TileExt0 );
AUX_VARIABLE( phi_TileExt1 );
AUX_VARIABLE( phi_TileExt2 );
AUX_VARIABLE( phi_FCAL0 );
AUX_VARIABLE( phi_FCAL1 );
AUX_VARIABLE( phi_FCAL2 );
*/
}
} // namespace xAOD
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: CaloClusterAuxContainer_v2.cxx 628097 2014-11-13 09:24:54Z krasznaa $
// Local include(s):
#include "xAODCaloEvent/versions/CaloClusterAuxContainer_v2.h"
namespace xAOD {
CaloClusterAuxContainer_v2::CaloClusterAuxContainer_v2()
: AuxContainerBase() {
AUX_VARIABLE( time );
AUX_VARIABLE( clusterSize );
AUX_VARIABLE( eta0 );
AUX_VARIABLE( phi0 );
AUX_VARIABLE( rawE );
AUX_VARIABLE( rawEta );
AUX_VARIABLE( rawPhi );
AUX_VARIABLE( rawM );
AUX_VARIABLE( altE );
AUX_VARIABLE( altEta );
AUX_VARIABLE( altPhi );
AUX_VARIABLE( altM );
AUX_VARIABLE( calE );
AUX_VARIABLE( calEta );
AUX_VARIABLE( calPhi );
AUX_VARIABLE( calM );
// Energies in various samplings
AUX_VARIABLE ( e_sampl );
}
} // namespace xAOD
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: CaloCluster_v1.cxx 612245 2014-08-18 11:13:48Z wlampl $
// $Id: CaloCluster_v1.cxx 636000 2014-12-15 14:48:40Z wlampl $
// System include(s):
#include <cmath>
......@@ -26,7 +26,7 @@ namespace xAOD {
CaloCluster_v1::CaloCluster_v1()
: IParticle(),
m_samplingPattern(0),
m_p4(), m_p4Cached(false),
m_p4(),
m_cellLinks(0),
m_ownCellLinks(false)
{
......@@ -37,7 +37,7 @@ namespace xAOD {
CaloCluster_v1::CaloCluster_v1(const CaloCluster_v1& other)
: IParticle(), //IParticel does not have a copy constructor. AuxElement has one with same behavior as default ctor
m_samplingPattern(other.samplingPattern()),
m_p4(), m_p4Cached(false),
m_p4(),
m_cellLinks(0),
m_ownCellLinks(false),
m_recoStatus(other.m_recoStatus) {
......@@ -46,15 +46,36 @@ namespace xAOD {
#ifndef XAOD_ANALYSIS
const CaloClusterCellLink* links=other.getCellLinks();
if (links) {
m_cellLinks=new CaloClusterCellLink(*links);
m_ownCellLinks=true;
static Accessor<ElementLink<CaloClusterCellLinkContainer> > accCellLinks("CellLink");
if (accCellLinks.isAvailable(*this)) { //In case an element link was copied by makePrivateStore, invalidate it
accCellLinks(*this).reset();
} //end if have element link to CaloClusterCellLink
}//end if have CaloClusterCellLink
this->addCellLink(new CaloClusterCellLink(*links));
}
static Accessor<ElementLink<CaloClusterCellLinkContainer> > accCellLinks("CellLink");
if (accCellLinks.isAvailable(*this)) { //In case an element link was copied by makePrivateStore, invalidate it
accCellLinks(*this).reset();
} //end if have element link to CaloClusterCellLink
#endif // not XAOD_ANALYSIS
}
CaloCluster_v1& CaloCluster_v1::operator=(const xAOD::CaloCluster_v1& other) {
if (this == &other) return *this;
SG::AuxElement::operator=( other ); //Call assignment operator of base-class
m_p4Cached.reset();
m_recoStatus=other.m_recoStatus;
setSignalState(other.signalState());
#ifndef XAOD_ANALYSIS
const CaloClusterCellLink* links=other.getCellLinks();
if (links) {
this->addCellLink(new CaloClusterCellLink(*links));
}
static Accessor<ElementLink<CaloClusterCellLinkContainer> > accCellLinks("CellLink");
if (accCellLinks.isAvailable(*this)) { //In case an element link was copied by SG::AuxElement::operator=, invalidate it
accCellLinks(*this).reset();
} //end if have element link to CaloClusterCellLink
#endif // not XAOD_ANALYSIS
return *this;
}
CaloCluster_v1::~CaloCluster_v1() {
......@@ -594,7 +615,10 @@ namespace xAOD {
float CaloCluster_v1::etaSample(const CaloSample sampling) const {
static Accessor< std::vector <float > > etaAcc("eta_sampl");
return getSamplVarFromAcc(etaAcc,sampling);
if (!etaAcc.isAvailable( *this ))
return -999;
else
return getSamplVarFromAcc(etaAcc,sampling);
}
bool CaloCluster_v1::setEta(const CaloSample sampling, const float eta) {
......@@ -605,7 +629,10 @@ namespace xAOD {
float CaloCluster_v1::phiSample(const CaloSample sampling) const {
static Accessor< std::vector <float > > phiAcc("phi_sampl");
return getSamplVarFromAcc(phiAcc,sampling);
if (!phiAcc.isAvailable( *this ))
return -999;
else
return getSamplVarFromAcc(phiAcc,sampling);
}
bool CaloCluster_v1::setPhi(const CaloSample sampling, const float phi) {
......@@ -617,7 +644,10 @@ namespace xAOD {
float CaloCluster_v1::energy_max(const CaloSample sampling) const {
static Accessor< std::vector <float > > emaxAcc("emax_sampl");
return getSamplVarFromAcc(emaxAcc,sampling,0.0); //Return energy 0 in case of failure (eg. sampling not set)
if (!emaxAcc.isAvailable( *this ))
return 0.0;
else
return getSamplVarFromAcc(emaxAcc,sampling,0.0); //Return energy 0 in case of failure (eg. sampling not set)
}
bool CaloCluster_v1::setEmax(const CaloSample sampling, const float eMax ) {
......@@ -627,7 +657,10 @@ namespace xAOD {
float CaloCluster_v1::etamax(const CaloSample sampling) const {
static Accessor< std::vector <float > > etamaxAcc("etamax_sampl");
return getSamplVarFromAcc(etamaxAcc,sampling);
if (!etamaxAcc.isAvailable( *this ))
return -999;
else
return getSamplVarFromAcc(etamaxAcc,sampling);
}
bool CaloCluster_v1::setEtamax(const CaloSample sampling, const float etaMax ) {
......@@ -637,7 +670,10 @@ namespace xAOD {
float CaloCluster_v1::phimax(const CaloSample sampling) const {
static Accessor< std::vector <float > > phimaxAcc("phimax_sampl");
return getSamplVarFromAcc(phimaxAcc,sampling);
if (!phimaxAcc.isAvailable( *this ))
return -999;
else
return getSamplVarFromAcc(phimaxAcc,sampling);
}
bool CaloCluster_v1::setPhimax(const CaloSample sampling, const float phiMax ) {
......@@ -648,7 +684,10 @@ namespace xAOD {
float CaloCluster_v1::etasize(const CaloSample sampling) const {
static Accessor< std::vector <float > > etasizeAcc("etasize_sampl");
return getSamplVarFromAcc(etasizeAcc,sampling);
if (!etasizeAcc.isAvailable( *this ))
return -999;
else
return getSamplVarFromAcc(etasizeAcc,sampling);
}
bool CaloCluster_v1::setEtasize(const CaloSample sampling, const float etaSize ) {
......@@ -658,7 +697,10 @@ namespace xAOD {
float CaloCluster_v1::phisize(const CaloSample sampling) const {
static Accessor< std::vector <float > > phisizeAcc("phisize_sampl");
return getSamplVarFromAcc(phisizeAcc,sampling);
if (!phisizeAcc.isAvailable( *this ))
return -999;
else
return getSamplVarFromAcc(phisizeAcc,sampling);
}
bool CaloCluster_v1::setPhisize(const CaloSample sampling, const float phiSize ) {
......@@ -667,13 +709,6 @@ namespace xAOD {
}
void CaloCluster_v1::insertMoment( MomentType type, double value ) {
( *( momentAccessorV1( type ) ) )( *this ) = value;
return;
}
float CaloCluster_v1::energyBE(const unsigned sample) const {
if (sample>3) return -999;
const CaloSample barrelSample=(CaloSample)(CaloSampling::PreSamplerB+sample);
......@@ -814,6 +849,13 @@ namespace xAOD {
return true;
}
void CaloCluster_v1::insertMoment( MomentType type, double value ) {
( *( momentAccessorV1( type ) ) )( *this ) = value;
return;
}
/** for debugging only ...
std::vector<std::pair<std::string,float> > CaloCluster_v1::getAllMoments() {
std::vector<std::pair<std::string,float> > retval;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
/**
* @file xAODCaloEvent/src/CaloVertexedClusterBase.cxx
* @author scott snyder <snyder@bnl.gov>
* @date Feb, 2014
* @brief Evaluate cluster kinematics with a different vertex / signal state.
*/
#include "xAODCaloEvent/CaloVertexedClusterBase.h"
#include "CxxUtils/sincos.h"
#include <cmath>
using std::cosh;
using std::tanh;
namespace xAOD {
/**
* @brief Constructor.
* @param cl The cluster to proxy.
*
* In this case, we'll return unchanged the kinematics of the cluster
* for the default signal state.
*/
CaloVertexedClusterBase::CaloVertexedClusterBase (const CaloCluster& cl)
: m_cl (&cl),
m_eta (cl.eta()),
m_phi (cl.phi()),
m_p4 (cl.p4())
{
}
/**
* @brief Constructor.
* @param cl The cluster to proxy.
* @param s The desired signal state.
*
* In this case, we'll return unchanged the kinematics of the cluster
* for signal state S.
*/
CaloVertexedClusterBase::CaloVertexedClusterBase (const CaloCluster& cl,
CaloCluster::State s)
: m_cl (&cl),
m_eta (cl.eta(s)),
m_phi (cl.phi(s)),
m_p4 (cl.p4(s))
{
}
/**
* @brief Calculate cluster kinematics for a given vertex.
* @param vx The vertex to use for calculating cluster kinematics.
*/
void
CaloVertexedClusterBase::computeVertexCorr (const Amg::Vector3D& vx, double radius)
{
if (radius<1.) return;
double eta = m_eta;
double phi = m_phi;
if (std::fabs(eta)>10. || std::fabs(phi)>10.) return;
CxxUtils::sincos sc (phi);
double iradius = 1 / radius;
m_eta += (-vx[2]/cosh(m_eta) + sc.apply (vx[1], vx[0])*tanh(m_eta)) * iradius;
m_phi += sc.apply (vx[0], -vx[1]) * iradius;
double pt = m_p4.P() / cosh (m_eta);
m_p4.SetPtEtaPhiE (pt, m_eta, m_phi, m_p4.E());
}
} // namespace xAOD
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
/**
* @file xAODCaloEvent/src/CaloVertexedTopoCluster.cxx
* @author scott snyder <snyder@bnl.gov>
* @date Feb, 2014
* @brief Evaluate cluster kinematics with a different vertex / signal state.
*/
#include "xAODCaloEvent/CaloVertexedTopoCluster.h"
namespace xAOD {
/**
* @brief Constructor.
* @param cl The cluster to proxy.
*
* In this case, we'll return unchanged the kinematics of the cluster
* for the default signal state.
*/
CaloVertexedTopoCluster::CaloVertexedTopoCluster (const CaloCluster& cl)
: CaloVertexedClusterBase(cl)
{
}
/**
* @brief Constructor.
* @param cl The cluster to proxy.
* @param s The desired signal state.
*
* In this case, we'll return unchanged the kinematics of the cluster
* for signal state S.
*/
CaloVertexedTopoCluster::CaloVertexedTopoCluster (const CaloCluster& cl,
CaloCluster::State s)
: CaloVertexedClusterBase(cl,s)
{
}
/**
* @brief Constructor.
* @param cl The cluster to proxy.
* @param vx The vertex to use for calculating cluster kinematics.
*
* In this case, we'll return unchanged the kinematics of the cluster
* relative to vertex @c vx for the default signal state.
*/
CaloVertexedTopoCluster::CaloVertexedTopoCluster (const CaloCluster& cl,
const Amg::Vector3D& vx)
: CaloVertexedClusterBase(cl)
{
computeVertexCorr (vx, retrieveRadius());
}
/**
* @brief Constructor.
* @param cl The cluster to proxy.
* @param s The desired signal state.
* @param vx The vertex to use for calculating cluster kinematics.
*
* In this case, we'll return unchanged the kinematics of the cluster
* relative to vertex @c vx for the default signal state.
* for signal state S.
*/
CaloVertexedTopoCluster::CaloVertexedTopoCluster (const CaloCluster& cl,
CaloCluster::State s,
const Amg::Vector3D& vx)
: CaloVertexedClusterBase(cl,s)
{
computeVertexCorr (vx, retrieveRadius() );
}
/** @brief returns the radius value needed for vertex correction. Uses the CENTER_MAG moment.
*/
double CaloVertexedTopoCluster::retrieveRadius() {
double radius = 0;
double mag = 0;
if (m_cl->retrieveMoment (CaloCluster::CENTER_MAG, mag)) {
radius = mag/cosh(m_eta);
}
return radius;
}
} // namespace xAOD
......@@ -9,8 +9,10 @@ public
use AtlasPolicy AtlasPolicy-*
use AthContainers AthContainers-* Control
use AthLinks AthLinks-* Control
use CxxUtils CxxUtils-* Control
# EDM package(s):
use GeoPrimitives GeoPrimitives-* DetectorDescription
use xAODBase xAODBase-* Event/xAOD
use xAODCore xAODCore-* Event/xAOD
......@@ -20,6 +22,9 @@ use CaloGeoHelpers CaloGeoHelpers-* Calorimeter
use_ifndef pplist="XAOD_ANALYSIS" pkg="Calorimeter/CaloEvent"
# Specify the required ROOT components for cmake (transparent to CMT)
apply_pattern cmake_add_command command="find_package(ROOT COMPONENTS Physics)"
library xAODCaloEvent ../Root/*.cxx ../src/*.cxx
apply_pattern installed_library
......
......@@ -4,7 +4,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: CaloCluster.h 563319 2013-09-27 11:35:45Z krasznaa $
// $Id: CaloCluster.h 628097 2014-11-13 09:24:54Z krasznaa $
#ifndef XAODCALOEVENT_CALOCLUSTER_H
#define XAODCALOEVENT_CALOCLUSTER_H
......@@ -17,4 +17,8 @@ namespace xAOD {
typedef CaloCluster_v1 CaloCluster;
}