CMS 3D CMS Logo

LHEProvenanceHelper.cc
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
5 
12 
14 
18 
19 namespace edm {
21  TypeID const& runProductType,
22  ProductRegistry& productRegistry,
23  BranchIDListHelper& branchIDListHelper)
24  : eventProductBranchDescription_(BranchDescription(InEvent,
25  "source",
26  "LHEFile"
27  // , "LHE"
28  ,
29  "LHEEventProduct",
30  "LHEEventProduct",
31  "",
32  "LHESource",
34  TypeWithDict(eventProductType.typeInfo()),
35  false)),
36  runProductBranchDescription_(BranchDescription(InRun,
37  "source",
38  "LHEFile"
39  // , "LHE"
40  ,
41  "LHERunInfoProduct",
42  "LHERunInfoProduct",
43  "",
44  "LHESource",
46  TypeWithDict(runProductType.typeInfo()),
47  false)),
48  eventProductProvenance_(eventProductBranchDescription_.branchID()),
49  commonProcessParameterSet_(fillCommonProcessParameterSet()),
50  processParameterSet_(),
51  branchListIndexes_(1, 0) {
52  // Add the products to the product registry
54  ep.setIsProvenanceSetOnRead();
55  productRegistry.copyProduct(ep);
58  productRegistry.copyProduct(rp);
59  BranchIDList bli(1UL, ep.branchID().id());
60  branchIDListHelper.updateFromInput({{bli}});
61  }
62 
64  // We create a process parameter set for the "LHC" process.
65  // This function only fills parameters whose values are independent of the LHE input files.
66  // We don't currently use the untracked parameters, However, we make them available, just in case.
71  typedef std::vector<std::string> vstring;
72  vstring empty;
73 
74  vstring modlbl;
75  modlbl.reserve(1);
76  modlbl.push_back(moduleLabel);
77  pset.addParameter("@all_sources", modlbl);
78 
80  triggerPaths.addParameter<vstring>("@trigger_paths", empty);
81  pset.addParameter<ParameterSet>("@trigger_paths", triggerPaths);
82 
83  ParameterSet pseudoInput;
84  pseudoInput.addParameter<std::string>("@module_edm_type", "Source");
85  pseudoInput.addParameter<std::string>("@module_label", moduleLabel);
86  pseudoInput.addParameter<std::string>("@module_type", moduleName);
87  pset.addParameter<ParameterSet>(moduleLabel, pseudoInput);
88 
89  pset.addParameter<vstring>("@all_esmodules", empty);
90  pset.addParameter<vstring>("@all_esprefers", empty);
91  pset.addParameter<vstring>("@all_essources", empty);
92  pset.addParameter<vstring>("@all_loopers", empty);
93  pset.addParameter<vstring>("@all_modules", empty);
94  pset.addParameter<vstring>("@end_paths", empty);
95  pset.addParameter<vstring>("@paths", empty);
96  pset.addParameter<std::string>("@process_name", processName);
97  return pset;
98  }
99 
102  if (runInfo == nullptr)
103  return;
104  typedef std::vector<std::string> vstring;
105  auto const& heprup = *runInfo->getHEPRUP();
106  processParameterSet_.addParameter<int>("IDBMUP1", heprup.IDBMUP.first);
107  processParameterSet_.addParameter<int>("IDBMUP2", heprup.IDBMUP.second);
108  processParameterSet_.addParameter<int>("EBMUP1", heprup.EBMUP.first);
109  processParameterSet_.addParameter<int>("EBMUP2", heprup.EBMUP.second);
110  processParameterSet_.addParameter<int>("PDFGUP1", heprup.PDFGUP.first);
111  processParameterSet_.addParameter<int>("PDFGUP2", heprup.PDFGUP.second);
112  processParameterSet_.addParameter<int>("PDFSUP1", heprup.PDFSUP.first);
113  processParameterSet_.addParameter<int>("PDFSUP2", heprup.PDFSUP.second);
114  processParameterSet_.addParameter<int>("IDWTUP", heprup.IDWTUP);
115  for (auto const& header : runInfo->getHeaders()) {
117  continue;
118  }
120  }
121  }
122 
124  // Now we register the process parameter set.
126  //std::cerr << processParameterSet_.dump() << std::endl;
127 
128  // Insert an entry for this process in the process history registry
130  ph.emplace_back(
132  processHistoryRegistry.registerProcessHistory(ph);
133 
134  // Save the process history ID for use every event.
135  return ph.id();
136  }
137 
138 } // namespace edm
std::string getPassID()
Definition: GetPassID.h:7
void setIsProvenanceSetOnRead(bool value=true) noexcept
bool registerProcessHistory(ProcessHistory const &processHistory)
std::string const & moduleName() const
std::string const & processName() const
BranchDescription const runProductBranchDescription_
ParameterSetID id() const
LHEProvenanceHelper(TypeID const &eventProductType, TypeID const &runProductType, ProductRegistry &productRegistry, BranchIDListHelper &helper)
ParameterSet const & registerIt()
ParameterSet fillCommonProcessParameterSet()
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:136
static bool isTagComparedInMerge(const std::string &tag)
std::string getReleaseVersion()
ProcessHistoryID lheInit(ProcessHistoryRegistry &processHistoryRegistry)
ParameterSet const commonProcessParameterSet_
bool updateFromInput(BranchIDLists const &bidlists)
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
HLT enums.
static std::string const triggerPaths
Definition: EdmProvDump.cc:48
std::string const & moduleLabel() const
std::vector< std::string > vstring
Definition: Schedule.cc:482
BranchDescription const eventProductBranchDescription_
void lheAugment(lhef::LHERunInfo const *runInfo)
void copyProduct(BranchDescription const &productdesc)