ATLAS Offline Software
Loading...
Searching...
No Matches
EgammaReEmEnFex.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ********************************************************************
6//
7// NAME: EgammaReEmEnFex.cxx
8// PACKAGE: Trigger/TrigAlgorithms/TrigT2CaloEgamma
9//
10// AUTHOR: M.P. Casado
11//
12// ********************************************************************
13
14#include "CaloGeoHelpers/CaloSampling.h"
16
17#include "EgammaReEmEnFex.h"
19
20EgammaReEmEnFex::EgammaReEmEnFex(const std::string& type, const std::string& name,
21 const IInterface* parent) :
22 IReAlgToolCalo(type, name, parent)
23{
24}
25
29
30StatusCode EgammaReEmEnFex::execute(xAOD::TrigEMCluster& rtrigEmCluster, const IRoiDescriptor& roi,
31 const CaloDetDescrElement*& caloDDE,
32 const EventContext& context) const
33{
34 bool clusterInBarrel = true;
35 if (caloDDE) clusterInBarrel = caloDDE->is_lar_em_barrel();
36
37 ATH_MSG_DEBUG("in execute(TrigEMCluster &)");
38
39 // Region Selector, sampling 0
40 int sampling = 0;
41
43 ATH_CHECK( m_dataSvc->loadCollections(context, roi, TTEM, sampling, sel) );
44
45 double deta = 0.; // eta difference current cell - seed
46 double dphi = 0.; // phi difference current cell - seed
47
48 double totalEnergy = 0;
50
51 double energyEta = rtrigEmCluster.eta();
52 double energyPhi = rtrigEmCluster.phi();
53 if (caloDDE) {
54 energyEta = caloDDE->eta();
55 energyPhi = caloDDE->phi();
56 }
57
58 int ncells = 0;
59
60 for (const LArCell* larcell : sel) { // Should be revised for London scheme
61 ncells++;
62
63 double etaCell = larcell->eta();
64 double phiCell = larcell->phi();
65 double energyCell = larcell->energy();
66
67 // find the standard em cluster energy (3*7 cell, now sampling 0)
68 // Find position of current cell w.r.t. seed
69 deta = std::abs(etaCell - energyEta);
70 dphi = std::abs(phiCell - energyPhi);
71
72 if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
73 // 3x7 means three cells per 7 in the second layer 0.025*3/2, 0.025*7/2, for instance
74 bool condition37 = clusterInBarrel &&
75 ((deta <= 0.0375 + 0.0005) && (dphi <= 0.0875 + 0.0005));
76 bool condition55 = (!clusterInBarrel) &&
77 ((deta <= 0.0625 + 0.0005) && (dphi <= 0.0625 + 0.0005));
78
79 if (condition37 || condition55) {
80
81 totalEnergy += energyCell;
82 // samp = CaloSampling::getSampling(*larcell);
83 samp = larcell->caloDDE()->getSampling();
84 rtrigEmCluster.setEnergy(samp, rtrigEmCluster.energy(samp) + energyCell);
85 rtrigEmCluster.setRawEnergy(samp, rtrigEmCluster.rawEnergy(samp) + energyCell);
86 }
87
88 } // end of loop over sampling 0
89
90 // Region Selector, sampling 3
91 sampling = 3;
92
94 ATH_CHECK( m_dataSvc->loadCollections(context, roi, TTEM, sampling, sel3) );
95
96 for (const LArCell* larcell : sel3) { // Should be revised for London scheme
97 ncells++;
98 double etaCell = larcell->eta();
99 double phiCell = larcell->phi();
100 double energyCell = larcell->energy();
101
102 // find the standard em cluster energy (3*7 cell, now sampling 0)
103 // Find position of current cell w.r.t. seed
104 deta = std::abs(etaCell - energyEta);
105 dphi = std::abs(phiCell - energyPhi);
106 if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
107
108 // 3x7 means three cells per 7 in the second layer 0.025*3/2, 0.025*7/2, for instance
109 bool condition37 = clusterInBarrel && ((deta <= 0.0375 + 0.001) && (dphi <= 0.0875 + 0.001));
110 bool condition55 = (!clusterInBarrel) &&
111 ((deta <= 0.0625 + 0.001) && (dphi <= 0.0625 + 0.001));
112
113 if (condition37 || condition55) {
114
115 totalEnergy += energyCell;
116 samp = larcell->caloDDE()->getSampling();
117 rtrigEmCluster.setEnergy(samp, rtrigEmCluster.energy(samp) + energyCell);
118 rtrigEmCluster.setRawEnergy(samp, rtrigEmCluster.rawEnergy(samp) + energyCell);
119 }
120
121 } // end of loop over sampling 3
122
123 // Update Cluster Variables
124 rtrigEmCluster.setNCells(ncells + rtrigEmCluster.nCells());
125 rtrigEmCluster.setRawEnergy(rtrigEmCluster.rawEnergy() + totalEnergy);
126 // The dependency with energy is not defined yet
127 rtrigEmCluster.setEnergy(rtrigEmCluster.rawEnergy() );
128
129 rtrigEmCluster.setEt(rtrigEmCluster.energy() / cosh(energyEta));
130 rtrigEmCluster.setRawEt(rtrigEmCluster.rawEnergy() / cosh(energyEta));
131
132 return StatusCode::SUCCESS;
133}
#define M_PI
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
@ TTEM
Definition RegSelEnums.h:28
This class groups all DetDescr information related to a CaloCell.
bool is_lar_em_barrel() const
cell belongs to EM barrel
EgammaReEmEnFex(const std::string &type, const std::string &name, const IInterface *parent)
virtual ~EgammaReEmEnFex()
virtual StatusCode execute(xAOD::TrigEMCluster &rtrigEmCluster, const IRoiDescriptor &roi, const CaloDetDescrElement *&caloDDE, const EventContext &context) const override
execute feature extraction for the EM Calorimeter second layer
IReAlgToolCalo(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
ServiceHandle< ITrigCaloDataAccessSvc > m_dataSvc
Describes the API of the Region of Ineterest geometry.
Data object for LAr calorimeter readout cell.
Definition LArCell.h:53
void setNCells(int)
set number of cells used from RoI
float rawEnergy() const
get Raw Energy (no calibration)
int nCells() const
get number of cells used from RoI
void setRawEnergy(float)
set Raw Energy (no calibration)
void setRawEt(float)
set Raw Et (no calibration)
void setEt(float)
set Et (calibrated)
float eta() const
get Eta (calibrated)
void setEnergy(float energy)
set Energy (calibrated)
float phi() const
get Phi (calibrated)
float energy() const
get Energy (calibrated)
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.