#include <SourceVariableSet.h>
Classes | |
struct | PosVar |
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 (AtomicId name) const |
SourceVariable * | find (Magic magic) const |
std::vector< SourceVariable * > | get (bool withMagic=false) const |
size_type | size (bool withMagic=false) const |
SourceVariableSet () | |
~SourceVariableSet () | |
Private Attributes | |
std::vector< PosVar > | vars |
Definition at line 14 of file SourceVariableSet.h.
typedef std::size_t PhysicsTools::SourceVariableSet::size_type |
Definition at line 16 of file SourceVariableSet.h.
Definition at line 21 of file SourceVariableSet.h.
PhysicsTools::SourceVariableSet::SourceVariableSet | ( | ) | [inline] |
Definition at line 18 of file SourceVariableSet.h.
{}
PhysicsTools::SourceVariableSet::~SourceVariableSet | ( | ) | [inline] |
Definition at line 19 of file SourceVariableSet.h.
{}
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, evf::evtn::offset(), pos, PhysicsTools::SourceVariableSet::PosVar::pos, PhysicsTools::SourceVariableSet::PosVar::var, PhysicsTools::SourceVariableSet::PosVar::VarNameLess(), and vars.
Referenced by PhysicsTools::MVATrainer::fillInputVars(), and PhysicsTools::MVATrainer::fillOutputVars().
{ std::vector<PosVar>::iterator pos = std::lower_bound(vars.begin(), vars.end(), var->getName(), PosVar::VarNameLess); if (pos != vars.end() && (pos->var == var || (pos->var->getSource() == var->getSource() && pos->var->getName() == var->getName()))) return true; PosVar item; item.pos = offset < 0 ? vars.size() : offset; item.var = var; item.magic = magic; vars.insert(pos, 1, item); return false; }
SourceVariable * PhysicsTools::SourceVariableSet::find | ( | Magic | magic | ) | const |
SourceVariable * PhysicsTools::SourceVariableSet::find | ( | AtomicId | name | ) | const |
Definition at line 33 of file SourceVariableSet.cc.
References mergeVDriftHistosByStation::name, pos, PhysicsTools::SourceVariableSet::PosVar::VarNameLess(), and vars.
Referenced by PhysicsTools::Source::getOutput().
std::vector< SourceVariable * > PhysicsTools::SourceVariableSet::get | ( | bool | withMagic = false | ) | const |
Definition at line 55 of file SourceVariableSet.cc.
References if(), kRegular, pos, query::result, and vars.
Referenced by PhysicsTools::MVATrainer::connectProcessors(), PhysicsTools::TrainProcessor::doTrainBegin(), PhysicsTools::MVATrainer::findFinalProcessors(), and PhysicsTools::MVATrainer::findUntrainedComputers().
{ std::vector<SourceVariable*> result(vars.size()); for(std::vector<PosVar>::const_iterator iter = vars.begin(); iter != vars.end(); iter++) result[iter->pos] = iter->var; if (!withMagic) { unsigned int pos = vars.size(); for(std::vector<PosVar>::const_iterator iter = vars.begin(); iter != vars.end(); iter++) if (iter->magic != kRegular) { result.erase(result.begin() + (iter->pos - (iter->pos >= pos))); pos = iter->pos; } } return result; }
size_type PhysicsTools::SourceVariableSet::size | ( | bool | withMagic = false | ) | const [inline] |
Definition at line 33 of file SourceVariableSet.h.
References PhysicsTools::SourceVariableSet::PosVar::noMagic(), and vars.
Referenced by PhysicsTools::MVATrainer::connectProcessors().
{ if (withMagic) return vars.size(); else return std::count_if(vars.begin(), vars.end(), std::mem_fun_ref(&PosVar::noMagic)); }
std::vector<PosVar> PhysicsTools::SourceVariableSet::vars [private] |