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 
10 
12 
16 
17 namespace edm {
18  LHEProvenanceHelper::LHEProvenanceHelper(TypeID const& eventProductType, TypeID const& runProductType)
19  : eventProductBranchDescription_(BranchDescription(
20  InEvent
21  , "source"
22  , "LHEFile"
23  // , "LHE"
24  , "LHEEventProduct"
25  , "LHEEventProduct"
26  , ""
27  , "LHESource"
28  , ParameterSetID()
29  , TypeWithDict(eventProductType.typeInfo())
30  , false))
31  , runProductBranchDescription_(BranchDescription(
32  InRun
33  , "source"
34  , "LHEFile"
35  // , "LHE"
36  , "LHERunInfoProduct"
37  , "LHERunInfoProduct"
38  , ""
39  , "LHESource"
40  , ParameterSetID()
41  , TypeWithDict(runProductType.typeInfo())
42  , false))
43  , eventProductProvenance_(eventProductBranchDescription_.branchID())
44  , processParameterSet_() {
45 
46  // Now we create a process parameter set for the "LHC" process.
47  // We don't currently use the untracked parameters, However, we make them available, just in case.
51  typedef std::vector<std::string> vstring;
52  vstring empty;
53 
54  vstring modlbl;
55  modlbl.reserve(1);
56  modlbl.push_back(moduleLabel);
57  processParameterSet_.addParameter("@all_sources", modlbl);
58 
60  triggerPaths.addParameter<vstring>("@trigger_paths", empty);
62 
63  ParameterSet pseudoInput;
64  pseudoInput.addParameter<std::string>("@module_edm_type", "Source");
65  pseudoInput.addParameter<std::string>("@module_label", moduleLabel);
66  pseudoInput.addParameter<std::string>("@module_type", moduleName);
67  processParameterSet_.addParameter<ParameterSet>(moduleLabel, pseudoInput);
68 
69  processParameterSet_.addParameter<vstring>("@all_esmodules", empty);
70  processParameterSet_.addParameter<vstring>("@all_esprefers", empty);
71  processParameterSet_.addParameter<vstring>("@all_essources", empty);
72  processParameterSet_.addParameter<vstring>("@all_loopers", empty);
73  processParameterSet_.addParameter<vstring>("@all_modules", empty);
74  processParameterSet_.addParameter<vstring>("@end_paths", empty);
75  processParameterSet_.addParameter<vstring>("@paths", empty);
76  processParameterSet_.addParameter<std::string>("@process_name", processName);
77  }
78 
79  void
81  if(runInfo == nullptr) return;
82  typedef std::vector<std::string> vstring;
83  auto const& heprup = *runInfo->getHEPRUP();
84  processParameterSet_.addParameter<int>("IDBMUP1", heprup.IDBMUP.first);
85  processParameterSet_.addParameter<int>("IDBMUP2", heprup.IDBMUP.second);
86  processParameterSet_.addParameter<int>("EBMUP1", heprup.EBMUP.first);
87  processParameterSet_.addParameter<int>("EBMUP2", heprup.EBMUP.second);
88  processParameterSet_.addParameter<int>("PDFGUP1", heprup.PDFGUP.first);
89  processParameterSet_.addParameter<int>("PDFGUP2", heprup.PDFGUP.second);
90  processParameterSet_.addParameter<int>("PDFSUP1", heprup.PDFSUP.first);
91  processParameterSet_.addParameter<int>("PDFSUP2", heprup.PDFSUP.second);
92  processParameterSet_.addParameter<int>("IDWTUP", heprup.IDWTUP);
93  for(auto const& header : runInfo->getHeaders()) {
94  if(!LHERunInfoProduct::isTagComparedInMerge(header.tag())) {
95  continue;
96  }
97  processParameterSet_.addParameter<vstring>(header.tag(), header.lines());
98  }
99  }
100 
102  LHEProvenanceHelper::lheInit(ProductRegistry& productRegistry, ProcessHistoryRegistry& processHistoryRegistry) {
103  // Now we register the process parameter set.
105  //std::cerr << processParameterSet_.dump() << std::endl;
106  // Now we need to set all the metadata
107  // Add the products to the product registry
109  productRegistry.copyProduct(runProductBranchDescription_);
110 
111  // Insert an entry for this process in the process history registry
112  ProcessHistory ph;
114  processHistoryRegistry.registerProcessHistory(ph);
115 
116  // Save the process history ID for use every event.
117  return ph.id();
118  }
119 
120 }
std::string getPassID()
Definition: GetPassID.h:8
ParameterSetID id() const
bool registerProcessHistory(ProcessHistory const &processHistory)
std::string const & processName() const
void emplace_back(Args &&...args)
BranchDescription const runProductBranchDescription_
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
std::string const & moduleLabel() const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:142
static bool isTagComparedInMerge(const std::string &tag)
const std::vector< Header > & getHeaders() const
Definition: LHERunInfo.h:58
std::string const & moduleName() const
std::string getReleaseVersion()
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
ProcessHistoryID lheInit(ProductRegistry &productRegistry, ProcessHistoryRegistry &processHistoryRegistry)
volatile std::atomic< bool > shutdown_flag false
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
ProcessHistoryID id() const
ParameterSet const & registerIt()
std::vector< std::string > vstring
Definition: Schedule.cc:347
BranchDescription const eventProductBranchDescription_
void lheAugment(lhef::LHERunInfo const *runInfo)
void copyProduct(BranchDescription const &productdesc)
LHEProvenanceHelper(TypeID const &eventProductType, TypeID const &runProductType)