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

calculates out-of-cluster corrections based on cluster quantities More...

#include <CaloLCOutOfClusterTool.h>

Inheritance diagram for CaloLCOutOfClusterTool:
Collaboration diagram for CaloLCOutOfClusterTool:

Public Member Functions

virtual ~CaloLCOutOfClusterTool ()
 
virtual StatusCode weight (xAOD::CaloCluster *theCluster, const EventContext &ctx) const override
 method to weight the cells in a cluster More...
 
virtual StatusCode initialize () override
 
 CaloLCOutOfClusterTool (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 out-of-cluster weights More...
 
bool m_useEmProbability
 look for em-probability moment and apply relative weight only More...
 
bool m_useHadProbability
 look for em-probability moment and apply relative weight only More...
 
std::vector< std::string > m_invalidSamplingNames
 vector of names of the calorimeter samplings not to use when applying the out-of-cluster weights. More...
 
std::set< int > m_invalidSamplings
 actual set of samplings to be ignored for out-of-cluster weights 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...
 
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 out-of-cluster corrections based on cluster quantities

Version
$Id: CaloLCOutOfClusterTool.h,v 1.3 2009-01-27 09:09:14 gunal Exp $
Author
Sven Menke menke.nosp@m.@mpp.nosp@m.mu.mp.nosp@m.g.de
Date
2-March-2007 concrete class implementing a IClusterCellWeightTool to calculate the out-of-cluster corrections for topo clusters. The cluster moments and its energy are used to derive the correction
  • therefore the correction is not called cell-by-cell, but for the entire cluster This tool reads its data from pool containing TProfile2D based correction data.

Definition at line 27 of file CaloLCOutOfClusterTool.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

◆ ~CaloLCOutOfClusterTool()

CaloLCOutOfClusterTool::~CaloLCOutOfClusterTool ( )
virtualdefault

◆ CaloLCOutOfClusterTool()

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

Definition at line 33 of file CaloLCOutOfClusterTool.cxx.

37  m_key("OOCCorrection"),
38  m_useEmProbability(false),
39  m_useHadProbability(false),
40  m_interpolate(false)
41 
42 {
43 
44  declareInterface<IClusterCellWeightTool>(this);
45  m_invalidSamplingNames.resize(3);
46 
47  m_invalidSamplingNames[0] = "PreSamplerB";
48  m_invalidSamplingNames[1] = "PreSamplerE";
49  m_invalidSamplingNames[2] = "TileGap3";
50 
51  declareProperty("CorrectionKey",m_key);
52  declareProperty("UseEmProbability",m_useEmProbability);
53  declareProperty("UseHadProbability",m_useHadProbability);
54  declareProperty("InvalidSamplings",m_invalidSamplingNames);
55 
56  // Use Interpolation or not
57  declareProperty("Interpolate",m_interpolate);
59  m_interpolateDimensionNames[0] = "DIMO_ENER";
60  m_interpolateDimensionNames[1] = "DIMO_ETA";
61  m_interpolateDimensionNames[2] = "DIMO_LAMBDA";
62  declareProperty("InterpolateDimensionNames", m_interpolateDimensionNames);
63  declareProperty("UpdateSamplingVars",m_updateSamplingVars=false);
64 }

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

Definition at line 66 of file CaloLCOutOfClusterTool.cxx.

67 {
68  ATH_MSG_INFO( "Initializing " << name() );
69 
70  //--- check sampling names to use exclude in correction
73  for(; samplingIter!=samplingIterEnd; ++samplingIter) {
74  int theSampling(CaloSampling::Unknown);
75  for (unsigned int jsamp = 0;jsamp< CaloSampling::Unknown; jsamp++) {
76  if ( *samplingIter == CaloSamplingHelper::getSamplingName((CaloSampling::CaloSample)jsamp)) {
77  theSampling = jsamp;
78  break;
79  }
80  }
81  if ( theSampling == CaloSampling::Unknown ) {
82  msg(MSG::ERROR) << "Calorimeter sampling "
83  << *samplingIter
84  << " is not a valid Calorimeter sampling name and will be ignored! "
85  << "Valid names are: ";
86  for (unsigned int jsamp = 0;jsamp< CaloSampling::Unknown; jsamp++) {
88  if ( jsamp < CaloSampling::Unknown-1)
89  msg() << ", ";
90  else
91  msg() << ".";
92  }
93  msg() << endmsg;
94  }
95  else {
96  m_invalidSamplings.insert(theSampling);
97  }
98  }
99 
100  msg(MSG::INFO) << "Samplings to exclude from the out-of-cluster weighting:";
101  samplingIter = m_invalidSamplingNames.begin();
102  for(; samplingIter!=samplingIterEnd; ++samplingIter)
103  msg() << " " << *samplingIter;
104  msg() << endmsg;
105 
106  if(m_interpolate) {
107  msg(MSG::INFO) << "Interpolation is ON, dimensions: ";
109  msg() << " " << (*it);
110  }
111  msg() << endmsg;
115  m_interpolateDimensions.push_back(int(id));
116  }else{
117  ATH_MSG_WARNING( "Dimension '" << (*it) << "' is invalid and will be excluded." );
118  }
119  }
120  }
121 
122  // callback for conditions data
124 
125  return StatusCode::SUCCESS;
126 }

