ATLAS Offline Software
Loading...
Searching...
No Matches
CaloLCClassificationTool Class Reference

classify clusters according to their probability to stem from an em object More...

#include <CaloLCClassificationTool.h>

Inheritance diagram for CaloLCClassificationTool:
Collaboration diagram for CaloLCClassificationTool:

Public Member Functions

virtual ~CaloLCClassificationTool ()
virtual CaloRecoStatus::StatusIndicator classify (xAOD::CaloCluster *thisCluster) const override
 method to return the classification status of a cluster.
virtual StatusCode initialize () override
 CaloLCClassificationTool (const std::string &type, const std::string &name, const IInterface *parent)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< CaloLocalHadCoeffm_key
 name of the key for em fraction data
bool m_useSpread
 if set to true the spread of EM probabilities in each bin is taken into account for classification otherwise only the mean is used
bool m_useNormalizedEnergyDensity
 old data depends on energy density while new data depends on energy density over energy.
double m_maxProbability
 cut value on EM probability below which all clusters are classified as hadronic
bool m_storeClassificationProbabilityInAOD
 if true the phase space probability based on single pions that the current cluster stems from a pi0 is saved on AOD as a moment.
bool m_interpolate
 interpolate correction coefficients
std::vector< std::string > m_interpolateDimensionNames
 vector of names of dimensions in look-up tables to interpolate
std::vector< int > m_interpolateDimensions
 actual set of dimension id's to interpolate
bool m_absOpt
 is set to true, classify neg.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

classify clusters according to their probability to stem from an em object

Version
$Id: CaloLCClassificationTool.h,v 1.6 2009-01-27 09:09:14 gunal Exp $
Author
Sven Menke menke.nosp@m.@mpp.nosp@m.mu.mp.nosp@m.g.de
Date
27-September-2005

concrete class implementing a IClusterClassificationTool to classify clusters according to their probability to be caused by an electromagnetic decaying particle or shower. Clusters with high em probability should not be weighted. This tool reads its data from pool containing TProfile2D based em-probability data.

Definition at line 28 of file CaloLCClassificationTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~CaloLCClassificationTool()

CaloLCClassificationTool::~CaloLCClassificationTool ( )
virtualdefault

◆ CaloLCClassificationTool()

CaloLCClassificationTool::CaloLCClassificationTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 30 of file CaloLCClassificationTool.cxx.

33 : AthAlgTool(type,name,parent),
34 m_key("EMFracClassify"),
35 m_useSpread(false),
39 m_interpolate(false),
40 m_absOpt(false)
41{
42
43 declareInterface<IClusterClassificationTool>(this);
44 // Name of data object in conditions store
45 declareProperty("ClassificationKey",m_key);
46 // Use Spread of EM probability for estimate
47 declareProperty("UseSpread",m_useSpread);
48 // Use normalized energy density
49 declareProperty("UseNormalizedEnergyDensity",m_useNormalizedEnergyDensity);
50 // Maximal EM probability below which all clusters are considered hadronic
51 declareProperty("MaxProbability",m_maxProbability);
52 // Store the classification Probability as a cluster moment in AOD
53 // (if false it goes to ESD only)
54 declareProperty("StoreClassificationProbabilityInAOD",m_storeClassificationProbabilityInAOD);
55 // Use Interpolation or not
56 declareProperty("Interpolate",m_interpolate);
57 //Use weighting of negative clusters?
58 declareProperty("WeightingOfNegClusters",m_absOpt);
59
61 m_interpolateDimensionNames[0] = "DIMC_ETA";
62 m_interpolateDimensionNames[1] = "DIMC_EDENS";
63 m_interpolateDimensionNames[2] = "DIMC_LAMBDA";
64 declareProperty("InterpolateDimensionNames", m_interpolateDimensionNames);
65}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadCondHandleKey< CaloLocalHadCoeff > m_key
name of the key for em fraction data
bool m_absOpt
is set to true, classify neg.
bool m_useSpread
if set to true the spread of EM probabilities in each bin is taken into account for classification ot...
bool m_useNormalizedEnergyDensity
old data depends on energy density while new data depends on energy density over energy.
std::vector< std::string > m_interpolateDimensionNames
vector of names of dimensions in look-up tables to interpolate
double m_maxProbability
cut value on EM probability below which all clusters are classified as hadronic
bool m_interpolate
interpolate correction coefficients
bool m_storeClassificationProbabilityInAOD
if true the phase space probability based on single pions that the current cluster stems from a pi0 i...

Member Function Documentation

◆ classify()

CaloRecoStatus::StatusIndicator CaloLCClassificationTool::classify ( xAOD::CaloCluster * thisCluster) const
overridevirtual

method to return the classification status of a cluster.

Parameters
theClusterthe pointer to the CaloCluster to be classified

this method is purely virtual because every derived class needs to implement it.

Implements IClusterClassificationTool.

Definition at line 92 of file CaloLCClassificationTool.cxx.

