CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
CounterChecker Class Reference

Class for finding the most popular both EC and BC counter, and filling the conversion status 'wrong EC/BC number' for frames with different value. More...

#include <CounterChecker.h>

Classes

class  Comparer
 

Public Types

enum  CheckerType { BCChecker, ECChecker }
 
typedef std::map< word, std::vector< TotemFramePosition > > CounterMap
 
typedef unsigned short word
 

Public Member Functions

template<typename T >
void Analyze (T &status, bool error, std::ostream &es)
 summarizes and fill the status (wrong EC and BC progress error for some frames) More...
 
 CounterChecker (CheckerType _type=CounterChecker::BCChecker, const std::string &_name="", unsigned int _min=0, double _fraction=0., unsigned int _verbosity=0)
 
void Fill (word counter, TotemFramePosition fr)
 add new value to map, counter takes value of EC or BC number More...
 

Private Attributes

double fraction
 
unsigned int min
 minimal required number of frames to search for the most frequent one More...
 
std::string name
 the name of this check, used in error messages More...
 
CounterMap relationMap
 counter value -> list of frames with this value More...
 
CheckerType type
 EC or BC counter checker. More...
 
unsigned int verbosity
 level of verbosity More...
 

Detailed Description

Class for finding the most popular both EC and BC counter, and filling the conversion status 'wrong EC/BC number' for frames with different value.

Definition at line 25 of file CounterChecker.h.

Member Typedef Documentation

◆ CounterMap

typedef std::map<word, std::vector<TotemFramePosition> > CounterChecker::CounterMap

Definition at line 35 of file CounterChecker.h.

◆ word

typedef unsigned short CounterChecker::word

Definition at line 33 of file CounterChecker.h.

Member Enumeration Documentation

◆ CheckerType

Enumerator
BCChecker 
ECChecker 

Definition at line 37 of file CounterChecker.h.

37 : name

Constructor & Destructor Documentation

◆ CounterChecker()

CounterChecker::CounterChecker ( CheckerType  _type = CounterChecker::BCChecker,
const std::string &  _name = "",
unsigned int  _min = 0,
double  _fraction = 0.,
unsigned int  _verbosity = 0 
)
inline
Parameters
tCounterChecker::ECCounter or CounterChecker::BCCounter. On that, depends whether checker will fill wrong EC or BC rogress error.
namename
minminimal required number of frames to search for the most frequent one

Definition at line 45 of file CounterChecker.h.

45  : type(_type), name(_name), min(_min), fraction(_fraction), verbosity(_verbosity) {}
46 
49 

Member Function Documentation

◆ Analyze()

template<typename T >
void CounterChecker::Analyze ( T status,
bool  error,
std::ostream &  es 
)

summarizes and fill the status (wrong EC and BC progress error for some frames)

Definition at line 84 of file CounterChecker.h.

85  {
86  word mostFrequentCounter = 0;
87  word mostFrequentSize = 0;
88  unsigned int totalFrames = 0;
89 
90  // finding the most frequent counter
91  for (CounterMap::iterator iter = relationMap.begin(); iter != relationMap.end(); iter++) {
92  unsigned int iterSize = iter->second.size();
93  totalFrames += iterSize;
94 
95  if (iterSize > mostFrequentSize) {
96  mostFrequentCounter = iter->first;
97  mostFrequentSize = iter->second.size();
98  }
99  }
100 
101  if (totalFrames < min) {
102  if (verbosity > 0)
103  es << "Too few frames to determine the most frequent " << name << " value.";
104 
105  return;
106  }
107 
108  // if there are too few frames with the most frequent value
109  if ((float)mostFrequentSize / (float)totalFrames < fraction) {
110  if (verbosity > 0)
111  es << "The most frequent " << name << " value is doubtful - variance is too high.";
112 
113  return;
114  }
115 
116  for (CounterMap::iterator iter = relationMap.begin(); iter != relationMap.end(); iter++) {
117  if (iter->first != mostFrequentCounter) {
118  for (std::vector<TotemFramePosition>::iterator fr = iter->second.begin(); fr != iter->second.end(); fr++) {
119  if (error) {
120  if (type == ECChecker)
121  status[*fr].status.setECProgressError();
122  if (type == BCChecker)
123  status[*fr].status.setBCProgressError();
124  }
125 
126  if (verbosity > 0)
127  es << "Frame at " << *fr << ": " << name << " number " << iter->first
128  << " is different from the most frequent one " << mostFrequentCounter << std::endl;
129  }
130  }
131  }

Referenced by RawToDigiConverter::runCommon().

◆ Fill()

void CounterChecker::Fill ( word  counter,
TotemFramePosition  fr 
)

add new value to map, counter takes value of EC or BC number

Definition at line 14 of file CounterChecker.cc.

14  {
15  pair<CounterMap::iterator, bool> ret;
16 
17  vector<TotemFramePosition> list;
18  list.push_back(fr);
19  ret = relationMap.insert(pair<word, vector<TotemFramePosition> >(counter, list));
20  if (ret.second == false)
21  relationMap[counter].push_back(fr);
22 }

References counter, and runTheMatrix::ret.

Referenced by RawToDigiConverter::runCommon().

Member Data Documentation

◆ fraction

double CounterChecker::fraction
private

the most frequent value is accepted only provided its sub-sample size is greater than the specified fraction of the full sample

Definition at line 83 of file CounterChecker.h.

◆ min

unsigned int CounterChecker::min
private

minimal required number of frames to search for the most frequent one

Definition at line 79 of file CounterChecker.h.

◆ name

std::string CounterChecker::name
private

the name of this check, used in error messages

Definition at line 76 of file CounterChecker.h.

Referenced by ElectronMVAID.ElectronMVAID::__call__(), FWLite.ElectronMVAID::__call__(), dirstructure.Directory::__create_pie_image(), DisplayManager.DisplayManager::__del__(), dqm_interfaces.DirID::__eq__(), dirstructure.Directory::__get_full_path(), dirstructure.Comparison::__get_img_name(), dataset.Dataset::__getDataType(), dataset.Dataset::__getFileInfoList(), dirstructure.Comparison::__make_image(), core.autovars.NTupleVariable::__repr__(), core.autovars.NTupleObjectType::__repr__(), core.autovars.NTupleObject::__repr__(), core.autovars.NTupleCollection::__repr__(), dirstructure.Directory::__repr__(), dqm_interfaces.DirID::__repr__(), dirstructure.Comparison::__repr__(), config.Service::__setattr__(), config.CFG::__str__(), counter.Counter::__str__(), average.Average::__str__(), FWLite.WorkingPoints::_reformat_cut_definitions(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), dataset.CMSDataset::buildListOfFiles(), dataset.LocalDataset::buildListOfFiles(), dataset.CMSDataset::buildListOfFilesDBS(), dirstructure.Directory::calcStats(), validation.Sample::digest(), python.rootplot.utilities.Hist::divide(), python.rootplot.utilities.Hist::divide_wilson(), DisplayManager.DisplayManager::Draw(), TreeCrawler.Package::dump(), core.autovars.NTupleVariable::fillBranch(), core.autovars.NTupleObject::fillBranches(), core.autovars.NTupleCollection::fillBranchesScalar(), core.autovars.NTupleCollection::fillBranchesVector(), core.autovars.NTupleCollection::get_cpp_declaration(), core.autovars.NTupleCollection::get_cpp_wrapper_class(), core.autovars.NTupleCollection::get_py_wrapper_class(), utils.StatisticalTest::get_status(), production_tasks.Task::getname(), dataset.CMSDataset::getPrimaryDatasetEntries(), dataset.PrivateDataset::getPrimaryDatasetEntries(), VIDSelectorBase.VIDSelectorBase::initialize(), core.autovars.NTupleVariable::makeBranch(), core.autovars.NTupleObject::makeBranches(), core.autovars.NTupleCollection::makeBranchesScalar(), core.autovars.NTupleCollection::makeBranchesVector(), dirstructure.Directory::print_report(), dataset.BaseDataset::printInfo(), dataset.Dataset::printInfo(), production_tasks.MonitorJobs::run(), python.rootplot.utilities.Hist::TGraph(), python.rootplot.utilities.Hist::TH1F(), counter.Counter::write(), and average.Average::write().

◆ relationMap

CounterMap CounterChecker::relationMap
private

counter value -> list of frames with this value

Definition at line 70 of file CounterChecker.h.

◆ type

CheckerType CounterChecker::type
private

EC or BC counter checker.

Definition at line 73 of file CounterChecker.h.

Referenced by core.autovars.NTupleVariable::makeBranch(), and core.AutoHandle.AutoHandle::ReallyLoad().

◆ verbosity

unsigned int CounterChecker::verbosity
private

level of verbosity

Definition at line 86 of file CounterChecker.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
counter
Definition: counter.py:1
mps_update.status
status
Definition: mps_update.py:68
CounterChecker::name
std::string name
the name of this check, used in error messages
Definition: CounterChecker.h:76
CounterChecker::min
unsigned int min
minimal required number of frames to search for the most frequent one
Definition: CounterChecker.h:79
relativeConstraints.error
error
Definition: relativeConstraints.py:53
CounterChecker::type
CheckerType type
EC or BC counter checker.
Definition: CounterChecker.h:73
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
CounterChecker::relationMap
CounterMap relationMap
counter value -> list of frames with this value
Definition: CounterChecker.h:70
CounterChecker::verbosity
unsigned int verbosity
level of verbosity
Definition: CounterChecker.h:86
CounterChecker::BCChecker
Definition: CounterChecker.h:37
TotemFramePosition
Definition: TotemFramePosition.h:31
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
CounterChecker::ECChecker
Definition: CounterChecker.h:37
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:18
CounterChecker::fraction
double fraction
Definition: CounterChecker.h:83
CounterChecker::Fill
void Fill(word counter, TotemFramePosition fr)
add new value to map, counter takes value of EC or BC number
Definition: CounterChecker.cc:14