CMS 3D CMS Logo

VarProcessor.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     MVAComputer
00004 // Class  :     VarProcessor
00005 // 
00006 
00007 // Implementation:
00008 //     Base class for variable processors. Basically only passes calls
00009 //     through to virtual methods in the actual implementation daughter class.
00010 //
00011 // Author:      Christophe Saout
00012 // Created:     Sat Apr 24 15:18 CEST 2007
00013 // $Id: VarProcessor.cc,v 1.4 2009/03/27 14:33:38 saout Exp $
00014 //
00015 
00016 #include "PhysicsTools/MVAComputer/interface/VarProcessor.h"
00017 #include "PhysicsTools/MVAComputer/interface/Calibration.h"
00018 #include "PhysicsTools/MVAComputer/interface/BitSet.h"
00019 
00020 namespace PhysicsTools {
00021 
00022 VarProcessor::VarProcessor(const char *name,
00023                            const Calibration::VarProcessor *calib,
00024                            const MVAComputer *computer) :
00025         computer(computer),
00026         inputVars(Calibration::convert(calib->inputVars)),
00027         nInputVars(inputVars.bits())
00028 {
00029 }
00030 
00031 VarProcessor::~VarProcessor()
00032 {
00033         inputVars = BitSet(0);
00034         nInputVars = 0;
00035 }
00036 
00037 void VarProcessor::configure(ConfigCtx &config)
00038 {
00039         ConfigCtx::size_type pos = config.size();
00040         if (pos != inputVars.size())
00041                 return;
00042 
00043         ConfIterator iter(inputVars.iter(), config);
00044         configure(iter, nInputVars);
00045 
00046         VarProcessor *loop = config.loop ? config.loop : this;
00047         ConfigCtx::Context *ctx =
00048                 loop->configureLoop(config.ctx, config.begin(),
00049                                     config.begin() + pos, config.end());
00050 
00051         if (ctx != config.ctx) {
00052                 delete config.ctx;
00053                 config.ctx = ctx;
00054         }
00055 
00056         if (config.loop && !ctx)
00057                 config.loop = 0;
00058         else if (!config.loop && ctx)
00059                 config.loop = this;
00060 }
00061 
00062 VarProcessor::ConfigCtx::ConfigCtx(std::vector<Variable::Flags> flags) :
00063         loop(0), ctx(0)
00064 {
00065         for(std::vector<Variable::Flags>::const_iterator iter = flags.begin();
00066             iter != flags.end(); ++iter)
00067                 configs.push_back(Config(*iter, 1));
00068 }
00069 
00070 VarProcessor::ConfigCtx::Context *
00071 VarProcessor::configureLoop(ConfigCtx::Context *ctx, ConfigCtx::iterator begin,
00072                             ConfigCtx::iterator cur, ConfigCtx::iterator end)
00073 {
00074         return 0;
00075 }
00076 
00077 } // namespace PhysicsTools

Generated on Tue Jun 9 17:41:31 2009 for CMSSW by  doxygen 1.5.4