CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

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

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<>
VarProcessor * PhysicsTools::ProcessRegistry::Factory< VarProcessor, Calibration::VarProcessor, const MVAComputer >::create ( const char *  name,
const Calibration::VarProcessor calib,
const MVAComputer parent 
)

Definition at line 95 of file VarProcessor.cc.

References PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::create(), alignCSCRings::e, reco::get(), query::result, and cms::Exception::what().

98 {
99  VarProcessor *result = ProcessRegistry::create(name, calib, parent);
100  if (!result) {
101  // try to load the shared library and retry
102  try {
103  delete VarProcessor::PluginFactory::get()->create(
104  std::string("VarProcessor/") + name);
106  } catch(const cms::Exception &e) {
107  // caller will have to deal with the null pointer
108  // in principle this will just give a slightly more
109  // descriptive error message (and will rethrow anyhow)
110 
111  edm::LogError("CannotBuildMVAProc")
112  << "Caught exception when building processor: "
113  << name << " message: " << std::endl
114  << e.what() << std::endl;
115  throw e;
116  }
117  }
118  return result;
119 }
virtual char const * what() const
Definition: Exception.cc:141
list parent
Definition: dbtoconf.py:74
static Base_t * create(const char *name, const CalibBase_t *calib, Parent_t *parent)
create an instance of name, given a calibration calib and parent parent
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
tuple result
Definition: query.py:137
T get(const Candidate &c)
Definition: component.h:56
template<>
TrainProcessor * PhysicsTools::ProcessRegistry::Factory< TrainProcessor, AtomicId, MVATrainer >::create ( const char *  ,
const AtomicId ,
MVATrainer  
)
template<>
TrainProcessor * PhysicsTools::ProcessRegistry::Factory< TrainProcessor, AtomicId, MVATrainer >::create ( const char *  name,
const AtomicId id,
MVATrainer trainer 
)

Definition at line 150 of file TrainProcessor.cc.

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

152 {
153  TrainProcessor *result = ProcessRegistry::create(name, id, trainer);
154  if (!result) {
155  // try to load the shared library and retry
156  try {
157  delete TrainProcessor::PluginFactory::get()->create(
158  std::string("TrainProcessor/") + name);
159  result = ProcessRegistry::create(name, id, trainer);
160  } catch(const cms::Exception &e) {
161  // caller will have to deal with the null pointer
162  // in principle this will just give a slightly more
163  // descriptive error message (and will rethrow anyhow)
164  }
165  }
166  return result;
167 }
static Base_t * create(const char *name, const CalibBase_t *calib, Parent_t *parent)
create an instance of name, given a calibration calib and parent parent
tuple result
Definition: query.py:137
T get(const Candidate &c)
Definition: component.h:56