ATLAS Offline Software
Loading...
Searching...
No Matches
JetKeyDescriptorCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
9 JetKeyDescriptor* transObj,
10 MsgStream& msg ) const
11{
12 msg << MSG::DEBUG << "JetKeyDescriptorCnv persToTrans Begin " << endmsg;
13
14 msg << MSG::DEBUG << " Size : " << (persObj->m_catStore).size() << endmsg;
15 if(msg.level() <= MSG::VERBOSE ){
16 for ( std::vector<std::string>::const_iterator it = (persObj->m_catStore).begin();
17 it != (persObj->m_catStore).end(); ++it )
18 {
19 msg << MSG::VERBOSE << " " << *it << endmsg;
20 }
21 }
22 if( (persObj->m_keyStoreLength).size() != (persObj->m_catStore).size() )
23 {
24 msg << MSG::ERROR << "Length of KeyStore and CategoryStore do not match !"
25 << endmsg;
26 return;
27 }
28
30
31 transObj->m_keyStore.clear();
32 transObj->m_catStore.clear();
33 // if(bool( instance->m_Stores ) ) delete instance->m_Stores; // to avoid memory link
34 instance->m_Stores = transObj; // global instance points to the store being read.
35 instance->m_ConstStores = transObj;
36
37
38 unsigned int index(0);
39 for( unsigned int n = 0; n < (persObj->m_keyStoreLength).size(); n++ )
40 {
41 if(msg.level() <= MSG::VERBOSE ) msg << MSG::VERBOSE << " "
42 << (persObj->m_keyStoreLength)[n] << " "
43 << (persObj->m_catStore)[n] << endmsg;
44 // (persObj->m_keyStore).resize((persObj->m_keyStoreLength)[n]);
45 for( unsigned int m = 0; m < (persObj->m_keyStoreLength)[n]; m++ )
46 {
47 size_t index2 = instance->getIndex( (persObj->m_catStore)[n],
48 (persObj->m_keyStore)[index]);
49 if(msg.level() <= MSG::VERBOSE ) msg << MSG::VERBOSE << " "
50 << m << " "
51 << (persObj->m_keyStore)[index]
52 << " stored at index "
53 << index2
54 << endmsg;
55 index++;
56 }
57 }
58
59 // These have to exist, because some of the Jet converters try to set them.
60 // But they weren't there for some old files --- so make sure here that
61 // we know about these.
62 instance->getIndex ("JetShapes", "Timing", true);
63 instance->getIndex ("JetShapes", "LArQuality", true);
64 instance->getIndex ("JetInfo", "TrigJetRec", true);
65
66 msg << MSG::DEBUG << "JetKeyDescriptorCnv persToTrans End" << endmsg;
67}
68
69
70
72 JetKeyDescriptor_p1* persObj,
73 MsgStream& msg ) const
74{
75 msg << MSG::DEBUG << "JetKeyDescriptorCnv transToPers Begin " << endmsg;
76
77 persObj->m_keyStoreLength.resize((transObj->m_catStore).size(),0);
78 msg << MSG::DEBUG << " Size : " << (transObj->m_catStore).size()
79 << endmsg;
80
81 for ( JetKeyDescriptor::catlist_t::const_iterator it = (transObj->m_catStore).begin();
82 it != (transObj->m_catStore).end(); ++it )
83 {
84 if(msg.level() <= MSG::VERBOSE ) msg << MSG::VERBOSE << " " << *it << endmsg;
85 persObj->m_catStore.push_back(*it);
86 }
87
88 unsigned int n(0);
89 for ( JetKeyDescriptor::storelist_t::const_iterator iti = (transObj->m_keyStore).begin();
90 iti != (transObj->m_keyStore).end(); ++iti )
91 {
92 for ( JetKeyDescriptor::keystore_t::const_iterator ito = (*iti).begin();
93 ito != (*iti).end(); ++ito )
94 {
95 if(msg.level() <= MSG::VERBOSE ) msg << MSG::VERBOSE << " " << *ito << " : " << n << endmsg;
96 persObj->m_keyStore.push_back(*ito);
97 persObj->m_keyStoreLength[n]++;
98 }
99 n++;
100 }
101 msg << MSG::DEBUG << "JetKeyDescriptorCnv transToPers End" << endmsg;
102}
103
104
105
#define endmsg
std::map< std::string, double > instance
virtual void persToTrans(const JetKeyDescriptor_p1 *persObj, JetKeyDescriptor *transObj, MsgStream &msg) const override
Method creating the transient representation of JetKeyDescriptor from its persistent representation J...
virtual void transToPers(const JetKeyDescriptor *transObj, JetKeyDescriptor_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation JetKeyDescriptor_p1 from its transient representation J...
Theses classes implement a mapping between string and index used by jets.
static JetKeyDescriptorInstance * instance()
std::vector< std::string > m_catStore
std::vector< std::string > m_keyStore
std::vector< unsigned int > m_keyStoreLength
//////////////////////////////////////////////////
storelist_t m_keyStore
Definition index.py:1
MsgStream & msg
Definition testRead.cxx:32