ATLAS Offline Software
MissingEtTruthCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 NAME: MissingEtTruthCnv.h
7 PACKAGE: offline/Reconstruction/RecAthenaPool
8 PURPOSE: Implementation file for class MissingETCnv
9 ********************************************************************/
10 
11 // Framework includes
12 #include "GaudiKernel/MsgStream.h"
13 
14 // RecTPCnv includes
18 
19 // RecAthenaPool includes
20 #include "MissingEtTruthCnv.h"
21 
22 
25 {
26  MsgStream msg( msgSvc(), "MissingEtTruthCnv" );
27 
29  MissingEtTruth_PERS *persObj = cnv.createPersistent( transCont, msg );
30 
31  msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
32  return persObj;
33 }
34 
36 {
37  MsgStream msg( msgSvc(), "MissingEtTruthCnv" );
38 
39  MissingEtTruth *transObj = 0;
40 
41  static const pool::Guid tr_guid("2147ED1C-7337-4717-900B-1B52BD8DC316");
42  static const pool::Guid p1_guid("E7D6D6B8-08A8-409E-9477-2A61467738B2");
43  static const pool::Guid p2_guid("291A1BDB-A25E-412D-8E49-EF0E1EA1A835");
44  static const pool::Guid p3_guid("3FA8CC45-8798-4C24-9D0E-22E5F11AD85F");
45 
46  if ( compareClassGuid(p3_guid)) {
47 
48  // using unique_ptr ensures deletion of the persistent object
49  std::unique_ptr<MissingEtTruth_p3> persObj( poolReadObject<MissingEtTruth_p3>() );
51  transObj = cnv.createTransient( persObj.get(), msg );
52 
53  } else if ( compareClassGuid(p2_guid)) {
54 
55  // using unique_ptr ensures deletion of the persistent object
56  std::unique_ptr<MissingEtTruth_p2> persObj( poolReadObject<MissingEtTruth_p2>() );
58  transObj = cnv.createTransient( persObj.get(), msg );
59 
60  } else if ( compareClassGuid(p1_guid)) {
61 
62  // using unique_ptr ensures deletion of the persistent object
63  std::unique_ptr<MissingEtTruth_p1> persObj( poolReadObject<MissingEtTruth_p1>() );
65  transObj = cnv.createTransient( persObj.get(), msg );
66 
67  } else if ( compareClassGuid(tr_guid) ) { // regular object from before the T/P separation
68  return poolReadObject<MissingEtTruth>();
69  } else {
70  throw std::runtime_error("Unsupported persistent version of MissingEtTruth");
71  }
72 
73  return transObj;
74 }
MissingEtTruth
Definition: MissingEtTruth.h:28
MissingEtTruth_p3
Definition: MissingEtTruth_p3.h:19
MissingEtTruthCnv.h
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
MissingEtTruthCnv_p1
Definition: MissingEtTruthCnv_p1.h:26
MissingEtTruthCnv_p3
Definition: MissingEtTruthCnv_p3.h:20
MissingEtTruthCnv::createPersistent
virtual MissingEtTruth_PERS * createPersistent(MissingEtTruth *transCont)
Build the persistent representation from the transient one.
Definition: MissingEtTruthCnv.cxx:24
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
MissingEtTruthCnv_p2
Definition: MissingEtTruthCnv_p2.h:25
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MissingEtTruthCnv_p1.h
MissingEtTruthCnv_p2.h
MissingEtTruthCnv::createTransient
virtual MissingEtTruth * createTransient()
Build the transient representation from a persistent one.
Definition: MissingEtTruthCnv.cxx:35
DEBUG
#define DEBUG
Definition: page_access.h:11
T_AthenaPoolCustCnv< MissingEtTruth, MissingEtTruth_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
MissingEtTruthCnv_p3.h