ATLAS Offline Software
Loading...
Searching...
No Matches
T2CaloEgammaForwardReFastAlgo.cxx
Go to the documentation of this file.
1
2
3#include "GaudiKernel/StatusCode.h"
4#include "AthLinks/ElementLink.h"
11
12class ISvcLocator;
13
14T2CaloEgammaForwardReFastAlgo::T2CaloEgammaForwardReFastAlgo(const std::string& name, ISvcLocator* pSvcLocator) :
15 AthReentrantAlgorithm(name, pSvcLocator)
16{}
17
18
19
20
22{
23 m_emAlgTools.retrieve().ignore();
24 ATH_CHECK(m_clusterContainerKey.initialize());
25 ATH_CHECK(m_roiCollectionKey.initialize());
26 ATH_CHECK( m_bcidAvgKey.initialize() );
27 if (! m_monTool.empty() ) ATH_CHECK( m_monTool.retrieve() );
28 return StatusCode::SUCCESS;
29}
30
31StatusCode T2CaloEgammaForwardReFastAlgo::execute(const EventContext& context) const
32{
33
34
35
37 ATH_CHECK( trigEmClusterCollection.record(std::make_unique<xAOD::TrigEMClusterContainer>(),
38 std::make_unique<xAOD::TrigEMClusterAuxContainer>()) );
39
40
41 auto roisHandle = SG::makeHandle(m_roiCollectionKey, context);
42
43 if (!roisHandle.isValid()) {
44 ATH_MSG_DEBUG("no RoI");
45 return StatusCode::SUCCESS;
46 }
47
48 trigEmClusterCollection->reserve(roisHandle->size());
49
50
51 ATH_MSG_DEBUG("RoI descriptor size is " << roisHandle->size() );
52
53 for (const TrigRoiDescriptor* roiDescriptor : *roisHandle)
54 {
55 float etaL1, phiL1;
56 double etamin, etamax, phimin, phimax;
57
58 ATH_MSG_INFO( "RoI eta = " << roiDescriptor->eta() << " RoI phi = " << roiDescriptor->phi());
59
60
61 etamin = std::max( -3.2 , roiDescriptor->eta() - m_etaWidth);
62 etamax = std::min( 3.2 , roiDescriptor->eta() + m_etaWidth);
63
64 phimin = CxxUtils::wrapToPi(roiDescriptor->phi() - m_phiWidth);
65 phimax = CxxUtils::wrapToPi(roiDescriptor->phi() + m_phiWidth);
66
67 etaL1 = roiDescriptor->eta();
68 phiL1 = roiDescriptor->phi();
69
70 TrigRoiDescriptor newroi(roiDescriptor->eta(), etamin, etamax,
71 roiDescriptor->phi(), phimin, phimax);
72
73
74 ATH_MSG_DEBUG(" etamin = " << etamin << " etamax = " << etamax <<
75 " phimin = " << phimin << " phimax = " << phimax);
76
77 xAOD::TrigEMCluster* ptrigEmCluster = new xAOD::TrigEMCluster();
78 trigEmClusterCollection->push_back(ptrigEmCluster);
79 ptrigEmCluster->setEnergy(0.0);
80 ptrigEmCluster->setEt(0.0);
81 ptrigEmCluster->setRawEnergy(0.0);
82 ptrigEmCluster->setRawEt(0.0);
83 ptrigEmCluster->setE277(0);
84 ptrigEmCluster->setEmaxs1(0);
85 ptrigEmCluster->setE2tsts1(0);
86 ptrigEmCluster->setEhad1(-999);
87 ptrigEmCluster->setWeta2(-999);
88 ptrigEmCluster->setFracs1(-999);
89 ptrigEmCluster->setE233(-999);
90 ptrigEmCluster->setE237(-999);
91 ptrigEmCluster->setWstot(-999);
92 ptrigEmCluster->setEta1(-999);
93 ptrigEmCluster->setNCells(0);
94 ptrigEmCluster->setRawEta(-999);
95 ptrigEmCluster->setRawPhi(-999);
96
97 // It is a good idea to clear the energies
98 for (int i = 0; i < CaloSampling::CaloSample::MINIFCAL0; i++) {
99 ptrigEmCluster->setEnergy((CaloSampling::CaloSample)i, 0.);
100 ptrigEmCluster->setRawEnergy((CaloSampling::CaloSample)i, 0.);
101 }
102 // Initial cluster position is the LVL1 position
103 ptrigEmCluster->setEta(etaL1);
104 ptrigEmCluster->setPhi(phiL1);
105
106
107 ptrigEmCluster->setRoIword(roiDescriptor->roiWord());
108 const CaloDetDescrElement* caloDDE = nullptr;
109
110 //uint32_t error = 0;
111 for (const auto& tool : m_emAlgTools) {
112 ATH_CHECK( tool->execute(*ptrigEmCluster, newroi, caloDDE, context) );
113 }
114
115
116
117
118 } // end of roiCollection iterator
119
120 return StatusCode::SUCCESS;
121}
122
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
An algorithm that can be simultaneously executed in multiple threads.
This class groups all DetDescr information related to a CaloCell.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
T2CaloEgammaForwardReFastAlgo(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< GenericMonitoringTool > m_monTool
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
virtual StatusCode execute(const EventContext &context) const override
SG::WriteHandleKey< xAOD::TrigEMClusterContainer > m_clusterContainerKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
ToolHandleArray< IReAlgToolCalo > m_emAlgTools
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
void setNCells(int)
set number of cells used from RoI
void setRoIword(long)
set RoI Word
void setRawPhi(float)
set Raw Phi (no calibration)
void setRawEnergy(float)
set Raw Energy (no calibration)
void setRawEta(float)
set Raw Eta (no calibration)
void setRawEt(float)
set Raw Et (no calibration)
void setPhi(float)
set Phi (calibrated)
void setEta(float)
set Eta (calibrated)
void setEt(float)
set Et (calibrated)
void setEhad1(float)
set hadronic Energy (first hadronic layer)
void setWeta2(float)
set cluster width (based on a 3x5 cluster - 2nd layer)
void setEnergy(float energy)
set Energy (calibrated)
void setE2tsts1(float)
set second maximum energy in sampling 1 (strip layer)
void setE237(float)
set Energy in a 3x7 cluster (no calibration) around hottest cell
void setE277(float)
set Energy in a 7x7 cluster (no calibration) around hottest cell
void setEmaxs1(float)
set maximum energy in sampling 1 (strip layer)
void setFracs1(float)
set Energy in a 7 strips (around hottest strip) minus energy in 3 strips divided by energy in 3 strip...
void setWstot(float)
set width in first layer
void setE233(float)
set Energy in a 3x3 cluster (no calibration) around hottest cell
void setEta1(float)
set Eta sampling 1 (strip layer)
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:24
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.
Helper for azimuthal angle calculations.