ATLAS Offline Software
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 
11 #include "LArShape32MCCnv.h"
13 #include "LArShapeCompleteCnv.h"
14 #include <cmath>
15 #include <limits>
16 
17 static const LArShapeSubsetCnv_p1 TPconverter;
18 
19 #if 0
20 namespace {
21 
23 inline
24 float toFloat (double x)
25 {
26  if (std::abs (x) > std::numeric_limits<float>::max()) {
27  if (x > 0)
29  else
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 
LArShape32MCCnv::createTransient
virtual LArShapeTransType * createTransient()
method to be implemented by the developer.
Definition: LArShape32MCCnv.cxx:49
LArShapeSubsetCnv_p1
Definition: LArShapeSubsetCnv_p1.h:20
get_generator_info.result
result
Definition: get_generator_info.py:21
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
LArShapeSubset_p1
persistent class container of LArConditionsSubset for LArShape data.
Definition: LArShapeSubset_p1.h:30
x
#define x
LArShapeSubsetCnv_p1.h
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
LArShape32MCCnv::createPersistent
virtual LArShapePersType * createPersistent(LArShapeTransType *transObj)
Definition: LArShape32MCCnv.cxx:39
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TPConverterConstBase::createPersistentConst
virtual PERS * createPersistentConst(const TRANS *transObj, MsgStream &log) const
T_AthenaPoolCoolMultChanCnv::poolReadObject
P * poolReadObject()
Read object of type P.
LArShapeCopy
Definition: LArShapeCompleteCnv.h:40
LArShapeCompleteCnv.h
AthenaPool converter LArShapeComplete.
LArConditionsSubset
template class for use for I/O of conditions data
Definition: LArConditionsSubset.h:122
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
T_AthenaPoolCustCnv< COLL_T, ELEM_T >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
LArShapeCopy::copyOldtoNew
void copyOldtoNew(const LArConditionsSubset< LArShapeP > *oldShape, LArConditionsSubset< LArShapeP1 > *newShape)
Definition: LArShapeCompleteCnv.cxx:85
TPConverterConstBase::createTransientConst
virtual TRANS * createTransientConst(const PERS *persObj, MsgStream &log) const
LArShape32MCCnv.h
AthenaPool converter LArShape32MC.