#include <PhysicsTools/MVATrainer/interface/MVATrainerLooperImpl.h>
Public Types | |
enum | { kTrainer, kTrained } |
Public Member Functions | |
MVATrainerContainerLooperImpl (const edm::ParameterSet ¶ms) | |
edm::ESProducts< edm::es::L < Calibration::MVAComputerContainer, kTrainer >, edm::es::L < Calibration::MVAComputerContainer, kTrained > > | produce (const Record_t &record) |
virtual | ~MVATrainerContainerLooperImpl () |
Classes | |
class | Trainer |
Definition at line 36 of file MVATrainerLooperImpl.h.
anonymous enum |
PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::MVATrainerContainerLooperImpl | ( | const edm::ParameterSet & | params | ) | [inline] |
Definition at line 40 of file MVATrainerLooperImpl.h.
References PhysicsTools::MVATrainerLooper::addTrainer(), edm::ParameterSet::getParameter(), iter, PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::kTrained, PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::kTrainer, edm::es::label(), edm::ESProducer::setWhatProduced(), and PhysicsTools::MVATrainerLooper::trainers.
00040 : 00041 MVATrainerLooper(params) 00042 { 00043 setWhatProduced(this, edm::es::label("trainer", kTrainer) 00044 ("trained", kTrained)); 00045 00046 std::vector<edm::ParameterSet> trainers = 00047 params.getParameter<std::vector<edm::ParameterSet> >( 00048 "trainers"); 00049 00050 for(std::vector<edm::ParameterSet>::const_iterator iter = 00051 trainers.begin(); iter != trainers.end(); iter++) 00052 00053 addTrainer(new Trainer(*iter)); 00054 }
virtual PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::~MVATrainerContainerLooperImpl | ( | ) | [inline, virtual] |
edm::ESProducts< edm::es::L<Calibration::MVAComputerContainer, kTrainer>, edm::es::L<Calibration::MVAComputerContainer, kTrained> > PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::produce | ( | const Record_t & | record | ) | [inline] |
Definition at line 61 of file MVATrainerLooperImpl.h.
References begin, calib, PhysicsTools::MVATrainerLooper::TrainerContainer::end(), PhysicsTools::MVATrainer::getCalibration(), PhysicsTools::MVATrainerLooper::Trainer::getCalibration(), PhysicsTools::MVATrainerLooper::Trainer::getTrainer(), PhysicsTools::MVATrainerLooper::getTrainers(), iter, and edm::es::products().
00062 { 00063 boost::shared_ptr<MVATrainerContainer> trainerCalib( 00064 new MVATrainerContainer()); 00065 TrainContainer trainedCalib; 00066 00067 bool untrained = false; 00068 for(TrainerContainer::const_iterator iter = 00069 getTrainers().begin(); 00070 iter != getTrainers().end(); iter++) { 00071 Trainer *trainer = dynamic_cast<Trainer*>(*iter); 00072 TrainObject calib = trainer->getCalibration(); 00073 00074 trainerCalib->addTrainer(trainer->calibrationRecord, 00075 calib); 00076 if (calib) { 00077 untrained = true; 00078 continue; 00079 } 00080 00081 if (!trainedCalib) 00082 trainedCalib = TrainContainer( 00083 new Calibration::MVAComputerContainer); 00084 00085 trainedCalib->add(trainer->calibrationRecord) = 00086 *trainer->getTrainer()->getCalibration(); 00087 } 00088 00089 if (untrained) 00090 trainedCalib = TrainContainer( 00091 new UntrainedMVAComputerContainer); 00092 00093 edm::es::L<Calibration::MVAComputerContainer, kTrainer> 00094 trainedESLabel(trainerCalib); 00095 00096 return edm::es::products(trainedESLabel, 00097 edm::es::l<kTrained>(trainedCalib)); 00098 }