CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Private Attributes
PhysicsTools::Calibration::MVAComputer Class Reference

#include <MVAComputer.h>

Inheritance diagram for PhysicsTools::Calibration::MVAComputer:
PhysicsTools::MVATrainerLooper::UntrainedMVAComputer PhysicsTools::TrainMVAComputerCalibration

Public Types

typedef unsigned int CacheId
 

Public Member Functions

void addProcessor (const VarProcessor *proc)
 
bool changed (CacheId old) const
 
CacheId getCacheId () const
 
virtual std::vector
< VarProcessor * > 
getProcessors () const
 
 MVAComputer ()
 
 MVAComputer (const MVAComputer &orig)
 
MVAComputeroperator= (const MVAComputer &orig)
 
virtual ~MVAComputer ()
 

Public Attributes

std::vector< VariableinputSet
 
unsigned int output
 

Private Attributes

CacheId cacheId
 
std::vector< VarProcessor * > processors
 

Detailed Description

Definition at line 161 of file MVAComputer.h.

Member Typedef Documentation

Definition at line 173 of file MVAComputer.h.

Constructor & Destructor Documentation

PhysicsTools::Calibration::MVAComputer::MVAComputer ( )

Definition at line 68 of file MVAComputer.cc.

68  :
70 {
71 }
static MVAComputer::CacheId getNextMVAComputerCacheId()
Definition: MVAComputer.cc:59
PhysicsTools::Calibration::MVAComputer::MVAComputer ( const MVAComputer orig)

Definition at line 73 of file MVAComputer.cc.

References addProcessor(), and processors.

73  :
74  inputSet(orig.inputSet),
75  output(orig.output),
76  cacheId(orig.cacheId)
77 {
78  for(std::vector<VarProcessor*>::const_iterator iter =
79  orig.processors.begin();
80  iter != orig.processors.end(); ++iter)
81  addProcessor(*iter);
82 }
void addProcessor(const VarProcessor *proc)
Definition: MVAComputer.cc:116
std::vector< Variable > inputSet
Definition: MVAComputer.h:177
PhysicsTools::Calibration::MVAComputer::~MVAComputer ( )
virtual

Definition at line 84 of file MVAComputer.cc.

References processors.

85 {
86  for(std::vector<VarProcessor*>::iterator iter = processors.begin();
87  iter != processors.end(); ++iter)
88  delete *iter;
89  processors.clear();
90 }
std::vector< VarProcessor * > processors
Definition: MVAComputer.h:181

Member Function Documentation

void PhysicsTools::Calibration::MVAComputer::addProcessor ( const VarProcessor proc)

Definition at line 116 of file MVAComputer.cc.

References cacheId, filterCSVwithJSON::copy, edm::hlt::Exception, PhysicsTools::Calibration::getNextMVAComputerCacheId(), getGTfromDQMFile::obj, and processors.

Referenced by PhysicsTools::MVATrainer::connectProcessors(), MVAComputer(), and operator=().

117 {
119 
120  ROOT::Reflex::Type baseType = ROOT::Reflex::GetType<VarProcessor>();
122  ROOT::Reflex::Type::ByTypeInfo(typeid(*proc));
123  ROOT::Reflex::Type refType(type,
124  ROOT::Reflex::CONST & ROOT::Reflex::REFERENCE);
125  if (!type.Name().size())
126  throw cms::Exception("MVAComputerCalibration")
127  << "Calibration class " << typeid(*proc).name()
128  << " not registered with ROOT::Reflex."
129  << std::endl;
130 
131  ROOT::Reflex::Object obj =
132  ROOT::Reflex::Object(baseType, const_cast<void*>(
133  static_cast<const void*>(proc))).CastObject(type);
134 
135  // find and call copy constructor
136  for(ROOT::Reflex::Member_Iterator iter = type.FunctionMember_Begin();
137  iter != type.FunctionMember_End(); iter++) {
138  const ROOT::Reflex::Type &ctor = iter->TypeOf();
139  if (!iter->IsConstructor() ||
140  ctor.FunctionParameterSize() != 1 ||
141  ctor.FunctionParameterAt(0).Id() != refType.Id())
142  continue;
143 
144  ROOT::Reflex::Object copy = type.Construct(ctor,
145  ROOT::Reflex::Tools::MakeVector<void*>(obj.Address()));
146 
147  processors.push_back(static_cast<VarProcessor*>(copy.Address()));
148  return;
149  }
150 
151  throw cms::Exception("MVAComputerCalibration")
152  << "Calibration class " << typeid(*proc).name()
153  << " has no copy ctor registered with ROOT::Reflex."
154  << std::endl;
155 }
type
Definition: HCALResponse.h:22
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< VarProcessor * > processors
Definition: MVAComputer.h:181
static MVAComputer::CacheId getNextMVAComputerCacheId()
Definition: MVAComputer.cc:59
bool PhysicsTools::Calibration::MVAComputer::changed ( CacheId  old) const
inline

Definition at line 175 of file MVAComputer.h.

References cacheId.

Referenced by GenericMVAComputerCache::update(), and PhysicsTools::MVAComputerCache::update().

175 { return old != cacheId; }
CacheId PhysicsTools::Calibration::MVAComputer::getCacheId ( ) const
inline

Definition at line 174 of file MVAComputer.h.

References cacheId.

Referenced by GenericMVAComputerCache::update(), and PhysicsTools::MVAComputerCache::update().

std::vector< VarProcessor * > PhysicsTools::Calibration::MVAComputer::getProcessors ( ) const
virtual

Definition at line 111 of file MVAComputer.cc.

References processors.

Referenced by PhysicsTools::MVAComputer::setup().

112 {
113  return processors;
114 }
std::vector< VarProcessor * > processors
Definition: MVAComputer.h:181
MVAComputer & PhysicsTools::Calibration::MVAComputer::operator= ( const MVAComputer orig)

Definition at line 92 of file MVAComputer.cc.

References addProcessor(), cacheId, inputSet, output, and processors.

93 {
94  inputSet = orig.inputSet;
95  output = orig.output;
96  cacheId = orig.cacheId;
97 
98  for(std::vector<VarProcessor*>::iterator iter = processors.begin();
99  iter != processors.end(); ++iter)
100  delete *iter;
101  processors.clear();
102 
103  for(std::vector<VarProcessor*>::const_iterator iter =
104  orig.processors.begin();
105  iter != orig.processors.end(); ++iter)
106  addProcessor(*iter);
107 
108  return *this;
109 }
std::vector< VarProcessor * > processors
Definition: MVAComputer.h:181
void addProcessor(const VarProcessor *proc)
Definition: MVAComputer.cc:116
std::vector< Variable > inputSet
Definition: MVAComputer.h:177

Member Data Documentation

CacheId PhysicsTools::Calibration::MVAComputer::cacheId
private

Definition at line 183 of file MVAComputer.h.

Referenced by addProcessor(), changed(), getCacheId(), and operator=().

std::vector<Variable> PhysicsTools::Calibration::MVAComputer::inputSet
unsigned int PhysicsTools::Calibration::MVAComputer::output
std::vector<VarProcessor*> PhysicsTools::Calibration::MVAComputer::processors
private

Definition at line 181 of file MVAComputer.h.

Referenced by addProcessor(), getProcessors(), MVAComputer(), operator=(), and ~MVAComputer().