93{
94 const CaloLocalHadCoeff* condObject(nullptr);
95 SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key);
96 condObject = *rch;
97 if(condObject==nullptr) {
98 ATH_MSG_ERROR("Unable to access conditions object");
100 }
101
102 CaloLCCoeffHelper hp;
104
106 double probPi0 = 0;
107 // on ESD only
108 std::vector<float> vars(6);
109 if ( thisCluster->e() > 0 || m_absOpt ) { //with abs option, always weight cluster
110 double log10cluse = log10(thisCluster->e());
111 if( m_absOpt ) log10cluse = log10(fabs(thisCluster->e()));
112 double log10cluseOrig = log10cluse;
113
114 const CaloLocalHadCoeff::LocalHadDimension *logeDim = condObject->getArea(0)->getDimension(3);
115 double lemax = logeDim->getXmax()-0.5*logeDim->getDx();
116 double lemin = logeDim->getXmin()+0.5*logeDim->getDx();
117 if ( log10cluse > lemax )
118 log10cluse = lemax;
119 if ( log10cluse < lemin )
120 log10cluse = lemin;
121
122 double m1_dens,center_lambda;
123 //Fixme ... check moavailability ..
124 if (thisCluster->retrieveMoment(CaloCluster::FIRST_ENG_DENS,m1_dens) &&
125 thisCluster->retrieveMoment(CaloCluster::CENTER_LAMBDA,center_lambda)) {
126 if ( m1_dens > 0 && center_lambda > 0) {
127 const double abseta = fabs(thisCluster->eta());
128 double log10edens = log10(m1_dens);
129 if ( m_useNormalizedEnergyDensity ) log10edens -= log10cluseOrig;
130 double log10lambda = log10(center_lambda);
131
132 vars[CaloLocalHadDefs::DIMC_SIDE] = static_cast<float> ((thisCluster->eta()<0?-1.0:1.0));
133 vars[CaloLocalHadDefs::DIMC_ETA] = static_cast<float> (abseta);
134 vars[CaloLocalHadDefs::DIMC_PHI] = static_cast<float> (thisCluster->phi());
135 vars[CaloLocalHadDefs::DIMC_ENER] = static_cast<float> (log10cluse);
136 vars[CaloLocalHadDefs::DIMC_EDENS] = static_cast<float> (log10edens);
137 vars[CaloLocalHadDefs::DIMC_LAMBDA] = static_cast<float> (log10lambda);
138
139 bool isDataOK = false;
140 double emProb(0);
141
142 int iBin = condObject->getBin(0,vars);
143 if ( iBin >= 0 ) {
144 const CaloLocalHadCoeff::LocalHadCoeff * pData = condObject->getCoeff(iBin);
145 if ( pData && (*pData)[CaloLocalHadDefs::BIN_ENTRIES] > 0 ) {
146 isDataOK = true;
147 emProb = (*pData)[CaloLocalHadDefs::BIN_WEIGHT];
148 if (m_useSpread) {
149 double emErr = sqrt((*pData)[CaloLocalHadDefs::BIN_ENTRIES])*(*pData)[CaloLocalHadDefs::BIN_ERROR];
150 emProb += emErr;
151 }
152
153 if(m_interpolate) {
154 // accesing interpolated coefficients
155 bool isa = CaloLCCoeffHelper::Interpolate(condObject, 0,vars,parint, m_interpolateDimensions);
156 if(isa) {
157 if ( parint[CaloLocalHadDefs::BIN_ENTRIES] > 0 ) {
158 isDataOK = true;
159 emProb = parint[CaloLocalHadDefs::BIN_WEIGHT];
160 if (m_useSpread) {
161 double emErr = sqrt(parint[CaloLocalHadDefs::BIN_ENTRIES])*parint[CaloLocalHadDefs::BIN_ERROR];
162 emProb += emErr;
163 }
164 }
165 }//end if isa
166 }//end if m_interpolate
167 } //end if pData
168 } //end if iBin
169
170 if(isDataOK) {
171 probPi0 = emProb;
172 if ( emProb < m_maxProbability )
174 else
175 recStat = CaloRecoStatus::TAGGEDEM;
176 }
177
178 } // if >0
179 } //if got sucessfully retrieved moments
180 else {
181 ATH_MSG_ERROR( "Can not retrieve one or more of the cluster moments "
182 << "CENTER_LAMBDA, FIRST_ENG_DENS for current cluster"
183 << "- classification not possible - "
184 << "you need to enable those moments in the cluster maker!"
185 );
187 }
188 }
189
190 thisCluster->insertMoment(CaloCluster::EM_PROBABILITY,probPi0);
191 thisCluster->insertMoment(CaloCluster::HAD_WEIGHT,1.0);
192 thisCluster->insertMoment(CaloCluster::OOC_WEIGHT,1.0);
193 thisCluster->insertMoment(CaloCluster::DM_WEIGHT,1.0);
194
195 return recStat;
196}
#define ATH_MSG_ERROR(x)
std::vector< int > m_interpolateDimensions
actual set of dimension id's to interpolate
static bool Interpolate(const CaloLocalHadCoeff *m_data, const unsigned int n_area, std::vector< float > &x, CaloLocalHadCoeff::LocalHadCoeff &pars, const std::vector< int > &dim, double xfit=0.)
float getDx() const
return size of bin
float getXmax() const
return maximum value for the last bin
float getXmin() const
return minimum value for the first bin
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
StatusIndicator
reconstruction status word
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
void insertMoment(MomentType type, double value)
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ OOC_WEIGHT
Out-of-cluster weight (E_ooc/E_w)
@ EM_PROBABILITY
Classification probability to be em-like.
@ DM_WEIGHT
Dead-material weight (E_dm/E_ooc)
@ FIRST_ENG_DENS
First Moment in E/V.
@ HAD_WEIGHT
Hadronic weight (E_w/E_em)
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode CaloLCClassificationTool::initialize ( )
overridevirtual

