6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/TypeNameString.h"
19 const std::string& name,
20 const IInterface* parent)
38 msg(MSG::ERROR) <<
"More than one classification tool specified!" <<
endmsg;
39 return StatusCode::FAILURE;
53 msg(MSG::ERROR) <<
"Please specify at least one valid reco status with ClusterRecoStatus = [...] for this calib tool " <<
endmsg;
54 return StatusCode::FAILURE;
56 return StatusCode::SUCCESS;
68 bool isSelected (
false);
69 for (
unsigned int i=0;!isSelected && i<
m_recoStatus.size();i++ )
79 double emprobability(0.);
93 double oldEnergy = theCluster->
e();
105 for(;cellIter!=theCluster->
cell_end();cellIter++) {
107 double CellEnergy = pCell->
e();
110 if( CellEnergy < 0. ) CellEnergy = -1 * pCell->
e();
112 double cellWeight = cellIter.
weight();
113 myCluster->addCell(cellIndex,cellWeight);
118 myCluster->setRawE(myCluster->e());
121 for(
unsigned int i=0; i != CaloSampling::Unknown; ++ i) {
134 for (
const ToolHandle<IClusterCellWeightTool>& tool :
m_calibTools) {
135 if (tool->weight(myCluster.get(),ctx).isFailure())
136 msg(MSG::ERROR) <<
" failed to weight cluster " <<
endmsg;
140 std::map<IdentifierHash,double> weightMap;
143 for(;mycellIter!=mycellIterEnd;mycellIter++) {
144 const CaloCell* pCell = *mycellIter;
145 double cellWeight = mycellIter.
weight();
148 weightMap[myHashId] = cellWeight;
155 for(;cellIter!=theCluster->
cell_end();cellIter++) {
158 double weight = weightMap[myHashId];
167 double newWeightMoment = theCluster->
e()/oldEnergy;
171 if(
m_calibTools[0].typeAndName() ==
"CaloLCOutOfClusterTool/LCOutPi0")
175 newWeightMoment *= ooc_weight;
183 for (
const ToolHandle<IClusterCellWeightTool>& tool :
m_calibTools) {
184 if (tool->weight(theCluster,ctx).isFailure())
185 msg(MSG::ERROR) <<
" failed to weight cluster " <<
endmsg;
195 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition of CaloDetDescrManager.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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.
bool m_absOpt
if set to true, negative clusters are weighted as well
ToolHandleArray< IClusterCellWeightTool > m_calibTools
property: Array of IClusterCellWeightTool
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *theCluster) const override
Execute on a single cluster.
std::vector< int > m_recoStatus
property: vector of valid Reco Statuses for the clusters in order to be calibrated
CaloClusterLocalCalib(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool constructor.
ToolHandleArray< IClusterClassificationTool > m_classificationTool
property: Classification tools
virtual StatusCode initialize() override
Tool initialization: load calibration tools specified by jobOptions.
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.