◆ 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 CaloLCOutOfClusterTool::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 128 of file CaloLCOutOfClusterTool.cxx.

129 {
130  double eWeightedOrig = theCluster->e();
131  double eWeighted = theCluster->e();
132  // get ratio of weighted and em cluster
133  double ratio=1.;
134  std::vector<float> vars(5);
135 
137 
138  double pi0Prob = 0;
140  if (!theCluster->retrieveMoment(CaloCluster::EM_PROBABILITY,pi0Prob)) {
141  ATH_MSG_WARNING ("Cannot find cluster moment EM_PROBABILITY");
142  }
143  }
144  else if (theCluster->recoStatus().checkStatus(CaloRecoStatus::TAGGEDEM)) {
145  pi0Prob = 1.;
146  }
147  if ( pi0Prob < 0 )
148  pi0Prob = 0;
149  if ( pi0Prob > 1 )
150  pi0Prob = 1;
151 
152  double classifyWeight = 1;
153  if ( m_useEmProbability ) {
154  classifyWeight = pi0Prob;
155  }
156  else if ( m_useHadProbability ) {
157  classifyWeight = 1-pi0Prob;
158  }
159  double eEM = theCluster->rawE();
160  // basic energy can be 0 if the locking tool option FixBasicEnergy is False
161  // in that case simply use the weighted energy ...
162  if ( eEM == 0. ) {
163  ATH_MSG_DEBUG("Basic Energy is 0. Use weighted energy instead");
164  eEM = eWeighted;
165  }
166 
167 
168 
169  // subtract the samplings to ignore from eEM and eWeighted, assuming that
170  // they would not have received any cell weights in prior calibration
171  // steps
172  std::set<int>::const_iterator ivSamplingIter = m_invalidSamplings.begin();
173  std::set<int>::const_iterator ivSamplingIterEnd = m_invalidSamplings.end();
174  for(; ivSamplingIter!=ivSamplingIterEnd; ++ivSamplingIter) {
175  eEM -= theCluster->eSample((CaloCluster::CaloSample)(*ivSamplingIter));
176  eWeighted -= theCluster->eSample((CaloCluster::CaloSample)(*ivSamplingIter));
177  }
178 
179  if ( eEM > 0 && eWeighted > 0 ) {
180  // ratio is em energy over weighted energy without the samplings
181  // to ignore. This means also the OOC weight tables have to be made
182  // relative to the em energy wihtout the samplings to ignore ...
183  ratio = eEM / eWeighted;
184 
185  if ( ratio < 0.3 || ratio > 3 ) {
186  ATH_MSG_DEBUG("The ratio eEM/eWeighted = "
187  << ratio << " is out of normal range [0.3,3]"
188  << " - this mean we have mainly noise ... using 1 instead");
189  ratio = 1.0;
190  }
191 
192  double log10cluse = log10(eEM);
193 
195  const CaloLocalHadCoeff* data = *h;
196  if (!data) {
197  ATH_MSG_ERROR("Unable to access conditions object");
199  }
200 
201  const CaloLocalHadCoeff::LocalHadDimension *logeDim = data->getArea(0)->getDimension(2);
202  double lemax = logeDim->getXmax()-0.5*logeDim->getDx();
203  double lemin = logeDim->getXmin()+0.5*logeDim->getDx();
204  if ( log10cluse > lemax )
205  log10cluse = lemax;
206  if ( log10cluse < lemin )
207  log10cluse = lemin;
208 
209  double center_lambda,isolation;
210  if ( theCluster->retrieveMoment(CaloCluster::ISOLATION,isolation)
211  && theCluster->retrieveMoment(CaloCluster::CENTER_LAMBDA, center_lambda)) {
212  if ( isolation > 0 ) {
213  if ( center_lambda > 0 ) {
214  const double abseta = fabs(theCluster->eta());
215  const double log10lambda = log10(center_lambda);
216 
217  vars[CaloLocalHadDefs::DIMO_SIDE] = static_cast<float> ((theCluster->eta()<0?-1.0:1.0));
218  vars[CaloLocalHadDefs::DIMO_PHI] = static_cast<float> (theCluster->phi());
219  vars[CaloLocalHadDefs::DIMO_ENER] = static_cast<float> (log10cluse);
220  vars[CaloLocalHadDefs::DIMO_ETA] = static_cast<float> (abseta);
221  vars[CaloLocalHadDefs::DIMO_LAMBDA] = static_cast<float> (log10lambda);
222 
223  bool isDataOK = false;
224  double oocData(0);
225 
226  // accessing coefficients (non-interpolated)
227  int iBin = data->getBin(0,vars);
228  if ( iBin >= 0 ) {
229  const CaloLocalHadCoeff::LocalHadCoeff * pData = data->getCoeff(iBin);
230  if ( pData && (*pData)[CaloLocalHadDefs::BIN_ENTRIES] > 0 ) {
231  isDataOK = true;
232  oocData = (*pData)[CaloLocalHadDefs::BIN_WEIGHT];
233  }
234  if(m_interpolate) {
235  // accesing interpolated coefficients
237  bool isa = CaloLCCoeffHelper::Interpolate(data, 0,vars,parint, m_interpolateDimensions);
238  if(isa && parint[CaloLocalHadDefs::BIN_ENTRIES] > 0) {
239  isDataOK = true;
240  oocData = parint[CaloLocalHadDefs::BIN_WEIGHT];
241  }
242  }
243  }
244 
245  ATH_MSG_DEBUG("interpolation_ON=" << m_interpolate
246  << "isDataOK="<<isDataOK
247  << "side = " << vars[0]
248  << ", phi = " << vars[1]
249  << ", log10cluse = " << log10cluse
250  << ", eta = " << abseta
251  << ", log10lambda = " << log10lambda
252  << ", ratio = " << ratio
253  << ", isol = " << isolation
254  << ", oocData = " << oocData);
255 
256  if(isDataOK){
257  const double oocWeight = 1.+classifyWeight*isolation*ratio*oocData;
258  // loop over all cells
259  CaloCluster::cell_iterator itrCell = theCluster->cell_begin();
260  CaloCluster::cell_iterator itrCellEnd = theCluster->cell_end();
261  for (;itrCell!=itrCellEnd; ++itrCell) {
262  CaloPrefetch::nextDDE(itrCell, itrCellEnd);
263  const CaloDetDescrElement* cDDE = itrCell->caloDDE();
264  if ( cDDE && !m_invalidSamplings.contains(cDDE->getSampling())) { //Fixme ... could use a bit-pattern
265  double weight = itrCell.weight();//theCluster->getCellWeight(itrCell); // fastest!
266  weight *= oocWeight;
267  // reweight cell in cluster
268  theCluster->reweightCell(itrCell,weight);
269  } else if (cDDE) {
270  ATH_MSG_DEBUG("Exclude cell with sampling = " << cDDE->getSampling());
271  }
272  }//cell-loop
274  }
275  } // log10lambda
276  } // isolation
277  } // moments
278  }
279 
280  // assume that the weighting could be called more than once. In that
281  // case eWeighted is the result of the previous step and the current
282  // e/eWeighted ratio should be multiplied with the existing
283  // OOC_WEIGHT moment
284  if ( eWeightedOrig > 0 || eWeightedOrig < 0 ) {
285  double old_weight(1);
286  if (!theCluster->retrieveMoment(CaloCluster::OOC_WEIGHT,old_weight)) {
287  ATH_MSG_ERROR("Cannot retrieve OOC_WEIGHT cluster moment." );
288  return StatusCode::FAILURE;
289  }
290  const double new_weight = old_weight*theCluster->e()/eWeightedOrig;
291  theCluster->insertMoment(CaloCluster::OOC_WEIGHT,new_weight);
292  }
293  return StatusCode::SUCCESS;
294 }

