7#include "CLHEP/Units/SystemOfUnits.h"
15#include "CaloEvent/CaloCluster.h"
33 const std::string& name,
34 const IInterface* pParent)
62 MsgStream report(msgSvc(),name());
68 if ( checkOut.isFailure() )
71 <<
"failed to configure direction calculations."
73 return StatusCode::FAILURE;
80 <<
"*** configuration insufficient *** "
81 <<
"no hadronic cell calibration tool configured"
83 return StatusCode::FAILURE;
87 return StatusCode::SUCCESS;
100 double clusterE(pClus->
rawE());
101 double clusterEta(pClus->
rawEta());
102 double clusterPhi(pClus->
rawPhi());
111 pClus->
setE(clusterE);
112 pClus->
setEta(clusterEta);
113 pClus->
setPhi(clusterPhi);
121 StatusCode checkOut(StatusCode::SUCCESS);
124 checkOut = (this->*
m_calc)(pClus);
128 checkOut = pClus->
e() > 0.
138 if ( checkOut.isFailure() )
141 <<
"problem in calculation of cell weighted signal state"
143 return StatusCode::SUCCESS;
160 std::string tag(
"all");
162 ? StatusCode::SUCCESS : StatusCode::FAILURE;
168 std::string aboveTag(
"above threshold");
169 std::string belowTag(
"below threshold");
173 ? StatusCode::SUCCESS : StatusCode::FAILURE;
177 const std::string& tag,
185 <<
"cluster direction ("
187 <<
") from positive cells only"
198 <<
"cluster direction ("
200 <<
") from absolute cell signals"
211 <<
"cluster direction ("
213 <<
") from raw signals (unchanged by this tool)"
223 report << MSG::WARNING
224 <<
"invalid configuration, use default!"
231 const std::string& b)
234 if (
a.length() != b.length() )
return false;
237 std::string::const_iterator p1(
a.begin());
238 std::string::const_iterator p2(b.begin());
239 while ( p1 !=
a.end() && p2 != b.end() )
241 if ( std::toupper(*p1) != std::toupper(*p2) )
return false;
259 for ( ; fCell != lCell; fCell++ )
271 return StatusCode::SUCCESS;
288 return StatusCode::SUCCESS;
301 for ( ; fCell != lCell; fCell++ )
305 double eWght(fCell.
weight() *
312 double phiCell(
proxim(cell->phi(),phiRef));
313 etaRef += cell->eta() * eWght;
322 pClus->
setEta(etaRef/eRef);
326 return StatusCode::SUCCESS;
339 double eWght(cell->e() *
345 double phiCell(
proxim(cell->phi(),phiRef));
346 etaRef += cell->eta() * eWght;
355 pClus->
setEta(etaRef/eRef);
359 return StatusCode::SUCCESS;
371 for ( ; fCell != lCell; fCell++ )
375 double eWght(fCell.
weight() *
378 double phiCell(
proxim(cell->phi(),phiRef));
382 etaRef += cell->eta() * eWght;
390 pClus->
setEta(etaRef/eRef);
394 return StatusCode::SUCCESS;
408 double phiCell(
proxim(cell->phi(),phiRef));
412 etaRef += cell->eta() * eWght;
420 pClus->
setEta(etaRef/eRef);
424 return StatusCode::SUCCESS;
CaloPhiRange class declaration.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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.
bool m_ignoreGeoWghts
Flag to ignore geometrical cell weights in clusters.
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.
static const std::string m_defName
Negative signal handling: default tag.
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 const std::string m_posName
Negative signal handling: positive signal tag.
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.
ToolHandle< ICellWeightTool > m_cellWeight
Handle for cell weight tool.
double m_eThreshold
Energy threshold for direction calculation.
bool m_calibNoiseLikeAll
Property controlling calibration of noise clusters.
StatusCode setupSpc(MsgStream &report)
Setup for different calculation for noise clusters.
CALCULATOR m_calc_noise
Pointer to direction calculation for noise clusters.
static const std::string m_rawName
Negative signal handling: raw signal tag.
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 const std::string m_absName
Negative signal handling: absolute signal tag.
virtual ~CaloClusterCellWeightCalib() override
Base tool destructor.
std::string m_noiseDirectionCalculation
Property controlling calibration method for noise clusters.
std::string m_directionCalculation
Property controlling negative signal handling.
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)