00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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 }