ATLAS Offline Software
HLTCaloCellSumMaker.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  * NAME: HLTCaloCellSumMaker.cxx
7  * PACKAGE: Trigger/TrigDataAccess/TrigCaloDataAccessSvc
8  *
9  * AUTHOR: Denis Oliveira Damazio
10  *
11  * PURPOSE: New Algorithm to produce CaloCellContainer Vector
12  *
13  **/
14 
15 #include "HLTCaloCellSumMaker.h"
16 
17 HLTCaloCellSumMaker::HLTCaloCellSumMaker(const std::string & name, ISvcLocator* pSvcLocator)
18  : AthReentrantAlgorithm(name, pSvcLocator),
19  m_cellContainerV("CaloClusters"),
20  m_roiMode(true)
21 {
22  declareProperty("CellsVName", m_cellContainerVKey = std::string("CellsVClusters"), "Calo cluster container");
23  declareProperty("CellsName", m_cellContainerKey = std::string("CellsClusters"), "Calo cluster container");
24  declareProperty("roiMode",m_roiMode,"RoiMode roi->CaloCellCollection");
25 }
26 
30  return StatusCode::SUCCESS;
31 }
32 
33 StatusCode HLTCaloCellSumMaker::execute( const EventContext& context ) const {
34 
35 
36  if ( m_roiMode ) {
37  int cc=0;
38  // datahandle
39  auto roisHandle = SG::makeHandle( m_cellContainerKey, context );
40  const CaloCellContainer* roiCollection = roisHandle.cptr();
41  if ( !roiCollection ){
42  ATH_MSG_INFO( "empty container");
43  return StatusCode::SUCCESS;
44  }
45  float sum=0.;
46  for(auto c : *roiCollection ) {sum+=c->et(); cc++;}
47  ATH_MSG_DEBUG ( "REGTEST: Executing " << name() << "... size : " << cc << "; Energy Et Sum : " << sum );
48 
49  } else {
50  auto roisHandle = SG::makeHandle( m_cellContainerVKey, context );
51  const ConstDataVector<CaloCellContainerVector>* roiCollection = roisHandle.cptr();
52 
53  int cc=0;
54  // datahandle
55  for(const CaloCellContainer* roiDescriptor : *roiCollection ) {
56  if ( roiDescriptor->size() > 0 ) {
57  float sum=0.;
58  for(auto c : *roiDescriptor ) {sum+=c->et(); cc++;}
59  ATH_MSG_DEBUG("REGTEST: Executing " << name() << "; size : " << cc << "; Energy ET Sum : " << sum );
60  } else { ATH_MSG_INFO( "empty container"); }
61 
62  }
63  }
64  return StatusCode::SUCCESS;
65 }
HLTCaloCellSumMaker.h
HLTCaloCellSumMaker::m_cellContainerKey
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
Definition: HLTCaloCellSumMaker.h:37
HLTCaloCellSumMaker::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: HLTCaloCellSumMaker.cxx:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
HLTCaloCellSumMaker::HLTCaloCellSumMaker
HLTCaloCellSumMaker(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HLTCaloCellSumMaker.cxx:17
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
HLTCaloCellSumMaker::m_cellContainerVKey
SG::ReadHandleKey< ConstDataVector< CaloCellContainerVector > > m_cellContainerVKey
Definition: HLTCaloCellSumMaker.h:35
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
HLTCaloCellSumMaker::initialize
virtual StatusCode initialize() override
Definition: HLTCaloCellSumMaker.cxx:27
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
HLTCaloCellSumMaker::m_roiMode
bool m_roiMode
Definition: HLTCaloCellSumMaker.h:39
python.compressB64.c
def c
Definition: compressB64.py:93
python.handimod.cc
int cc
Definition: handimod.py:523