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

A cluster builder tool to calibrate topo-clusters formed from (EM) calorimeter towers to the LCW scale. More...

#include <CaloTopoTowerFromClusterCalibrator.h>

Inheritance diagram for CaloTopoTowerFromClusterCalibrator:
Collaboration diagram for CaloTopoTowerFromClusterCalibrator:

Public Member Functions

 CaloTopoTowerFromClusterCalibrator (const std::string &type, const std::string &name, const IInterface *pParent)
 Tool constructor.
virtual StatusCode execute (const EventContext &ctx, xAOD::CaloClusterContainer *pClusCont, CaloCellClusterWeights *cellWeights) const override
 Tool execution.
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 ()
 Standard Gaudi interface ID method.

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

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
Tool properties
bool m_orderByPt = { false }
 Turn on pT ordering if true.

Detailed Description

A cluster builder tool to calibrate topo-clusters formed from (EM) calorimeter towers to the LCW scale.

This module applies LCW weights to cells contributing to towers represented by xAOD::CaloCluster objects. The overall energy contribution of a given cell contributing to a given tower is then \( w_{\rm geo} \times w_{\rm LCW} \times E_{\rm cell} \), where \( w_{\rm geo} \) is the geometrical weight, \( w_{\rm LCW} \) is the calibration weight the cell received from the LCW calibration in the context of the xAOD::CaloCluster objects it contributes to (at most two), and \( E_{\rm cell} \) is the cell energy on EM scale. More details on the weights are given on this page.

Author
Peter Loch loch@.nosp@m.phys.nosp@m.ics.a.nosp@m.rizo.nosp@m.na.ed.nosp@m.u

Definition at line 16 of file CaloTopoTowerFromClusterCalibrator.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

◆ CaloTopoTowerFromClusterCalibrator()

CaloTopoTowerFromClusterCalibrator::CaloTopoTowerFromClusterCalibrator ( const std::string & type,
const std::string & name,
const IInterface * pParent )

Tool constructor.

Definition at line 22 of file CaloTopoTowerFromClusterCalibrator.cxx.

23 : AthAlgTool(type,name,pParent)
24{
25 declareInterface<CaloTowerCollectionProcessor>(this);
26 declareProperty("OrderClusterByPt", m_orderByPt, "Order clusters by calibrated Pt (input)");
27}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

Member Function Documentation

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

◆ execute()

StatusCode CaloTopoTowerFromClusterCalibrator::execute ( const EventContext & ctx,
xAOD::CaloClusterContainer * pClusCont,
CaloCellClusterWeights * cellWeights ) const
overridevirtual

Tool execution.

Implements CaloTowerCollectionProcessor.

Definition at line 29 of file CaloTopoTowerFromClusterCalibrator.cxx.

32{
33
34 // protection needed?
35 if ( cellWeights == nullptr ) {
36 ATH_MSG_ERROR("Tower calibrator needs valid pointer to LCW weight lookup");
37 return StatusCode::FAILURE;
38 }
39
41 // Calibrated clusters //
43
44 // loop towers
45 for ( auto pClus : *pClusCont ) {
46 // loop cells in towers
47 for ( auto fCell(pClus->cell_begin()); fCell != pClus->cell_end(); ++fCell ) {
48 // pick up the LCW weights (one if cell is only in one topo-cluster, two if cell is split between two) -> w_cell
49 const CaloCellClusterWeights::weight_t& wght(cellWeights->at(*fCell));
50 // pick up geometrical weight of cells in tower
51 double weight(fCell.weight());
52 // combine the weights -> w_geo * w_cell
53 weight *= accumulateWeight(wght);
54 if ( weight == 0. ) {
55 // weight = 0 should actualy never happen!!!!
56 ATH_MSG_DEBUG( CaloRec::Helpers::fmtMsg("[NO_LCW_REWEIGHT] Tower (%6.3f,%6.3f) cell [%6zu] weight = %6.3f [# LCW weights %zu geo %6.3f LCW %6.3f] SamplingID %2u Name \042%s\042",
57 pClus->eta(),pClus->phi(),(size_t)fCell->caloDDE()->calo_hash(),weight,wght.size(),fCell.weight(),weight/std::max(fCell.weight(),1e-08),
58 (unsigned int)fCell->caloDDE()->getSampling(),CaloSampling::getSamplingName(fCell->caloDDE()->getSampling()).c_str()) );
59 } else {
60 // valid weight, apply to cell in tower
61 ATH_MSG_DEBUG( CaloRec::Helpers::fmtMsg("[DO_LCW_REWEIGHT] Tower (%6.3f,%6.3f) cell [%6zu] weight = %6.3f [# LCW weights %zu geo %6.3f LCW %6.3f]",
62 pClus->eta(),pClus->phi(),(size_t)fCell->caloDDE()->calo_hash(),weight,wght.size(),fCell.weight(),weight/fCell.weight()) );
63 pClus->reweightCell(fCell,weight); // Set new weight. //
64 }
65 }
66 // preserve raw (EM) kinematics
67 double rawE(pClus->e());
68 double rawEta(pClus->eta()); // Clusters are instantiated with signal state CALIBRATED. The kinematics prior to the //
69 double rawPhi(pClus->phi()); // application of LCW is EM. This code saves the EM scale kinematics. //
70 double rawM(pClus->m());
71 // update cluster kinematics
73 pClus->setRawE(rawE); // The calculateKine function recombines cell signals with the updated weights (combined //
74 pClus->setRawEta(rawEta); // LCW and tower geometry weights). After this function, the CALIBRATED state reflects //
75 pClus->setRawPhi(rawPhi); // these combined weights. The EM scale kinematics is restored as raw (UNCALIBRATED). //
76 pClus->setRawM(rawM);
77 } // cluster loop
78
79 // order clusters by Pt if requested
80 if ( m_orderByPt ) {
81 std::sort(pClusCont->begin(),pClusCont->end(),[](xAOD::CaloCluster* pc1,xAOD::CaloCluster* pc2) {
82 volatile double pt1(pc1->pt());
83 volatile double pt2(pc2->pt());
84 return ( pt1 > pt2 );
85 }
86 );
87 }
88
89 return StatusCode::SUCCESS;
90}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
std::vector< double > weight_t
Type of weight.
const weight_t & at(size_t hash) const
Accessing value using function and hash.
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
bool calculateKine(xAOD::CaloCluster *pClus, bool onlyKine=false)
Kinematic updates.
std::string fmtMsg(const char *fmt,...)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
setRawEt rawPhi

◆ 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

◆ 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 & CaloTowerCollectionProcessor::interfaceID ( )
inlinestaticinherited

Standard Gaudi interface ID method.

Definition at line 45 of file CaloTowerCollectionProcessor.h.

static const InterfaceID IID_CaloTowerCollectionProcessor("CaloTowerCollectionProcessor", 1, 0)

◆ 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_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_orderByPt

bool CaloTopoTowerFromClusterCalibrator::m_orderByPt = { false }
private

Turn on pT ordering if true.

Definition at line 33 of file CaloTopoTowerFromClusterCalibrator.h.

33{ false };

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