CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions

PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory Class Reference

Factory helper class to instantiate a processor. More...

#include <ProcessRegistry.h>

Inheritance diagram for PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory:
PhysicsTools::TrainProcessor PhysicsTools::VarProcessor PhysicsTools::Interceptor

List of all members.

Public Member Functions

template<>
VarProcessorcreate (const char *, const Calibration::VarProcessor *, const MVAComputer *)
template<>
TrainProcessorcreate (const char *name, const AtomicId *id, MVATrainer *trainer)
template<>
TrainProcessorcreate (const char *, const AtomicId *, MVATrainer *)
template<>
VarProcessorcreate (const char *name, const Calibration::VarProcessor *calib, const MVAComputer *parent)

Static Public Member Functions

static Base_t * create (const char *name, const CalibBase_t *calib, Parent_t *parent=0)

Detailed Description

template<class Base_t, class CalibBase_t, class Parent_t>
class PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory

Factory helper class to instantiate a processor.

The common base class of a processor can inherit from this helper class to provide a create() method to instantiate variable processor instances.

Definition at line 68 of file ProcessRegistry.h.


Member Function Documentation

template<class Base_t , class CalibBase_t , class Parent_t >
static Base_t* PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory::create ( const char *  name,
const CalibBase_t *  calib,
Parent_t *  parent = 0 
) [static]
template<>
TrainProcessor * PhysicsTools::ProcessRegistry::Factory< TrainProcessor, AtomicId, MVATrainer >::create ( const char *  name,
const AtomicId id,
MVATrainer trainer 
)

Definition at line 149 of file TrainProcessor.cc.

References PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::create(), reco::get(), mergeVDriftHistosByStation::name, and query::result.

{
        TrainProcessor *result = ProcessRegistry::create(name, id, trainer);
        if (!result) {
                // try to load the shared library and retry
                try {
                        delete TrainProcessor::PluginFactory::get()->create(
                                std::string("TrainProcessor/") + name);
                        result = ProcessRegistry::create(name, id, trainer);
                } catch(const cms::Exception &e) {
                        // caller will have to deal with the null pointer
                        // in principle this will just give a slightly more
                        // descriptive error message (and will rethrow anyhow)
                }
        }
        return result;
}
template<>
TrainProcessor * PhysicsTools::ProcessRegistry::Factory< TrainProcessor, AtomicId, MVATrainer >::create ( const char *  ,
const AtomicId ,
MVATrainer  
)
template<>
VarProcessor * PhysicsTools::ProcessRegistry::Factory< VarProcessor, Calibration::VarProcessor, const MVAComputer >::create ( const char *  name,
const Calibration::VarProcessor calib,
const MVAComputer parent 
)

Definition at line 94 of file VarProcessor.cc.

References calib, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory::create(), reco::get(), mergeVDriftHistosByStation::name, dbtoconf::parent, query::result, and cms::Exception::what().

{
        VarProcessor *result = ProcessRegistry::create(name, calib, parent);
        if (!result) {
                // try to load the shared library and retry
                try {
                        delete VarProcessor::PluginFactory::get()->create(
                                        std::string("VarProcessor/") + name);
                        result = ProcessRegistry::create(name, calib, parent);
                } catch(const cms::Exception &e) {
                        // caller will have to deal with the null pointer
                        // in principle this will just give a slightly more
                        // descriptive error message (and will rethrow anyhow)

                  edm::LogError("CannotBuildMVAProc")
                    << "Caught exception when building processor: "
                    << name << " message: " << std::endl
                    << e.what() << std::endl;
                  throw e;
                }
        }
        return result;
}