Skip to content

Commit 42f8fc2

Browse files
committed
Moved GlobalObjectMapRecord back to global namespace
This type is stored in the RAW data format so must remain in the global namespace to allow reading old files.
1 parent 6f74ae3 commit 42f8fc2

3 files changed

Lines changed: 78 additions & 65 deletions

File tree

DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h

Lines changed: 49 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -25,60 +25,53 @@
2525

2626
// forward declarations
2727

28-
namespace io_v1 {
29-
// class declaration
30-
class GlobalObjectMapRecord {
31-
public:
32-
/// constructor(s)
33-
GlobalObjectMapRecord() {}
34-
35-
/// destructor
36-
~GlobalObjectMapRecord() {}
37-
38-
void swap(GlobalObjectMapRecord& rh) { m_gtObjectMap.swap(rh.m_gtObjectMap); }
39-
40-
public:
41-
/// return the object map for the algorithm algoNameVal
42-
const GlobalObjectMap* getObjectMap(const std::string& algoNameVal) const;
43-
44-
/// return the object map for the algorithm with bit number const int algoBitNumberVal
45-
const GlobalObjectMap* getObjectMap(const int algoBitNumberVal) const;
46-
47-
/// return all the combinations passing the requirements imposed in condition condNameVal
48-
/// from algorithm with name algoNameVal
49-
const CombinationsWithBxInCond* getCombinationsInCond(const std::string& algoNameVal,
50-
const std::string& condNameVal) const;
51-
52-
/// return all the combinations passing the requirements imposed in condition condNameVal
53-
/// from algorithm with bit number algoBitNumberVal
54-
const CombinationsWithBxInCond* getCombinationsInCond(const int algoBitNumberVal,
55-
const std::string& condNameVal) const;
56-
57-
/// return the result for the condition condNameVal
58-
/// from algorithm with name algoNameVal
59-
bool getConditionResult(const std::string& algoNameVal, const std::string& condNameVal) const;
60-
61-
/// return the result for the condition condNameVal
62-
/// from algorithm with bit number algoBitNumberVal
63-
bool getConditionResult(const int algoBitNumberVal, const std::string& condNameVal) const;
64-
65-
public:
66-
/// get / set the vector of object maps
67-
inline const std::vector<GlobalObjectMap>& gtObjectMap() const { return m_gtObjectMap; }
68-
69-
inline void setGtObjectMap(const std::vector<GlobalObjectMap>& gtObjectMapValue) {
70-
m_gtObjectMap = gtObjectMapValue;
71-
}
72-
73-
inline void swapGtObjectMap(std::vector<GlobalObjectMap>& gtObjectMapValue) {
74-
m_gtObjectMap.swap(gtObjectMapValue);
75-
}
76-
77-
private:
78-
std::vector<GlobalObjectMap> m_gtObjectMap;
79-
};
80-
81-
inline void swap(GlobalObjectMapRecord& lh, GlobalObjectMapRecord& rh) { lh.swap(rh); }
82-
} // namespace io_v1
83-
using GlobalObjectMapRecord = io_v1::GlobalObjectMapRecord;
28+
// class declaration
29+
class GlobalObjectMapRecord {
30+
public:
31+
/// constructor(s)
32+
GlobalObjectMapRecord() {}
33+
34+
/// destructor
35+
~GlobalObjectMapRecord() {}
36+
37+
void swap(GlobalObjectMapRecord& rh) { m_gtObjectMap.swap(rh.m_gtObjectMap); }
38+
39+
public:
40+
/// return the object map for the algorithm algoNameVal
41+
const GlobalObjectMap* getObjectMap(const std::string& algoNameVal) const;
42+
43+
/// return the object map for the algorithm with bit number const int algoBitNumberVal
44+
const GlobalObjectMap* getObjectMap(const int algoBitNumberVal) const;
45+
46+
/// return all the combinations passing the requirements imposed in condition condNameVal
47+
/// from algorithm with name algoNameVal
48+
const CombinationsWithBxInCond* getCombinationsInCond(const std::string& algoNameVal,
49+
const std::string& condNameVal) const;
50+
51+
/// return all the combinations passing the requirements imposed in condition condNameVal
52+
/// from algorithm with bit number algoBitNumberVal
53+
const CombinationsWithBxInCond* getCombinationsInCond(const int algoBitNumberVal,
54+
const std::string& condNameVal) const;
55+
56+
/// return the result for the condition condNameVal
57+
/// from algorithm with name algoNameVal
58+
bool getConditionResult(const std::string& algoNameVal, const std::string& condNameVal) const;
59+
60+
/// return the result for the condition condNameVal
61+
/// from algorithm with bit number algoBitNumberVal
62+
bool getConditionResult(const int algoBitNumberVal, const std::string& condNameVal) const;
63+
64+
public:
65+
/// get / set the vector of object maps
66+
inline const std::vector<GlobalObjectMap>& gtObjectMap() const { return m_gtObjectMap; }
67+
68+
inline void setGtObjectMap(const std::vector<GlobalObjectMap>& gtObjectMapValue) { m_gtObjectMap = gtObjectMapValue; }
69+
70+
inline void swapGtObjectMap(std::vector<GlobalObjectMap>& gtObjectMapValue) { m_gtObjectMap.swap(gtObjectMapValue); }
71+
72+
private:
73+
std::vector<GlobalObjectMap> m_gtObjectMap;
74+
};
75+
76+
inline void swap(GlobalObjectMapRecord& lh, GlobalObjectMapRecord& rh) { lh.swap(rh); }
8477
#endif
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef DataFormats_L1TGlobal_GlobalObjectMapRecordFwd_h
22
#define DataFormats_L1TGlobal_GlobalObjectMapRecordFwd_h
33

