ATLAS Offline Software
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 
20 EgammaReEmEnFex::EgammaReEmEnFex(const std::string& type, const std::string& name,
21  const IInterface* parent) :
23 {
24 }
25 
27 {
28 }
29 
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 }
xAOD::TrigEMCluster_v1::eta
float eta() const
get Eta (calibrated)
xAOD::TrigCaloCluster_v1::nCells
int nCells() const
get number of cells used from RoI
xAOD::TrigEMCluster_v1::setEnergy
void setEnergy(float energy)
set Energy (calibrated)
EgammaReEmEnFex.h
xAOD::TrigCaloCluster_v1::setRawEt
void setRawEt(float)
set Raw Et (no calibration)
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
TrigEMCluster.h
EgammaReEmEnFex::execute
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
Definition: EgammaReEmEnFex.cxx:30
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::TrigCaloCluster_v1::rawEnergy
float rawEnergy() const
get Raw Energy (no calibration)
EgammaReEmEnFex::EgammaReEmEnFex
EgammaReEmEnFex(const std::string &type, const std::string &name, const IInterface *parent)
Definition: EgammaReEmEnFex.cxx:20
IReAlgToolCalo::m_dataSvc
ServiceHandle< ITrigCaloDataAccessSvc > m_dataSvc
Definition: IReAlgToolCalo.h:84
xAOD::TrigEMCluster_v1::phi
float phi() const
get Phi (calibrated)
TTEM
@ TTEM
Definition: RegSelEnums.h:28
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
sel
sel
Definition: SUSYToolsTester.cxx:97
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
LArTT_Selector< LArCellCont >
xAOD::TrigCaloCluster_v1::setNCells
void setNCells(int)
set number of cells used from RoI
IReAlgToolCalo
Base Class for Tools used for Egamma and Tau Feature Extraction Algorithms.
Definition: IReAlgToolCalo.h:37
EgammaReEmEnFex::~EgammaReEmEnFex
virtual ~EgammaReEmEnFex()
Definition: EgammaReEmEnFex.cxx:26
CaloDetDescrElement::is_lar_em_barrel
bool is_lar_em_barrel() const
cell belongs to EM barrel
Definition: CaloDetDescrElement.cxx:98
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::TrigCaloCluster_v1::setRawEnergy
void setRawEnergy(float)
set Raw Energy (no calibration)
xAOD::TrigEMCluster_v1::setEt
void setEt(float)
set Et (calibrated)
Calo_Def.h
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
xAOD::TrigEMCluster_v1
Description of a trigger EM cluster.
Definition: TrigEMCluster_v1.h:28
xAOD::TrigEMCluster_v1::energy
float energy() const
get Energy (calibrated)