CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LHEProvenanceHelper.cc
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
5 
12 
14 
18 
19 namespace edm {
20  LHEProvenanceHelper::LHEProvenanceHelper(TypeID const& eventProductType, TypeID const& runProductType)
21  : eventProductBranchDescription_(BranchDescription(
22  InEvent
23  , "source"
24  , "LHEFile"
25  // , "LHE"
26  , "LHEEventProduct"
27  , "LHEEventProduct"
28  , ""
29  , "LHESource"
30  , ParameterSetID()
31  , TypeWithDict(eventProductType.typeInfo())
32  , false))
33  , runProductBranchDescription_(BranchDescription(
34  InRun
35  , "source"
36  , "LHEFile"
37  // , "LHE"
38  , "LHERunInfoProduct"
39  , "LHERunInfoProduct"
40  , ""
41  , "LHESource"
42  , ParameterSetID()
43  , TypeWithDict(runProductType.typeInfo())
44  , false))
45  , eventProductProvenance_(eventProductBranchDescription_.branchID())
46  , processParameterSet_() {
47 
48  // Now we create a process parameter set for the "LHC" process.
49  // We don't currently use the untracked parameters, However, we make them available, just in case.
53  typedef std::vector<std::string> vstring;
54  vstring empty;
55 
56  vstring modlbl;
57  modlbl.reserve(1);
58  modlbl.push_back(moduleLabel);
59  processParameterSet_.addParameter("@all_sources", modlbl);
60 
61  ParameterSet triggerPaths;
62  triggerPaths.addParameter<vstring>("@trigger_paths", empty);
63  processParameterSet_.addParameter<ParameterSet>("@trigger_paths", triggerPaths);
64 
65  ParameterSet pseudoInput;
66  pseudoInput.addParameter<std::string>("@module_edm_type", "Source");
67  pseudoInput.addParameter<std::string>("@module_label", moduleLabel);
68  pseudoInput.addParameter<std::string>("@module_type", moduleName);
69  processParameterSet_.addParameter<ParameterSet>(moduleLabel, pseudoInput);
70 
71  processParameterSet_.addParameter<vstring>("@all_esmodules", empty);
72  processParameterSet_.addParameter<vstring>("@all_esprefers", empty);
73  processParameterSet_.addParameter<vstring>("@all_essources", empty);
74  processParameterSet_.addParameter<vstring>("@all_loopers", empty);
75  processParameterSet_.addParameter<vstring>("@all_modules", empty);
76  processParameterSet_.addParameter<vstring>("@end_paths", empty);
77  processParameterSet_.addParameter<vstring>("@paths", empty);
78  processParameterSet_.addParameter<std::string>("@process_name", processName);
79  }
80 
81  void
83  if(runInfo == nullptr) return;
84  typedef std::vector<std::string> vstring;
85  auto const& heprup = *runInfo->getHEPRUP();
86  processParameterSet_.addParameter<int>("IDBMUP1", heprup.IDBMUP.first);
87  processParameterSet_.addParameter<int>("IDBMUP2", heprup.IDBMUP.second);
88  processParameterSet_.addParameter<int>("EBMUP1", heprup.EBMUP.first);
89  processParameterSet_.addParameter<int>("EBMUP2", heprup.EBMUP.second);
90  processParameterSet_.addParameter<int>("PDFGUP1", heprup.PDFGUP.first);
91  processParameterSet_.addParameter<int>("PDFGUP2", heprup.PDFGUP.second);
92  processParameterSet_.addParameter<int>("PDFSUP1", heprup.PDFSUP.first);
93  processParameterSet_.addParameter<int>("PDFSUP2", heprup.PDFSUP.second);
94  processParameterSet_.addParameter<int>("IDWTUP", heprup.IDWTUP);
95  for(auto const& header : runInfo->getHeaders()) {
96  if(!LHERunInfoProduct::isTagComparedInMerge(header.tag())) {
97  continue;
98  }
99  processParameterSet_.addParameter<vstring>(header.tag(), header.lines());
100  }
101  }
102 
105  // Now we register the process parameter set.
107  //std::cerr << processParameterSet_.dump() << std::endl;
108  // Now we need to set all the metadata
109  // Add the products to the product registry
110  productRegistry.copyProduct(eventProductBranchDescription_.me());
111  productRegistry.copyProduct(runProductBranchDescription_.me());
112 
113  // Insert an entry for this process in the process history registry
114  ProcessHistory ph;
116  ProcessConfiguration const& pc = ph.data().back();
118 
119  // Insert an entry for this process in the process configuration registry
121 
122  // Save the process history ID for use every event.
123  return ph.id();
124  }
125 
126 }
std::string const & processName() const
std::string getPassID()
Definition: GetPassID.h:8
BranchDescription const & me() const
std::vector< std::string > vstring
Definition: Schedule.cc:277
ParameterSetID id() const
static ThreadSafeRegistry * instance()
collection_type const & data() const
bool insertMapped(value_type const &v)
void emplace_back(Args &&...args)
std::string const & moduleName() const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:145
static bool isTagComparedInMerge(const std::string &tag)
const std::vector< Header > & getHeaders() const
Definition: LHERunInfo.h:58
std::string getReleaseVersion()
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
ConstBranchDescription eventProductBranchDescription_
ProcessHistoryID lheInit(ProductRegistry &productRegistry)
ProcessHistoryID id() const
ParameterSet const & registerIt()
void lheAugment(lhef::LHERunInfo const *runInfo)
void copyProduct(BranchDescription const &productdesc)
ConstBranchDescription runProductBranchDescription_
std::string const & moduleLabel() const
LHEProvenanceHelper(TypeID const &eventProductType, TypeID const &runProductType)