ATLAS Offline Software
Loading...
Searching...
No Matches
JetCollectionCnv_p5.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
7// JetCollectionCnv_p5.cxx
8// Implementation file for class JetCollectionCnv_p5
9// Author: S.Binet<binet@cern.ch>
11
12// DataModel includes
14
15// JetEvent includes
16#include "JetEvent/Jet.h"
18
19
20// JetEventTPCnv includes
25
26// DataModelAthenaPool includes
28
29// preallocate converters
30static const JetCnv_p5 jetCnv;
32
33
34void
36 JetCollection* trans,
37 MsgStream& msg ) const
38{
39 msg << MSG::DEBUG << "Loading JetCollection from persistent state..."
40 << endmsg;
41
42 // make sure to first read the JetKeyDescriptor
44 JetKeyStoreCnv.persToTrans( &pers->m_keyStore, &trans->m_keyStore, msg );
45 // link the JetKeyDescriptorInstance to the store:
46 if( trans->m_keyStore.isValid() ){
47 trans->keyDesc()->m_Stores = nullptr;
48 trans->keyDesc()->m_ConstStores = trans->m_keyStore.cptr();
49 // make sure the global instance is pointing to this jetkey store
52 }
53 else if (trans->m_keyStore.isDefault()) {
54 DataLink<JetKeyDescriptor> dl ("JetKeyMap");
55 if (dl.isValid()) {
56 trans->keyDesc()->m_Stores = nullptr;
57 trans->keyDesc()->m_ConstStores = dl.cptr();
58 // make sure the global instance is pointing to this jetkey store
61 }
62 else {
63 trans->keyDesc()->m_Stores =
65 trans->keyDesc()->m_ConstStores =
67 }
68 }
69 else {
72 }
73
74 msg << MSG::DEBUG << "attached JetKeyDescriptor to its instance" << endmsg;
75
77
78 trans->setOrdered (static_cast<JetCollection::OrderedVar>(pers->m_ordered));
79 // not used any more ... trans->m_ROIauthor = //pers->m_roiAuthor;
80
82
83 trans->clear();
84 trans->reserve(pers->size());
85
86 for (const TPObjRef& ref : *pers) {
88
89 }
90
91 msg << MSG::DEBUG << "Loading JetCollection from persistent state [OK]"
92 << endmsg;
93}
94
95void
97 JetCollection_p5* pers,
98 MsgStream& msg ) const
99{
100// msg << MSG::DEBUG << "Creating persistent state of JetCollection..."
101// << endmsg;
102
103 pers->m_ordered = static_cast<short>(trans->ordered());
104 // not used any more ... //pers->m_roiAuthor = trans->m_ROIauthor;
105
106 pers->clear();
107 pers->reserve(trans->size());
108
109 for (const Jet* jet : *trans) {
110 pers->push_back(toPersistent((ITPConverterFor<Jet>**)nullptr, jet, msg));
111 }
112
113 // RS now deal with the JetKeyDescriptor
115 JetKeyStoreCnv.transToPers( &trans->m_keyStore, &pers->m_keyStore, msg );
116}
const boost::regex ref(r_ef)
#define endmsg
This file contains the class definition for the DataLinkCnv_p1 class and DataLinkVectorCnv_p1 class.
JetConverterBase< Jet_p5 > JetCnv_p5
Definition JetCnv_p5.h:85
static const JetCnv_p1 jetCnv
static const JetKeyDescriptorCnv_p1 jetkeyCnv
bool isDefault() const
Test to see if we're in the default state.
virtual void persToTrans(const PersDLink_t *pers, DLink_t *trans, MsgStream &log) const override
virtual void transToPers(const DLink_t *trans, PersDLink_t *pers, MsgStream &log) const override
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
size_type size() const noexcept
Returns the number of elements in the collection.
Common base class for all TP converters, specialized for a given transient type.
Definition TPConverter.h:37
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
virtual void persToTrans(const JetCollection_p5 *pers, JetCollection *trans, MsgStream &msg) const override
Method creating the transient representation of JetCollection from its persistent representation JetC...
virtual void transToPers(const JetCollection *trans, JetCollection_p5 *pers, MsgStream &msg) const override
Method creating the persistent representation JetCollection_p1 from its transient representation JetC...
DataLink_p1 m_keyStore
JetCollection::OrderedVar ordered() const
DataLink< JetKeyDescriptor > m_keyStore
link to the JetKeyDescriptor is mandatory for persistency. Access done through the JetKeyDescriptorIn...
void setOrdered(JetCollection::OrderedVar ordered)
void push_back(Jet *j)
JetKeyDescriptorInstance * keyDesc() const
const JetKeyDescriptor * m_ConstStores
JetKeyDescriptor * m_Stores
static JetKeyDescriptorInstance * instance()
This class is an object reference used in Athena persistent data model.
Definition TPObjRef.h:20
MsgStream & msg
Definition testRead.cxx:32