8#include "GaudiKernel/MsgStream.h"
9#include <CLHEP/Units/SystemOfUnits.h>
15 const std::string& name,
16 const IInterface* parent)
28 return StatusCode::SUCCESS;
35 if ( msgSvc()->outputLevel(name()) <= MSG::DEBUG ) {
37 msg(MSG::DEBUG) <<
" old cluster eta = " << theCluster->
eta()
38 <<
" phi = " << theCluster->
phi() <<
endmsg;
50 const double absEClus = fabs(theCluster->
e());
53 const double inv_absEClus = 1. / absEClus;
54 std::vector<double> weightSample(CaloCell_ID::Unknown,0);
55 std::vector<double> etaSample(CaloCell_ID::Unknown,0);
56 std::vector<double> phiSample(CaloCell_ID::Unknown,0);
58 double weightAll(0),etaAll(0),phiAll(0);
62 for (;itrCell!=itrCellEnd; ++itrCell) {
64 double weight = itrCell.
weight();
67 double absE = fabs(weight*thisCell->
e());
70 double lw =
m_offset + log(absE*inv_absEClus);
74 << thisCell->
eta() <<
" phi " << thisCell->
phi()
75 <<
" energy " << thisCell->
e() <<
" weight " << weight
76 <<
" sampling " << theSample <<
" cluster e "
77 << theCluster->
e() <<
" log weight " << lw);
80 etaAll += thisCell->
eta()*lw;
89 phiAll += (thisCell->
phi()-360*
deg)*lw;
90 else if ( weightAll > 0
93 phiAll += (thisCell->
phi()+360*
deg)*lw;
95 phiAll += thisCell->
phi()*lw;
99 etaSample[theSample] += thisCell->
eta()*lw;
100 if ( weightSample[theSample] > 0
101 && phiSample[theSample]/weightSample[theSample]
104 phiSample[theSample] += (thisCell->
phi()-360*
deg)*lw;
105 else if ( weightSample[theSample] > 0
106 && phiSample[theSample]/weightSample[theSample]
109 phiSample[theSample] += (thisCell->
phi()+360*
deg)*lw;
111 phiSample[theSample] += thisCell->
phi()*lw;
112 weightSample[theSample] += lw;
118 if ( weightAll > 0 ) {
119 const double inv_weightAll = 1. / weightAll;
120 theCluster->
setEta(etaAll * inv_weightAll);
132 for(
int i=0;i<CaloCell_ID::Unknown;i++) {
134 if ( theCluster->
hasSampling(s) && weightSample[i] > 0 ) {
135 float etaSample=theCluster->
etaSample(s);
136 float phiSample=theCluster->
phiSample(s);
137 etaSample /= weightSample[i];
138 phiSample /= weightSample[i];
140 theCluster->
setEta(s,etaSample);
141 theCluster->
setPhi(s,phiSample);
146 if ( msgSvc()->outputLevel(name()) <= MSG::DEBUG ) {
149 <<
" phi = " << theCluster->
phi());
162 return StatusCode::SUCCESS;
#define ATH_MSG_VERBOSE(x)
CaloPhiRange class declaration.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Data object for each calorimeter readout cell.
virtual double e() const override final
get energy (data member) (synonym to method energy()
virtual double phi() const override final
get phi (through CaloDetDescrElement)
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
virtual double eta() const override final
get eta (through CaloDetDescrElement)
weight_t weight() const
Accessor for weight associated to this cell.
CaloClusterLogPos(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool constructor.
StatusCode initialize() override
StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *theCluster) const override
Execute on a single cluster.
CaloClusterProcessor(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
CaloCell_ID::CaloSample getSampling() const
cell sampling
static double fix(double phi)
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double eta() const
The pseudorapidity ( ) of the particle.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version)
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.
virtual double phi() const
The azimuthal angle ( ) of the particle.
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.