Member Data Documentation

◆ 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 CaloLCOutOfClusterTool::m_interpolate
private

interpolate correction coefficients

Definition at line 80 of file CaloLCOutOfClusterTool.h.

◆ m_interpolateDimensionNames

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

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

Definition at line 88 of file CaloLCOutOfClusterTool.h.

◆ m_interpolateDimensions

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

actual set of dimension id's to interpolate

Definition at line 92 of file CaloLCOutOfClusterTool.h.

◆ m_invalidSamplingNames

std::vector<std::string> CaloLCOutOfClusterTool::m_invalidSamplingNames
private

vector of names of the calorimeter samplings not to use when applying the out-of-cluster weights.

The pre-sampler layers (barrel and endcap) and the gap-scintillators should not receive out-of-cluster weights as they mainly deal with dead-material corrections.

Definition at line 69 of file CaloLCOutOfClusterTool.h.

◆ m_invalidSamplings

std::set<int> CaloLCOutOfClusterTool::m_invalidSamplings
private

actual set of samplings to be ignored for out-of-cluster weights

This set is created according to the names given in the property m_invalidSamplingNames.

Definition at line 76 of file CaloLCOutOfClusterTool.h.

◆ m_key

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

name of the key for out-of-cluster weights

Definition at line 44 of file CaloLCOutOfClusterTool.h.

