ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigEvent
TrigRoiConversion
src
RoiWriter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
//
5
// @file RoiWriter.cxx
6
//
7
// @author M.Sutton
8
// @author F. Winklmeier
9
//
10
11
// EDM include(s):
12
#include "
xAODTrigger/RoiDescriptorStore.h
"
13
#include "
xAODTrigger/RoiDescriptorStoreAuxInfo.h
"
14
15
// Athena include(s):
16
#include "
StoreGate/ReadHandle.h
"
17
#include "
StoreGate/WriteHandle.h
"
18
19
// Local include(s):
20
#include "
RoiWriter.h
"
21
#include "
TrigRoiConversion/RoiSerialise.h
"
22
23
namespace
{
24
// Prefix of the AOD container:
25
static
const
std::string
prefix
=
"HLT_TrigRoiDescriptorCollection"
;
26
static
const
std::string newPrefix =
"HLT_xAOD__RoiDescriptorStore"
;
27
}
28
29
RoiWriter::RoiWriter
(
const
std::string& name, ISvcLocator* pSvcLocator )
30
:
AthReentrantAlgorithm
( name, pSvcLocator ) {
31
}
32
33
StatusCode
RoiWriter::execute
(
const
EventContext& ctx)
const
{
34
35
ATH_MSG_DEBUG
(
"In execute()..."
);
36
37
// Get the keys of the AOD container(s):
38
std::vector< std::string > keys;
39
evtStore
()->keys<
TrigRoiDescriptorCollection
>( keys );
40
41
// Buffer for serialisation:
42
std::vector< std::vector< uint32_t > > roiserial;
43
44
bool
just_dandy =
true
;
45
46
// Create handle keys for use in the loop:
47
SG::ReadHandleKey< TrigRoiDescriptorCollection >
rhk(
"temp"
);
48
SG::WriteHandleKey< xAOD::RoiDescriptorStore >
whk(
"temp"
);
49
ATH_CHECK
( rhk.
initialize
() && whk.
initialize
() );
50
51
// Loop over these container(s):
52
for
(
const
std::string& key : keys ) {
53
// Update key to read from:
54
rhk = key;
55
56
// Construct the key of the new container:
57
whk = ( ( key.find( prefix ) == 0 ) ?
58
( newPrefix + key.substr( prefix.size() ) ) :
59
key );
60
61
auto
rh =
SG::makeHandle
(rhk, ctx);
62
auto
wh =
SG::makeHandle
(whk, ctx);
63
66
if
( rh.isValid() ) {
67
68
// Create the "new payload" from it:
69
roiserial.clear();
70
RoiUtil::serialise
( *rh, roiserial );
71
72
// Create the xAOD objects:
73
auto
store = std::make_unique< xAOD::RoiDescriptorStore >();
74
auto
aux = std::make_unique< xAOD::RoiDescriptorStoreAuxInfo >();
75
store->setStore( aux.get() );
76
store->setSerialised( roiserial );
77
78
// Record the new container:
79
ATH_CHECK
( wh.record( std::move( store ), std::move( aux ) ) );
80
}
81
else
just_dandy =
false
;
82
}
83
84
// Return gracefully:
85
return
just_dandy ? StatusCode::SUCCESS : StatusCode::FAILURE;
86
}
87
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
RoiDescriptorStoreAuxInfo.h
RoiDescriptorStore.h
RoiSerialise.h
RoiWriter.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
RoiWriter::RoiWriter
RoiWriter(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm constructor.
Definition
RoiWriter.cxx:29
RoiWriter::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute the conversion.
Definition
RoiWriter.cxx:33
SG::ReadHandleKey< TrigRoiDescriptorCollection >
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
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition
StoreGate/StoreGate/WriteHandleKey.h:40
TrigRoiDescriptorCollection
Definition
TrigRoiDescriptorCollection.h:14
RoiUtil::serialise
void serialise(const std::vector< const IRoiDescriptor * > &rois, roiserial_type &s)
serialise an entire vector of IRoiDescriptors
Definition
RoiSerialise.cxx:45
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
checkCorrelInHIST.prefix
dict prefix
Definition
checkCorrelInHIST.py:391
Generated on
for ATLAS Offline Software by
1.17.0