ATLAS Offline Software
GepClusterTimingAlg.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
8 
9 GepClusterTimingAlg::GepClusterTimingAlg(const std::string& name, ISvcLocator* pSvcLocator) :
10  AthReentrantAlgorithm(name, pSvcLocator){
11 }
12 
13 
15 
16 
18  ATH_MSG_INFO ("Initializing " << name() << "...");
19 
20  // Initialize data access keys
23 
24  return StatusCode::SUCCESS;
25 }
26 
28  ATH_MSG_INFO ("Finalizing " << name() << "...");
29 
30  return StatusCode::SUCCESS;
31 }
32 
33 StatusCode GepClusterTimingAlg::execute(const EventContext& ctx) const{
34  ATH_MSG_DEBUG ("Executing " << name() << "...");
35 
36  // This is a filtering Algorithm: it writes out a CaloClusterCollection obtained
37  // filed by clusters selected from an input CaloClusterCollection, and writes
38  // out the selected clusters to s view contsainer (ie no copying)
39 
40  // read in clusters
41  auto h_inCaloClusters = SG::makeHandle(m_inCaloClustersKey, ctx);
42  CHECK(h_inCaloClusters.isValid());
43  ATH_MSG_DEBUG("Read in " << (h_inCaloClusters->size()) << " clusters");
44 
45 
46  auto h_outCaloClusters = SG::makeHandle(m_outCaloClustersKey, ctx);
47 
49 
50 
51  const static SG::AuxElement::ConstAccessor<float> acc_larq("AVG_LAR_Q");
52  const static SG::AuxElement::ConstAccessor<float> acc_clambda("CENTER_LAMBDA");
53 
54  // select clusters
55  for ( const auto& cluster : *h_inCaloClusters) {
56 
57  float time = cluster->time();
58  float quality = acc_larq(*cluster)/65535;
59  float lambda_center = acc_clambda(*cluster);
60 
61  float timeCut = quality > m_qualityCut ? m_timeCutLargeQ : m_timeCutSmallQ;
62  if(lambda_center < m_lambdaCalDivide && std::abs(cluster->eta()) < m_etaCut) {
63  if( abs(time) > timeCut )continue;
64  }
65 
66  // record cluster if selected
67  h_outCaloClusters->push_back(cluster);
68 
69  }
70 
71  ATH_MSG_DEBUG("Read In " << h_inCaloClusters->size() << " Selected " << h_outCaloClusters->size());
72 
73  return StatusCode::SUCCESS;
74 }
75 
76 
77 
GepClusterTimingAlg::m_timeCutLargeQ
Gaudi::Property< float > m_timeCutLargeQ
Definition: GepClusterTimingAlg.h:36
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
GepClusterTimingAlg::execute
virtual StatusCode execute(const EventContext &) const
Definition: GepClusterTimingAlg.cxx:33
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
GepClusterTimingAlg::m_etaCut
Gaudi::Property< float > m_etaCut
Definition: GepClusterTimingAlg.h:38
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
CaloClusterAuxContainer.h
GepClusterTimingAlg.h
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
GepClusterTimingAlg::GepClusterTimingAlg
GepClusterTimingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: GepClusterTimingAlg.cxx:9
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
GepClusterTimingAlg::~GepClusterTimingAlg
virtual ~GepClusterTimingAlg()
Definition: GepClusterTimingAlg.cxx:14
GepClusterTimingAlg::m_qualityCut
Gaudi::Property< float > m_qualityCut
Definition: GepClusterTimingAlg.h:35
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
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
GepClusterTimingAlg::m_inCaloClustersKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inCaloClustersKey
Definition: GepClusterTimingAlg.h:26
GepClusterTimingAlg::m_outCaloClustersKey
SG::WriteHandleKey< ConstDataVector< xAOD::CaloClusterContainer > > m_outCaloClustersKey
Definition: GepClusterTimingAlg.h:30
GepClusterTimingAlg::m_lambdaCalDivide
Gaudi::Property< float > m_lambdaCalDivide
Definition: GepClusterTimingAlg.h:34
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
CaloClusterContainer.h
GepClusterTimingAlg::finalize
virtual StatusCode finalize()
Definition: GepClusterTimingAlg.cxx:27
GepClusterTimingAlg::m_timeCutSmallQ
Gaudi::Property< float > m_timeCutSmallQ
Definition: GepClusterTimingAlg.h:37
GepClusterTimingAlg::initialize
virtual StatusCode initialize()
Definition: GepClusterTimingAlg.cxx:17