ATLAS Offline Software
TrigSerializeGuidHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 #include "StorageSvc/DbReflex.h"
10 
11 
12 TrigSerializeGuidHelper::TrigSerializeGuidHelper(const std::string& name, const std::string& type,
13  const IInterface* parent) :
15 {
16  declareInterface<ITrigSerializeGuidHelper>( this );
17 
18 }
19 
21 
22 }
23 
25  std::string remapToDictName(const std::string &s);
26 }
27 
29  iarr[0] = iarr[1] = iarr[2] = iarr[3] = 0;
30 
31  std::string cl = TrigSerializeResult::remapToDictName(clname);
32 
34  RootPropertyList pl = t.Properties();
35  if (pl.HasProperty("ClassID")){
36  std::string gecko = pl.PropertyAsString("ClassID");
37  ATH_MSG_DEBUG( clname << " to ROOT known as " << cl << " has " << "ClassID=" << gecko );
38 
39  const Guid guid(gecko );
40  iarr[0] = guid.data1();
41  iarr[1] = guid.data2() << 16 | guid.data3();
42  iarr[2] = guid.data4(0) << 24 | guid.data4(1) << 16 | guid.data4(2) << 8 | guid.data4(3);
43  iarr[3] = guid.data4(4) << 24 | guid.data4(5) << 16 | guid.data4(6) << 8 | guid.data4(7);
44  }
45  else{
46  ATH_MSG_WARNING( "property list has no ClassID for class name " << clname << " aka (" << cl << ")" );
47  return StatusCode::FAILURE;
48  }
49 
50  return StatusCode::SUCCESS;
51 }
52 
54 
55  Guid guid;
56  guid.setData1(iarr[0]);
57  guid.setData2(iarr[1] >> 16);
58  guid.setData3(iarr[1] & 0xFFFF);
59  guid.setData4(iarr[2] >> 24, 0);
60  guid.setData4(iarr[2] >> 16, 1);
61  guid.setData4(iarr[2] >> 8, 2);
62  guid.setData4(iarr[2] & 0xFF, 3);
63  guid.setData4(iarr[3] >> 24, 4);
64  guid.setData4(iarr[3] >> 16, 5);
65  guid.setData4(iarr[3] >> 8, 6);
66  guid.setData4(iarr[3] & 0xFF, 7);
67 
68  ATH_MSG_DEBUG( "constructed " << guid.toString() << " from ints" );
69 
70  if( clname != "" ) {
71  // Instead of getting a typename for a known guid (quite costly in ROOT6)
72  // and comparing names,
73  // get a class by name and compare guids
74  Guid g( pool::DbReflex::guid( RootType(clname) ) );
75  if( g != guid ) {
76  // the typename was wrong, will need to look it up by GUID
77  clname = "";
78  }
79  }
80 
81  if( clname == "" ) {
83  clname = cltype.Name(Reflex::SCOPED);
84  }
85 
86  ATH_MSG_DEBUG( "corresponds to " << clname );
87 
88  if (clname.empty()){
89  return StatusCode::FAILURE;
90  }
91 
92  return StatusCode::SUCCESS;
93 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TScopeAdapter::ByNameNoQuiet
static TScopeAdapter ByNameNoQuiet(const std::string &name, Bool_t load=kTRUE)
Definition: RootType.cxx:581
DbReflex.h
TPropertyListAdapter::HasProperty
Bool_t HasProperty(const std::string &key) const
Definition: RootType.cxx:74
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
pool::DbReflex::forGuid
static const TypeH forGuid(const Guid &info)
Access classes by Guid.
TrigSerializeGuidHelper::ClassNameToInts
StatusCode ClassNameToInts(const std::string &clname, uint32_t *iarr)
Definition: TrigSerializeGuidHelper.cxx:28
RootType
TTypeAdapter RootType
Definition: RootType.h:211
TrigSerializeGuidHelper::~TrigSerializeGuidHelper
virtual ~TrigSerializeGuidHelper()
Definition: TrigSerializeGuidHelper.cxx:20
Reflex::SCOPED
@ SCOPED
Definition: RootType.h:27
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigSerializeResult::remapToDictName
std::string remapToDictName(const std::string &s)
Definition: SerializeCommon.cxx:31
TScopeAdapter::Name
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition: RootType.cxx:607
TrigSerializeGuidHelper::IntsToClassName
StatusCode IntsToClassName(const uint32_t *iarr, std::string &clname)
Definition: TrigSerializeGuidHelper.cxx:53
pool_uuid.guid
guid
Definition: pool_uuid.py:112
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TPropertyListAdapter
Definition: RootType.h:37
TrigSerializeGuidHelper.h
TPropertyListAdapter::PropertyAsString
std::string PropertyAsString(const std::string &key) const
Definition: RootType.cxx:83
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigSerializeResult
Definition: TrigSerializeGuidHelper.cxx:24
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RootType.h
Guid.h
This file contains the class definition for the Guid class (migrated from POOL).
AthAlgTool
Definition: AthAlgTool.h:26
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
TrigSerializeGuidHelper::TrigSerializeGuidHelper
TrigSerializeGuidHelper(const std::string &name, const std::string &type, const IInterface *parent)
Definition: TrigSerializeGuidHelper.cxx:12
TScopeAdapter
Definition: RootType.h:119
pool::DbReflex::guid
static Guid guid(const TypeH &id)
Determine Guid (normalized string form) from reflection type.