ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRawAlgs
BCM_ZeroSuppression
src
BCM_ZeroSuppression.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "GaudiKernel/StatusCode.h"
6
7
#include "
BCM_ZeroSuppression/BCM_ZeroSuppression.h
"
8
9
#include "
InDetBCM_RawData/BCM_RawData.h
"
10
#include "
InDetBCM_RawData/BCM_RDO_Collection.h
"
11
#include "
StoreGate/ReadHandle.h
"
12
#include "
StoreGate/WriteHandle.h
"
13
14
#include <vector>
15
using namespace
std
;
16
17
BCM_ZeroSuppression::BCM_ZeroSuppression
(
const
std::string& name,
18
ISvcLocator* pSvcLocator)
19
:
AthReentrantAlgorithm
(name, pSvcLocator)
20
{
21
declareProperty
(
"BcmContainerName"
,
m_bcmContainerName
=
"BCM_RDOs"
);
22
declareProperty
(
"BcmOutputContainerName"
,
m_bcmOutputName
=
"BCM_CompactDOs"
);
23
}
24
25
BCM_ZeroSuppression::~BCM_ZeroSuppression
()
26
=
default
;
27
28
StatusCode
BCM_ZeroSuppression::initialize
() {
29
ATH_CHECK
(
m_bcmContainerName
.initialize() );
30
ATH_CHECK
(
m_bcmOutputName
.initialize() );
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
BCM_ZeroSuppression::execute
(
const
EventContext& ctx)
const
{
35
// Retrieve BCM RDO
36
SG::ReadHandle<BCM_RDO_Container>
bcm_rdo(
m_bcmContainerName
, ctx);
37
if
( !bcm_rdo.
isValid
() ) {
38
// There is a warning from StoreGate anyways at this point.
39
// @TODO return failure instead ?
40
return
StatusCode::SUCCESS;
41
}
42
43
// Create output RDO container and record it to StoreGate
44
SG::WriteHandle<BCM_RDO_Container>
bcm_compact_DO(
m_bcmOutputName
, ctx);
45
if
(bcm_compact_DO.
record
(std::make_unique<BCM_RDO_Container>()).isFailure()) {
46
ATH_MSG_FATAL
(
"Container '"
<<
m_bcmOutputName
<<
"' could not be registered in StoreGate"
);
47
return
StatusCode::FAILURE;
48
}
49
50
// check if the collection exists if in the original container and loop over it
51
// and copy only those which have information in them
52
for
(
const
BCM_RDO_Collection
*BCM_RDO: *bcm_rdo) {
53
54
std::unique_ptr<BCM_RDO_Collection> my_collection(std::make_unique<BCM_RDO_Collection>() );
55
56
for
(
const
BCM_RawData
*RDO_element: *BCM_RDO) {
57
58
int
bcm_pulse1width = RDO_element->getPulse1Width();
59
int
bcm_pulse2width = RDO_element->getPulse2Width();
60
if
((bcm_pulse1width != 0) || (bcm_pulse2width !=0)) {
61
my_collection->push_back((
new
BCM_RawData
(*RDO_element)));
62
}
63
64
}
65
66
if
(!my_collection->empty()) {
67
ATH_MSG_VERBOSE
(
"Container '"
<<
m_bcmOutputName
.key() <<
"' is being filled"
);
68
bcm_compact_DO->push_back(my_collection.release());
69
}
70
71
}
//end of container loop
72
73
return
StatusCode::SUCCESS;
74
}
75
76
StatusCode
BCM_ZeroSuppression::finalize
() {
77
return
StatusCode::SUCCESS;
78
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
BCM_RDO_Collection.h
BCM_RawData.h
BCM_ZeroSuppression.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
BCM_RDO_Collection
Definition
BCM_RDO_Collection.h:27
BCM_RawData
Definition
BCM_RawData.h:36
BCM_ZeroSuppression::finalize
StatusCode finalize() override
Definition
BCM_ZeroSuppression.cxx:76
BCM_ZeroSuppression::execute
StatusCode execute(const EventContext &ctx) const override
Definition
BCM_ZeroSuppression.cxx:34
BCM_ZeroSuppression::m_bcmOutputName
SG::WriteHandleKey< BCM_RDO_Container > m_bcmOutputName
Definition
BCM_ZeroSuppression.h:37
BCM_ZeroSuppression::BCM_ZeroSuppression
BCM_ZeroSuppression(const std::string &name, ISvcLocator *pSvcLocator)
Definition
BCM_ZeroSuppression.cxx:17
BCM_ZeroSuppression::m_bcmContainerName
SG::ReadHandleKey< BCM_RDO_Container > m_bcmContainerName
A data member to contain the name of the BCM RDO that contains the input BCM information.
Definition
BCM_ZeroSuppression.h:36
BCM_ZeroSuppression::~BCM_ZeroSuppression
~BCM_ZeroSuppression()
BCM_ZeroSuppression::initialize
StatusCode initialize() override
Definition
BCM_ZeroSuppression.cxx:28
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0