◆ m_updateSamplingVars

bool CaloLCOutOfClusterTool::m_updateSamplingVars
private

update also sampling variables

Definition at line 84 of file CaloLCOutOfClusterTool.h.

◆ m_useEmProbability

bool CaloLCOutOfClusterTool::m_useEmProbability
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. OOC weights are applied with the additional em-prob factor p to all clusters for the cases EM and HAD.

Definition at line 52 of file CaloLCOutOfClusterTool.h.

◆ m_useHadProbability

bool CaloLCOutOfClusterTool::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. OOC weights are applied with the additional had-prob factor (1-p) to all clusters for the cases EM and HAD.

Definition at line 60 of file CaloLCOutOfClusterTool.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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloLocalHadDefs::DIMO_LAMBDA
@ DIMO_LAMBDA
Definition: CaloLocalHadDefs.h:64
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
TauGNNUtils::Variables::Cluster::CENTER_LAMBDA
bool CENTER_LAMBDA(const xAOD::TauJet &, const xAOD::CaloVertexedTopoCluster &cluster, double &out)
Definition: TauGNNUtils.cxx:831
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloRecoStatus::TAGGEDUNKNOWN
@ TAGGEDUNKNOWN
Definition: CaloRecoStatus.h:41
TauGNNUtils::Variables::Cluster::EM_PROBABILITY
bool EM_PROBABILITY(const xAOD::TauJet &, const xAOD::CaloVertexedTopoCluster &cluster, double &out)
Definition: TauGNNUtils.cxx:900
CaloLCOutOfClusterTool::m_invalidSamplings
std::set< int > m_invalidSamplings
actual set of samplings to be ignored for out-of-cluster weights
Definition: CaloLCOutOfClusterTool.h:76
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloLocalHadDefs::DIMO_PHI
@ DIMO_PHI
Definition: CaloLocalHadDefs.h:61
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
skel.it
it
Definition: skel.GENtoEVGEN.py:423
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
CaloLocalHadCoeff::LocalHadDimension::getXmin
float getXmin() const
return minimum value for the first bin
Definition: CaloLocalHadCoeff.h:102
CaloLCOutOfClusterTool::weight
virtual StatusCode weight(xAOD::CaloCluster *theCluster, const EventContext &ctx) const override
method to weight the cells in a cluster
Definition: CaloLCOutOfClusterTool.cxx:128
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CaloLCOutOfClusterTool::m_updateSamplingVars
bool m_updateSamplingVars
update also sampling variables
Definition: CaloLCOutOfClusterTool.h:84
CaloLCOutOfClusterTool::m_interpolateDimensionNames
std::vector< std::string > m_interpolateDimensionNames
vector of names of dimensions in look-up tables to interpolate
Definition: CaloLCOutOfClusterTool.h:88
CaloLocalHadDefs::LocalHadDimensionId
LocalHadDimensionId
enums to identify user dimensions id number DIMC_* - classification, DIMW_*-weighting,...
Definition: CaloLocalHadDefs.h:45
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
CaloLocalHadDefs::DIMO_SIDE
@ DIMO_SIDE
Definition: CaloLocalHadDefs.h:60
CaloLCOutOfClusterTool::m_invalidSamplingNames
std::vector< std::string > m_invalidSamplingNames
vector of names of the calorimeter samplings not to use when applying the out-of-cluster weights.
Definition: CaloLCOutOfClusterTool.h:69
CaloLCOutOfClusterTool::m_useEmProbability
bool m_useEmProbability
look for em-probability moment and apply relative weight only
Definition: CaloLCOutOfClusterTool.h:52
CaloLocalHadDefs::BIN_ENTRIES
@ BIN_ENTRIES
Definition: CaloLocalHadDefs.h:29
CaloCluster::cell_iterator
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:115
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloLocalHadDefs::DIMO_ENER
@ DIMO_ENER
Definition: CaloLocalHadDefs.h:62
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloLocalHadDefs::DIMO_ETA
@ DIMO_ETA
Definition: CaloLocalHadDefs.h:63
extractSporadic.h
list h
Definition: extractSporadic.py:97
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloLCOutOfClusterTool::m_key
SG::ReadCondHandleKey< CaloLocalHadCoeff > m_key
name of the key for out-of-cluster weights
Definition: CaloLCOutOfClusterTool.h:44
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
CaloLCCoeffHelper
Definition: CaloLCCoeffHelper.h:15
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
CaloLCOutOfClusterTool::m_interpolateDimensions
std::vector< int > m_interpolateDimensions
actual set of dimension id's to interpolate
Definition: CaloLCOutOfClusterTool.h:92
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
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
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:192
top::ISOLATION
@ ISOLATION
Definition: ScaleFactorRetriever.h:213
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloRecoStatus::TAGGEDEM
@ TAGGEDEM
Definition: CaloRecoStatus.h:38
CaloSamplingHelper::getSamplingName
static const std::string & getSamplingName(const CaloSampling::CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition: CaloUtils/src/CaloSamplingHelper.cxx:42
a
TList * a
Definition: liststreamerinfos.cxx:10
h
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
CaloSample
CaloCell_ID::CaloSample CaloSample
Definition: CaloCellCollector.cxx:18
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
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
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
CaloLocalHadDefs::BIN_WEIGHT
@ BIN_WEIGHT
Definition: CaloLocalHadDefs.h:28
CaloLCOutOfClusterTool::m_useHadProbability
bool m_useHadProbability
look for em-probability moment and apply relative weight only
Definition: CaloLCOutOfClusterTool.h:60
CaloLCOutOfClusterTool::m_interpolate
bool m_interpolate
interpolate correction coefficients
Definition: CaloLCOutOfClusterTool.h:80
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
fitman.k
k
Definition: fitman.py:528