6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/TypeNameString.h"
19 const std::string& name,
20 const IInterface* parent)
29 msg(MSG::ERROR) <<
"More than one classification tool specified!" <<
endmsg;
30 return StatusCode::FAILURE;
44 msg(MSG::ERROR) <<
"Please specify at least one valid reco status with ClusterRecoStatus = [...] for this calib tool " <<
endmsg;
45 return StatusCode::FAILURE;
47 return StatusCode::SUCCESS;
59 bool isSelected (
false);
60 for (
unsigned int i=0;!isSelected && i<
m_recoStatus.size();i++ )
70 double emprobability(0.);
84 double oldEnergy = theCluster->
e();
96 for(;cellIter!=theCluster->
cell_end();cellIter++) {
98 double CellEnergy = pCell->
e();
101 if( CellEnergy < 0. ) CellEnergy = -1 * pCell->
e();
103 double cellWeight = cellIter.
weight();
104 myCluster->addCell(cellIndex,cellWeight);
109 myCluster->setRawE(myCluster->e());
112 for(
unsigned int i=0; i != CaloSampling::Unknown; ++ i) {
125 for (
const ToolHandle<IClusterCellWeightTool>& tool :
m_calibTools) {
126 if (tool->weight(myCluster.get(),ctx).isFailure())
127 msg(MSG::ERROR) <<
" failed to weight cluster " <<
endmsg;
131 std::map<IdentifierHash,double> weightMap;
134 for(;mycellIter!=mycellIterEnd;mycellIter++) {
135 const CaloCell* pCell = *mycellIter;
136 double cellWeight = mycellIter.
weight();
139 weightMap[myHashId] = cellWeight;
146 for(;cellIter!=theCluster->
cell_end();cellIter++) {
149 double weight = weightMap[myHashId];
158 double newWeightMoment = theCluster->
e()/oldEnergy;
162 if(
m_calibTools[0].typeAndName() ==
"CaloLCOutOfClusterTool/LCOutPi0")
166 newWeightMoment *= ooc_weight;
174 for (
const ToolHandle<IClusterCellWeightTool>& tool :
m_calibTools) {
175 if (tool->weight(theCluster,ctx).isFailure())
176 msg(MSG::ERROR) <<
" failed to weight cluster " <<
endmsg;
186 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition of CaloDetDescrManager.
const ServiceHandle< StoreGateSvc > & detStore() const
Container class for CaloCell.
void push_back(CaloCell *)
reimplementation of const push_back
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Helper class for offline cell identifiers.
Data object for each calorimeter readout cell.
float time() const
get time (data member)
virtual double e() const override final
get energy (data member) (synonym to method energy()
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
uint16_t provenance() const
get provenance (data member)
uint16_t quality() const
get quality (data member)
CaloGain::CaloGain gain() const
get gain (data member )
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
weight_t weight() const
Accessor for weight associated to this cell.
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.
ToolHandleArray< IClusterCellWeightTool > m_calibTools
property: Array of IClusterCellWeightTool
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *theCluster) const override
Execute on a single cluster.
CaloClusterLocalCalib(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool constructor.
Gaudi::Property< std::vector< int > > m_recoStatus
property: vector of valid Reco Statuses for the clusters in order to be calibrated
ToolHandleArray< IClusterClassificationTool > m_classificationTool
property: Classification tools
virtual StatusCode initialize() override
Tool initialization: load calibration tools specified by jobOptions.
Gaudi::Property< bool > m_absOpt
if set to true, negative clusters are weighted as well
CaloClusterProcessor(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
Principal data class for CaloCell clusters.
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
bool retrieveMoment(const moment_type &momType, moment_value &momValue, bool useLink=true) const
Retrieve individual moment.
virtual double e() const
Retrieve energy independent of signal state.
void insertMoment(const moment_type &momType, const moment_value &momValue, bool useLink=true)
Set individual moment.
cell_iterator cell_end() const
Retrieve a STL-type end() iterator for the cell store.
void reweightCell(const CaloCell *pCell, double weight)
Reweight a cell with kinematic update.
cell_iterator cell_begin() const
Retrieve a STL-type begin() iterator for the cell store.
reconstruction status indicator
StatusIndicator
reconstruction status word
virtual bool checkStatus(const StatusIndicator &statusIndicator) const
Check status.
virtual void setStatus(const StatusIndicator &statusIndicator)
Set status.
This is a "hash" representation of an Identifier.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version)
@ 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.
@ ISOLATION
Energy weighted fraction of non-clustered perimeter cells.
CaloSampling::CaloSample CaloSample
@ OWN_ELEMENTS
this data object owns its elements
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.