46 throw cms::Exception(
"GBRForestWriter") <<
" Undefined Configuration Parameter 'inputFileName !!\n";
48 if (inputFileType_string ==
"XML")
50 else if (inputFileType_string ==
"GBRForest")
54 <<
" Invalid Configuration Parameter 'inputFileType' = " << inputFileType_string <<
" !!\n";
76 if (
cfg.exists(
"categories")) {
78 for (edm::VParameterSet::const_iterator cfgCategory = cfgCategories.begin(); cfgCategory != cfgCategories.end();
88 if (outputFileType_string ==
"GBRForest")
90 else if (outputFileType_string ==
"SQLLite")
94 <<
" Invalid Configuration Parameter 'outputFileType' = " << outputFileType_string <<
" !!\n";
117 : moduleLabel_(
cfg.getParameter<
std::
string>(
"@module_label")) {
119 for (edm::VParameterSet::const_iterator cfgJob = cfgJobs.begin(); cfgJob != cfgJobs.end(); ++cfgJob) {
121 jobs_.push_back(job);
126 for (std::vector<jobEntryType*>::iterator
it =
jobs_.begin();
it !=
jobs_.end(); ++
it) {
132 for (std::vector<jobEntryType*>::iterator job =
jobs_.begin(); job !=
jobs_.end(); ++job) {
133 std::map<std::string, const GBRForest*> gbrForests;
134 for (std::vector<categoryEntryType*>::iterator
category = (*job)->categories_.begin();
135 category != (*job)->categories_.end();
141 TFile*
inputFile =
new TFile((*category)->inputFileName_.data());
148 throw cms::Exception(
"GBRForestWriter") <<
" Failed to load GBRForest = " << (*category)->gbrForestName_.data()
149 <<
" from file = " << (*category)->inputFileName_ <<
" !!\n";
150 gbrForests[(*category)->gbrForestName_] = gbrForest;
153 TFile*
outputFile =
new TFile((*job)->outputFileName_.data(),
"RECREATE");
155 for (std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
156 gbrForest != gbrForests.end();
158 outputFile->WriteObject(gbrForest->second, gbrForest->first.data());
164 throw cms::Exception(
"GBRForestWriter") <<
" Failed to access PoolDBOutputService !!\n";
166 for (std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
167 gbrForest != gbrForests.end();
170 if (gbrForests.size() > 1)
171 outputRecord.append(
"_").append(gbrForest->first);
177 for (std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
178 gbrForest != gbrForests.end();
180 delete gbrForest->second;
categoryEntryType(const edm::ParameterSet &cfg)
std::vector< ParameterSet > VParameterSet
cond::Time_t beginOfTime() const
GBRForestWriter(const edm::ParameterSet &)
std::string gbrForestName_
std::vector< categoryEntryType * > categories_
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
vstring spectatorVariables_
#define DEFINE_FWK_MODULE(type)
std::string outputFileName_
~GBRForestWriter() override
std::string outputRecord_
jobEntryType(const edm::ParameterSet &cfg)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< jobEntryType * > jobs_
const std::string & fullPath() const
std::vector< std::string > vstring
std::string inputFileName_