ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
InDetEventAthenaPool
src
PixelRDO_ContainerCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PixelRDO_ContainerCnv.h
"
6
#include "
MsgUtil.h
"
7
#include "
InDetIdentifier/PixelID.h
"
8
9
#include <memory>
10
11
#include <iostream>
12
13
14
15
//================================================================
16
namespace
{
17
std::string shortPrint(
const
PixelRDO_Container
*main_input_Pixel,
unsigned
maxprint=25) {
18
std::ostringstream
os
;
19
if
(main_input_Pixel) {
20
for
(
unsigned
i=0;
i
<maxprint;
i
++) {
21
const
auto
*
p
= main_input_Pixel->
indexFindPtr
(i);
22
if
(p !=
nullptr
) {
23
os
<<
" "
<<
p
->size();
24
}
25
else
{
26
os
<<
" *"
;
27
}
28
}
29
}
30
else
{
31
os
<<
" [PixelRDO_Container==NULL]"
;
32
}
33
return
os
.str();
34
}
35
}
36
//================================================================
37
StatusCode
PixelRDO_ContainerCnv::initialize
() {
38
ATH_CHECK
(
PixelRDO_ContainerCnvBase::initialize
() );
39
40
ATH_MSG_INFO
(
"PixelRDO_ContainerCnv::initialize()"
);
41
42
// Get the pixel helper from the detector store
43
const
PixelID
* idhelper(
nullptr
);
44
ATH_CHECK
(
detStore
()->retrieve(idhelper,
"PixelID"
) );
45
46
m_converter_p0
.initialize(idhelper);
47
m_converter_TP1
.initialize(idhelper);
48
m_converter_TP2
.initialize(idhelper);
49
50
ATH_MSG_DEBUG
(
"Converter initialized"
);
51
52
return
StatusCode::SUCCESS;
53
}
54
55
//================================================================
56
PixelRDO_Container_PERS
*
PixelRDO_ContainerCnv::createPersistent
(
PixelRDO_Container
* transCont) {
57
ATH_MSG_DEBUG
(
"createPersistent(): main converter. TRANS = "
<<shortPrint(transCont));
58
59
// converter_num is a switch to determine which persistent type to use
60
// 1: if concrete type private data is equivalent to InDetRawData_p1
61
// 2: for cosmic/TB not implemented
62
//
63
unsigned
int
converter_num(1);
64
PixelRDO_Container::const_iterator
it_Coll = transCont->
begin
();
65
PixelRDO_Container::const_iterator
it_CollEnd = transCont->
end
();
66
// check one element of the container. The container can't be empty for this...
67
if
(it_Coll != it_CollEnd) {
68
while
(it_Coll != it_CollEnd && (*it_Coll) && (*it_Coll)->size() == 0 ) ++it_Coll;
69
if
(it_Coll != it_CollEnd) {
70
const
PixelRDORawData
*test((**it_Coll)[0]);
71
if
(
dynamic_cast<
const
Pixel1RawData
*
>
(test) !=
nullptr
) {
72
ATH_MSG_DEBUG
(
"Found container with Pixel1RawData concrete type objects"
);
73
converter_num=1;
74
}
else
{
75
ATH_MSG_FATAL
(
"Converter not implemented for this concrete type "
);
76
throw
"Converter not implemented"
;
77
}
78
}
else
{
79
ATH_MSG_DEBUG
(
"Container has only empty collections. Using TP1 converter"
);
80
}
81
}
else
{
82
ATH_MSG_DEBUG
(
"Empty container. Using TP1 converter"
);
83
}
84
// Switch facility depending on the concrete data type of the contained objects
85
// Should do by getting the type_info of one of the contained objects
86
PixelRDO_Container_PERS
*persObj(
nullptr
);
87
if
(converter_num == 1) {
88
persObj =
m_converter_PERS
.createPersistent( transCont,
msg
() );
89
}
else
{
90
ATH_MSG_FATAL
(
"This shouldn't happen!! "
);
91
}
92
ATH_MSG_DEBUG
(
"Success"
);
93
return
persObj;
94
}
95
96
//================================================================
97
PixelRDO_Container
*
PixelRDO_ContainerCnv::createTransient
(
const
Token
* token) {
98
99
static
const
Guid
p0_guid(
"7F2C09B6-0B47-4957-8BBA-EDC665A290AC"
);
// with Pixel1RawData
100
static
const
Guid
TP1_guid(
"DA76970C-E019-43D2-B2F9-25660DCECD9D"
);
// for t/p separated version with InDetRawDataContainer_p1
101
static
const
Guid
TP2_guid(
"7138342E-0A80-4A32-A387-2842A01C2539"
);
// for t/p separated version with InDetRawDataContainer_p2
102
ATH_MSG_DEBUG
(
"createTransient(const Token* token): main converter"
);
103
104
if
(
compareClassGuid
(token, TP2_guid) ) {
105
ATH_MSG_DEBUG
(
"createTransient(const Token* token): New TP version - TP2 branch"
);
106
107
std::unique_ptr< InDetRawDataContainer_p2 > col_vect(
poolReadObject< InDetRawDataContainer_p2 >
(token) );
108
PixelRDO_Container
*
res
=
m_converter_TP2
.createTransient( col_vect.get(),
msg
() );
109
110
ATH_MSG_DEBUG
(
"createTransient(const Token* token), TP2 branch: returns TRANS = "
<<shortPrint(
res
));
111
112
return
res
;
113
114
115
}
116
else
if
(
compareClassGuid
(token, TP1_guid) ) {
117
ATH_MSG_DEBUG
(
"createTransient(const Token* token): New TP version - TP1 branch"
);
118
119
std::unique_ptr< InDetRawDataContainer_p1 > col_vect(
poolReadObject< InDetRawDataContainer_p1 >
(token) );
120
PixelRDO_Container
*
res
=
m_converter_TP1
.createTransient( col_vect.get(),
msg
() );
121
122
ATH_MSG_DEBUG
(
"createTransient(const Token* token), TP1 branch: returns TRANS = "
<<shortPrint(
res
));
123
124
return
res
;
125
126
127
}
128
else
if
(
compareClassGuid
(token, p0_guid) ) {
129
ATH_MSG_DEBUG
(
"createTransient(const Token* token): Old input file - p0 branch"
);
130
131
std::unique_ptr< PixelRDO_Container_p0 > col_vect(
poolReadObject< PixelRDO_Container_p0 >
(token) );
132
PixelRDO_Container
*
res
=
m_converter_p0
.createTransient( col_vect.get(),
msg
() );
133
134
ATH_MSG_DEBUG
(
"createTransient(const Token* token), p0 branch: returns TRANS = "
<<shortPrint(
res
));
135
136
return
res
;
137
}
138
throw
std::runtime_error(
"Unsupported persistent version of PixelRDO_Container"
);
139
}
140
141
//================================================================
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:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:28
res
std::pair< std::vector< unsigned int >, bool > res
Definition
JetGroupProductTest.cxx:11
MsgUtil.h
PixelRDO_Container_PERS
InDetRawDataContainer_p2 PixelRDO_Container_PERS
Definition
PhaseIIPixelRawDataContainerCnv.h:17
PixelID.h
This is an Identifier helper class for the Pixel subdetector.
PixelRDO_ContainerCnv.h
PixelRDO_Container
InDetRawDataContainer< InDetRawDataCollection< PixelRDORawData > > PixelRDO_Container
Definition
PixelRDO_Container.h:25
T_AthenaPoolCustomCnv< PixelRDO_Container, PixelRDO_Container_PERS >::msg
MsgStream & msg() const
Definition
AthMessaging.h:167
T_AthenaPoolCustomCnv< PixelRDO_Container, PixelRDO_Container_PERS >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthenaPoolConverter.h:68
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition
Guid.h:25
IdentifiableContainerMT::const_iterator
Definition
IdentifiableContainerMT.h:81
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition
IdentifiableContainerMT.h:247
IdentifiableContainerMT::indexFindPtr
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Definition
IdentifiableContainerMT.h:297
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition
IdentifiableContainerMT.h:241
Pixel1RawData
Definition
Pixel1RawData.h:23
PixelID
This is an Identifier helper class for the Pixel subdetector.
Definition
PixelID.h:69
PixelRDORawData
Definition
PixelRDORawData.h:23
PixelRDO_ContainerCnv::createTransient
virtual PixelRDO_Container * createTransient(const Token *token) override
Definition
PixelRDO_ContainerCnv.cxx:97
PixelRDO_ContainerCnv::createPersistent
virtual PixelRDO_Container_PERS * createPersistent(PixelRDO_Container *transCont) override
Definition
PixelRDO_ContainerCnv.cxx:56
PixelRDO_ContainerCnv::m_converter_TP1
Pixel1RawDataContainerCnv_p1 m_converter_TP1
Definition
PixelRDO_ContainerCnv.h:32
PixelRDO_ContainerCnv::m_converter_TP2
Pixel1RawDataContainerCnv_p2 m_converter_TP2
Definition
PixelRDO_ContainerCnv.h:33
PixelRDO_ContainerCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition
PixelRDO_ContainerCnv.cxx:37
PixelRDO_ContainerCnv::m_converter_p0
PixelRDO_ContainerCnv_p0 m_converter_p0
Definition
PixelRDO_ContainerCnv.h:31
PixelRDO_ContainerCnv::m_converter_PERS
PixelRDO_ContainerCnv_PERS m_converter_PERS
Definition
PixelRDO_ContainerCnv.h:34
T_AthenaPoolCustomCnv< PixelRDO_Container, PixelRDO_Container_PERS >::compareClassGuid
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
T_AthenaPoolCustomCnv< PixelRDO_Container, PixelRDO_Container_PERS >::initialize
virtual StatusCode initialize()
T_AthenaPoolCustomCnv< PixelRDO_Container, PixelRDO_Container_PERS >::poolReadObject
P * poolReadObject(const Token *token)
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition
Token.h:22
ReadFromCrestCompare.os
int os
Definition
ReadFromCrestCompare.py:229
lumiFormat.i
int i
Definition
lumiFormat.py:85
python.utils.AtlRunQueryDQUtils.p
p
Definition
AtlRunQueryDQUtils.py:209
Generated on
for ATLAS Offline Software by
1.17.0