Definition at line 67 of file CaloLCClassificationTool.cxx.

68{
69 ATH_MSG_INFO( "Initializing " << name() );
70
71 ATH_CHECK( m_key.initialize() );
72
73 if(m_interpolate) {
74 msg(MSG::INFO) << "Interpolation is ON, dimensions: ";
75 for(std::vector<std::string>::iterator it=m_interpolateDimensionNames.begin(); it!=m_interpolateDimensionNames.end(); ++it){
76 msg() << " " << (*it);
77 }
78 msg() << endmsg;
79 for(std::vector<std::string>::iterator it=m_interpolateDimensionNames.begin(); it!=m_interpolateDimensionNames.end(); ++it){
82 m_interpolateDimensions.push_back(int(id));
83 }else{
84 ATH_MSG_WARNING( "Dimension '" << (*it) << "' is invalid and will be excluded." );
85 }
86 }
87 }
88
89 return StatusCode::SUCCESS;
90}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
MsgStream & msg() const
static CaloLocalHadDefs::LocalHadDimensionId getDimensionId(const std::string &dimensionName)
LocalHadDimensionId
enums to identify user dimensions id number DIMC_* - classification, DIMW_*-weighting,...

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & IClusterClassificationTool::interfaceID ( )
inlinestaticinherited

Definition at line 28 of file IClusterClassificationTool.h.

28 {
29 static const InterfaceID IID_IClusterClassificationTool("IClusterClassificationTool", 1 , 0);
30 return IID_IClusterClassificationTool;
31 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_absOpt

bool CaloLCClassificationTool::m_absOpt
private

is set to true, classify neg.

Clusters as well

Definition at line 113 of file CaloLCClassificationTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_interpolate

bool CaloLCClassificationTool::m_interpolate
private

interpolate correction coefficients

Definition at line 100 of file CaloLCClassificationTool.h.

◆ m_interpolateDimensionNames

std::vector<std::string> CaloLCClassificationTool::m_interpolateDimensionNames
private

vector of names of dimensions in look-up tables to interpolate

Definition at line 104 of file CaloLCClassificationTool.h.

◆ m_interpolateDimensions

std::vector<int> CaloLCClassificationTool::m_interpolateDimensions
private

actual set of dimension id's to interpolate

Definition at line 109 of file CaloLCClassificationTool.h.

◆ m_key

SG::ReadCondHandleKey<CaloLocalHadCoeff> CaloLCClassificationTool::m_key
private

name of the key for em fraction data

Definition at line 47 of file CaloLCClassificationTool.h.

◆ m_maxProbability

double CaloLCClassificationTool::m_maxProbability
private

cut value on EM probability below which all clusters are classified as hadronic

Useful values are around 0.5. Clusters in Bins with an average EM probability below this cut value are tagged as hadronic. Clusters in Bins with an average EM probability above this value are considered electromagnetic and clusters falling in bins with no information are tagged as unknown.

Definition at line 83 of file CaloLCClassificationTool.h.

◆ m_storeClassificationProbabilityInAOD

bool CaloLCClassificationTool::m_storeClassificationProbabilityInAOD
private

if true the phase space probability based on single pions that the current cluster stems from a pi0 is saved on AOD as a moment.

If false the moment goes to ESD only.

Classification histos report this quantity. The subsequent calibration functions can retrieve this probability if stored as moment and weight the respective calibration by this (or 1 minus it) to avoid overcorrections.

Definition at line 95 of file CaloLCClassificationTool.h.

◆ m_useNormalizedEnergyDensity

bool CaloLCClassificationTool::m_useNormalizedEnergyDensity
private

old data depends on energy density while new data depends on energy density over energy.

This bool is needed to switch.

Classification histos have energy density or normalized energy density for the x-axis. The old cond data is not normalized which causes problems for neutral pions. The new cond data is and this switch selects the proper normalization for the tool.

Definition at line 71 of file CaloLCClassificationTool.h.

◆ m_useSpread

bool CaloLCClassificationTool::m_useSpread
private

if set to true the spread of EM probabilities in each bin is taken into account for classification otherwise only the mean is used

For some regions of phase space the spread in the EM probability values can be quite large. If this property is set to true the EM probability which is maximaly consistent with the current bin is calculated (mean+spread) and in case the property is false just the mean is used to estimate the EM probability.

Definition at line 60 of file CaloLCClassificationTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: