ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CaloLCWeightTool Class Reference

calculates hadronic cell weights based on cluster and cell quantities More...

#include <CaloLCWeightTool.h>

Inheritance diagram for CaloLCWeightTool:
Collaboration diagram for CaloLCWeightTool:

Public Member Functions

virtual ~CaloLCWeightTool ()
 
virtual StatusCode weight (xAOD::CaloCluster *theCluster, const EventContext &ctx) const override
 method to weight the cells in a cluster More...
 
virtual StatusCode initialize () override
 
 CaloLCWeightTool (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. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) 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 More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadCondHandleKey< CaloLocalHadCoeffm_key
 name of the key for had cell weights More...
 
double m_signalOverNoiseCut
 minimal signal/elec_noise ratio for a cell to be weighted More...
 
bool m_useHadProbability
 look for em-probability moment and apply relative weight only More...
 
std::vector< std::string > m_sampnames
 vector of names of individual samplings More...
 
bool m_interpolate
 interpolate correction coefficients More...
 
bool m_updateSamplingVars
 update also sampling variables More...
 
std::vector< std::string > m_interpolateDimensionNames
 vector of names of dimensions in look-up tables to interpolate More...
 
std::vector< int > m_interpolateDimensions
 actual set of dimension id's to interpolate More...
 
const CaloCell_IDm_calo_id
 
SG::ReadCondHandleKey< CaloNoisem_noiseCDOKey {this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

calculates hadronic cell weights based on cluster and cell quantities

Version
$Id: CaloLCWeightTool.h,v 1.8 2009-01-27 09:09:14 gunal Exp $
Author
Sven Menke menke.nosp@m.@mpp.nosp@m.mu.mp.nosp@m.g.de
Date
26-August-2009 concrete class implementing a IClusterCellWeightTool to calculate the H1-type cell hadronic weights for cells inside a cluster. The cluster moments and its energy are also used to derive the weights
  • therefore the weighting is not called cell-by-cell, but for the entire cluster This tool reads its data from pool containing TProfile2D based weighting data.

Definition at line 33 of file CaloLCWeightTool.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

◆ ~CaloLCWeightTool()

CaloLCWeightTool::~CaloLCWeightTool ( )
virtualdefault

◆ CaloLCWeightTool()

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

Definition at line 32 of file CaloLCWeightTool.cxx.

36  m_key("HadWeights"),
38  m_useHadProbability(false),
39  m_interpolate(false),
40  m_calo_id(nullptr)
41 {
42 
43  declareInterface<IClusterCellWeightTool>(this);
44  declareProperty("CorrectionKey",m_key);
45  // Minimal Signal Over Noise (|E|/sigma) level for cells
46  declareProperty("SignalOverNoiseCut",m_signalOverNoiseCut);
47  // Use EM_PROBABILITY Moment to apply relative weights
48  declareProperty("UseHadProbability",m_useHadProbability);
49  // Use Interpolation or not
50  declareProperty("Interpolate",m_interpolate);
52  m_interpolateDimensionNames[0] = "DIMW_ETA";
53  m_interpolateDimensionNames[1] = "DIMW_ENER";
54  m_interpolateDimensionNames[2] = "DIMW_EDENS";
55  declareProperty("InterpolateDimensionNames", m_interpolateDimensionNames);
56  declareProperty("UpdateSamplingVars",m_updateSamplingVars=false);
57 }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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 CaloLCWeightTool::initialize ( )
overridevirtual

Definition at line 59 of file CaloLCWeightTool.cxx.

60 {
61  if(m_interpolate) {
62  msg(MSG::INFO) << "Interpolation is ON, dimensions: ";
64  msg(MSG::INFO) << " " << (*it);
65  }
66  msg() << endmsg;
70  m_interpolateDimensions.push_back(int(id));
71  }else{
72  ATH_MSG_WARNING( "Dimension '" << (*it) << "' is invalid and will be excluded." );
73  }
74  }
75  }
76 
77  ATH_MSG_INFO( "Initializing " << name() );
78 
80 
81  ATH_CHECK( detStore()->retrieve( m_calo_id, "CaloCell_ID") );
82 
84  for (int iSamp=0;iSamp<CaloSampling::Unknown;iSamp++) {
86  }
87 
89 
90  return StatusCode::SUCCESS;
91 }

◆ 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()

static const InterfaceID& IClusterCellWeightTool::interfaceID ( )
inlinestaticinherited

Definition at line 28 of file IClusterCellWeightTool.h.

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

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ weight()

StatusCode CaloLCWeightTool::weight ( xAOD::CaloCluster thisCluster,
const EventContext &  ctx 
) const
overridevirtual

method to weight the cells in a cluster

Parameters
theClusterthe pointer to the CaloCluster to be weighted

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

Implements IClusterCellWeightTool.

Definition at line 93 of file CaloLCWeightTool.cxx.

94 {
95  const CaloLocalHadCoeff* data(nullptr);
97 
99  const CaloNoise* noiseCDO=*noiseHdl;
100 
101  data = *rch;
102  if(data==nullptr) {
103  ATH_MSG_ERROR("Unable to access conditions object");
104  return StatusCode::FAILURE;
105  }
106  // this is not super effective, but try to put is here first, and optimize later
107  std::vector<int> isAmpMap(CaloSampling::Unknown,-1);
108  for (int iArea=0;iArea<data->getSizeAreaSet();iArea++) {
109  for (int iSamp=0;iSamp<CaloSampling::Unknown;iSamp++) {
110  if ( m_sampnames[iSamp] == data->getArea(iArea)->getTitle() ) {
111  ATH_MSG_DEBUG("Found Area for Sampling " << CaloSamplingHelper::getSamplingName((CaloSampling::CaloSample)iSamp));
112  isAmpMap[iSamp] = iArea;
113  break;
114  }
115  }
116  }
117 
118  double eEM = theCluster->e();
119 
120  std::vector<float> vars(5);
121 
124 
125  double pi0Prob = 0;
126  if ( m_useHadProbability) {
127  if (!theCluster->retrieveMoment(xAOD::CaloCluster::EM_PROBABILITY,pi0Prob)) {
128  ATH_MSG_WARNING ("Cannot find cluster moment EM_PROBABILITY");
129  }
130  }
131  else if (theCluster->recoStatus().checkStatus(CaloRecoStatus::TAGGEDEM)) {
132  pi0Prob = 1.;
133  }
134  if ( pi0Prob < 0 )
135  pi0Prob = 0;
136  if ( pi0Prob > 1 )
137  pi0Prob = 1;
138 
139  if ( eEM > 0 ) {
140  // loop over all cells
141 
142  xAOD::CaloCluster::cell_iterator itrCell = theCluster->cell_begin();
143  xAOD::CaloCluster::cell_iterator itrCellEnd = theCluster->cell_end();
144  for (;itrCell!=itrCellEnd; ++itrCell) {
145  CaloPrefetch::nextDDE(itrCell, itrCellEnd);
146  // check calo and sampling index for current cell
147  Identifier myId = itrCell->ID();
149  if ( isAmpMap[theSample] >= 0 ) {
150  double sigma = noiseCDO->getNoise(itrCell->ID(),itrCell->gain());
151  double energy = fabs(itrCell->e());
152  double ratio = 0;
153  if ( std::isfinite(sigma) && sigma > 0 )
154  ratio = energy/sigma;
155  if ( ratio > m_signalOverNoiseCut ) {
156  double volume = 0;
157  double density = 0;
158  const CaloDetDescrElement* myCDDE = itrCell->caloDDE();
159  if ( myCDDE ) {
160  volume = myCDDE->volume();
161  }
162  if ( volume > 0 )
163  density = energy/volume;
164  if ( density > 0 ) {
165  double abseta = fabs(itrCell->eta());
166  double log10edens = log10(density);
167  double log10cluse = log10(eEM);
168  const CaloLocalHadCoeff::LocalHadDimension *logeDim = data->getArea(isAmpMap[theSample])->getDimension(3);
169  double lemax = logeDim->getXmax()-0.5*logeDim->getDx();
170  if ( log10cluse > lemax ) log10cluse = lemax;
171 
172  vars[CaloLocalHadDefs::DIMW_SIDE] = static_cast<float> ((itrCell->eta()<0?-1.0:1.0));
173  vars[CaloLocalHadDefs::DIMW_ETA] = static_cast<float> (abseta);
174  vars[CaloLocalHadDefs::DIMW_PHI] = static_cast<float> (itrCell->phi());
175  vars[CaloLocalHadDefs::DIMW_ENER] = static_cast<float> (log10cluse);
176  vars[CaloLocalHadDefs::DIMW_EDENS] = static_cast<float> (log10edens);
177 
178  bool isDataOK = false;
179  double wData(0);
180 
181  // accessing coefficients (non-interpolated)
182  int iBin = data->getBin(isAmpMap[theSample],vars);
183  if ( iBin >= 0 ) {
184  const CaloLocalHadCoeff::LocalHadCoeff * pData = data->getCoeff(iBin);
185  if ( pData && (*pData)[CaloLocalHadDefs::BIN_ENTRIES] > 10 ) {
186  isDataOK = true;
187  wData = (*pData)[CaloLocalHadDefs::BIN_WEIGHT];
188  }
189  if(m_interpolate) {
190  // accesing interpolated coefficients
191  bool isa = CaloLCCoeffHelper::Interpolate(data, isAmpMap[theSample], vars, parint, m_interpolateDimensions);
192  if(isa && parint[CaloLocalHadDefs::BIN_ENTRIES] > 10) {
193  isDataOK = true;
194  wData = parint[CaloLocalHadDefs::BIN_WEIGHT];
195  }
196  }
197  }
198 
199  if(isDataOK) {
200  ATH_MSG_DEBUG(" weight("
201  << theSample << ", "
202  << vars[0] << ", "
203  << vars[1] << ", "
204  << vars[2] << ", "
205  << vars[3] << ", "
206  << vars[4] << ") = "
207  << wData);
208  double weight = itrCell.weight();//theCluster->getCellWeight(itrCell); // fastest!
209  weight *= (pi0Prob + (1-pi0Prob)*wData);
210  // reweight cell in cluster
211  theCluster->reweightCell(itrCell,weight);
212  }
213  } // density
214  } // noise cut
215  } // sampling
216  } // itrCell
218  } // eEM
219 
220  // assume that the weighting could be called more than once. In that case
221  // eEM is the result of the previous step and the current e/eEM ratio
222  // should be multiplied with the existing HAD_WEIGHT moment
223  double new_weight (1);
224  if (!theCluster->retrieveMoment(xAOD::CaloCluster::HAD_WEIGHT,new_weight)) {
225  ATH_MSG_ERROR("Cannot retrieve HAD_WEIGHT cluster moment." );
226  return StatusCode::FAILURE;
227  }
228 
229  if ( eEM > 0 || eEM < 0 ) {
230  new_weight *= theCluster->e()/eEM;
231  }
232  theCluster->insertMoment(xAOD::CaloCluster::HAD_WEIGHT,new_weight);
233 
234  return StatusCode::SUCCESS;
235 }

Member Data Documentation

◆ m_calo_id

const CaloCell_ID* CaloLCWeightTool::m_calo_id
private

Definition at line 93 of file CaloLCWeightTool.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 CaloLCWeightTool::m_interpolate
private

interpolate correction coefficients

Definition at line 77 of file CaloLCWeightTool.h.

◆ m_interpolateDimensionNames

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

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

Definition at line 85 of file CaloLCWeightTool.h.

◆ m_interpolateDimensions

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

actual set of dimension id's to interpolate

Definition at line 90 of file CaloLCWeightTool.h.

◆ m_key

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

name of the key for had cell weights

Definition at line 49 of file CaloLCWeightTool.h.

◆ m_noiseCDOKey

SG::ReadCondHandleKey<CaloNoise> CaloLCWeightTool::m_noiseCDOKey {this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}
private

Definition at line 95 of file CaloLCWeightTool.h.

◆ m_sampnames

std::vector<std::string> CaloLCWeightTool::m_sampnames
private

vector of names of individual samplings

needed to not call many times CaloSamplingHelper::getSamplingName

Definition at line 73 of file CaloLCWeightTool.h.

◆ m_signalOverNoiseCut

double CaloLCWeightTool::m_signalOverNoiseCut
private

minimal signal/elec_noise ratio for a cell to be weighted

Only cells with |energy| above this value times the RMS of the electronics noise are considered in weighting.

Definition at line 56 of file CaloLCWeightTool.h.

◆ m_updateSamplingVars

bool CaloLCWeightTool::m_updateSamplingVars
private

update also sampling variables

Definition at line 81 of file CaloLCWeightTool.h.

◆ m_useHadProbability

bool CaloLCWeightTool::m_useHadProbability
private

look for em-probability moment and apply relative weight only

The classification provides the probability p for the current cluster to be em-like. Hadronic weights are applied with the additional hadronic probablity factor (1-p) to all clusters for the cases EM and HAD.

