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 68 of file MVAComputer.cc.

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

Definition at line 73 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 84 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 116 of file MVAComputer.cc.

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

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

{
        cacheId = getNextMVAComputerCacheId();

        ROOT::Reflex::Type baseType = ROOT::Reflex::GetType<VarProcessor>();
        ROOT::Reflex::Type type =
                                ROOT::Reflex::Type::ByTypeInfo(typeid(*proc));
        ROOT::Reflex::Type refType(type,
                                ROOT::Reflex::CONST & ROOT::Reflex::REFERENCE);
        if (!type.Name().size())
                throw cms::Exception("MVAComputerCalibration")
                        << "Calibration class " << typeid(*proc).name()
                        << " not registered with ROOT::Reflex."
                        << std::endl;

        ROOT::Reflex::Object obj =
                ROOT::Reflex::Object(baseType, const_cast<void*>(
                        static_cast<const void*>(proc))).CastObject(type);

        // find and call copy constructor
        for(ROOT::Reflex::Member_Iterator iter = type.FunctionMember_Begin();
            iter != type.FunctionMember_End(); iter++) {
                const ROOT::Reflex::Type &ctor = iter->TypeOf();
                if (!iter->IsConstructor() ||
                    ctor.FunctionParameterSize() != 1 ||
                    ctor.FunctionParameterAt(0).Id() != refType.Id())
                        continue;

                ROOT::Reflex::Object copy = type.Construct(ctor,
                        ROOT::Reflex::Tools::MakeVector<void*>(obj.Address()));

                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::Reflex."
                        << 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 111 of file MVAComputer.cc.

References processors.

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

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

Definition at line 92 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().