File indexing completed on 2024-04-06 12:19:10
0001 #include "IOPool/Provenance/interface/CommonProvenanceFiller.h"
0002
0003 #include "DataFormats/Provenance/interface/BranchType.h"
0004 #include "DataFormats/Provenance/interface/ParameterSetBlob.h"
0005 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0006 #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ParameterSet/interface/Registry.h"
0009
0010 #include "TBranch.h"
0011 #include "TTree.h"
0012
0013 #include <cassert>
0014 #include <utility>
0015
0016 namespace edm {
0017
0018 void fillParameterSetBranch(TTree* parameterSetsTree, int basketSize) {
0019 std::pair<ParameterSetID, ParameterSetBlob> idToBlob;
0020 std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob;
0021 TBranch* b =
0022 parameterSetsTree->Branch(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob, basketSize, 0);
0023
0024 for (auto const& pset : *pset::Registry::instance()) {
0025 idToBlob.first = pset.first;
0026 idToBlob.second.pset() = pset.second.toString();
0027
0028 b->Fill();
0029 }
0030 }
0031
0032 void fillProcessHistoryBranch(TTree* metaDataTree,
0033 int basketSize,
0034 ProcessHistoryRegistry const& processHistoryRegistry) {
0035 ProcessHistoryVector procHistoryVector;
0036 for (auto const& ph : processHistoryRegistry) {
0037 procHistoryVector.push_back(ph.second);
0038 }
0039 ProcessHistoryVector* p = &procHistoryVector;
0040 TBranch* b = metaDataTree->Branch(poolNames::processHistoryBranchName().c_str(), &p, basketSize, 0);
0041 assert(b);
0042 b->Fill();
0043 }
0044
0045 }