#include <MVATrainerLooperImpl.h>
Classes | |
class | Trainer |
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 () |
Definition at line 36 of file MVATrainerLooperImpl.h.
anonymous enum |
Definition at line 38 of file MVATrainerLooperImpl.h.
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(), PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::kTrained, PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::kTrainer, edm::es::label(), edm::ESProducer::setWhatProduced(), and PhysicsTools::MVATrainerLooper::trainers.
: MVATrainerLooper(params) { setWhatProduced(this, edm::es::label("trainer", kTrainer) ("trained", kTrained)); std::vector<edm::ParameterSet> trainers = params.getParameter<std::vector<edm::ParameterSet> >( "trainers"); for(std::vector<edm::ParameterSet>::const_iterator iter = trainers.begin(); iter != trainers.end(); iter++) addTrainer(new Trainer(*iter)); }
virtual PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::~MVATrainerContainerLooperImpl | ( | ) | [inline, virtual] |
Definition at line 56 of file MVATrainerLooperImpl.h.
{}
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(), and edm::es::products().
{ boost::shared_ptr<MVATrainerContainer> trainerCalib( new MVATrainerContainer()); TrainContainer trainedCalib; bool untrained = false; for(TrainerContainer::const_iterator iter = getTrainers().begin(); iter != getTrainers().end(); iter++) { Trainer *trainer = dynamic_cast<Trainer*>(*iter); TrainObject calib = trainer->getCalibration(); trainerCalib->addTrainer(trainer->calibrationRecord, calib); if (calib) { untrained = true; continue; } if (!trainedCalib) trainedCalib = TrainContainer( new Calibration::MVAComputerContainer); trainedCalib->add(trainer->calibrationRecord) = *trainer->getTrainer()->getCalibration(); } if (untrained) trainedCalib = TrainContainer( new UntrainedMVAComputerContainer); edm::es::L<Calibration::MVAComputerContainer, kTrainer> trainedESLabel(trainerCalib); return edm::es::products(trainedESLabel, edm::es::l<kTrained>(trainedCalib)); }