#include <PhysicsTools/MVATrainer/interface/SourceVariableSet.h>
Public Types | |
enum | Magic { kRegular = 0, kTarget, kWeight } |
typedef std::size_t | size_type |
Public Member Functions | |
bool | append (SourceVariable *var, Magic magic=kRegular, int offset=-1) |
SourceVariable * | find (Magic magic) const |
SourceVariable * | find (AtomicId name) const |
std::vector< SourceVariable * > | get (bool withMagic=false) const |
size_type | size (bool withMagic=false) const |
SourceVariableSet () | |
~SourceVariableSet () | |
Private Attributes | |
std::vector< PosVar > | vars |
Classes | |
struct | PosVar |
Definition at line 14 of file SourceVariableSet.h.
typedef std::size_t PhysicsTools::SourceVariableSet::size_type |
Definition at line 16 of file SourceVariableSet.h.
PhysicsTools::SourceVariableSet::SourceVariableSet | ( | ) | [inline] |
PhysicsTools::SourceVariableSet::~SourceVariableSet | ( | ) | [inline] |
bool PhysicsTools::SourceVariableSet::append | ( | SourceVariable * | var, | |
Magic | magic = kRegular , |
|||
int | offset = -1 | |||
) |
Definition at line 12 of file SourceVariableSet.cc.
References PhysicsTools::Variable::getName(), PhysicsTools::Source::getName(), PhysicsTools::SourceVariable::getSource(), PhysicsTools::SourceVariableSet::PosVar::magic, PhysicsTools::SourceVariableSet::PosVar::pos, PhysicsTools::SourceVariableSet::PosVar::var, PhysicsTools::SourceVariableSet::PosVar::VarNameLess(), and vars.
Referenced by PhysicsTools::MVATrainer::fillInputVars(), and PhysicsTools::MVATrainer::fillOutputVars().
00013 { 00014 std::vector<PosVar>::iterator pos = 00015 std::lower_bound(vars.begin(), vars.end(), 00016 var->getName(), PosVar::VarNameLess); 00017 00018 if (pos != vars.end() && (pos->var == var || 00019 (pos->var->getSource() == var->getSource() && 00020 pos->var->getName() == var->getName()))) 00021 return true; 00022 00023 PosVar item; 00024 item.pos = offset < 0 ? vars.size() : offset; 00025 item.var = var; 00026 item.magic = magic; 00027 00028 vars.insert(pos, 1, item); 00029 00030 return false; 00031 }
SourceVariable * PhysicsTools::SourceVariableSet::find | ( | Magic | magic | ) | const |
Definition at line 45 of file SourceVariableSet.cc.
References vars.
00046 { 00047 for(std::vector<PosVar>::const_iterator pos = vars.begin(); 00048 pos != vars.end(); ++pos) 00049 if (pos->magic == magic) 00050 return pos->var; 00051 00052 return 0; 00053 }
SourceVariable * PhysicsTools::SourceVariableSet::find | ( | AtomicId | name | ) | const |
Definition at line 33 of file SourceVariableSet.cc.
References PhysicsTools::SourceVariableSet::PosVar::VarNameLess(), and vars.
Referenced by PhysicsTools::Source::getOutput().
00034 { 00035 std::vector<PosVar>::const_iterator pos = 00036 std::lower_bound(vars.begin(), vars.end(), 00037 name, PosVar::VarNameLess); 00038 00039 if (pos == vars.end() || pos->var->getName() != name) 00040 return 0; 00041 00042 return pos->var; 00043 }
std::vector< SourceVariable * > PhysicsTools::SourceVariableSet::get | ( | bool | withMagic = false |
) | const |
Definition at line 55 of file SourceVariableSet.cc.
References if(), iter, kRegular, HLT_VtxMuL3::result, and vars.
Referenced by PhysicsTools::MVATrainer::connectProcessors(), PhysicsTools::TrainProcessor::doTrainBegin(), PhysicsTools::MVATrainer::findFinalProcessors(), and PhysicsTools::MVATrainer::findUntrainedComputers().
00056 { 00057 std::vector<SourceVariable*> result(vars.size()); 00058 00059 for(std::vector<PosVar>::const_iterator iter = vars.begin(); 00060 iter != vars.end(); iter++) 00061 result[iter->pos] = iter->var; 00062 00063 if (!withMagic) { 00064 unsigned int pos = vars.size(); 00065 for(std::vector<PosVar>::const_iterator iter = vars.begin(); 00066 iter != vars.end(); iter++) 00067 if (iter->magic != kRegular) { 00068 result.erase(result.begin() + 00069 (iter->pos - (iter->pos >= pos))); 00070 pos = iter->pos; 00071 } 00072 } 00073 00074 return result; 00075 }
Definition at line 33 of file SourceVariableSet.h.
References PhysicsTools::SourceVariableSet::PosVar::noMagic(), and vars.
Referenced by PhysicsTools::MVATrainer::connectProcessors().
00034 { 00035 if (withMagic) 00036 return vars.size(); 00037 else 00038 return std::count_if(vars.begin(), vars.end(), 00039 std::mem_fun_ref(&PosVar::noMagic)); 00040 }
std::vector<PosVar> PhysicsTools::SourceVariableSet::vars [private] |