CMS 3D CMS Logo

PhysicsTools::MVATrainerContainerLooperImpl< Record_t > Class Template Reference

#include <PhysicsTools/MVATrainer/interface/MVATrainerLooperImpl.h>

Inheritance diagram for PhysicsTools::MVATrainerContainerLooperImpl< Record_t >:

PhysicsTools::MVATrainerLooper edm::ESProducerLooper edm::ESProducer edm::EventSetupRecordIntervalFinder edm::EDLooper edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Types

enum  { kTrainer, kTrained }

Public Member Functions

 MVATrainerContainerLooperImpl (const edm::ParameterSet &params)
edm::ESProducts< edm::es::L
< Calibration::MVAComputerContainer,
kTrainer >, edm::es::L
< Calibration::MVAComputerContainer,
kTrained > > 
produce (const Record_t &record)
virtual ~MVATrainerContainerLooperImpl ()

Classes

class  Trainer


Detailed Description

template<class Record_t>
class PhysicsTools::MVATrainerContainerLooperImpl< Record_t >

Definition at line 36 of file MVATrainerLooperImpl.h.


Member Enumeration Documentation

template<class Record_t>
anonymous enum

Enumerator:
kTrainer 
kTrained 

Definition at line 38 of file MVATrainerLooperImpl.h.

00038 { kTrainer, kTrained };


Constructor & Destructor Documentation

template<class Record_t>
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         }

template<class Record_t>
virtual PhysicsTools::MVATrainerContainerLooperImpl< Record_t >::~MVATrainerContainerLooperImpl (  )  [inline, virtual]

Definition at line 56 of file MVATrainerLooperImpl.h.

00056 {}


Member Function Documentation

template<class Record_t>
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         }


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:50:12 2009 for CMSSW by  doxygen 1.5.4