DataFormats
Common
src
setIsMergeable.cc
Go to the documentation of this file.
1
2
#include "
DataFormats/Common/interface/setIsMergeable.h
"
3
4
#include "
DataFormats/Common/interface/WrapperBase.h
"
5
#include "
DataFormats/Provenance/interface/BranchDescription.h
"
6
#include "
FWCore/Utilities/interface/BranchType.h
"
7
#include "
FWCore/Utilities/interface/getAnyPtr.h
"
8
9
#include "TClass.h"
10
11
#include <memory>
12
13
namespace
edm
{
14
15
void
setIsMergeable
(
BranchDescription
& desc) {
16
// Save some time here with the knowledge that the isMergeable
17
// data member can only be true for run or lumi products.
18
// It defaults to false. Also if it is true that means it
19
// was already set.
20
if
(desc.
branchType
() ==
InRun
|| desc.
branchType
() ==
InLumi
) {
21
if
(!desc.
isMergeable
()) {
22
TClass* wrapperBaseTClass =
TypeWithDict::byName
(
"edm::WrapperBase"
).
getClass
();
23
TClass* tClass = desc.
wrappedType
().
getClass
();
24
void
*
p
= tClass->New();
25
int
offset
= tClass->GetBaseClassOffset(wrapperBaseTClass);
26
std::unique_ptr<WrapperBase> wrapperBase = getAnyPtr<WrapperBase>(
p
,
offset
);
27
if
(wrapperBase->isMergeable()) {
28
desc.
setIsMergeable
(
true
);
29
}
30
}
31
}
32
}
33
}
// namespace edm
edm::TypeWithDict::byName
static TypeWithDict byName(std::string const &name)
Definition:
TypeWithDict.cc:74
BranchType.h
edm::setIsMergeable
void setIsMergeable(BranchDescription &)
Definition:
setIsMergeable.cc:15
edm
HLT enums.
Definition:
AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
edm::BranchDescription::wrappedType
TypeWithDict const & wrappedType() const
Definition:
BranchDescription.h:92
edm::InRun
Definition:
BranchType.h:11
getAnyPtr.h
WrapperBase.h
BranchDescription.h
edm::BranchDescription::isMergeable
bool isMergeable() const
Definition:
BranchDescription.h:125
edm::InLumi
Definition:
BranchType.h:11
edm::BranchDescription::branchType
BranchType const & branchType() const
Definition:
BranchDescription.h:121
edm::TypeWithDict::getClass
TClass * getClass() const
Definition:
TypeWithDict.cc:380
setIsMergeable.h
edm::BranchDescription::setIsMergeable
void setIsMergeable(bool v)
Definition:
BranchDescription.h:126
edm::BranchDescription
Definition:
BranchDescription.h:32
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:78
Generated for CMSSW Reference Manual by
1.8.16