ATLAS Offline Software
EgammaReHadEnFex.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: EgammaReHadEnFex.cxx
8 // PACKAGE: Trigger/TrigAlgorithms/TrigT2CaloEgamma
9 //
10 // AUTHOR: M.P. Casado
11 //
12 // REFERENCES: Based on Trigger/TrigT2CaloEgamma/T2EmHadAlgorithm.cxx
13 //
14 // ********************************************************************
15 
16 #include "EgammaReHadEnFex.h"
17 #include "CaloGeoHelpers/CaloSampling.h"
19 #include <math.h>
20 
21 EgammaReHadEnFex::EgammaReHadEnFex(const std::string& type, const std::string& name,
22  const IInterface* parent) :
24 {}
25 
27  const CaloDetDescrElement*& /*caloDDE*/,
28  const EventContext& context) const
29 {
30  double deta = 0.; // eta difference current cell - seed
31  double dphi = 0.; // phi difference current cell - seed
32 
34 
35  double energyEta = rtrigEmCluster.eta();
36  double energyPhi = rtrigEmCluster.phi();
37  rtrigEmCluster.setEhad1(0.);
38 
39  // Dump eta-phi strip ranges into arrays
40  // Define variables here so that their scope covers both the Tile and HEC loops
41  // Use arrays of length 3 since there is no samp 0 in the HAD calorimeters
42  // this avoids wasting memory but makes the code slightly less clear
43 
44  int ncells = 0;
45 
46  for (unsigned int sampling = 0; sampling < 3; sampling++) {
47 
49  ATH_CHECK( m_dataSvc->loadCollections(context, roi, TTHEC, sampling, sel) );
50 
51  for (const LArCell* larcell : sel) {
52 
53  ncells++;
54  double etaCell = larcell->eta();
55  double phiCell = larcell->phi();
56  double energyCell = larcell->energy();
57 
58  // find position of current cell w.r.t. seed
59  deta = std::abs(etaCell - energyEta);
60  dphi = std::abs(phiCell - energyPhi);
61  if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
62  // hadronic measurements: energy sum in 0.1*0.1
63  if (deta <= 0.12 && dphi <= 0.12) {
64  // samp = CaloSampling::getSampling(*larcell);
65  samp = larcell->caloDDE()->getSampling();
66  rtrigEmCluster.setEnergy(samp, rtrigEmCluster.energy(samp) + energyCell);
67  rtrigEmCluster.setRawEnergy(samp, rtrigEmCluster.rawEnergy(samp) + energyCell);
68  if (CaloSampling::HEC0 == samp) {
69  rtrigEmCluster.setEhad1(rtrigEmCluster.ehad1() + energyCell);
70  }
71  }
72 
73  } // end of loop over cells
74 
75  } // End sampling loop
76 
77  // Next TILECAL
78 
79  std::vector<const TileCell*> seltile;
80  ATH_CHECK( m_dataSvc->loadCollections(context, roi, seltile) );
81 
82  for (const TileCell* tilecell : seltile) { // loop over cells
83 
84  ncells++;
85  double etaCell = tilecell->eta();
86  double phiCell = tilecell->phi();
87  double energyCell = tilecell->energy();
88 
89  // find position of current cell w.r.t. seed
90  deta = std::abs(etaCell - energyEta);
91  dphi = std::abs(phiCell - energyPhi);
92  if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
93  // hadronic measurements: energy sum in 0.1*0.1
94  if (deta <= 0.12 && dphi <= 0.12) {
95  // samp = CaloSampling::getSampling(*tilecell);
96  samp = tilecell->caloDDE()->getSampling();
97  rtrigEmCluster.setEnergy(samp, rtrigEmCluster.energy(samp) + energyCell);
98  rtrigEmCluster.setRawEnergy(samp, rtrigEmCluster.rawEnergy(samp) + energyCell);
99  if ((CaloSampling::TileBar0 == samp) || (CaloSampling::TileExt0 == samp) ||
100  (CaloSampling::TileGap1 == samp) || (CaloSampling::TileGap2 == samp)) {
101  rtrigEmCluster.setEhad1(rtrigEmCluster.ehad1() + energyCell);
102  }
103  }
104 
105  } // end of loop over cells
106 
107  rtrigEmCluster.setNCells(ncells + rtrigEmCluster.nCells());
108 
109  return StatusCode::SUCCESS;
110 }
EgammaReHadEnFex::EgammaReHadEnFex
EgammaReHadEnFex(const std::string &type, const std::string &name, const IInterface *parent)
Definition: EgammaReHadEnFex.cxx:21
TileCell
Definition: TileCell.h:57
TTHEC
@ TTHEC
Definition: RegSelEnums.h:29
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)
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
xAOD::TrigEMCluster_v1::setEhad1
void setEhad1(float)
set hadronic Energy (first hadronic layer)
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::TrigCaloCluster_v1::rawEnergy
float rawEnergy() const
get Raw Energy (no calibration)
IReAlgToolCalo::m_dataSvc
ServiceHandle< ITrigCaloDataAccessSvc > m_dataSvc
Definition: IReAlgToolCalo.h:84
EgammaReHadEnFex::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: EgammaReHadEnFex.cxx:26
EgammaReHadEnFex.h
xAOD::TrigEMCluster_v1::phi
float phi() const
get Phi (calibrated)
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCell_ID_FCS::TileBar0
@ TileBar0
Definition: FastCaloSim_CaloCell_ID.h:31
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
CaloCell_ID_FCS::TileGap2
@ TileGap2
Definition: FastCaloSim_CaloCell_ID.h:35
sel
sel
Definition: SUSYToolsTester.cxx:92
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_ID_FCS::TileGap1
@ TileGap1
Definition: FastCaloSim_CaloCell_ID.h:34
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
xAOD::TrigEMCluster_v1::ehad1
float ehad1() const
get hadronic Energy (first hadronic layer)
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::TrigCaloCluster_v1::setRawEnergy
void setRawEnergy(float)
set Raw Energy (no calibration)
Calo_Def.h
xAOD::TrigEMCluster_v1
Description of a trigger EM cluster.
Definition: TrigEMCluster_v1.h:28
xAOD::TrigEMCluster_v1::energy
float energy() const
get Energy (calibrated)