43 for ( std::vector<jobEntryType*>::iterator job =
jobs_.begin();
44 job !=
jobs_.end(); ++job ) {
45 std::map<std::string, const GBRForest*> gbrForests;
46 for ( std::vector<categoryEntryType*>::iterator
category = (*job)->categories_.begin();
50 TMVA::Tools::Instance();
51 TMVA::Reader* mvaReader =
new TMVA::Reader(
"!V:!Silent");
52 std::vector<Float_t> dummyVariables;
53 for ( vstring::const_iterator inputVariable = (*category)->inputVariables_.begin();
54 inputVariable != (*category)->inputVariables_.end(); ++inputVariable ) {
55 dummyVariables.push_back(0.);
56 mvaReader->AddVariable(inputVariable->data(), &dummyVariables.back());
58 for ( vstring::const_iterator spectatorVariable = (*category)->spectatorVariables_.begin();
59 spectatorVariable != (*category)->spectatorVariables_.end(); ++spectatorVariable ) {
60 dummyVariables.push_back(0.);
61 mvaReader->AddSpectator(spectatorVariable->data(), &dummyVariables.back());
64 TMVA::MethodBDT* bdt =
dynamic_cast<TMVA::MethodBDT*
>(mvaReader->FindMVA((*category)->methodName_.data()));
67 <<
"Failed to load MVA = " << (*category)->methodName_.data() <<
" from file = " << (*category)->inputFileName_ <<
" !!\n";
70 TMVA::Tools::DestroyInstance();
72 TFile*
inputFile =
new TFile((*category)->inputFileName_.data());
74 gbrForest = (
GBRForest*)inputFile->Get((*category)->gbrForestName_.data());
79 <<
" Failed to load GBRForest = " << (*category)->gbrForestName_.data() <<
" from file = " << (*category)->inputFileName_ <<
" !!\n";
80 gbrForests[(*category)->gbrForestName_] = gbrForest;
83 TFile*
outputFile =
new TFile((*job)->outputFileName_.data(),
"RECREATE");
85 for ( std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
86 gbrForest != gbrForests.end(); ++gbrForest ) {
87 outputFile->WriteObject(gbrForest->second, gbrForest->first.data());
94 <<
" Failed to access PoolDBOutputService !!\n";
96 for ( std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
97 gbrForest != gbrForests.end(); ++gbrForest ) {
99 if ( gbrForests.size() > 1 ) outputRecord.append(
"_").append(gbrForest->first);
105 for ( std::map<std::string, const GBRForest*>::iterator gbrForest = gbrForests.begin();
106 gbrForest != gbrForests.end(); ++gbrForest ) {
107 delete gbrForest->second;
cond::Time_t beginOfTime() const
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
TMVA::IMethod * loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)
std::vector< jobEntryType * > jobs_