CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
btagbtvdeep::DeepBoostedJetFeatures Class Reference

#include <DeepBoostedJetFeatures.h>

Public Member Functions

void add (const std::string &name)
 
void check_consistency (const std::vector< std::string > &names) const
 
bool empty () const
 
void fill (const std::string &name, float value)
 
const std::vector< float > & get (const std::string &name) const
 
void reserve (const std::string &name, unsigned capacity)
 
void set (const std::string &name, const std::vector< float > &vec)
 

Private Attributes

std::unordered_map< std::string, std::vector< float > > feature_map_
 
bool is_empty_ = true
 

Detailed Description

Definition at line 11 of file DeepBoostedJetFeatures.h.

Member Function Documentation

void btagbtvdeep::DeepBoostedJetFeatures::add ( const std::string &  name)
inline

Definition at line 19 of file DeepBoostedJetFeatures.h.

References feature_map_, and dataset::name.

Referenced by DeepBoostedJetTagInfoProducer::produce(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

19  {
21  }
std::unordered_map< std::string, std::vector< float > > feature_map_
void btagbtvdeep::DeepBoostedJetFeatures::check_consistency ( const std::vector< std::string > &  names) const
inline

Definition at line 41 of file DeepBoostedJetFeatures.h.

References Exception, mps_fire::i, and findQualityFiles::size.

Referenced by DeepBoostedJetTagInfoProducer::produce().

41  {
42  if (names.empty()) return;
43  const auto ref_len = get(names.front()).size();
44  for (unsigned i=1; i<names.size(); ++i){
45  if (get(names[i]).size() != ref_len){
46  throw cms::Exception("InvalidArgument") << "[DeepBoostedJetFeatures::check_consistency()] Inconsistent variable length "
47  << get(names[i]).size() << " for " << names[i] << ", should be " << ref_len;
48  }
49  }
50  }
size
Write out results.
const std::string names[nVars_]
bool btagbtvdeep::DeepBoostedJetFeatures::empty ( ) const
inline
void btagbtvdeep::DeepBoostedJetFeatures::fill ( const std::string &  name,
float  value 
)
inline

Definition at line 27 of file DeepBoostedJetFeatures.h.

References Exception, feature_map_, and is_empty_.

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures(), and DeepBoostedJetTagInfoProducer::fillSVFeatures().

27  {
28  auto item = feature_map_.find(name);
29  if (item != feature_map_.end()){
30  item->second.push_back(value);
31  is_empty_ = false;
32  }else{
33  throw cms::Exception("InvalidArgument") << "[DeepBoostedJetFeatures::fill()] Feature " << name << " has not been registered";
34  }
35  }
Definition: value.py:1
std::unordered_map< std::string, std::vector< float > > feature_map_
const std::vector<float>& btagbtvdeep::DeepBoostedJetFeatures::get ( const std::string &  name) const
inline
void btagbtvdeep::DeepBoostedJetFeatures::reserve ( const std::string &  name,
unsigned  capacity 
)
inline

Definition at line 23 of file DeepBoostedJetFeatures.h.

References feature_map_, and dataset::name.

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures(), and DeepBoostedJetTagInfoProducer::fillSVFeatures().

23  {
24  feature_map_[name].reserve(capacity);
25  }
std::unordered_map< std::string, std::vector< float > > feature_map_
void btagbtvdeep::DeepBoostedJetFeatures::set ( const std::string &  name,
const std::vector< float > &  vec 
)
inline

Definition at line 37 of file DeepBoostedJetFeatures.h.

References feature_map_, and dataset::name.

37  {
38  feature_map_[name] = vec;
39  }
std::unordered_map< std::string, std::vector< float > > feature_map_

Member Data Documentation

std::unordered_map<std::string, std::vector<float> > btagbtvdeep::DeepBoostedJetFeatures::feature_map_
private

Definition at line 63 of file DeepBoostedJetFeatures.h.

Referenced by add(), fill(), get(), reserve(), and set().

bool btagbtvdeep::DeepBoostedJetFeatures::is_empty_ = true
private

Definition at line 62 of file DeepBoostedJetFeatures.h.

Referenced by empty(), and fill().