test
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 Member Functions | Private Attributes | Friends
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 Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

CacheId cacheId
 
std::vector< VarProcessor * > processors
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 201 of file MVAComputer.h.

Member Typedef Documentation

Definition at line 213 of file MVAComputer.h.

Constructor & Destructor Documentation

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

Definition at line 70 of file MVAComputer.cc.

70  :
72 {
73 }
static MVAComputer::CacheId getNextMVAComputerCacheId()
Definition: MVAComputer.cc:61
PhysicsTools::Calibration::MVAComputer::MVAComputer ( const MVAComputer orig)

Definition at line 75 of file MVAComputer.cc.

References addProcessor(), getDQMSummary::iter, and processors.

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

Definition at line 86 of file MVAComputer.cc.

References getDQMSummary::iter, and processors.

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

Member Function Documentation

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

Definition at line 118 of file MVAComputer.cc.

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

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

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

Definition at line 215 of file MVAComputer.h.

References cacheId.

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

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

Definition at line 214 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 113 of file MVAComputer.cc.

References processors.

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

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

Definition at line 94 of file MVAComputer.cc.

References addProcessor(), cacheId, inputSet, getDQMSummary::iter, output, and processors.

95 {
96  inputSet = orig.inputSet;
97  output = orig.output;
98  cacheId = orig.cacheId;
99 
100  for(std::vector<VarProcessor*>::iterator iter = processors.begin();
101  iter != processors.end(); ++iter)
102  delete *iter;
103  processors.clear();
104 
105  for(std::vector<VarProcessor*>::const_iterator iter =
106  orig.processors.begin();
107  iter != orig.processors.end(); ++iter)
108  addProcessor(*iter);
109 
110  return *this;
111 }
std::vector< VarProcessor * > processors
Definition: MVAComputer.h:221
void addProcessor(const VarProcessor *proc)
Definition: MVAComputer.cc:118
std::vector< Variable > inputSet
Definition: MVAComputer.h:217
template<class Archive >
void PhysicsTools::Calibration::MVAComputer::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 225 of file MVAComputer.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 225 of file MVAComputer.h.

Member Data Documentation

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

Definition at line 223 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 221 of file MVAComputer.h.

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