ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecAlgs
InDetPrepRawDataFormation
src
TRT_RIO_Maker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
13
14
#include "
InDetPrepRawDataFormation/TRT_RIO_Maker.h
"
15
#include "
InDetIdentifier/TRT_ID.h
"
16
//
17
#include "GaudiKernel/ISvcLocator.h"
18
19
20
21
namespace
InDet
{
22
24
// Constructior
26
TRT_RIO_Maker::TRT_RIO_Maker
27
(
const
std::string& name,ISvcLocator* pSvcLocator) :
28
AthReentrantAlgorithm
(name,pSvcLocator),
29
m_pTRTHelper
(nullptr){}
30
32
// Initialisation
34
StatusCode
TRT_RIO_Maker::initialize
() {
35
// Get TRT_DriftCircle tool
36
ATH_CHECK
(
m_driftcircle_tool
.retrieve());
37
ATH_CHECK
(
detStore
()->retrieve(
m_pTRTHelper
,
"TRT_ID"
));
38
if
(
m_roiSeeded
.value()) {
39
ATH_CHECK
(
m_roiCollectionKey
.initialize());
40
ATH_CHECK
(
m_regionSelector
.retrieve());
41
}
else
{
42
ATH_CHECK
(
m_roiCollectionKey
.initialize(
false
));
43
m_regionSelector
.disable();
44
}
45
46
ATH_CHECK
(
m_rdoContainerKey
.initialize() );
47
ATH_CHECK
(
m_rioContainerKey
.initialize() );
48
ATH_CHECK
(
m_rioContainerCacheKey
.initialize(!
m_rioContainerCacheKey
.key().empty()) );
49
msg
(MSG::DEBUG) <<
"getTRTBadChannels on or off (1/0)"
<<
m_trtBadChannels
<<
endmsg
;
50
return
StatusCode::SUCCESS;
51
}
52
53
//no-op destructor
54
TRT_RIO_Maker::~TRT_RIO_Maker
() =
default
;
55
57
// Execute
59
StatusCode
TRT_RIO_Maker::execute
(
const
EventContext& ctx)
const
{
60
// TRT_DriftCircle container registration
61
SG::WriteHandle<InDet::TRT_DriftCircleContainer>
rioContainer(
m_rioContainerKey
, ctx);
62
if
(
m_rioContainerCacheKey
.key().empty()){
63
rioContainer = std::make_unique<InDet::TRT_DriftCircleContainer>(
m_pTRTHelper
->straw_layer_hash_max(),
EventContainers::Mode::OfflineFast
);
64
}
else
{
65
SG::UpdateHandle<TRT_DriftCircleContainerCache>
clusterContainercache(
m_rioContainerCacheKey
, ctx);
66
ATH_CHECK
( rioContainer.
record
(std::make_unique<TRT_DriftCircleContainer>(clusterContainercache.
ptr
()) ));
67
}
68
69
ATH_CHECK
(rioContainer.
isValid
());
70
ATH_MSG_DEBUG
(
"Container "
<< rioContainer.
name
() <<
" initialised"
);
71
SG::ReadHandle<TRT_RDO_Container>
rdoContainer(
m_rdoContainerKey
, ctx);
72
ATH_CHECK
(rdoContainer.
isValid
());
73
74
const
bool
hasExternalCache = rdoContainer->hasExternalCache();
75
std::unique_ptr<DataPool<TRT_DriftCircle>> dataItemsPool =
nullptr
;
76
if
(!hasExternalCache) {
77
dataItemsPool = std::make_unique<DataPool<TRT_DriftCircle>>(ctx);
78
dataItemsPool->reserve(100000);
// Some large default size
79
}
else
if
(
m_useDataPoolWithCache
){
80
dataItemsPool = std::make_unique<DataPool<TRT_DriftCircle>>(ctx);
81
//Default size for now 1024 let it expand on its own
82
}
83
84
// Get TRT_RDO and produce TRT_RIO collections
85
if
(!
m_roiSeeded
) {
//Full-scan mode
86
87
for
(
const
auto
*
const
rdoCollections : *rdoContainer) {
88
const
InDetRawDataCollection<TRT_RDORawData>
* currentCollection(rdoCollections);
89
InDet::TRT_DriftCircleContainer::IDC_WriteHandle
lock
= rioContainer->getWriteHandle(currentCollection->
identifyHash
());
90
if
(
lock
.OnlineAndPresentInAnotherView()) {
91
continue
;
92
}
93
std::unique_ptr<TRT_DriftCircleCollection> p_rio(
94
m_driftcircle_tool
->convert(
m_mode_rio_production
,
95
currentCollection, ctx, dataItemsPool.get(),
96
m_trtBadChannels
));
97
if
(p_rio && !p_rio->empty()) {
98
ATH_CHECK
(
lock
.addOrDelete(std::move(p_rio)));
99
}
100
}
101
}
else
{
102
SG::ReadHandle<TrigRoiDescriptorCollection>
roiCollection(
m_roiCollectionKey
, ctx);
103
ATH_CHECK
(roiCollection.
isValid
());
104
std::vector<IdentifierHash> listOfTRTIds;
105
for
(
const
TrigRoiDescriptor
* roi : *roiCollection){
106
107
listOfTRTIds.clear();
//Prevents needless memory reallocations
108
m_regionSelector
->lookup(ctx)->HashIDList( *roi, listOfTRTIds);
109
for
(
auto
&
id
: listOfTRTIds){
110
const
InDetRawDataCollection<TRT_RDORawData>
* RDO_Collection (rdoContainer->indexFindPtr(
id
));
111
if
(!RDO_Collection)
continue
;
112
InDet::TRT_DriftCircleContainer::IDC_WriteHandle
lock
= rioContainer->getWriteHandle(
id
);
113
if
(
lock
.OnlineAndPresentInAnotherView() ) {
114
continue
;
115
}
116
117
// Use one of the specific clustering AlgTools to make clusters
118
std::unique_ptr<TRT_DriftCircleCollection> p_rio(
119
m_driftcircle_tool
->convert(
m_mode_rio_production
,
120
RDO_Collection, ctx, dataItemsPool.get(),
121
m_trtBadChannels
));
122
if
(p_rio && !p_rio->empty()) {
123
ATH_CHECK
(
lock
.addOrDelete(std::move(p_rio)));
124
}
125
}
126
}
127
}
128
ATH_MSG_DEBUG
(
"rioContainer->numberOfCollections() "
<< rioContainer->numberOfCollections());
129
ATH_CHECK
(rioContainer.
setConst
());
130
return
StatusCode::SUCCESS;
131
}
132
134
// Finalize
136
StatusCode
TRT_RIO_Maker::finalize
() {
137
return
StatusCode::SUCCESS;
138
}
139
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
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
lock
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
TRT_ID.h
This is an Identifier helper class for the TRT subdetector.
TRT_RIO_Maker.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
InDetRawDataCollection
Definition
InDetRawDataCollection.h:31
InDetRawDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
InDet::TRT_RIO_Maker::finalize
virtual StatusCode finalize() override
Definition
TRT_RIO_Maker.cxx:136
InDet::TRT_RIO_Maker::m_trtBadChannels
BooleanProperty m_trtBadChannels
Definition
TRT_RIO_Maker.h:73
InDet::TRT_RIO_Maker::m_pTRTHelper
const TRT_ID * m_pTRTHelper
Definition
TRT_RIO_Maker.h:61
InDet::TRT_RIO_Maker::m_useDataPoolWithCache
BooleanProperty m_useDataPoolWithCache
Definition
TRT_RIO_Maker.h:77
InDet::TRT_RIO_Maker::m_rdoContainerKey
SG::ReadHandleKey< TRT_RDO_Container > m_rdoContainerKey
Definition
TRT_RIO_Maker.h:62
InDet::TRT_RIO_Maker::TRT_RIO_Maker
TRT_RIO_Maker()=delete
InDet::TRT_RIO_Maker::initialize
virtual StatusCode initialize() override
Definition
TRT_RIO_Maker.cxx:34
InDet::TRT_RIO_Maker::m_regionSelector
ToolHandle< IRegSelTool > m_regionSelector
region selector tool
Definition
TRT_RIO_Maker.h:69
InDet::TRT_RIO_Maker::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
TRT_RIO_Maker.cxx:59
InDet::TRT_RIO_Maker::m_rioContainerKey
SG::WriteHandleKey< InDet::TRT_DriftCircleContainer > m_rioContainerKey
Definition
TRT_RIO_Maker.h:80
InDet::TRT_RIO_Maker::m_rioContainerCacheKey
SG::UpdateHandleKey< InDet::TRT_DriftCircleContainerCache > m_rioContainerCacheKey
Definition
TRT_RIO_Maker.h:83
InDet::TRT_RIO_Maker::m_roiSeeded
BooleanProperty m_roiSeeded
Definition
TRT_RIO_Maker.h:76
InDet::TRT_RIO_Maker::m_roiCollectionKey
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
Definition
TRT_RIO_Maker.h:64
InDet::TRT_RIO_Maker::m_mode_rio_production
IntegerProperty m_mode_rio_production
Definition
TRT_RIO_Maker.h:72
InDet::TRT_RIO_Maker::~TRT_RIO_Maker
virtual ~TRT_RIO_Maker()
no-op destructor
InDet::TRT_RIO_Maker::m_driftcircle_tool
ToolHandle< ITRT_DriftCircleTool > m_driftcircle_tool
Definition
TRT_RIO_Maker.h:67
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::UpdateHandle
Definition
UpdateHandle.h:91
SG::UpdateHandle::ptr
pointer_type ptr()
Dereference the pointer.
SG::VarHandleBase::setConst
StatusCode setConst()
Set the 'const' bit for the bound proxy in the store.
Definition
StoreGate/src/VarHandleBase.cxx:612
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
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.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
Definition
TrigRoiDescriptor.h:48
EventContainers::Mode::OfflineFast
@ OfflineFast
Definition
IdentifiableContainerBase.h:13
InDet
Primary Vertex Finder.
Definition
VP1ErrorUtils.h:36
Generated on
for ATLAS Offline Software by
1.17.0