CMS 3D CMS Logo

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

List of all members.

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 (const MVAComputer &orig)
 MVAComputer ()
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 71 of file MVAComputer.cc.

PhysicsTools::Calibration::MVAComputer::MVAComputer ( const MVAComputer orig)

Definition at line 76 of file MVAComputer.cc.

References addProcessor(), and processors.

                                                :
        inputSet(orig.inputSet),
        output(orig.output),
        cacheId(orig.cacheId)
{
        for(std::vector<VarProcessor*>::const_iterator iter =
                                                orig.processors.begin();
            iter != orig.processors.end(); ++iter)
                addProcessor(*iter);
}
PhysicsTools::Calibration::MVAComputer::~MVAComputer ( ) [virtual]

Definition at line 87 of file MVAComputer.cc.

References processors.

{
        for(std::vector<VarProcessor*>::iterator iter = processors.begin();
            iter != processors.end(); ++iter)
                delete *iter;
        processors.clear();
}

Member Function Documentation

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

Definition at line 119 of file MVAComputer.cc.

References edm::FunctionWithDict::begin(), cacheId, edm::ObjectWithDict::castObject(), edm::ConstReference, edm::TypeWithDict::construct(), filterCSVwithJSON::copy, Exception, edm::FunctionWithDict::functionParameterSize(), PhysicsTools::Calibration::getNextMVAComputerCacheId(), edm::TypeWithDict::id(), edm::FunctionWithDict::isConstructor(), mem, getGTfromDQMFile::obj, processors, edm::FunctionWithDict::typeOf(), and makeHLTPrescaleTable::values.

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

{
        cacheId = getNextMVAComputerCacheId();

        edm::TypeWithDict baseType(typeid(VarProcessor));
        edm::TypeWithDict type(typeid(*proc));
        if (!bool(type))
                throw cms::Exception("MVAComputerCalibration")
                        << "Calibration class " << typeid(*proc).name()
                        << " not registered with ROOT."
                        << std::endl;

        edm::TypeWithDict refType(type, edm::TypeModifiers::ConstReference);

        edm::ObjectWithDict baseObj(baseType, const_cast<void*>(static_cast<const void*>(proc)));
        edm::ObjectWithDict obj(baseObj.castObject(type));

        // find and call copy constructor
        edm::TypeFunctionMembers members(type);
        for(auto const& mem : members) {
            edm::FunctionWithDict member(mem);
                if (!member.isConstructor() ||
                    member.functionParameterSize() != 1 ||
                    edm::TypeWithDict(*member.begin()).id() != refType.id())
                        continue;

                const edm::TypeWithDict &ctor = member.typeOf();
                std::vector<void *> values(1, obj.address()); 
                edm::ObjectWithDict copy(type.construct(ctor, values));

                processors.push_back(static_cast<VarProcessor*>(copy.address()));
                return;
        }

        throw cms::Exception("MVAComputerCalibration")
                        << "Calibration class " << typeid(*proc).name()
                        << " has no copy ctor registered with ROOT."
                        << std::endl;
}
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().

{ 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().

{ return cacheId; }
std::vector< VarProcessor * > PhysicsTools::Calibration::MVAComputer::getProcessors ( ) const [virtual]

Definition at line 114 of file MVAComputer.cc.

References processors.

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

{
        return processors;
}
MVAComputer & PhysicsTools::Calibration::MVAComputer::operator= ( const MVAComputer orig)

Definition at line 95 of file MVAComputer.cc.

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

{
        inputSet = orig.inputSet;
        output = orig.output;
        cacheId = orig.cacheId;

        for(std::vector<VarProcessor*>::iterator iter = processors.begin();
            iter != processors.end(); ++iter)
                delete *iter;
        processors.clear();

        for(std::vector<VarProcessor*>::const_iterator iter =
                                                orig.processors.begin();
            iter != orig.processors.end(); ++iter)
                addProcessor(*iter);

        return *this;
}

Member Data Documentation

Definition at line 183 of file MVAComputer.h.

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

Definition at line 181 of file MVAComputer.h.

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