ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSwGap_g3 Class Reference

#include <CaloSwGap_g3.h>

Inheritance diagram for CaloSwGap_g3:
Collaboration diagram for CaloSwGap_g3:

Public Member Functions

virtual StatusCode initialize () override
 Standard Gaudi initialize method.
virtual void makeCorrection (const Context &myctx, xAOD::CaloCluster *cluster) const override
virtual StatusCode setCaloCellContainerName (const std::string &name) override
 Change the name of the CaloCellContainer used by this tool.
virtual void setsample (xAOD::CaloCluster *cluster, CaloSampling::CaloSample sampling, float em, float etam, float phim, float emax, float etamax, float phimax, float etas, float phis) const
virtual void setenergy (xAOD::CaloCluster *cluster, float energy) const
StatusCode execute (const EventContext &ctx, xAOD::CaloCluster *cluster) const override
virtual StatusCode execute (const EventContext &ctx, xAOD::CaloClusterContainer *collection) const
 Execute on an entire collection of clusters.

Protected Attributes

SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}

Private Member Functions

 CaloSwGap_g3 ()=delete

Private Attributes

Constant< float > m_etamin_crack { this, "etamin_crack", "" }
Constant< float > m_etamax_crack { this, "etamax_crack", "" }
Constant< CxxUtils::Array< 1 > > m_scint_weight { this, "scint_weight", "" }
Constant< CxxUtils::Array< 1 > > m_correction { this, "correction", "" }
SG::ReadHandleKey< CaloCellContainerm_cells_name { this, "cells_name", "AllCalo", "" }
 Property: The name of the container in which to look to find tile cells.

Detailed Description

Definition at line 34 of file CaloSwGap_g3.h.

Constructor & Destructor Documentation

◆ CaloSwGap_g3()

CaloSwGap_g3::CaloSwGap_g3 ( )
privatedelete

Member Function Documentation

◆ execute() [1/2]

StatusCode CaloClusterCorrection::execute ( const EventContext & ctx,
xAOD::CaloCluster * cluster ) const
overrideinherited

Definition at line 52 of file CaloClusterCorrection.cxx.

54{
55 this->makeCorrection (context(ctx), cluster);
56
57#if 0
58 ATH_MSG_DEBUG( " ...... e, et " << cluster->e() << " " << cluster->et() << endmsg);
59 ATH_MSG_DEBUG( " ...... eta, etaBE, etaSmp " << cluster->eta() << " " << cluster->etaBE(2)
60 << " " << cluster->etaSample(CaloSampling::EMB1)
61 << " " << cluster->etaSample(CaloSampling::EMB2)
62 << " " << cluster->etaSample(CaloSampling::EMB3) << endmsg);
63 ATH_MSG_DEBUG( " ...... phi, phiBE, phiSmp " << cluster->phi() << " " << cluster->phiBE(2)
64 << " " << cluster->phiSample(CaloSampling::EMB1)
65 << " " << cluster->phiSample(CaloSampling::EMB2)
66 << " " << cluster->phiSample(CaloSampling::EMB3) << endmsg);
67#endif
68
69 return StatusCode::SUCCESS;
70}
#define endmsg
#define ATH_MSG_DEBUG(x)
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *) const =0
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.

◆ execute() [2/2]

StatusCode CaloClusterProcessor::execute ( const EventContext & ctx,
xAOD::CaloClusterContainer * collection ) const
inherited

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters.

This will iterate over all the clusters in collection and call execute on each one individually.

Parameters
collectionThe container of clusters.
ctxThe event context.

This will iterate over all the clusters in collection and call execute on each one individually.

Definition at line 65 of file CaloClusterProcessor.cxx.

46{
47 for (xAOD::CaloCluster* clu : *collection) {
48 ATH_CHECK( execute (ctx, clu) );
49 }
50 return StatusCode::SUCCESS;
51}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *cluster) const override
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ initialize()

StatusCode CaloSwGap_g3::initialize ( )
overridevirtual

Standard Gaudi initialize method.

Reimplemented from CaloClusterCorrection.

Definition at line 54 of file CaloSwGap_g3.cxx.

55{
57 ATH_CHECK( m_cells_name.initialize() );
58 return StatusCode::SUCCESS;
59}
virtual StatusCode initialize() override
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.

◆ makeCorrection()

void CaloSwGap_g3::makeCorrection ( const Context & myctx,
xAOD::CaloCluster * cluster ) const
overridevirtual

Implements CaloClusterCorrection.

Definition at line 62 of file CaloSwGap_g3.cxx.

