42 for ( std::vector<jobEntryType*>::iterator
job =
jobs_.begin();
44 std::map<std::string, const GBRForest*> gbrForests;
45 for ( std::vector<categoryEntryType*>::iterator
category = (*job)->categories_.begin();
49 TMVA::Tools::Instance();
50 TMVA::Reader* mvaReader =
new TMVA::Reader(
"!V:!Silent");
51 std::vector<Float_t> dummyVariables;
52 for ( vstring::const_iterator inputVariable = (*category)->inputVariables_.begin();
53 inputVariable != (*category)->inputVariables_.end(); ++inputVariable ) {
54 dummyVariables.push_back(0.);
55 mvaReader->AddVariable(inputVariable->data(), &dummyVariables.back());
57 for ( vstring::const_iterator spectatorVariable = (*category)->spectatorVariables_.begin();
58 spectatorVariable != (*category)->spectatorVariables_.end(); ++spectatorVariable ) {
59 dummyVariables.push_back(0.);
60 mvaReader->AddSpectator(spectatorVariable->data(), &dummyVariables.back());
62 mvaReader->BookMVA((*category)->gbrForestName_.data(), (*category)->inputFileName_.data());
63 TMVA::MethodBDT* bdt =
dynamic_cast<TMVA::MethodBDT*
>(mvaReader->FindMVA((*category)->gbrForestName_.data()));
66 <<
"Failed to load MVA = " << (*category)->gbrForestName_.data() <<
" from file = " << (*category)->inputFileName_ <<
" !!\n";
69 TMVA::Tools::DestroyInstance();
71 TFile*
inputFile =
new TFile((*category)->inputFileName_.data());
73 gbrForest = (
GBRForest*)inputFile->Get((*category)->gbrForestName_.data());
78 <<
" Failed to load GBRForest = " << (*category)->gbrForestName_.data() <<
" from file = " << (*category)->inputFileName_ <<
" !!\n";
79 gbrForests[(*category)->gbrForestName_] = gbrForest;
82 TFile*
outputFile =
new TFile((*job)->outputFileName_.data(),
"RECREATE");
84 for ( std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
85 gbrForest != gbrForests.end(); ++gbrForest ) {
86 outputFile->WriteObject(gbrForest->second, gbrForest->first.data());
93 <<
" Failed to access PoolDBOutputService !!\n";
95 for ( std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
96 gbrForest != gbrForests.end(); ++gbrForest ) {
98 if ( gbrForests.size() > 1 ) outputRecord.append(
"_").append(gbrForest->first);
104 for ( std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
105 gbrForest != gbrForests.end(); ++gbrForest ) {
106 delete gbrForest->second;
cond::Time_t beginOfTime() const
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
std::vector< jobEntryType * > jobs_