7#include "CLHEP/Units/SystemOfUnits.h"
15#include "CaloEvent/CaloCluster.h"
27 const std::string& name,
28 const IInterface* pParent)
42 MsgStream report(msgSvc(),name());
48 if ( checkOut.isFailure() )
51 <<
"failed to configure direction calculations."
53 return StatusCode::FAILURE;
60 <<
"*** configuration insufficient *** "
61 <<
"no hadronic cell calibration tool configured"
63 return StatusCode::FAILURE;
67 return StatusCode::SUCCESS;
80 double clusterE(pClus->
rawE());
81 double clusterEta(pClus->
rawEta());
82 double clusterPhi(pClus->
rawPhi());
91 pClus->
setE(clusterE);
101 StatusCode checkOut(StatusCode::SUCCESS);
104 checkOut = (this->*
m_calc)(pClus);
108 checkOut = pClus->
e() > 0.
118 if ( checkOut.isFailure() )
121 <<
"problem in calculation of cell weighted signal state"
123 return StatusCode::SUCCESS;
140 std::string tag(
"all");
142 ? StatusCode::SUCCESS : StatusCode::FAILURE;
148 std::string aboveTag(
"above threshold");
149 std::string belowTag(
"below threshold");
153 ? StatusCode::SUCCESS : StatusCode::FAILURE;
157 const std::string& tag,
165 <<
"cluster direction ("
167 <<
") from positive cells only"
178 <<
"cluster direction ("
180 <<
") from absolute cell signals"
191 <<
"cluster direction ("
193 <<
") from raw signals (unchanged by this tool)"
203 report << MSG::WARNING
204 <<
"invalid configuration, use default!"
211 const std::string& b)
214 if (
a.length() != b.length() )
return false;
217 std::string::const_iterator p1(
a.begin());
218 std::string::const_iterator p2(b.begin());
219 while ( p1 !=
a.end() && p2 != b.end() )
221 if ( std::toupper(*p1) != std::toupper(*p2) )
return false;
239 for ( ; fCell != lCell; fCell++ )
251 return StatusCode::SUCCESS;
268 return StatusCode::SUCCESS;
281 for ( ; fCell != lCell; fCell++ )
285 double eWght(fCell.
weight() *
292 double phiCell(
proxim(cell->phi(),phiRef));
293 etaRef += cell->eta() * eWght;
302 pClus->
setEta(etaRef/eRef);
306 return StatusCode::SUCCESS;
319 double eWght(cell->e() *
325 double phiCell(
proxim(cell->phi(),phiRef));
326 etaRef += cell->eta() * eWght;
335 pClus->
setEta(etaRef/eRef);
339 return StatusCode::SUCCESS;
351 for ( ; fCell != lCell; fCell++ )
355 double eWght(fCell.
weight() *
358 double phiCell(
proxim(cell->phi(),phiRef));
362 etaRef += cell->eta() * eWght;
370 pClus->
setEta(etaRef/eRef);
374 return StatusCode::SUCCESS;
388 double phiCell(
proxim(cell->phi(),phiRef));
392 etaRef += cell->eta() * eWght;
400 pClus->
setEta(etaRef/eRef);
404 return StatusCode::SUCCESS;
CaloPhiRange class declaration.
Data object for each calorimeter readout cell.
weight_t weight() const
Accessor for weight associated to this cell.
StatusCode f_dirAbs(xAOD::CaloCluster *pClus) const
Calculator implementation for direction from absolute signal.
StatusCode f_dirRaw(xAOD::CaloCluster *pClus) const
Calculator implementation for energy only update.
StatusCode f_dirPos(xAOD::CaloCluster *pClus) const
Calculator implementation for direction from positive signal.
StatusCode(CaloClusterCellWeightCalib::* CALCULATOR)(xAOD::CaloCluster *pClus) const
Processor type for cluster calibration.
StatusCode f_dirPosNW(xAOD::CaloCluster *pClus) const
Calculator implementation for direction from positive signal.
StatusCode setupAll(MsgStream &report)
Setup for calculation for all or non-noise clusters.
Gaudi::Property< double > m_eThreshold
Energy threshold for direction calculation.
Gaudi::Property< std::string > m_directionCalculation
Property controlling negative signal handling.
StatusCode f_dirRawNW(xAOD::CaloCluster *pClus) const
Calculator implementation for energy only update.
virtual StatusCode initialize() override
Tool initialization.
StatusCode f_dirAbsNW(xAOD::CaloCluster *pClus) const
Calculator implementation for direction from absolute signal.
static constexpr std::string s_posName
Negative signal handling: positive signal tag.
Gaudi::Property< bool > m_ignoreGeoWghts
Flag to ignore geometrical cell weights in clusters.
CaloClusterCellWeightCalib(const std::string &type, const std::string &name, const IInterface *pParent)
Algorithm tool constructor.
bool setup(const std::string &name, const std::string &tag, CALCULATOR &calc, std::string &conf, MsgStream &report)
Common setup function.
static constexpr std::string s_defName
Negative signal handling: default tag.
static constexpr std::string s_absName
Negative signal handling: absolute signal tag.
Gaudi::Property< bool > m_calibNoiseLikeAll
Property controlling calibration of noise clusters.
ToolHandle< ICellWeightTool > m_cellWeight
Handle for cell weight tool.
StatusCode setupSpc(MsgStream &report)
Setup for different calculation for noise clusters.
Gaudi::Property< std::string > m_noiseDirectionCalculation
Property controlling calibration method for noise clusters.
CALCULATOR m_calc_noise
Pointer to direction calculation for noise clusters.
static bool cmpNoCase(const std::string &a, const std::string &b)
Helper for non-case sensitive string comparison.
CALCULATOR m_calc
Pointer to direction calculation implementation.
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *theCluster) const override
Execute on a single cluster.
static constexpr std::string s_rawName
Negative signal handling: raw signal tag.
virtual ~CaloClusterCellWeightCalib() override
Base tool destructor.
Helper to temporarily change the signal state of a cluster.
CaloClusterProcessor(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
static double fix(double phi)
virtual void setStatus(const StatusIndicator &statusIndicator)
Set status.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
flt_t rawPhi() const
Get in signal state UNCALIBRATED.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version)
flt_t rawEta() const
Get in signal state UNCALIBRATED.
virtual double e() const
The total energy of the particle.
const_cell_iterator cell_end() const
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
CaloRecoStatus & recoStatus()
Accesssor to CaloRecoStatus (non-const)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
double proxim(double b, double a)