64{
65 float eta = cluster->eta();
66 float phi = cluster->phi();
67
68 float aeta = fabs(eta);
69
70 const float etamin_crack = m_etamin_crack (myctx);
71 const float etamax_crack = m_etamax_crack (myctx);
72 if (aeta < etamin_crack || aeta > etamax_crack)
73 return; // no correction required
74
75 const CxxUtils::Array<1> scint_weight = m_scint_weight (myctx);
76 const CxxUtils::Array<1> correction = m_correction (myctx);
77 assert (scint_weight.size() == correction.size());
78 if (correction.size() == 0) return;
79
80 SG::ReadHandle<CaloCellContainer> cc (m_cells_name, myctx.ctx());
81
82 double eh_scint = 0;
83 if(cc.isValid())
84 {
86 cc->beginConstCalo(CaloCell_ID::TILE);
88 cc->endConstCalo(CaloCell_ID::TILE);
89
90 for ( ; f_cell!=l_cell; ++f_cell)
91 {
92 const CaloCell* cell = (*f_cell) ;
93
94 int inum = cell->caloDDE()->getSampling();
95
96 if (CaloSampling::TileGap3 == inum ) {
97 double phic = cell->phi();
98 double etac = cell->eta();
99 if (phic-phi < -pi) phic = phic + twopi;
100 if (phic-phi > pi) phic = phic - twopi;
101 if (etac >= eta-deta && etac <= eta+deta) {
102 if (phic >= phi-dphi && phic <= phi+dphi) {
103 eh_scint += cell->e();
104 }
105 }
106 }
107 }
108 }
109
110 // make the correction
111 double granularity = (etamax_crack - etamin_crack)/correction.size();
112 int ind = static_cast<int> ((aeta - etamin_crack)/granularity);
113
114// Scintillator energy calibration
115 eh_scint = eh_scint * scint_weight[ind];
116
117//Correct for normalization factor total cluster energy and samplings energies
118 double energy = (cluster->e())*correction[ind];
119 setenergy(cluster,energy);
120
121// Add the scintillator energy to the cluster and correct the total energy
122 energy += eh_scint * correction[ind];
123 cluster->setE(energy);
124}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
#define pi
constexpr double twopi
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Read-only multidimensional array.
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ setCaloCellContainerName()

StatusCode CaloSwGap_g3::setCaloCellContainerName ( const std::string & name)
overridevirtual

Change the name of the CaloCellContainer used by this tool.

Parameters
nameThe new container name.

Implements ISetCaloCellContainerName.

Definition at line 132 of file CaloSwGap_g3.cxx.

134{
135 return this->setProperty (StringProperty ("cells_name", name));
136}
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)

◆ setenergy()

void CaloClusterCorrection::setenergy ( xAOD::CaloCluster * cluster,
float energy ) const
virtualinherited

Definition at line 93 of file CaloClusterCorrection.cxx.

94{
95 if (cluster->e() == 0) {
96 if (energy != 0)
97 REPORT_MESSAGE (MSG::WARNING)
98 << "Attempt to rescale zero-energy cluster to energy " << energy
99 << " ignored.";
100 return;
101 }
102
103 float correction = energy/cluster->e();
104 cluster->setE(energy);
105
106 // also correct individual sampling energies:
107
108 for (int iSample=CaloSampling::PreSamplerB;
109 iSample < CaloSampling::Unknown;
110 ++iSample)
111 {
112 CaloSampling::CaloSample sampling=static_cast<CaloSampling::CaloSample>(iSample);
113 if (cluster->hasSampling (sampling)) {
114 double e = cluster->eSample(sampling);
115 cluster->setEnergy(sampling,e*correction) ;
116 }
117 }
118}
#define REPORT_MESSAGE(LVL)
Report a message.
float eSample(const CaloSample sampling) const
bool setEnergy(const CaloSample sampling, const float e)
Set energy for a given sampling. Returns false if the sample isn't part of the cluster.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.

◆ setsample()

void CaloClusterCorrection::setsample ( xAOD::CaloCluster * cluster,
CaloSampling::CaloSample sampling,
float em,
float etam,
float phim,
float emax,
float etamax,
float phimax,
float etas,
float phis ) const
virtualinherited

Definition at line 73 of file CaloClusterCorrection.cxx.

78{
79 cluster->setEnergy(sampling, em);
80 cluster->setEta(sampling, etam);
81 cluster->setPhi(sampling, phim);
82
83 cluster->setEmax(sampling,emax);
84 cluster->setEtamax(sampling,etamax);
85 cluster->setPhimax(sampling,phimax);
86
87 cluster->setEtasize(sampling, etas);
88 cluster->setPhisize(sampling, phis);
89}
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
bool setEtasize(const CaloSample sampling, const float etaSize)
Set the cluster size in for a given sampling.
bool setPhisize(const CaloSample sampling, const float phiSize)
Set the cluster size in for a given sampling.
bool setPhimax(const CaloSample sampling, const float phiMax)
Set the phi of the cell with the highest energy in a particular sampling.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
bool setEmax(const CaloSample sampling, const float eMax)
Set the Energy of the cell with the highest energy in a particular sampling.
bool setEtamax(const CaloSample sampling, const float etaMax)
Set the eta of the cell with the highest energy in a particular sampling.

Member Data Documentation

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> CaloClusterCorrection::m_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
protectedinherited

Definition at line 83 of file CaloClusterCorrection.h.

83{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_cells_name

SG::ReadHandleKey<CaloCellContainer> CaloSwGap_g3::m_cells_name { this, "cells_name", "AllCalo", "" }
private

Property: The name of the container in which to look to find tile cells.

Definition at line 66 of file CaloSwGap_g3.h.

67{ this, "cells_name", "AllCalo", "" };

◆ m_correction

Constant<CxxUtils::Array<1> > CaloSwGap_g3::m_correction { this, "correction", "" }
private

Definition at line 63 of file CaloSwGap_g3.h.

63{ this, "correction", "" };

◆ m_etamax_crack

Constant<float> CaloSwGap_g3::m_etamax_crack { this, "etamax_crack", "" }
private

Definition at line 61 of file CaloSwGap_g3.h.

61{ this, "etamax_crack", "" };

◆ m_etamin_crack

Constant<float> CaloSwGap_g3::m_etamin_crack { this, "etamin_crack", "" }
private

Definition at line 60 of file CaloSwGap_g3.h.

60{ this, "etamin_crack", "" };

◆ m_scint_weight

Constant<CxxUtils::Array<1> > CaloSwGap_g3::m_scint_weight { this, "scint_weight", "" }
private

Definition at line 62 of file CaloSwGap_g3.h.

62{ this, "scint_weight", "" };

The documentation for this class was generated from the following files: