CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
vid::CutFlowResult Class Reference

#include <VIDCutFlowResult.h>

Public Member Functions

const std::string & cutFlowHash () const
 
const std::string & cutFlowName () const
 
bool cutFlowPassed () const
 
 CutFlowResult ()
 
 CutFlowResult (const std::string &name, const std::string &hash, const std::map< std::string, unsigned > &n2idx, const std::vector< double > &values, unsigned bitmap, unsigned mask=0)
 
size_t cutFlowSize () const
 
CutFlowResult getCutFlowResultMasking (const std::string &name) const
 
CutFlowResult getCutFlowResultMasking (const std::vector< std::string > &names) const
 
CutFlowResult getCutFlowResultMasking (const std::vector< unsigned > &idxs) const
 
CutFlowResult getCutFlowResultMasking (const unsigned idx) const
 
bool getCutResultByIndex (const unsigned idx) const
 
bool getCutResultByName (const std::string &name) const
 
const std::string & getNameAtIndex (const unsigned idx) const
 
double getValueCutUpon (const std::string &name) const
 
double getValueCutUpon (const unsigned idx) const
 
bool isCutMasked (const std::string &name) const
 
bool isCutMasked (const unsigned idx) const
 

Private Member Functions

 CutFlowResult (const std::string &name, const std::string &hash, const std::vector< std::string > &names, const std::vector< unsigned > &indices, const std::vector< double > &values, unsigned bitmap, unsigned mask)
 
bool getCutBit (const unsigned idx) const
 
double getCutValue (const unsigned idx) const
 
bool getMaskBit (const unsigned idx) const
 

Private Attributes

unsigned bitmap_
 
std::string hash_
 
std::vector< unsigned > indices_
 
unsigned mask_
 
std::string name_
 
std::vector< std::string > names_
 
std::vector< double > values_
 

Friends

template<class T >
class VersionedSelector
 

Detailed Description

Definition at line 41 of file VIDCutFlowResult.h.

Constructor & Destructor Documentation

◆ CutFlowResult() [1/3]

vid::CutFlowResult::CutFlowResult ( )
inline

Definition at line 61 of file VIDCutFlowResult.h.

Referenced by getCutFlowResultMasking().

◆ CutFlowResult() [2/3]

vid::CutFlowResult::CutFlowResult ( const std::string &  name,
const std::string &  hash,
const std::map< std::string, unsigned > &  n2idx,
const std::vector< double > &  values,
unsigned  bitmap,
unsigned  mask = 0 
)

Definition at line 10 of file VIDCutFlowResult.cc.

16  : name_(name), hash_(hash), bitmap_(bitmap), mask_(mask), values_(values) {
17  for (const auto& val : n2idx) {
18  names_.push_back(val.first);
19  indices_.push_back(val.second);
20  }
21  }

References indices_, names_, and heppy_batch::val.

◆ CutFlowResult() [3/3]

vid::CutFlowResult::CutFlowResult ( const std::string &  name,
const std::string &  hash,
const std::vector< std::string > &  names,
const std::vector< unsigned > &  indices,
const std::vector< double > &  values,
unsigned  bitmap,
unsigned  mask 
)
inlineprivate

Definition at line 112 of file VIDCutFlowResult.h.

Member Function Documentation

◆ cutFlowHash()

const std::string& vid::CutFlowResult::cutFlowHash ( ) const
inline

Definition at line 72 of file VIDCutFlowResult.h.

◆ cutFlowName()

const std::string& vid::CutFlowResult::cutFlowName ( ) const
inline

Definition at line 70 of file VIDCutFlowResult.h.

◆ cutFlowPassed()

bool vid::CutFlowResult::cutFlowPassed ( ) const
inline

Definition at line 74 of file VIDCutFlowResult.h.

76  :

◆ cutFlowSize()

size_t vid::CutFlowResult::cutFlowSize ( ) const
inline

Definition at line 79 of file VIDCutFlowResult.h.

◆ getCutBit()

bool vid::CutFlowResult::getCutBit ( const unsigned  idx) const
inlineprivate

Definition at line 123 of file VIDCutFlowResult.h.

Referenced by getCutResultByIndex(), and getCutResultByName().

◆ getCutFlowResultMasking() [1/4]

CutFlowResult vid::CutFlowResult::getCutFlowResultMasking ( const std::string &  name) const

Definition at line 117 of file VIDCutFlowResult.cc.

117  {
118  unsigned bitmap = bitmap_;
119  unsigned mask = mask_;
120  auto found_name = std::lower_bound(names_.begin(), names_.end(), name);
121  if (found_name == names_.end() || *found_name != name) {
122  throw cms::Exception("UnknownName") << "Cut name: " << name << " is not known for this cutflow!";
123  }
124  mask = mask | 1 << indices_[std::distance(names_.begin(), found_name)];
125  bitmap = bitmap | mask;
126  return CutFlowResult(name_, empty_str, names_, indices_, values_, bitmap, mask);
127  }

References bitmap_, CutFlowResult(), HLT_FULL_cff::distance, Exception, indices_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, mask_, Skims_PA_cff::name, name_, names_, and values_.

◆ getCutFlowResultMasking() [2/4]

CutFlowResult vid::CutFlowResult::getCutFlowResultMasking ( const std::vector< std::string > &  names) const

Definition at line 92 of file VIDCutFlowResult.cc.

92  {
93  unsigned bitmap = bitmap_;
94  unsigned mask = mask_;
95  for (const std::string& name : names) {
96  auto found_name = std::lower_bound(names_.begin(), names_.end(), name);
97  if (found_name == names_.end() || *found_name != name) {
98  throw cms::Exception("UnknownName") << "Cut name: " << name << " is not known for this cutflow!";
99  }
100  mask = mask | 1 << indices_[std::distance(names_.begin(), found_name)];
101  }
102  bitmap = bitmap | mask;
103  return CutFlowResult(name_, empty_str, names_, indices_, values_, bitmap, mask);
104  }

References bitmap_, CutFlowResult(), HLT_FULL_cff::distance, Exception, indices_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, mask_, Skims_PA_cff::name, name_, names, names_, AlCaHLTBitMon_QueryRunRegistry::string, and values_.

◆ getCutFlowResultMasking() [3/4]

CutFlowResult vid::CutFlowResult::getCutFlowResultMasking ( const std::vector< unsigned > &  idxs) const

Definition at line 79 of file VIDCutFlowResult.cc.

79  {
80  unsigned bitmap = bitmap_;
81  unsigned mask = mask_;
82  for (const unsigned idx : idxs) {
83  if (idx >= indices_.size()) {
84  throw cms::Exception("OutOfBounds") << idx << " is out of bounds for this cut flow!";
85  }
86  mask = mask | 1 << idx;
87  }
88  bitmap = bitmap | mask;
89  return CutFlowResult(name_, empty_str, names_, indices_, values_, bitmap, mask);
90  }

References bitmap_, CutFlowResult(), Exception, heavyIonCSV_trainingSettings::idx, indices_, mask_, name_, names_, and values_.

◆ getCutFlowResultMasking() [4/4]

CutFlowResult vid::CutFlowResult::getCutFlowResultMasking ( const unsigned  idx) const

Definition at line 106 of file VIDCutFlowResult.cc.

106  {
107  unsigned bitmap = bitmap_;
108  unsigned mask = mask_;
109  if (idx >= indices_.size()) {
110  throw cms::Exception("OutOfBounds") << idx << " is out of bounds for this cut flow!";
111  }
112  mask = mask | 1 << idx;
113  bitmap = bitmap | mask;
114  return CutFlowResult(name_, empty_str, names_, indices_, values_, bitmap, mask);
115  }

References bitmap_, CutFlowResult(), Exception, heavyIonCSV_trainingSettings::idx, indices_, mask_, name_, names_, and values_.

◆ getCutResultByIndex()

bool vid::CutFlowResult::getCutResultByIndex ( const unsigned  idx) const

Definition at line 34 of file VIDCutFlowResult.cc.

34  {
35  if (idx >= indices_.size()) {
36  throw cms::Exception("OutOfBounds") << idx << " is out of bounds for this cut flow!";
37  }
38  return getCutBit(idx);
39  }

References Exception, getCutBit(), heavyIonCSV_trainingSettings::idx, and indices_.

◆ getCutResultByName()

bool vid::CutFlowResult::getCutResultByName ( const std::string &  name) const

Definition at line 41 of file VIDCutFlowResult.cc.

41  {
42  auto found_name = std::lower_bound(names_.begin(), names_.end(), name);
43  if (found_name == names_.end() || *found_name != name) {
44  throw cms::Exception("UnknownName") << "Cut name: " << name << " is not known for this cutflow!";
45  }
46  return getCutBit(indices_[std::distance(names_.begin(), found_name)]);
47  }

References HLT_FULL_cff::distance, Exception, getCutBit(), indices_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, Skims_PA_cff::name, and names_.

◆ getCutValue()

double vid::CutFlowResult::getCutValue ( const unsigned  idx) const
inlineprivate

Definition at line 125 of file VIDCutFlowResult.h.

Referenced by getValueCutUpon().

◆ getMaskBit()

bool vid::CutFlowResult::getMaskBit ( const unsigned  idx) const
inlineprivate

Definition at line 121 of file VIDCutFlowResult.h.

Referenced by isCutMasked().

◆ getNameAtIndex()

const std::string & vid::CutFlowResult::getNameAtIndex ( const unsigned  idx) const

Definition at line 23 of file VIDCutFlowResult.cc.

23  {
24  unsigned internal_idx = 0;
25  for (const auto& value : indices_) {
26  if (value == idx)
27  return names_[internal_idx];
28  ++internal_idx;
29  }
30  throw cms::Exception("IndexNotFound") << "index = " << idx << " has no corresponding cut name!";
31  return empty_str;
32  }

References Exception, heavyIonCSV_trainingSettings::idx, indices_, and names_.

◆ getValueCutUpon() [1/2]

double vid::CutFlowResult::getValueCutUpon ( const std::string &  name) const

Definition at line 71 of file VIDCutFlowResult.cc.

71  {
72  auto found_name = std::lower_bound(names_.begin(), names_.end(), name);
73  if (found_name == names_.end() || *found_name != name) {
74  throw cms::Exception("UnknownName") << "Cut name: " << name << " is not known for this cutflow!";
75  }
76  return getCutValue(indices_[std::distance(names_.begin(), found_name)]);
77  }

References HLT_FULL_cff::distance, Exception, getCutValue(), indices_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, Skims_PA_cff::name, and names_.

◆ getValueCutUpon() [2/2]

double vid::CutFlowResult::getValueCutUpon ( const unsigned  idx) const

Definition at line 64 of file VIDCutFlowResult.cc.

64  {
65  if (idx >= indices_.size()) {
66  throw cms::Exception("OutOfBounds") << idx << " is out of bounds for this cut flow!";
67  }
68  return getCutValue(idx);
69  }

References Exception, getCutValue(), heavyIonCSV_trainingSettings::idx, and indices_.

◆ isCutMasked() [1/2]

bool vid::CutFlowResult::isCutMasked ( const std::string &  name) const

Definition at line 56 of file VIDCutFlowResult.cc.

56  {
57  auto found_name = std::lower_bound(names_.begin(), names_.end(), name);
58  if (found_name == names_.end() || *found_name != name) {
59  throw cms::Exception("UnknownName") << "Cut name: " << name << " is not known for this cutflow!";
60  }
61  return getMaskBit(indices_[std::distance(names_.begin(), found_name)]);
62  }

References HLT_FULL_cff::distance, Exception, getMaskBit(), indices_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, Skims_PA_cff::name, and names_.

◆ isCutMasked() [2/2]

bool vid::CutFlowResult::isCutMasked ( const unsigned  idx) const

Definition at line 49 of file VIDCutFlowResult.cc.

49  {
50  if (idx >= indices_.size()) {
51  throw cms::Exception("OutOfBounds") << idx << " is out of bounds for this cut flow!";
52  }
53  return getMaskBit(idx);
54  }

References Exception, getMaskBit(), heavyIonCSV_trainingSettings::idx, and indices_.

Friends And Related Function Documentation

◆ VersionedSelector

template<class T >
friend class VersionedSelector
friend

Definition at line 58 of file VIDCutFlowResult.h.

Member Data Documentation

◆ bitmap_

unsigned vid::CutFlowResult::bitmap_
private

Definition at line 107 of file VIDCutFlowResult.h.

Referenced by getCutFlowResultMasking().

◆ hash_

std::string vid::CutFlowResult::hash_
private

Definition at line 106 of file VIDCutFlowResult.h.

◆ indices_

std::vector<unsigned> vid::CutFlowResult::indices_
private

◆ mask_

unsigned vid::CutFlowResult::mask_
private

Definition at line 107 of file VIDCutFlowResult.h.

Referenced by getCutFlowResultMasking().

◆ name_

std::string vid::CutFlowResult::name_
private

Definition at line 106 of file VIDCutFlowResult.h.

Referenced by getCutFlowResultMasking().

◆ names_

std::vector<std::string> vid::CutFlowResult::names_
private

◆ values_

std::vector<double> vid::CutFlowResult::values_
private

Definition at line 108 of file VIDCutFlowResult.h.

Referenced by getCutFlowResultMasking().

vid::CutFlowResult::mask_
unsigned mask_
Definition: VIDCutFlowResult.h:107
vid::CutFlowResult::values_
std::vector< double > values_
Definition: VIDCutFlowResult.h:108
vid::CutFlowResult::CutFlowResult
CutFlowResult()
Definition: VIDCutFlowResult.h:61
cond::hash
Definition: Time.h:19
vid::CutFlowResult::bitmap_
unsigned bitmap_
Definition: VIDCutFlowResult.h:107
vid::CutFlowResult::getCutValue
double getCutValue(const unsigned idx) const
Definition: VIDCutFlowResult.h:125
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
vid::CutFlowResult::names_
std::vector< std::string > names_
Definition: VIDCutFlowResult.h:109
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
vid::CutFlowResult::indices_
std::vector< unsigned > indices_
Definition: VIDCutFlowResult.h:110
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
vid::CutFlowResult::name_
std::string name_
Definition: VIDCutFlowResult.h:106
value
Definition: value.py:1
vid::CutFlowResult::getCutBit
bool getCutBit(const unsigned idx) const
Definition: VIDCutFlowResult.h:123
heppy_batch.val
val
Definition: heppy_batch.py:351
vid::CutFlowResult::getMaskBit
bool getMaskBit(const unsigned idx) const
Definition: VIDCutFlowResult.h:121
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7796
vid::CutFlowResult::hash_
std::string hash_
Definition: VIDCutFlowResult.h:106