ATLAS Offline Software
McEventCollectionCnv.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // McEventCollectionCnv.cxx
8 // Implementation file for class McEventCollectionCnv
9 // Author: S.Binet<binet@cern.ch>
11 
12 // Framework includes
13 #include "GaudiKernel/MsgStream.h"
14 
15 // GeneratorObjectsTPCnv includes
23 
24 // GeneratorObjectsAthenaPool includes
25 #include "McEventCollectionCnv.h"
26 
29 {
30  MsgStream msg( msgSvc(), "McEventCollectionCnv" );
31 
33  McEventCollection_PERS *persObj = cnv.createPersistent( transCont, msg );
34 
35  msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
36  return persObj;
37 }
38 
40 {
41  MsgStream msg( msgSvc(), "McEventCollectionConverter" );
42 
43  McEventCollection *transObj = 0;
44 
45  static const pool::Guid tr_guid("6DE62B45-7C72-4539-92F2-3A8E739A4AC3");
46  static const pool::Guid p1_guid("BF93438C-D1D3-4F1C-8850-EB690AB7C416");
47  static const pool::Guid p2_guid("851BB1D2-1964-4B0A-B83A-6BD596CFB5E2");
48  static const pool::Guid p3_guid("6FC41599-64D6-4DB9-973E-9493166F6291");
49  static const pool::Guid p4_guid("C517102A-94DE-407C-B07F-09BD81F6172E");
50  static const pool::Guid p5_guid("D52391A4-F951-46BF-A0D5-E407698D2917");
51  static const pool::Guid p6_guid("6B78A751-B31A-4597-BFB6-DDCE62646CF9");
52  static const pool::Guid p7_guid("A3A04C74-A278-4E35-ACF8-4C6B8C32FC56");
53  // Hook to disable datapool if we are doing pileup
54  bool isPileup(false);
55  if(serviceLocator()->existsService("PileUpEventLoopMgr")) {
56  isPileup=true;
57  msg << MSG::DEBUG << "Pile run, disable datapool for McEventCollection " << endmsg;
58  }
59 
60  if ( compareClassGuid(tr_guid) ) {
61 
62  // regular object from before the T/P separation
63  return poolReadObject<McEventCollection>();
64 
65  } else if ( compareClassGuid(p1_guid) ) {
66 
67  std::unique_ptr<McEventCollection_p1> persObj( poolReadObject<McEventCollection_p1>() );
69  transObj = cnv.createTransient( persObj.get(), msg );
70  } else if ( compareClassGuid(p2_guid) ) {
71 
72  std::unique_ptr<McEventCollection_p2> persObj( poolReadObject<McEventCollection_p2>() );
74  transObj = cnv.createTransient( persObj.get(), msg );
75  } else if ( compareClassGuid(p3_guid) ) {
76 
77  std::unique_ptr<McEventCollection_p3> persObj( poolReadObject<McEventCollection_p3>() );
79  transObj = cnv.createTransient( persObj.get(), msg );
80  } else if ( compareClassGuid(p4_guid) ) {
81 
82  std::unique_ptr<McEventCollection_p4> persObj( poolReadObject<McEventCollection_p4>() );
84  if(isPileup) cnv.setPileup();
85  transObj = cnv.createTransient( persObj.get(), msg );
86  } else if ( compareClassGuid(p5_guid) ) {
87 
88  std::unique_ptr<McEventCollection_p5> persObj( poolReadObject<McEventCollection_p5>() );
90  if(isPileup) cnv.setPileup();
91  transObj = cnv.createTransient( persObj.get(), msg );
92  } else if ( compareClassGuid(p6_guid) ) {
93 
94  std::unique_ptr<McEventCollection_p6> persObj( poolReadObject<McEventCollection_p6>() );
96  if(isPileup) cnv.setPileup();
97  transObj = cnv.createTransient( persObj.get(), msg );
98  } else if ( compareClassGuid(p7_guid) ) {
99 
100  std::unique_ptr<McEventCollection_p7> persObj( poolReadObject<McEventCollection_p7>() );
102  if(isPileup) cnv.setPileup();
103  transObj = cnv.createTransient( persObj.get(), msg );
104  } else {
105  throw std::runtime_error("Unsupported persistent version of McEventCollection");
106  }
107 
108  return transObj;
109 }
McEventCollectionCnv_p3
Definition: McEventCollectionCnv_p3.h:47
McEventCollection_p6
Definition: McEventCollection_p6.h:27
McEventCollectionCnv_p1
Definition: McEventCollectionCnv_p1.h:43
McEventCollectionCnv_p7::setPileup
void setPileup()
Definition: McEventCollectionCnv_p7.cxx:968
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
McEventCollectionCnv_p6
Definition: McEventCollectionCnv_p6.h:58
McEventCollectionCnv::createTransient
virtual McEventCollection * createTransient()
Build the transient representation from a persistent one.
Definition: McEventCollectionCnv.cxx:39
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
McEventCollectionCnv.h
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
McEventCollectionCnv_p5::setPileup
void setPileup()
Definition: McEventCollectionCnv_p5.cxx:920
McEventCollectionCnv_p4::setPileup
void setPileup()
Definition: McEventCollectionCnv_p4.cxx:736
McEventCollectionCnv_p5
Definition: McEventCollectionCnv_p5.h:51
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
McEventCollectionCnv_p6.h
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
McEventCollectionCnv_p3.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
McEventCollectionCnv_p5.h
McEventCollectionCnv_p7.h
McEventCollectionCnv_p4.h
InDet::TrkOrigin::isPileup
bool isPileup(int origin)
from pileup
Definition: InDetTrackTruthOriginDefs.h:49
McEventCollectionCnv_p6::setPileup
void setPileup()
Definition: McEventCollectionCnv_p6.cxx:967
McEventCollectionCnv_p4
Definition: McEventCollectionCnv_p4.h:50
DEBUG
#define DEBUG
Definition: page_access.h:11
McEventCollectionCnv_p2
Definition: McEventCollectionCnv_p2.h:48
McEventCollectionCnv::createPersistent
virtual McEventCollection_PERS * createPersistent(McEventCollection *transCont)
Build the persistent representation from the transient one.
Definition: McEventCollectionCnv.cxx:28
McEventCollectionCnv_p2.h
McEventCollectionCnv_p7
Definition: McEventCollectionCnv_p7.h:58
T_AthenaPoolCustCnv< McEventCollection, McEventCollection_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
McEventCollectionCnv_p1.h