ATLAS Offline Software
Loading...
Searching...
No Matches
LArShape32MCCnv.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 "LArShape32MCCnv.h"
13#include "LArShapeCompleteCnv.h"
14#include <cmath>
15#include <limits>
16
18
19#if 0
20namespace {
21
23inline
24float toFloat (double x)
25{
26 if (std::abs (x) > std::numeric_limits<float>::max()) {
27 if (x > 0)
28 return std::numeric_limits<float>::max();
29 else
30 return - std::numeric_limits<float>::max();
31 }
32 return x;
33}
34
35} // anonymous namespace
36#endif
37
40{
41 MsgStream log(msgSvc(), "LArShape32MCCnv" );
42 //log << MSG::DEBUG << "LArShape32MC write" << endmsg;
43 LArShapePersType* persObj = TPconverter.createPersistentConst( transObj, log );
44 //log << MSG::DEBUG << "Success" << endmsg;
45 return persObj;
46}
47
50{
51 static const pool::Guid p1_guid("95B61750-4C45-412D-B4D4-9758E9DB40D1");
52 static const pool::Guid p0_guid("055CF2F5-08D0-4EAA-B154-8CE5B1A599E7");
53 MsgStream log(msgSvc(), "LArShape32MCCnv" );
54 if( compareClassGuid(p1_guid) ) {
55 // using unique_ptr ensures deletion of the persistent object
56 std::unique_ptr< LArShapeSubset_p1 > col_vect( poolReadObject< LArShapeSubset_p1 >() );
57 //
58 log << MSG::DEBUG << "Reading LArShapeSubset_p1" << endmsg;
59 return TPconverter.createTransientConst( col_vect.get(), log );
60 }
61 else if( compareClassGuid(p0_guid) ) {
62 // subset from before TP separation
63 log << MSG::DEBUG << "Reading LArShapeSubset (original)" << endmsg;
64
65 std::unique_ptr< LArConditionsSubset<LArShapeP> > subset ( poolReadObject< LArConditionsSubset<LArShapeP> >() );
66 // Here we must convert from LArShapeP to LArShapeP1
67
68 log << MSG::VERBOSE << "subset ptr " << subset.get() << endmsg;
69
70 return (createTransient(subset.get()));
71
72 }
73 throw std::runtime_error("Unsupported persistent version of LArShape32MCCnv");
74}
75
78{
79
80 //MsgStream log(msgSvc(), "LArShapeMCCnv" );
81 //log << MSG::DEBUG << "LArShapeMCCnv::createTransient orig " << orig << endmsg;
82
84
85 // Copy LArShapeP subset to LArShapeP1
86 LArShapeCopy copier;
87 copier.copyOldtoNew(orig, result);
88
89 return (result);
90}
91
#define endmsg
static const LArAutoCorrSubsetCnv_p1 TPconverter
AthenaPool converter LArShape32MC.
LArShapeSubset_p1 LArShapePersType
LArConditionsSubset< LArShapeP1 > LArShapeTransType
AthenaPool converter LArShapeComplete.
#define x
template class for use for I/O of conditions data
virtual LArShapePersType * createPersistent(LArShapeTransType *transObj)
method to be implemented by the developer.
virtual LArShapeTransType * createTransient()
method to be implemented by the developer.
void copyOldtoNew(const LArConditionsSubset< LArShapeP > *oldShape, LArConditionsSubset< LArShapeP1 > *newShape)
persistent class container of LArConditionsSubset for LArShape data.