ATLAS Offline Software
Loading...
Searching...
No Matches
GepClusterTimingAlg.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4
8
9GepClusterTimingAlg::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
21 CHECK(m_inCaloClustersKey.initialize());
22 CHECK(m_outCaloClustersKey.initialize());
23
24 return StatusCode::SUCCESS;
25}
26
28 ATH_MSG_INFO ("Finalizing " << name() << "...");
29
30 return StatusCode::SUCCESS;
31}
32
33StatusCode 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
48 CHECK(h_outCaloClusters.record(std::make_unique<ConstDataVector<xAOD::CaloClusterContainer>>(SG::VIEW_ELEMENTS)));
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
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
An algorithm that can be simultaneously executed in multiple threads.
DataVector adapter that acts like it holds const pointers.
SG::WriteHandleKey< ConstDataVector< xAOD::CaloClusterContainer > > m_outCaloClustersKey
virtual StatusCode execute(const EventContext &) const
virtual StatusCode initialize()
Gaudi::Property< float > m_lambdaCalDivide
Gaudi::Property< float > m_qualityCut
GepClusterTimingAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode finalize()
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inCaloClustersKey
Gaudi::Property< float > m_timeCutLargeQ
Gaudi::Property< float > m_timeCutSmallQ
Gaudi::Property< float > m_etaCut
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())