GeneratorInterface
LHEInterface
plugins
LHEProvenanceHelper.cc
Go to the documentation of this file.
1
#include <string>
2
#include <vector>
3
#include "
GeneratorInterface/LHEInterface/plugins/LHEProvenanceHelper.h
"
4
#include "
GeneratorInterface/LHEInterface/interface/LHERunInfo.h
"
5
6
#include "
DataFormats/Provenance/interface/ProcessHistory.h
"
7
#include "
DataFormats/Provenance/interface/ProcessHistoryRegistry.h
"
8
#include "
DataFormats/Provenance/interface/ProductRegistry.h
"
9
#include "
SimDataFormats/GeneratorProducts/interface/LesHouches.h
"
10
11
#include "
FWCore/Utilities/interface/GetPassID.h
"
12
13
#include "
FWCore/Utilities/interface/TypeID.h
"
14
#include "
FWCore/Reflection/interface/TypeWithDict.h
"
15
#include "
FWCore/Version/interface/GetReleaseVersion.h
"
16
17
namespace
edm
{
18
LHEProvenanceHelper::LHEProvenanceHelper
(
TypeID
const
& eventProductType,
19
TypeID
const
& runProductType,
20
ProductRegistry
& productRegistry)
21
: eventProductBranchDescription_(
BranchDescription
(
InEvent
,
22
"source"
,
23
"LHEFile"
24
// , "LHE"
25
,
26
"LHEEventProduct"
,
27
"LHEEventProduct"
,
28
""
,
29
"LHESource"
,
30
ParameterSetID
(),
31
TypeWithDict
(eventProductType.typeInfo()),
32
false
)),
33
runProductBranchDescription_(
BranchDescription
(
InRun
,
34
"source"
,
35
"LHEFile"
36
// , "LHE"
37
,
38
"LHERunInfoProduct"
,
39
"LHERunInfoProduct"
,
40
""
,
41
"LHESource"
,
42
ParameterSetID
(),
43
TypeWithDict
(runProductType.typeInfo()),
44
false
)),
45
eventProductProvenance_(eventProductBranchDescription_.branchID()),
46
commonProcessParameterSet_(fillCommonProcessParameterSet()),
47
processParameterSet_() {
48
// Add the products to the product registry
49
auto
ep
=
eventProductBranchDescription_
;
50
ep
.setIsProvenanceSetOnRead();
51
productRegistry.
copyProduct
(
ep
);
52
auto
rp =
runProductBranchDescription_
;
53
rp.
setIsProvenanceSetOnRead
();
54
productRegistry.
copyProduct
(rp);
55
}
56
57
ParameterSet
LHEProvenanceHelper::fillCommonProcessParameterSet
() {
58
// We create a process parameter set for the "LHC" process.
59
// This function only fills parameters whose values are independent of the LHE input files.
60
// We don't currently use the untracked parameters, However, we make them available, just in case.
61
ParameterSet
pset
;
62
std::string
const
&
moduleLabel
=
eventProductBranchDescription_
.
moduleLabel
();
63
std::string
const
&
processName
=
eventProductBranchDescription_
.
processName
();
64
std::string
const
&
moduleName
=
eventProductBranchDescription_
.
moduleName
();
65
typedef
std::vector<std::string>
vstring
;
66
vstring
empty
;
67
68
vstring
modlbl;
69
modlbl.reserve(1);
70
modlbl.push_back(
moduleLabel
);
71
pset
.addParameter(
"@all_sources"
, modlbl);
72
73
ParameterSet
triggerPaths
;
74
triggerPaths
.addParameter<
vstring
>(
"@trigger_paths"
,
empty
);
75
pset
.addParameter<
ParameterSet
>(
"@trigger_paths"
,
triggerPaths
);
76
77
ParameterSet
pseudoInput;
78
pseudoInput.
addParameter
<
std::string
>(
"@module_edm_type"
,
"Source"
);
79
pseudoInput.addParameter<
std::string
>(
"@module_label"
,
moduleLabel
);
80
pseudoInput.addParameter<
std::string
>(
"@module_type"
,
moduleName
);
81
pset
.addParameter<
ParameterSet
>(
moduleLabel
, pseudoInput);
82
83
pset
.addParameter<
vstring
>(
"@all_esmodules"
,
empty
);
84
pset
.addParameter<
vstring
>(
"@all_esprefers"
,
empty
);
85
pset
.addParameter<
vstring
>(
"@all_essources"
,
empty
);
86
pset
.addParameter<
vstring
>(
"@all_loopers"
,
empty
);
87
pset
.addParameter<
vstring
>(
"@all_modules"
,
empty
);
88
pset
.addParameter<
vstring
>(
"@end_paths"
,
empty
);
89
pset
.addParameter<
vstring
>(
"@paths"
,
empty
);
90
pset
.addParameter<
std::string
>(
"@process_name"
,
processName
);
91
return
pset
;
92
}
93
94
void
LHEProvenanceHelper::lheAugment
(
lhef::LHERunInfo
const
*
runInfo
) {
95
processParameterSet_
=
commonProcessParameterSet_
;
96
if
(
runInfo
==
nullptr
)
97
return
;
98
typedef
std::vector<std::string>
vstring
;
99
auto
const
& heprup = *
runInfo
->getHEPRUP();
100
processParameterSet_
.
addParameter
<
int
>(
"IDBMUP1"
, heprup.IDBMUP.first);
101
processParameterSet_
.
addParameter
<
int
>(
"IDBMUP2"
, heprup.IDBMUP.second);
102
processParameterSet_
.
addParameter
<
int
>(
"EBMUP1"
, heprup.EBMUP.first);
103
processParameterSet_
.
addParameter
<
int
>(
"EBMUP2"
, heprup.EBMUP.second);
104
processParameterSet_
.
addParameter
<
int
>(
"PDFGUP1"
, heprup.PDFGUP.first);
105
processParameterSet_
.
addParameter
<
int
>(
"PDFGUP2"
, heprup.PDFGUP.second);
106
processParameterSet_
.
addParameter
<
int
>(
"PDFSUP1"
, heprup.PDFSUP.first);
107
processParameterSet_
.
addParameter
<
int
>(
"PDFSUP2"
, heprup.PDFSUP.second);
108
processParameterSet_
.
addParameter
<
int
>(
"IDWTUP"
, heprup.IDWTUP);
109
for
(
auto
const
&
header
:
runInfo
->getHeaders()) {
110
if
(!
LHERunInfoProduct::isTagComparedInMerge
(
header
.tag())) {
111
continue
;
112
}
113
processParameterSet_
.
addParameter
<
vstring
>(
header
.tag(),
header
.lines());
114
}
115
}
116
117
ProcessHistoryID
LHEProvenanceHelper::lheInit
(
ProcessHistoryRegistry
& processHistoryRegistry) {
118
// Now we register the process parameter set.
119
processParameterSet_
.
registerIt
();
120
//std::cerr << processParameterSet_.dump() << std::endl;
121
122
// Insert an entry for this process in the process history registry
123
ProcessHistory
ph;
124
ph.
emplace_back
(
125
eventProductBranchDescription_
.
processName
(),
processParameterSet_
.
id
(),
getReleaseVersion
(),
getPassID
());
126
processHistoryRegistry.
registerProcessHistory
(ph);
127
128
// Save the process history ID for use every event.
129
return
ph.
id
();
130
}
131
132
}
// namespace edm
edm::ParameterSet::registerIt
ParameterSet const & registerIt()
Definition:
ParameterSet.cc:113
edm::ProcessHistoryRegistry::registerProcessHistory
bool registerProcessHistory(ProcessHistory const &processHistory)
Definition:
ProcessHistoryRegistry.cc:11
funct::false
false
Definition:
Factorize.h:29
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::LHEProvenanceHelper::LHEProvenanceHelper
LHEProvenanceHelper(TypeID const &eventProductType, TypeID const &runProductType, ProductRegistry &productRegistry)
Definition:
LHEProvenanceHelper.cc:18
edm::moduleName
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:27
edm::LHEProvenanceHelper::lheInit
ProcessHistoryID lheInit(ProcessHistoryRegistry &processHistoryRegistry)
Definition:
LHEProvenanceHelper.cc:117
edm::ProcessHistory::id
ProcessHistoryID id() const
Definition:
ProcessHistory.cc:10
TypeID.h
ProcessHistoryRegistry.h
TypeWithDict.h
ProductRegistry.h
edm::ParameterSet::id
ParameterSetID id() const
Definition:
ParameterSet.cc:189
edm::getPassID
std::string getPassID()
Definition:
GetPassID.h:7
edm::InRun
Definition:
BranchType.h:11
edm::LHEProvenanceHelper::processParameterSet_
ParameterSet processParameterSet_
Definition:
LHEProvenanceHelper.h:28
edm::ProductRegistry
Definition:
ProductRegistry.h:37
edm::vstring
std::vector< std::string > vstring
Definition:
Schedule.cc:653
ProcessHistory.h
edm::BranchDescription::processName
std::string const & processName() const
Definition:
BranchDescription.h:73
edm::Hash< ParameterSetType >
edm::InEvent
Definition:
BranchType.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LHEProvenanceHelper::fillCommonProcessParameterSet
ParameterSet fillCommonProcessParameterSet()
Definition:
LHEProvenanceHelper.cc:57
edm::ProductRegistry::copyProduct
void copyProduct(BranchDescription const &productdesc)
Definition:
ProductRegistry.cc:122
edm::TypeWithDict
Definition:
TypeWithDict.h:38
lhef::LHERunInfo
Definition:
LHERunInfo.h:25
edm::ParameterSet
Definition:
ParameterSet.h:47
GetReleaseVersion.h
LHERunInfo.h
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition:
ParameterSet.h:135
edm::LHEProvenanceHelper::lheAugment
void lheAugment(lhef::LHERunInfo const *runInfo)
Definition:
LHEProvenanceHelper.cc:94
GetPassID.h
triggerPaths
static const std::string triggerPaths
Definition:
EdmProvDump.cc:46
LHERunInfoProduct::isTagComparedInMerge
static bool isTagComparedInMerge(const std::string &tag)
Definition:
LHERunInfoProduct.cc:188
LHEProvenanceHelper.h
edm::ProcessHistory::emplace_back
void emplace_back(Args &&... args)
Definition:
ProcessHistory.h:34
LesHouches.h
edm::LHEProvenanceHelper::commonProcessParameterSet_
const ParameterSet commonProcessParameterSet_
Definition:
LHEProvenanceHelper.h:27
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition:
SimL1EmulatorRepack_CalouGT_cff.py:17
edm::BranchDescription::moduleName
std::string const & moduleName() const
Definition:
BranchDescription.h:116
edm::TypeID
Definition:
TypeID.h:22
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition:
BranchDescription.h:72
relativeConstraints.empty
bool empty
Definition:
relativeConstraints.py:46
edm::getReleaseVersion
std::string getReleaseVersion()
Definition:
GetReleaseVersion.cc:7
submitPVValidationJobs.runInfo
dictionary runInfo
Definition:
submitPVValidationJobs.py:1013
edm::ProcessHistoryRegistry
Definition:
ProcessHistoryRegistry.h:18
RecoTauValidation_cfi.header
header
Definition:
RecoTauValidation_cfi.py:292
edm::BranchDescription
Definition:
BranchDescription.h:32
edm::ProcessHistory
Definition:
ProcessHistory.h:13
edm::LHEProvenanceHelper::eventProductBranchDescription_
const BranchDescription eventProductBranchDescription_
Definition:
LHEProvenanceHelper.h:24
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition:
HerwigMaxPtPartonFilter_cfi.py:4
edm::BranchDescription::setIsProvenanceSetOnRead
void setIsProvenanceSetOnRead(bool value=true) noexcept
Definition:
BranchDescription.h:113
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition:
SiStripBadComponentsDQMServiceTemplate_cfg.py:86
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
edm::LHEProvenanceHelper::runProductBranchDescription_
const BranchDescription runProductBranchDescription_
Definition:
LHEProvenanceHelper.h:25
Generated for CMSSW Reference Manual by
1.8.16