ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
InDetEventAthenaPool
src
TRT_DriftCircleContainerCnv_p0.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TRT_DriftCircleContainerCnv_p0.h
"
6
#include "
TRT_ReadoutGeometry/TRT_BaseElement.h
"
7
#include "
InDetIdentifier/TRT_ID.h
"
8
#include "
StoreGate/ReadCondHandle.h
"
9
#include "
MsgUtil.h
"
10
#include "
AthenaKernel/errorcheck.h
"
11
12
// Gaudi
13
#include "GaudiKernel/ISvcLocator.h"
14
#include "GaudiKernel/Bootstrap.h"
15
#include "GaudiKernel/StatusCode.h"
16
#include "GaudiKernel/Service.h"
17
#include "GaudiKernel/MsgStream.h"
18
19
#include <string>
20
21
//================================================================
22
23
24
StatusCode
TRT_DriftCircleContainerCnv_p0::initialize
(MsgStream &log ) {
25
26
log << MSG::INFO <<
"TRT_DriftCircleContainerCnv::initialize()"
<<
endmsg
;
27
28
SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore"
)};
29
CHECK
( detStore.isValid() );
30
31
CHECK
( detStore->retrieve(
m_trtId
,
"TRT_ID"
) );
32
// Initialize readCondHandle key
33
CHECK
(
m_trtDetEleContKey
.initialize());
34
MSG_DEBUG
(log,
"Converter initialized."
);
35
36
return
StatusCode::SUCCESS;
37
}
38
39
40
41
42
InDet::TRT_DriftCircleContainer*
TRT_DriftCircleContainerCnv_p0::createTransient
(
TRT_DriftCircleContainer_p0
* persObj, MsgStream& log) {
43
44
auto
trans = std::make_unique<InDet::TRT_DriftCircleContainer>(
m_trtId
->straw_layer_hash_max());
45
MSG_DEBUG
(log,
"Read PRD vector, size "
<< persObj->
size
());
46
47
SG::ReadCondHandle<InDetDD::TRT_DetElementContainer>
trtDetEleHandle(
m_trtDetEleContKey
);
48
const
InDetDD::TRT_DetElementCollection
* elements(trtDetEleHandle->getElements());
49
if
(not trtDetEleHandle.
isValid
() or elements==
nullptr
) {
50
log << MSG::FATAL <<
m_trtDetEleContKey
.fullKey() <<
" is not available."
<<
endmsg
;
51
return
trans.release();
52
}
53
54
for
(InDet::TRT_DriftCircleCollection* dcColl : *persObj) {
55
// Add detElem to each drift circle
56
IdentifierHash
collHash = dcColl->identifyHash();
57
const
InDetDD::TRT_BaseElement
* de = elements->
getDetectorElement
(collHash);
58
MSG_DEBUG
(log,
"Set TRT_DriftCircle detector element to "
<< de);
59
60
InDet::TRT_DriftCircleCollection::iterator itColl = dcColl->begin();
61
InDet::TRT_DriftCircleCollection::iterator lastColl = dcColl->end();
62
for
(
int
num = 0; itColl != lastColl; ++itColl, ++num) {
63
MSG_DEBUG
(log,
"PRD "
<< num);
64
(*itColl)->m_detEl = de;
65
}
66
67
StatusCode
sc
= trans->addCollection(dcColl, collHash);
68
if
(
sc
.isSuccess()){
69
MSG_VERBOSE
(log,
"TRT_DriftCircleContainer successfully added to Container !"
);
70
}
else
{
71
log << MSG::ERROR <<
"Failed to add TRT_DriftCircleContainer to container"
<<
endmsg
;
72
return
nullptr
;
73
}
74
}
75
return
(trans.release());
76
}
77
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
MsgUtil.h
MSG_VERBOSE
#define MSG_VERBOSE(log, x)
Definition
MsgUtil.h:18
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition
MsgUtil.h:16
ReadCondHandle.h
TRT_BaseElement.h
TRT_DriftCircleContainerCnv_p0.h
TRT_DriftCircleContainer_p0
DataVector< Trk::PrepRawDataCollection< InDet::TRT_DriftCircle > > TRT_DriftCircleContainer_p0
Definition
TRT_DriftCircleContainerCnv_p0.h:15
TRT_ID.h
This is an Identifier helper class for the TRT subdetector.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
InDetDD::TRT_BaseElement
Virtual base class of TRT readout elements.
Definition
TRT_BaseElement.h:56
InDetDD::TRT_DetElementCollection
Class to hold collection of TRT detector elements.
Definition
TRT_DetElementCollection.h:26
InDetDD::TRT_DetElementCollection::getDetectorElement
const TRT_BaseElement * getDetectorElement(const IdentifierHash &hash) const
Definition
TRT_DetElementCollection.cxx:9
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
TRT_DriftCircleContainerCnv_p0::createTransient
virtual InDet::TRT_DriftCircleContainer * createTransient(const TRT_DriftCircleContainer_p0 *, MsgStream &) override
Definition
TRT_DriftCircleContainerCnv_p0.h:38
TRT_DriftCircleContainerCnv_p0::initialize
StatusCode initialize(MsgStream &log)
Definition
TRT_DriftCircleContainerCnv_p0.cxx:24
TRT_DriftCircleContainerCnv_p0::m_trtId
const TRT_ID * m_trtId
Definition
TRT_DriftCircleContainerCnv_p0.h:23
TRT_DriftCircleContainerCnv_p0::m_trtDetEleContKey
SG::ReadCondHandleKey< InDetDD::TRT_DetElementContainer > m_trtDetEleContKey
Definition
TRT_DriftCircleContainerCnv_p0.h:24
Generated on
for ATLAS Offline Software by
1.17.0