ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArCondAthenaPool
src
LArShapeCompleteCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
10
11
#include "
LArShapeCompleteCnv.h
"
12
#include <cmath>
13
#include <limits>
14
15
static
const
LArShapeSubsetCnv_p1
TPconverter1
;
16
static
const
LArShapeSubsetCnv_p2
TPconverter2
;
17
18
namespace
{
19
21
inline
22
float
toFloat (
double
x
)
23
{
24
if
(std::abs (
x
) > std::numeric_limits<float>::max()) {
25
if
(
x
> 0)
26
return
std::numeric_limits<float>::max();
27
else
28
return
- std::numeric_limits<float>::max();
29
}
30
return
x
;
31
}
32
33
}
// anonymous namespace
34
35
LArShapeSubset_p2
*
36
LArShapeCompleteCnv::createPersistent
(
LArShapeTransType2
* transObj)
37
{
38
MsgStream log(msgSvc(),
"LArShapeCompleteCnv"
);
39
//log << MSG::DEBUG << "LArShapeComplete write" << endmsg;
40
LArShapePersType2
* persObj =
TPconverter2
.createPersistentConst( transObj, log );
41
//log << MSG::DEBUG << "Success" << endmsg;
42
return
persObj;
43
}
44
45
LArConditionsSubset<LArShapeP2>
*
46
LArShapeCompleteCnv::createTransient
(
const
Token
* token)
47
{
48
static
const
pool::Guid
p2_guid(
"5139AF4A-5947-421A-A775-B2D1134145C7"
);
49
static
const
pool::Guid
p1_guid(
"95B61750-4C45-412D-B4D4-9758E9DB40D1"
);
50
static
const
pool::Guid
p0_guid(
"055CF2F5-08D0-4EAA-B154-8CE5B1A599E7"
);
51
52
MsgStream log(msgSvc(),
"LArShapeCompleteCnv"
);
53
if
(
compareClassGuid
(token, p2_guid) ) {
54
std::unique_ptr< LArShapeSubset_p2 > col_vect(
poolReadObject< LArShapeSubset_p2 >
(token) );
55
log << MSG::DEBUG <<
"Reading LArShapeSubset_p1"
<<
endmsg
;
56
return
TPconverter2
.createTransientConst( col_vect.get(), log );
57
}
58
else
if
(
compareClassGuid
(token, p1_guid) ) {
59
log << MSG::ERROR <<
"Sorry if you really want to read LArShapeSubset_p1 you will need to provide a legacy converter"
<<
endmsg
;
60
}
61
else
if
(
compareClassGuid
(token, p0_guid) ) {
62
log << MSG::ERROR <<
"Sorry if you really want to read the very old LArShapeSubset you will need to provide a legacy converter"
<<
endmsg
;
63
}
64
throw
std::runtime_error(
"Unsupported persistent version of LArShapeCompleteCnv"
);
65
}
66
67
LArConditionsSubset<LArShapeP1>
*
68
LArShapeCompleteCnv::createTransient
(
LArConditionsSubset<LArShapeP>
* orig)
69
{
70
71
//MsgStream log(msgSvc(), "LArShapeCompleteCnv" );
72
//log << MSG::DEBUG << "LArShapeCompleteCnv::createTransient orig " << orig << endmsg;
73
74
LArConditionsSubset<LArShapeP1>
* result =
new
LArConditionsSubset<LArShapeP1>
();
75
76
// Copy LArShapeP subset to LArShapeP1
77
LArShapeCopy
copier;
78
copier.
copyOldtoNew
(orig, result);
79
80
return
(result);
81
}
82
83
// Copy LArShapeP subset to LArShapeP1
84
void
85
LArShapeCopy::copyOldtoNew
(
const
LArConditionsSubset<LArShapeP>
* oldShape,
86
LArConditionsSubset<LArShapeP1>
* newShape)
87
{
88
newShape->
assign
(*oldShape,
89
[] (
const
LArShapeP
& from,
90
LArShapeP1
& to)
91
{
92
to.m_vShape.assign (from.
m_vShape
.begin(),
93
from.
m_vShape
.end());
94
95
unsigned
int
nShapeDers = from.
m_vShapeDer
.size();
96
to.m_vShapeDer.resize (nShapeDers);
97
for
(
size_t
k = 0; k < nShapeDers; k++)
98
to.m_vShapeDer[k] = toFloat (from.
m_vShapeDer
[k]);
99
});
100
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
TPconverter2
static const LArCaliWaveSubsetCnv_p2 TPconverter2
Definition
LArCaliWaveContainerCnv.cxx:17
TPconverter1
static const LArCaliWaveSubsetCnv_p1 TPconverter1
Definition
LArCaliWaveContainerCnv.cxx:16
LArShapeCompleteCnv.h
AthenaPool converter LArShapeComplete.
LArShapeTransType2
LArConditionsSubset< LArShapeP2 > LArShapeTransType2
Definition
LArShapeCompleteCnv.h:21
LArShapePersType2
LArShapeSubset_p2 LArShapePersType2
Definition
LArShapeCompleteCnv.h:23
x
#define x
LArConditionsSubset
template class for use for I/O of conditions data
Definition
LArConditionsSubset.h:122
LArConditionsSubset::assign
void assign(const LArConditionsSubset< U > &other, COPIER copier)
Copy from another subset object.
Definition
LArConditionsSubset.h:339
LArShapeCompleteCnv::createTransient
virtual LArShapeTransType2 * createTransient(const Token *token)
method to be implemented by the developer.
Definition
LArShapeCompleteCnv.cxx:46
LArShapeCompleteCnv::createPersistent
virtual LArShapePersType2 * createPersistent(LArShapeTransType2 *transObj)
method to be implemented by the developer.
Definition
LArShapeCompleteCnv.cxx:36
LArShapeCopy
Definition
LArShapeCompleteCnv.h:40
LArShapeCopy::copyOldtoNew
void copyOldtoNew(const LArConditionsSubset< LArShapeP > *oldShape, LArConditionsSubset< LArShapeP1 > *newShape)
Definition
LArShapeCompleteCnv.cxx:85
LArShapeP1
c-struct reproducing the structure of the persistent data
Definition
LArShapeP1.h:16
LArShapeP
c-struct reproducing the structure of the persistent data
Definition
LArShapeP.h:16
LArShapeP::m_vShapeDer
std::vector< double > m_vShapeDer
Definition
LArShapeP.h:22
LArShapeP::m_vShape
std::vector< double > m_vShape
Definition
LArShapeP.h:21
LArShapeSubsetCnv_p1
Definition
LArShapeSubsetCnv_p1.h:20
LArShapeSubsetCnv_p2
Definition
LArShapeSubsetCnv_p2.h:20
LArShapeSubset_p2
persistent class container of LArConditionsSubset for LArShape data.
Definition
LArShapeSubset_p2.h:30
T_AthenaPoolCoolMultChanCnv< LArShapeComplete, LArShapeTransType2, LArShapePersType2 >::poolReadObject
P * poolReadObject(const Token *token)
T_AthenaPoolCoolMultChanCnv< LArShapeComplete, LArShapeTransType2, LArShapePersType2 >::compareClassGuid
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition
Token.h:22
pool::Guid
::Guid Guid
Definition
T_AthenaPoolCustCnv.h:19
Generated on
for ATLAS Offline Software by
1.17.0