CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 26 of file CounterChecker.h.

Member Typedef Documentation

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

Definition at line 30 of file CounterChecker.h.

typedef unsigned short CounterChecker::word

Definition at line 28 of file CounterChecker.h.

Member Enumeration Documentation

Enumerator
BCChecker 
ECChecker 

Definition at line 32 of file CounterChecker.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file CounterChecker.h.

45  : type(_type), name(_name), min(_min), fraction(_fraction), verbosity(_verbosity) {}
unsigned int min
minimal required number of frames to search for the most frequent one
unsigned int verbosity
level of verbosity
std::string name
the name of this check, used in error messages
CheckerType type
EC or BC counter checker.

Member Function Documentation

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 85 of file CounterChecker.h.

References BCChecker, ECChecker, fraction, min, name, relationMap, and verbosity.

Referenced by RawToDigiConverter::runCommon().

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  }
132 }
unsigned int min
minimal required number of frames to search for the most frequent one
list status
Definition: mps_update.py:107
unsigned int verbosity
level of verbosity
std::string name
the name of this check, used in error messages
uint64_t word
CounterMap relationMap
counter value -&gt; list of frames with this value
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.

References counter, and runTheMatrix::ret.

Referenced by RawToDigiConverter::runCommon().

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 }
tuple ret
prodAgent to be discontinued
uint64_t word
static std::atomic< unsigned int > counter
CounterMap relationMap
counter value -&gt; list of frames with this value

Member Data Documentation

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 78 of file CounterChecker.h.

Referenced by Analyze().

unsigned int CounterChecker::min
private

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

Definition at line 74 of file CounterChecker.h.

Referenced by Analyze().

std::string CounterChecker::name
private

the name of this check, used in error messages

Definition at line 71 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(), Analyze(), dirstructure.Directory::calcStats(), geometryComparison.GeometryComparison::createScript(), 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(), primaryVertexResolution.PrimaryVertexResolution::getRepMap(), primaryVertexValidation.PrimaryVertexValidation::getRepMap(), zMuMuValidation.ZMuMuValidation::getRepMap(), 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().

CounterMap CounterChecker::relationMap
private

counter value -> list of frames with this value

Definition at line 65 of file CounterChecker.h.

Referenced by Analyze().

CheckerType CounterChecker::type
private

EC or BC counter checker.

Definition at line 68 of file CounterChecker.h.

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

unsigned int CounterChecker::verbosity
private

level of verbosity

Definition at line 81 of file CounterChecker.h.

Referenced by Analyze().