ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
InDetEventAthenaPool
src
TRT_RDO_ContainerCnv_p1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Andrei Gaponenko <agaponenko@lbl.gov>, 2006
6
7
#include "
TRT_RDO_ContainerCnv_p1.h
"
8
9
#include "
InDetRawData/TRT_RDO_Container.h
"
10
#include "
InDetIdentifier/TRT_ID.h
"
11
#include "
MsgUtil.h
"
12
13
#include <string>
14
#include <iostream>
15
#include <sstream>
16
17
18
19
//================================================================
20
namespace
{
21
#if 0
22
std::string shortPrint(
const
TRT_RDO_Container
*main_input_TRT,
unsigned
maxprint=25) {
23
std::ostringstream
os
;
24
if
(main_input_TRT) {
25
for
(
unsigned
i=0;
i
<maxprint;
i
++) {
26
TRT_RDO_Container::const_iterator
p
= main_input_TRT->
indexFind
(i);
27
if
(p != main_input_TRT->
end
()) {
28
os
<<
" "
<< (*p)->size();
29
}
30
else
{
31
os
<<
" *"
;
32
}
33
}
34
}
35
else
{
36
os
<<
" [TRT_RDO_Container==NULL]"
;
37
}
38
return
os
.str();
39
}
40
#endif
41
42
//----------------------------------------------------------------
43
std::string persistentTRT_ToString(
const
TRT_RDO_colvector
& rdoV,
unsigned
maxprint = 20) {
44
std::ostringstream
os
;
45
os
<<
"TRT_RDO_colvector = ["
<<rdoV.
size
()<<
"] "
;
46
unsigned
count
= 0;
47
for
(
TRT_RDO_colvector::const_iterator
it = rdoV.
begin
(); it != rdoV.
end
(); ++it) {
48
if
(++
count
>maxprint)
break
;
49
if
(*it) {
50
os
<<(*it)->size()<<
" "
;
51
}
52
else
{
53
os
<<
"* "
;
54
}
55
}
56
return
os
.str();
57
}
58
}
59
60
//================================================================
61
void
TRT_RDO_ContainerCnv_p1::transToPers
(
const
TRT_RDO_Container
*
trans
,
TRT_RDO_Container_p1
* pers, MsgStream &log) {
62
// Copy objects from InDetRawDataContainer collections to simple vector
63
64
unsigned
null_count(0);
65
66
// First try iterators on container. If no collections, then try
67
// retrieving directly from SG.
68
if
(
trans
->begin() !=
trans
->end()) {
69
MSG_DEBUG
(log,
"[p1] using container iterators"
);
70
for
(
TRT_RDO_Container::const_iterator
it=
trans
->begin(); it !=
trans
->end(); ++it) {
71
if
(*it) {
72
pers->
push_back
( *it );
73
}
74
else
{
75
null_count++;
76
}
77
}
78
}
79
else
{
80
// Access directly from SG
81
82
// Retrieve the digits by class, not by name
83
SG::ConstIterator<TRT_RDO_Collection >
it;
84
SG::ConstIterator<TRT_RDO_Collection >
last;
85
86
// Failure means no collections
87
StatusCode
sc
(
m_storeGate
->retrieve(it, last));
88
if
(
sc
.isFailure()) {
89
MSG_DEBUG
(log,
"[p1]: No RDO collections found !"
);
90
}
91
else
{
92
MSG_DEBUG
(log,
"[p1] using collections found in the StoreGate"
);
93
94
for
(; it != last; ++it) {
95
const
TRT_RDO_Collection
* RDO_Collection = &*it;
96
pers->
push_back
(RDO_Collection);
97
}
98
}
99
}
100
101
if
(null_count) {
102
log<<MSG::WARNING<<
"[p1] transToPers(): got "
<< null_count<<
" NULLs in IdentifiableContainer"
<<
endmsg
;
103
}
104
105
MSG_DEBUG
(log,
"[p1] transToPers(): PERS = "
<<persistentTRT_ToString(*pers));
106
}
107
108
//================================================================
109
void
TRT_RDO_ContainerCnv_p1::persToTrans
(
const
TRT_RDO_Container_p1
* pers,
TRT_RDO_Container
*
trans
, MsgStream &log) {
110
111
MSG_DEBUG
(log,
"[p1] persToTrans(): PERS = "
<<persistentTRT_ToString(*pers));
112
113
TRT_RDO_Container_p1::const_iterator
it = pers->
begin
();
114
TRT_RDO_Container_p1::const_iterator
last = pers->
end
();
115
for
(; it != last; ++it) {
116
const
TRT_RDO_Container::IDENTIFIABLE
*rdoColl = *it;
117
IdentifierHash
idHash = rdoColl->identifyHash();
118
StatusCode
sc
=
trans
->addCollection( rdoColl, idHash);
119
if
(
sc
.isFailure()) {
120
log << MSG::FATAL <<
"[p1] persToTrans(): TRT RDOs could not be added to the container!"
<<
endmsg
;
121
throw
std::runtime_error(
"TRT_RDO_ContainerCnv_p1::persToTrans(): TRT RDOs could not be added to the container!"
);
122
}
123
}
124
}
125
126
//================================================================
127
TRT_RDO_Container
*
TRT_RDO_ContainerCnv_p1::createTransient
(
const
TRT_RDO_Container_p1
* persObj, MsgStream& log) {
128
std::unique_ptr<TRT_RDO_Container>
trans
(std::make_unique<TRT_RDO_Container>(
m_trtId
->straw_layer_hash_max()));
129
persToTrans
(persObj,
trans
.get(), log);
130
return
(
trans
.release());
131
}
132
133
//================================================================
134
TRT_RDO_Container_p1
*
TRT_RDO_ContainerCnv_p1::createPersistent
(
const
TRT_RDO_Container
* transObj, MsgStream &log) {
135
std::unique_ptr<TRT_RDO_Container_p1> pers(std::make_unique<TRT_RDO_Container_p1>(
SG::VIEW_ELEMENTS
));
136
transToPers
(transObj, pers.get(), log);
137
return
(pers.release());
138
}
139
140
//================================================================
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
MsgUtil.h
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition
MsgUtil.h:16
TRT_ID.h
This is an Identifier helper class for the TRT subdetector.
TRT_RDO_Collection
InDetRawDataCollection< TRT_RDORawData > TRT_RDO_Collection
Definition
TRT_RDO_Collection.h:23
TRT_RDO_ContainerCnv_p1.h
TRT_RDO_Container_p1
TRT_RDO_colvector TRT_RDO_Container_p1
Definition
TRT_RDO_ContainerCnv_p1.h:15
TRT_RDO_Container.h
TRT_RDO_colvector
ConstDataVector< DataVector< InDetRawDataCollection< TRT_RDORawData > > > TRT_RDO_colvector
Definition
TRT_RDO_Container.h:37
TRT_RDO_Container
InDetRawDataContainer< InDetRawDataCollection< TRT_RDORawData > > TRT_RDO_Container
Definition
TRT_RDO_Container.h:26
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ConstDataVector::begin
iterator begin() noexcept
Return an iterator pointing at the beginning of the collection.
ConstDataVector::end
iterator end() noexcept
Return an iterator pointing past the end of the collection.
ConstDataVector< DataVector< InDetRawDataCollection< TRT_RDORawData > > >::const_iterator
DataVector< InDetRawDataCollection< TRT_RDORawData > >::const_iterator const_iterator
Definition
ConstDataVector.h:85
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
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::indexFind
const_iterator indexFind(IdentifierHash hashId) const
Definition
IdentifiableContainerMT.h:162
InDetRawDataContainer< InDetRawDataCollection< TRT_RDORawData > >::IDENTIFIABLE
T IDENTIFIABLE
Definition
IdentifiableContainerMT.h:68
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ConstIterator
a const_iterator facade to DataHandle.
Definition
SGIterator.h:164
TRT_RDO_ContainerCnv_p1::persToTrans
virtual void persToTrans(const TRT_RDO_Container_p1 *persObj, TRT_RDO_Container *transObj, MsgStream &log)
Definition
TRT_RDO_ContainerCnv_p1.cxx:109
TRT_RDO_ContainerCnv_p1::createPersistent
virtual TRT_RDO_Container_p1 * createPersistent(const TRT_RDO_Container *persObj, MsgStream &log)
Definition
TRT_RDO_ContainerCnv_p1.cxx:134
TRT_RDO_ContainerCnv_p1::m_storeGate
StoreGateSvc * m_storeGate
Definition
TRT_RDO_ContainerCnv_p1.h:21
TRT_RDO_ContainerCnv_p1::transToPers
virtual void transToPers(const TRT_RDO_Container *transObj, TRT_RDO_Container_p1 *persObj, MsgStream &log)
Definition
TRT_RDO_ContainerCnv_p1.cxx:61
TRT_RDO_ContainerCnv_p1::createTransient
virtual TRT_RDO_Container * createTransient(const TRT_RDO_Container_p1 *persObj, MsgStream &log)
Definition
TRT_RDO_ContainerCnv_p1.cxx:127
TRT_RDO_ContainerCnv_p1::m_trtId
const TRT_ID * m_trtId
Definition
TRT_RDO_ContainerCnv_p1.h:20
trans
TH1F * trans(TH1F *h, bool t=false)
Definition
comparitor.cxx:185
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
ReadFromCrestCompare.os
int os
Definition
ReadFromCrestCompare.py:229
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
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