ATLAS Offline Software
MissingETCnv.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: MissingETCnv.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 "MissingETCnv.h"
21 
24 {
25  MsgStream msg( msgSvc(), "MissingETCnv" );
26 
27  MissingETCnv_p3 cnv;
28  MissingET_PERS *persObj = cnv.createPersistent( transCont, msg );
29 
30  msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
31  return persObj;
32 }
33 
35 {
36  MsgStream msg( msgSvc(), "MissingETCnv" );
37 
38  MissingET *transObj = 0;
39 
40  static const pool::Guid tr_guid("14E6F88E-BA7F-4241-BF3D-99DE583B4709");
41  static const pool::Guid p1_guid("C0D9AEE8-A2B0-4EED-BD75-53D67DF9736F");
42  static const pool::Guid p2_guid("2D9729C7-646D-4BF5-B404-380AE2D9D308");
43  static const pool::Guid p3_guid("AD744C55-6CA6-4D44-8E2F-C47FF3CE980E");
44 
45  if ( compareClassGuid(tr_guid) ) { // regular object from before the T/P separation
46  return poolReadObject<MissingET>();
47  } else if ( compareClassGuid(p1_guid) ) {
48  // using unique_ptr ensures deletion of the persistent object
49  std::unique_ptr<MissingET_p1> persObj( poolReadObject<MissingET_p1>() );
50  MissingETCnv_p1 cnv;
51  transObj = cnv.createTransient( persObj.get(), msg );
52  } else if ( compareClassGuid(p2_guid) ) {
53  std::unique_ptr<MissingET_p2> persObj( poolReadObject<MissingET_p2>() );
54  MissingETCnv_p2 cnv;
55  transObj = cnv.createTransient( persObj.get(), msg );
56  } else if ( compareClassGuid(p3_guid) ) {
57  std::unique_ptr<MissingET_p3> persObj( poolReadObject<MissingET_p3>() );
58  MissingETCnv_p3 cnv;
59  transObj = cnv.createTransient( persObj.get(), msg );
60  } else {
61  throw std::runtime_error("Unsupported persistent version of MissingET");
62  }
63 
64  return transObj;
65 }
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
MissingETCnv_p2
Definition: MissingETCnv_p2.h:24
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
MissingETCnv::createPersistent
virtual MissingET_PERS * createPersistent(MissingET *transCont)
Build the persistent representation from the transient one.
Definition: MissingETCnv.cxx:23
MissingETCnv::createTransient
virtual MissingET * createTransient()
Build the transient representation from a persistent one.
Definition: MissingETCnv.cxx:34
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MissingETCnv_p3.h
MissingETCnv_p1.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MissingET_p3
Definition: MissingET_p3.h:18
MissingET
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:23
DEBUG
#define DEBUG
Definition: page_access.h:11
MissingETCnv_p2.h
T_AthenaPoolCustCnv< MissingET, MissingET_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
MissingETCnv_p1
Definition: MissingETCnv_p1.h:26
MissingETCnv_p3
Definition: MissingETCnv_p3.h:22
MissingETCnv.h