CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

VariableHelper Class Reference

#include <VariableHelper.h>

List of all members.

Public Types

typedef std::map< std::string,
const CachingVariable * >
::const_iterator 
iterator

Public Member Functions

iterator begin ()
iterator end ()
void print () const
std::string printValues (const edm::Event &event) const
void setHolder (std::string hn)
const CachingVariablevariable (std::string name) const
 VariableHelper (const edm::ParameterSet &iConfig)
 ~VariableHelper ()

Private Attributes

std::map< std::string, const
CachingVariable * > 
variables_

Detailed Description

Definition at line 9 of file VariableHelper.h.


Member Typedef Documentation

typedef std::map<std::string,const CachingVariable*>::const_iterator VariableHelper::iterator

Definition at line 17 of file VariableHelper.h.


Constructor & Destructor Documentation

VariableHelper::VariableHelper ( const edm::ParameterSet iConfig)

Definition at line 9 of file VariableHelper.cc.

References reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSetNames(), i, PFRecoTauDiscriminationAgainstElectronMVA2_cfi::method, AlCaHLTBitMon_QueryRunRegistry::string, and variables_.

                                                             {
  std::vector<std::string> psetNames;
  iConfig.getParameterSetNames(psetNames);
  for (unsigned int i=0;i!=psetNames.size();++i){
    std::string & vname=psetNames[i];
    edm::ParameterSet vPset=iConfig.getParameter<edm::ParameterSet>(psetNames[i]);
    std::string method=vPset.getParameter<std::string>("method");

    CachingVariableFactory::get()->create(method,CachingVariable::CachingVariableFactoryArg(vname,variables_,vPset));
  }

}
VariableHelper::~VariableHelper ( ) [inline]

Definition at line 12 of file VariableHelper.h.

References variables_.

                    {
    for (iterator it = variables_.begin() ; it!=variables_.end() ;++it){
      delete it->second;
    }
  }

Member Function Documentation

iterator VariableHelper::begin ( void  ) [inline]

Definition at line 21 of file VariableHelper.h.

References variables_.

{ return variables_.begin();}
iterator VariableHelper::end ( void  ) [inline]

Definition at line 22 of file VariableHelper.h.

References variables_.

{ return variables_.end();}
void VariableHelper::print ( void  ) const

Definition at line 28 of file VariableHelper.cc.

References variables_.

Referenced by VariableHelperService::init(), and variable().

                                {
  iterator it = variables_.begin();
  iterator it_end = variables_.end();
  for (;it!=it_end;++it)  it->second->print();
}
std::string VariableHelper::printValues ( const edm::Event event) const

Definition at line 34 of file VariableHelper.cc.

References event(), and variables_.

                                                                 {
  std::stringstream ss;
  iterator it = variables_.begin();
  iterator it_end = variables_.end();
  ss<<std::setw(10)<<event.id().run()<<" : "
    <<std::setw(10)<<event.id().event();    
  for (;it!=it_end;++it) {
    if (it->second->compute(event))
      ss<<" : "<<it->first<<"="<<(*it->second)(event);
    else
      ss<<" : "<<it->first<<" N/A";
  }
  return ss.str();
}
void VariableHelper::setHolder ( std::string  hn)

Definition at line 22 of file VariableHelper.cc.

References variables_.

Referenced by VariableHelperService::init().

                                          {
  iterator it = variables_.begin();
  iterator it_end = variables_.end();
  for (;it!=it_end;++it)  it->second->setHolder(hn);
}
const CachingVariable * VariableHelper::variable ( std::string  name) const

Definition at line 48 of file VariableHelper.cc.

References print(), findQualityFiles::v, and variables_.

                                                                   { 
  iterator v=variables_.find(name);
  if (v!=variables_.end())
    return v->second;
  else
    {
      edm::LogError("VariableHelper")<<"I don't know anything named: "<<name
                                     <<" list of available variables follows.";
      print();
      return 0;
    }
}

Member Data Documentation

std::map<std::string,const CachingVariable*> VariableHelper::variables_ [private]