ATLAS Offline Software
T2CaloEgammaForwardReFastAlgo.cxx
Go to the documentation of this file.
1 
2 
3 #include "GaudiKernel/StatusCode.h"
4 #include "AthLinks/ElementLink.h"
7 #include "CxxUtils/phihelper.h"
11 
12 class ISvcLocator;
13 
14 T2CaloEgammaForwardReFastAlgo::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());
27  if (! m_monTool.empty() ) ATH_CHECK( m_monTool.retrieve() );
28  return StatusCode::SUCCESS;
29 }
30 
31 StatusCode 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 
xAOD::TrigCaloCluster_v1::setRawPhi
void setRawPhi(float)
set Raw Phi (no calibration)
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
T2CaloEgammaForwardReFastAlgo::m_clusterContainerKey
SG::WriteHandleKey< xAOD::TrigEMClusterContainer > m_clusterContainerKey
Definition: T2CaloEgammaForwardReFastAlgo.h:51
T2CaloEgammaForwardReFastAlgo::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: T2CaloEgammaForwardReFastAlgo.cxx:31
xAOD::TrigEMCluster_v1::setEta
void setEta(float)
set Eta (calibrated)
T2CaloEgammaForwardReFastAlgo::m_etaWidth
Gaudi::Property< double > m_etaWidth
Definition: T2CaloEgammaForwardReFastAlgo.h:41
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::TrigEMCluster_v1::setE237
void setE237(float)
set Energy in a 3x7 cluster (no calibration) around hottest cell
T2CaloEgammaForwardReFastAlgo::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: T2CaloEgammaForwardReFastAlgo.h:53
xAOD::TrigEMCluster_v1::setEnergy
void setEnergy(float energy)
set Energy (calibrated)
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
xAOD::TrigCaloCluster_v1::setRawEt
void setRawEt(float)
set Raw Et (no calibration)
T2CaloEgammaForwardReFastAlgo::initialize
virtual StatusCode initialize() override
Definition: T2CaloEgammaForwardReFastAlgo.cxx:21
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
CxxUtils::wrapToPi
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition: phihelper.h:24
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::setE233
void setE233(float)
set Energy in a 3x3 cluster (no calibration) around hottest cell
T2CaloEgammaForwardReFastAlgo::m_emAlgTools
ToolHandleArray< IReAlgToolCalo > m_emAlgTools
Definition: T2CaloEgammaForwardReFastAlgo.h:44
xAOD::TrigEMCluster_v1::setEhad1
void setEhad1(float)
set hadronic Energy (first hadronic layer)
xAOD::TrigCaloCluster_v1::setRawEta
void setRawEta(float)
set Raw Eta (no calibration)
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
T2CaloEgammaForwardReFastAlgo::T2CaloEgammaForwardReFastAlgo
T2CaloEgammaForwardReFastAlgo(const std::string &name, ISvcLocator *pSvcLocator)
Definition: T2CaloEgammaForwardReFastAlgo.cxx:14
xAOD::TrigEMCluster_v1::setE277
void setE277(float)
set Energy in a 7x7 cluster (no calibration) around hottest cell
xAOD::TrigEMCluster_v1::setPhi
void setPhi(float)
set Phi (calibrated)
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
T2CaloEgammaForwardReFastAlgo::m_bcidAvgKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
Definition: T2CaloEgammaForwardReFastAlgo.h:46
xAOD::TrigEMCluster_v1::setEmaxs1
void setEmaxs1(float)
set maximum energy in sampling 1 (strip layer)
TrigEMClusterAuxContainer.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TrigEMCluster
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.
Definition: Event/xAOD/xAODTrigCalo/xAODTrigCalo/TrigEMCluster.h:17
IReAlgToolCalo.h
xAOD::TrigEMCluster_v1::setE2tsts1
void setE2tsts1(float)
set second maximum energy in sampling 1 (strip layer)
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigEMCluster_v1::setWeta2
void setWeta2(float)
set cluster width (based on a 3x5 cluster - 2nd layer)
xAOD::TrigEMCluster_v1::setFracs1
void setFracs1(float)
set Energy in a 7 strips (around hottest strip) minus energy in 3 strips divided by energy in 3 strip...
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::TrigEMCluster_v1::setEta1
void setEta1(float)
set Eta sampling 1 (strip layer)
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
xAOD::TrigCaloCluster_v1::setRoIword
void setRoIword(long)
set RoI Word
T2CaloEgammaForwardReFastAlgo::m_phiWidth
Gaudi::Property< double > m_phiWidth
Definition: T2CaloEgammaForwardReFastAlgo.h:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
phihelper.h
Helper for azimuthal angle calculations.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::TrigCaloCluster_v1::setNCells
void setNCells(int)
set number of cells used from RoI
TrigEMClusterContainer.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAOD::TrigCaloCluster_v1::setRawEnergy
void setRawEnergy(float)
set Raw Energy (no calibration)
T2CaloEgammaForwardReFastAlgo.h
xAOD::TrigEMCluster_v1::setEt
void setEt(float)
set Et (calibrated)
xAOD::TrigEMCluster_v1::setWstot
void setWstot(float)
set width in first layer
xAOD::TrigEMCluster_v1
Description of a trigger EM cluster.
Definition: TrigEMCluster_v1.h:28
T2CaloEgammaForwardReFastAlgo::m_roiCollectionKey
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
Definition: T2CaloEgammaForwardReFastAlgo.h:49
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137