Definition at line 65 of file CaloLCWeightTool.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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloLocalHadCoeff::LocalHadDimension
Class defines binning for user dimension.
Definition: CaloLocalHadCoeff.h:47
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
CaloCell::phi
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition: CaloCell.h:359
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::CaloCluster_v1::EM_PROBABILITY
@ EM_PROBABILITY
Classification probability to be em-like.
Definition: CaloCluster_v1.h:173
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloLCWeightTool::m_updateSamplingVars
bool m_updateSamplingVars
update also sampling variables
Definition: CaloLCWeightTool.h:81
CaloLocalHadDefs::DIMU_UNKNOWN
@ DIMU_UNKNOWN
Definition: CaloLocalHadDefs.h:73
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloLCWeightTool::m_interpolate
bool m_interpolate
interpolate correction coefficients
Definition: CaloLCWeightTool.h:77
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CaloLCCoeffHelper::getDimensionId
static CaloLocalHadDefs::LocalHadDimensionId getDimensionId(const std::string &dimensionName)
Definition: CaloLCCoeffHelper.h:32
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
CaloLCWeightTool::m_key
SG::ReadCondHandleKey< CaloLocalHadCoeff > m_key
name of the key for had cell weights
Definition: CaloLCWeightTool.h:49
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:317
CaloCell_Base_ID::calo_sample
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Definition: CaloCell_Base_ID.cxx:141
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CaloLocalHadDefs::DIMW_EDENS
@ DIMW_EDENS
Definition: CaloLocalHadDefs.h:58
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition: CaloNoise.h:34
CaloLocalHadDefs::DIMW_SIDE
@ DIMW_SIDE
Definition: CaloLocalHadDefs.h:54
CaloLocalHadDefs::LocalHadDimensionId
LocalHadDimensionId
enums to identify user dimensions id number DIMC_* - classification, DIMW_*-weighting,...
Definition: CaloLocalHadDefs.h:45
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
CaloLocalHadCoeff::LocalHadCoeff
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
Definition: CaloLocalHadCoeff.h:220
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
CaloLCWeightTool::m_interpolateDimensions
std::vector< int > m_interpolateDimensions
actual set of dimension id's to interpolate
Definition: CaloLCWeightTool.h:90
CaloLocalHadDefs::BIN_ENTRIES
@ BIN_ENTRIES
Definition: CaloLocalHadDefs.h:29
CaloLCWeightTool::m_calo_id
const CaloCell_ID * m_calo_id
Definition: CaloLCWeightTool.h:93
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
xAOD::CaloCluster_v1::HAD_WEIGHT
@ HAD_WEIGHT
Hadronic weight (E_w/E_em)
Definition: CaloCluster_v1.h:174
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
CaloCell_ID::CaloSample
CaloSampling::CaloSample CaloSample
Definition: CaloCell_ID.h:53
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloLocalHadCoeff
Hold binned correction data for local hadronic calibration procedure.
Definition: CaloLocalHadCoeff.h:41
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloLocalHadCoeff::LocalHadDimension::getDx
float getDx() const
return size of bin
Definition: CaloLocalHadCoeff.h:108
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CaloLCWeightTool::m_sampnames
std::vector< std::string > m_sampnames
vector of names of individual samplings
Definition: CaloLCWeightTool.h:73
CaloLCCoeffHelper
Definition: CaloLCCoeffHelper.h:15
CaloLCWeightTool::m_useHadProbability
bool m_useHadProbability
look for em-probability moment and apply relative weight only
Definition: CaloLCWeightTool.h:65
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
CaloNoise
Definition: CaloNoise.h:16
CaloLCCoeffHelper::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.)
Definition: CaloLCCoeffHelper.cxx:230
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
CaloDetDescrElement::volume
float volume() const
cell volume
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:381
CaloLocalHadCoeff::LocalHadDimension::getXmax
float getXmax() const
return maximum value for the last bin
Definition: CaloLocalHadCoeff.h:105
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition: CaloCell.h:345
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCell::ID
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition: CaloCell.h:279
CaloLocalHadDefs::DIMW_ETA
@ DIMW_ETA
Definition: CaloLocalHadDefs.h:55
CaloRecoStatus::TAGGEDEM
@ TAGGEDEM
Definition: CaloRecoStatus.h:38
CaloLCWeightTool::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Definition: CaloLCWeightTool.h:95
CaloSamplingHelper::getSamplingName
static const std::string & getSamplingName(const CaloSampling::CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition: CaloUtils/src/CaloSamplingHelper.cxx:44
CaloLCWeightTool::m_interpolateDimensionNames
std::vector< std::string > m_interpolateDimensionNames
vector of names of dimensions in look-up tables to interpolate
Definition: CaloLCWeightTool.h:85
a
TList * a
Definition: liststreamerinfos.cxx:10
CaloLCWeightTool::weight
virtual StatusCode weight(xAOD::CaloCluster *theCluster, const EventContext &ctx) const override
method to weight the cells in a cluster
Definition: CaloLCWeightTool.cxx:93
h
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloLocalHadDefs::DIMW_ENER
@ DIMW_ENER
Definition: CaloLocalHadDefs.h:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
CaloClusterKineHelper::calculateKine
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
Definition: CaloClusterKineHelper.cxx:223
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
CaloLocalHadDefs::BIN_WEIGHT
@ BIN_WEIGHT
Definition: CaloLocalHadDefs.h:28
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CaloPrefetch::nextDDE
void nextDDE(Iter iter, Iter endIter)
Prefetch next CaloDDE.
Definition: CaloPrefetch.h:47
CaloLocalHadDefs::DIMW_PHI
@ DIMW_PHI
Definition: CaloLocalHadDefs.h:56
CaloLCWeightTool::m_signalOverNoiseCut
double m_signalOverNoiseCut
minimal signal/elec_noise ratio for a cell to be weighted
Definition: CaloLCWeightTool.h:56
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
fitman.k
k
Definition: fitman.py:528
Identifier
Definition: IdentifierFieldParser.cxx:14