CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Attributes
PhysicsTools::SourceVariableSet Class Reference

#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)
 
SourceVariablefind (AtomicId name) const
 
SourceVariablefind (Magic magic) const
 
std::vector< SourceVariable * > get (bool withMagic=false) const
 
size_type size (bool withMagic=false) const
 
 SourceVariableSet ()
 
 ~SourceVariableSet ()
 

Private Attributes

std::vector< PosVarvars
 

Detailed Description

Definition at line 14 of file SourceVariableSet.h.

Member Typedef Documentation

Definition at line 16 of file SourceVariableSet.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PhysicsTools::SourceVariableSet::SourceVariableSet ( )
inline

Definition at line 18 of file SourceVariableSet.h.

18 {}
PhysicsTools::SourceVariableSet::~SourceVariableSet ( )
inline

Definition at line 19 of file SourceVariableSet.h.

19 {}

Member Function Documentation

bool PhysicsTools::SourceVariableSet::append ( SourceVariable var,
Magic  magic = kRegular,
int  offset = -1 
)

Definition at line 12 of file SourceVariableSet.cc.

References PhysicsTools::Source::getName(), PhysicsTools::Variable::getName(), PhysicsTools::SourceVariable::getSource(), PhysicsTools::SourceVariableSet::PosVar::magic, hltrates_dqm_sourceclient-live_cfg::offset, PhysicsTools::SourceVariableSet::PosVar::pos, MetTreeProducer::var(), PhysicsTools::SourceVariableSet::PosVar::var, PhysicsTools::SourceVariableSet::PosVar::VarNameLess(), and vars.

Referenced by diclist.diclist::add(), PhysicsTools::MVATrainer::fillInputVars(), PhysicsTools::MVATrainer::fillOutputVars(), and BeautifulSoup.Tag::setString().

13 {
14  std::vector<PosVar>::iterator pos =
15  std::lower_bound(vars.begin(), vars.end(),
16  var->getName(), PosVar::VarNameLess);
17 
18  if (pos != vars.end() && (pos->var == var ||
19  (pos->var->getSource() == var->getSource() &&
20  pos->var->getName() == var->getName())))
21  return true;
22 
23  PosVar item;
24  item.pos = offset < 0 ? vars.size() : offset;
25  item.var = var;
26  item.magic = magic;
27 
28  vars.insert(pos, 1, item);
29 
30  return false;
31 }
static bool VarNameLess(const PosVar &var, AtomicId name)
SourceVariable * PhysicsTools::SourceVariableSet::find ( AtomicId  name) const

Definition at line 33 of file SourceVariableSet.cc.

References mergeVDriftHistosByStation::name, PhysicsTools::SourceVariableSet::PosVar::VarNameLess(), and vars.

Referenced by PhysicsTools::Source::getOutput().

34 {
35  std::vector<PosVar>::const_iterator pos =
36  std::lower_bound(vars.begin(), vars.end(),
38 
39  if (pos == vars.end() || pos->var->getName() != name)
40  return 0;
41 
42  return pos->var;
43 }
static bool VarNameLess(const PosVar &var, AtomicId name)
SourceVariable * PhysicsTools::SourceVariableSet::find ( Magic  magic) const

Definition at line 45 of file SourceVariableSet.cc.

References vars.

46 {
47  for(std::vector<PosVar>::const_iterator pos = vars.begin();
48  pos != vars.end(); ++pos)
49  if (pos->magic == magic)
50  return pos->var;
51 
52  return 0;
53 }
std::vector< SourceVariable * > PhysicsTools::SourceVariableSet::get ( bool  withMagic = false) const

Definition at line 55 of file SourceVariableSet.cc.

References reco::if(), kRegular, mps_fire::result, and vars.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), PhysicsTools::MVATrainer::connectProcessors(), PhysicsTools::TrainProcessor::doTrainBegin(), PhysicsTools::MVATrainer::findFinalProcessors(), PhysicsTools::MVATrainer::findUntrainedComputers(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

56 {
57  std::vector<SourceVariable*> result(vars.size());
58 
59  for(std::vector<PosVar>::const_iterator iter = vars.begin();
60  iter != vars.end(); iter++)
61  result[iter->pos] = iter->var;
62 
63  if (!withMagic) {
64  unsigned int pos = vars.size();
65  for(std::vector<PosVar>::const_iterator iter = vars.begin();
66  iter != vars.end(); iter++)
67  if (iter->magic != kRegular) {
68  result.erase(result.begin() +
69  (iter->pos - (iter->pos >= pos)));
70  pos = iter->pos;
71  }
72  }
73 
74  return result;
75 }
tuple result
Definition: mps_fire.py:95
if(dp >Float(M_PI)) dp-
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().

34  {
35  if (withMagic)
36  return vars.size();
37  else
38  return std::count_if(vars.begin(), vars.end(),
39  std::mem_fun_ref(&PosVar::noMagic));
40  }

Member Data Documentation

std::vector<PosVar> PhysicsTools::SourceVariableSet::vars
private

Definition at line 54 of file SourceVariableSet.h.

Referenced by append(), find(), get(), and size().