4-
namespace io_v1 {
5-
class GlobalObjectMapRecord;
6-
}
7-
using GlobalObjectMapRecord = io_v1::GlobalObjectMapRecord;
4+
class GlobalObjectMapRecord;
5+
86
#endif

DataFormats/L1TGlobal/src/classes_def.xml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,39 @@
2020
<class name="edm::Wrapper<AXOL1TLScoreBxCollection>"/>
2121
<class name="std::vector<AXOL1TLScore>"/>
2222

23-
<class name="io_v1::GlobalObjectMapRecord" ClassVersion="3">
24-
<version ClassVersion="3" checksum="1021045974"/>
23+
<class name="GlobalObjectMapRecord" ClassVersion="10">
24+
<version ClassVersion="10" checksum="1219328086"/>
2525
</class>
26-
<class name="edm::Wrapper<io_v1::GlobalObjectMapRecord>"/>
26+
<class name="edm::Wrapper<GlobalObjectMapRecord>"/>
2727

28-
<class name="GlobalObjectMap" ClassVersion="3">
29-
<version ClassVersion="3" checksum="760424007"/>
28+
<class name="GlobalObjectMap" ClassVersion="11">
29+
<version ClassVersion="11" checksum="760424007"/>
30+
<version ClassVersion="10" checksum="1899280385"/>
3031
</class>
3132
<class name="edm::Wrapper<GlobalObjectMap>"/>
3233
<class name="std::vector<GlobalObjectMap>"/>
3334
<class name="edm::Wrapper<std::vector<GlobalObjectMap> >"/>
35+
<!-- Adding ioread rules for backwards compatibility -->
36+
<ioread sourceClass="GlobalObjectMap" version="[3-10]"
37+
source="std::vector<std::vector<std::vector<L1TObjIndexType>>> m_combinationVector;"
38+
targetClass="GlobalObjectMap" target="m_combinationWithBxVector">
39+
<![CDATA[
40+
m_combinationWithBxVector.clear();
41+
m_combinationWithBxVector.reserve(onfile.m_combinationVector.size());
42+
for(auto const& a0 : onfile.m_combinationVector) {
43+
CombinationsWithBxInCond b0;
44+
b0.reserve(a0.size());
45+
for(auto const& a1 : a0) {
46+
SingleCombWithBxInCond b1;
47+
b1.reserve(a1.size());
48+
for(auto const a2 : a1) {
49+
b1.emplace_back(0, a2);
50+
}
51+
b0.emplace_back(b1);
52+
}
53+
m_combinationWithBxVector.emplace_back(b0);
54+
}]]>
55+
</ioread>
3456

3557
<class name="std::vector<l1t::GlobalObject>"/>
3658
<class name="std::vector<std::vector<l1t::GlobalObject> >"/>

0 commit comments

Comments
 (0)