ATLAS Offline Software
Loading...
Searching...
No Matches
EgammaAllFex.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ********************************************************************
6//
7// NAME: EgammaAllFex.cxx
8// PACKAGE: Trigger/TrigAlgorithms/TrigT2CaloEgamma
9//
10// AUTHOR: D.O. Damazio
11//
12//
13// ********************************************************************
14
16
17//#include "TrigCaloEvent/TrigEMCluster.h"
19#include "CaloGeoHelpers/CaloSampling.h"
20
21#include "EgammaAllFex.h"
23
25
26EgammaAllFex::EgammaAllFex(const std::string & type, const std::string & name,
27 const IInterface* parent): IReAlgToolCalo(type, name, parent)
28 {
29 declareProperty("IncludeHad", m_includeHad = false );
30#ifndef NDEBUG
31 // Create Geometry object
32 // 0 -> CaloType EM, 2 -> Second Layer
33 // m_geometry[0] = new T2Geometry(0,2);
34#endif
35}
36
37StatusCode EgammaAllFex::execute(xAOD::TrigEMCluster &rtrigEmCluster,
38 const IRoiDescriptor& roi,
39 const CaloDetDescrElement*& /*caloDDE*/,
40 const EventContext& context) const {
41
42 // Time total AlgTool time
43 // reset error
44 int ncells = 0;
45 // LVL1 positions
46 float etaL1=rtrigEmCluster.eta();
47 float phiL1=rtrigEmCluster.phi();
48
49 double totalEnergy = 0;
50 double totalEnergyEM = 0;
52
53 ATH_MSG_DEBUG( "in execute(TrigEMCluster&)" );
54
55 // Time to access RegionSelector
56
57 for(DETID dd = TTEM; dd <= TTHEC; dd=(DETID)( ((int)dd)+1) ){
58 for(int sampling=0;sampling<4;sampling++) {
60 ATH_CHECK( m_dataSvc->loadCollections(context, roi, dd, sampling, sel) );
61
62
63 for(const LArCell* larcell : sel) {
64
65 double energyCell = larcell->energy();
66 totalEnergy += energyCell;
67 if( dd==TTEM) totalEnergyEM += energyCell;
68 //samp = CaloSampling::getSampling(*larcell);
69 samp = larcell->caloDDE()->getSampling();
70 rtrigEmCluster.setEnergy(samp,rtrigEmCluster.energy(samp) + energyCell);
71 rtrigEmCluster.setRawEnergy(samp,rtrigEmCluster.rawEnergy(samp) + energyCell);
72 ncells++;
73
74 } // end of loop over sampling
75 } // end of loop over all samples
76 } // end of loop over DetID
77
78 // TileCAL
79 // Finished to access RegionSelector
80 std::vector<const TileCell*> seltile;
81 ATH_CHECK(m_dataSvc->loadCollections(context, roi, seltile));
82
83
84 for(const TileCell* tilecell : seltile) {
85
86 double energyCell = tilecell->energy();
87 totalEnergy += energyCell;
88 samp = tilecell->caloDDE()->getSampling();
89 rtrigEmCluster.setEnergy(samp,rtrigEmCluster.energy(samp) + energyCell);
90 rtrigEmCluster.setRawEnergy(samp,rtrigEmCluster.rawEnergy(samp) + energyCell);
91 ncells++;
92
93 } // end of loop over sampling
94
95
96 // Update cluster Variables
97
98 if ( m_includeHad )
99 rtrigEmCluster.setEnergy(totalEnergy);
100 else
101 rtrigEmCluster.setEnergy(totalEnergyEM);
102 rtrigEmCluster.setEta(etaL1);
103 rtrigEmCluster.setPhi(phiL1);
104 rtrigEmCluster.setNCells(ncells);
105
106 // Finished save EMShowerMinimal time
107
108
109 return StatusCode::SUCCESS;
110}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
DETID
An enum to define subdetector names.
Definition RegSelEnums.h:23
@ TTHEC
Definition RegSelEnums.h:29
@ TTEM
Definition RegSelEnums.h:28
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
This class groups all DetDescr information related to a CaloCell.
virtual StatusCode execute(xAOD::TrigEMCluster &rtrigEmCluster, const IRoiDescriptor &roi, const CaloDetDescrElement *&, const EventContext &context) const override
execute feature extraction for the EM Calorimeter second layer
EgammaAllFex(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
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)
void setRawEnergy(float)
set Raw Energy (no calibration)
void setPhi(float)
set Phi (calibrated)
void setEta(float)
set Eta (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.