-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathCommonProvenanceFiller.cc
45 lines (36 loc) · 1.55 KB
/
CommonProvenanceFiller.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "IOPool/Provenance/interface/CommonProvenanceFiller.h"
#include "DataFormats/Provenance/interface/BranchType.h"
#include "DataFormats/Provenance/interface/ParameterSetBlob.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/Registry.h"
#include "TBranch.h"
#include "TTree.h"
#include <cassert>
#include <utility>
namespace edm {
void fillParameterSetBranch(TTree* parameterSetsTree, int basketSize) {
std::pair<ParameterSetID, ParameterSetBlob> idToBlob;
std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob;
TBranch* b =
parameterSetsTree->Branch(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob, basketSize, 0);
for (auto const& pset : *pset::Registry::instance()) {
idToBlob.first = pset.first;
idToBlob.second.pset() = pset.second.toString();
b->Fill();
}
}
void fillProcessHistoryBranch(TTree* metaDataTree,
int basketSize,
ProcessHistoryRegistry const& processHistoryRegistry) {
ProcessHistoryVector procHistoryVector;
for (auto const& ph : processHistoryRegistry) {
procHistoryVector.push_back(ph.second);
}
ProcessHistoryVector* p = &procHistoryVector;
TBranch* b = metaDataTree->Branch(poolNames::processHistoryBranchName().c_str(), &p, basketSize, 0);
assert(b);
b->Fill();
}
} // namespace edm