17#include "GaudiKernel/SystemOfUnits.h"
27 bool thereIsACentrCell =
false;
32 float clusEta = cluster->
eta();
33 float clusPhi = cluster->
phi();
34 float energymax = -999999.;
36 for (; cellIter != cellIterEnd; cellIter++) {
45 if (std::abs(
eta - clusEta) < 0.025 &&
47 (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) &&
48 (energy > energymax)) {
50 cellCentrId = cellIter->
ID();
51 thereIsACentrCell =
true;
54 return thereIsACentrCell;
58 const std::vector<IdentifierHash>& neighbourList,
62 std::vector<IdentifierHash>::const_iterator
it =
63 std::find(neighbourList.begin(), neighbourList.end(), hashId);
64 return (it != neighbourList.end());
67std::vector<IdentifierHash>
72 std::vector<IdentifierHash> neighbourList;
84 iflag |= (0x1 << parameter);
88template <
typename ...T>
90 const ToolHandle<ICaloAffectedTool> &affectedTool,
95 const int &problemType,
101 value |= affectedTool->isAffected(
114void coreCellHelper(
const bool isMissing,
const bool isMasked,
115 const bool isSporadicNoise,
const bool isAffected,
116 const bool isHighQ,
unsigned int& iflag) {
124void missingHelper(
const bool isPresampler,
const bool isL1,
125 const bool isStripCoreCell,
const bool isL2,
const bool isL3,
126 unsigned int& iflag) {
131 if (isStripCoreCell) {
141void maskedHelper(
const bool isPresampler,
const bool isL1,
142 const bool isStripCoreCell,
const bool isL2,
const bool isL3,
143 unsigned int& iflag) {
156void affectedHelper(
const bool isPresampler,
const bool isL1,
const bool isL2,
157 const bool isL3,
unsigned int& iflag) {
172 const std::string& name,
173 const IInterface* parent)
178 declareInterface<IegammaOQFlagsBuilder>(
this);
193 return StatusCode::SUCCESS;
199 return StatusCode::SUCCESS;
209 return StatusCode::SUCCESS;
211 if (cluster->
size() == 0) {
212 return StatusCode::SUCCESS;
215 const float clusterEta = cluster->
eta();
222 if (etaSize == 0 && phiSize == 0) {
233 unsigned int iflag = eg.OQ();
236 const double absEnergyGeV = std::abs(cluster->
e() * (1. / Gaudi::Units::GeV));
245 double energyCellMax = 0;
248 bool foundCentralCell = findCentralCell(cluster, cellCentrId);
249 if (foundCentralCell) {
251 std::vector<IdentifierHash> neighbourList =
260 for (; cellIter != cellIterEnd; cellIter++) {
266 if (cell->caloDDE()->is_tile()) {
270 const float eta = cell->eta();
272 const float qual = cell->quality();
273 const bool isHighQ = qual >= 4000;
276 const bool isMissing = ((cell->provenance() & 0x0A00) == 0x0A00);
277 const bool isMasked = ((cell->provenance() & 0x0A00) == 0x0800);
278 const bool isPresampler = (layer == CaloSampling::PreSamplerB ||
279 layer == CaloSampling::PreSamplerE);
281 (layer == CaloSampling::EMB1 || layer == CaloSampling::EME1);
283 (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2);
285 (layer == CaloSampling::EMB3 || layer == CaloSampling::EME3);
288 if ((cell->provenance() & 0x2000) && !(cell->provenance() & 0x0800)) {
290 if (cell->e() > energyCellMax) {
291 energyCellMax = cell->e();
297 const bool isACoreCell = isCore(cell->ID(), neighbourList,
m_calocellId);
299 bool isStripCoreCell =
false;
300 if ((layer == CaloSampling::EMB1 || layer == CaloSampling::EME1) &&
301 std::abs(
eta - clusterEta) < 0.025 / 2.) {
302 isStripCoreCell =
true;
306 if (layer >= CaloSampling::HEC0 && layer <= CaloSampling::HEC3 &&
313 const bool isAffected =
319 const bool isSporadicNoise =
323 coreCellHelper(isMissing, isMasked, isSporadicNoise, isAffected,
328 missingHelper(isPresampler, isL1, isStripCoreCell, isL2, isL3, iflag);
331 maskedHelper(isPresampler, isL1, isStripCoreCell, isL2, isL3, iflag);
334 affectedHelper(isPresampler, isL1, isL2, isL3, iflag);
343 double egammaLArQCleaning = 0;
345 egammaLArQCleaning = badE / totE;
353 double ratioCell = 0;
355 ratioCell = energyCellMax / totE;
371 ATH_MSG_WARNING(
"Do not have affected regions info, is this expected ?");
375 deta = 0.5 * 0.025 * etaSize;
376 dphi = 0.5 * 0.025 * phiSize;
378 bool isNonNominalHVPS = chainIsAffected(
385 CaloSampling::PreSamplerE,
386 CaloSampling::PreSamplerB);
388 bool isDeadHVPS = chainIsAffected(
395 CaloSampling::PreSamplerE,
396 CaloSampling::PreSamplerB);
400 deta = 0.5 * 0.025 * 3.;
401 dphi = 0.5 * 0.025 * 3.;
402 bool isDeadHVS2Core = chainIsAffected(
414 deta = 0.5 * 0.025 * etaSize;
415 dphi = 0.5 * 0.025 * phiSize;
417 bool isNonNominalHVS1S2S3 = chainIsAffected(
432 bool isDeadHVS1S2S3Edge = chainIsAffected(
449 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
std::vector< CaloAffectedRegionInfo > CaloAffectedRegionInfoVec
LArBadXCont< LArBadChannel > LArBadChannelCont
Handle class for reading from StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
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.
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
This is a "hash" representation of an Identifier.
bool shortProblem() const
bool unstableNoiseMG() const
bool unstableNoiseHG() const
bool peculiarCalibrationLine() const
bool unstableNoiseLG() const
bool sporadicBurstNoise() const
LArBC_t offlineStatus(const Identifier id) const
Query the status of a particular channel by offline ID This is the main client access method.
int get_neighbours(const IdentifierHash id, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found option = prevInPhi,...
Helper class for LArEM offline identifiers.
StatusCode finalize()
finalize method
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Handle to bad-channel CDO.
egammaOQFlagsBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Gaudi::Property< double > m_QCellCut
Gaudi::Property< double > m_LArQCut
Gaudi::Property< double > m_TCutVsE
Gaudi::Property< double > m_TCut
const LArEM_ID * m_emHelper
ToolHandle< ICaloAffectedTool > m_affectedTool
Gaudi::Property< double > m_QCellSporCut
StatusCode initialize()
initialize method
Gaudi::Property< double > m_QCellHECCut
virtual StatusCode execute(const EventContext &ctx, xAOD::Egamma &egamma) const
standard execute method
Gaudi::Property< double > m_RcellCut
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
const CaloCell_ID * m_calocellId
SG::ReadCondHandleKey< CaloAffectedRegionInfoVec > m_affKey
flt_t time() const
Access cluster time.
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
unsigned int getClusterEtaSize() const
Get eta size from cluster size.
virtual double e() const
The total energy of the particle.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version)
const_cell_iterator cell_end() const
virtual double phi() const
The azimuthal angle ( ) of the particle.
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
unsigned int getClusterPhiSize() const
Get phi size from cluster size.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
bool isBarrel(const xAOD::Egamma *eg)
return true if the cluster is in the barrel
@ AffectedCellCore
Affected cell in the core of the cluster.
@ HECHighQ
High quality factor cell in the HEC.
@ AffectedCellEdgePS
Affected presampler cell in the edge of the cluster.
@ HighRcell
High R_cell ----> Energy of the most energetic cell / total energy of the cluster.
@ HighQCore
High quality factor cell in the core of the cluster.
@ MissingFEBCellEdgeS2
Missing FEB in the edge of the cluster.
@ MaskedCellEdgePS
Masked presampler cell in the edge of the cluster.
@ NonNominalHVS1S2S3
Non Nominal High Voltage in the EM strips, middle and back.
@ MissingFEBCellEdgeS1
Missing FEB in the edge of the cluster.
@ MaskedCellEdgeS2
Masked middle cell in the edge of the cluster.
@ AffectedCellEdgeS3
Affected back cell in the edge of the cluster.
@ SporadicNoiseLowQCore
Sporadic noisy cell in the core of the cluster.
@ DeadHVPS
Dead High Voltage in the EM Presampler.
@ DeadHVS1S2S3Edge
Dead High Voltage in the EM strips, middle and back affecting the edge of the cluster.
@ BadS1Core
Missing FEB or masked cell in S1 core (corresponding to the 8 strips in front of the core of the clus...
@ MaskedCellEdgeS3
Masked back cell in the edge of the cluster.
@ MaskedCellCore
Masked cell in the core of the cluster.
@ MissingFEBCellEdgePS
Missing FEB in the edge of the cluster.
@ MissingFEBCellEdgeS3
Missing FEB in the edge of the cluster.
@ AffectedCellEdgeS1
Affected strip cell in the edge of the cluster.
@ SporadicNoiseLowQEdge
Sporadic noisy cell in the edge of the cluster.
@ MaskedCellEdgeS1
Masked strip cell in the edge of the cluster.
@ OutTime
Out of time cell.
@ HighQEdge
High quality factor cell in the edge of the cluster.
@ NonNominalHVPS
Non Nominal High Voltage in the EM Presampler.
@ AffectedCellEdgeS2
Affected middle cell in the edge of the cluster.
@ LArQCleaning
Cleaning based on LArQ factor--> sum[ E(Q>4000)/E].
@ DeadHVS1S2S3Core
Dead High Voltage in the EM strips, middle and back affecting the core of the cluster.
@ MissingFEBCellCore
Missing FEB in the core of the cluster.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".