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

Member Typedef Documentation

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

Definition at line 33 of file CounterChecker.h.

typedef unsigned short CounterChecker::word

Definition at line 31 of file CounterChecker.h.

Member Enumeration Documentation

Enumerator
BCChecker 
ECChecker 

Definition at line 35 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
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 43 of file CounterChecker.h.

References Analyze(), relativeConstraints::error, Fill(), and mps_update::status.

44  : type(_type),
45  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 88 of file CounterChecker.h.

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

Referenced by CounterChecker(), and RawToDigiConverter::RunCommon().

89 {
90  word mostFrequentCounter = 0;
91  word mostFrequentSize = 0;
92  unsigned int totalFrames = 0;
93 
94  // finding the most frequent counter
95  for (CounterMap::iterator iter = relationMap.begin(); iter != relationMap.end(); iter++)
96  {
97  unsigned int iterSize = iter->second.size();
98  totalFrames += iterSize;
99 
100  if (iterSize > mostFrequentSize)
101  {
102  mostFrequentCounter = iter->first;
103  mostFrequentSize = iter->second.size();
104  }
105  }
106 
107  if (totalFrames < min)
108  {
109  if (verbosity > 0)
110  es << "Too few frames to determine the most frequent " << name << " value.";
111 
112  return;
113  }
114 
115  // if there are too few frames with the most frequent value
116  if ((float)mostFrequentSize/(float)totalFrames < fraction)
117  {
118  if (verbosity > 0)
119  es << " The most frequent " << name << " value is doubtful - variance is too high.";
120 
121  return;
122  }
123 
124  for (CounterMap::iterator iter = relationMap.begin(); iter != relationMap.end(); iter++)
125  {
126  if (iter->first != mostFrequentCounter)
127  {
128  for (std::vector<TotemFramePosition>::iterator fr = iter->second.begin(); fr != iter->second.end(); fr++)
129  {
130  if (error)
131  {
132  if (type == ECChecker)
133  status[*fr].status.setECProgressError();
134  if (type == BCChecker)
135  status[*fr].status.setBCProgressError();
136  }
137 
138  if (verbosity > 0)
139  es << " Frame at " << *fr << ": " << name << " number " << iter->first
140  << " is different from the most frequent one " << mostFrequentCounter << std::endl;
141  }
142  }
143  }
144 }
unsigned int min
minimal required number of frames to search for the most frequent one
type
Definition: HCALResponse.h:21
unsigned int verbosity
level of verbosity
std::string name
the name of this check, used in error messages
unsigned short word
CounterMap relationMap
counter value -> 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 18 of file CounterChecker.cc.

References counter, and list().

Referenced by CounterChecker(), and RawToDigiConverter::RunCommon().

19 {
20  pair<CounterMap::iterator, bool> ret;
21 
22  vector<TotemFramePosition> list;
23  list.push_back(fr);
24  ret = relationMap.insert(pair<word, vector<TotemFramePosition> >(counter, list));
25  if (ret.second == false)
26  relationMap[counter].push_back(fr);
27 }
unsigned short word
static std::atomic< unsigned int > counter
CounterMap relationMap
counter value -> list of frames with this value
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

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

Referenced by Analyze().

std::string CounterChecker::name
private

the name of this check, used in error messages

Definition at line 72 of file CounterChecker.h.

Referenced by ElectronMVAID.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__(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), Analyze(), 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(), Vispa.Views.PropertyView.Property::valueChanged(), counter.Counter::write(), and average.Average::write().

CounterMap CounterChecker::relationMap
private

counter value -> list of frames with this value

Definition at line 66 of file CounterChecker.h.

Referenced by Analyze().

CheckerType CounterChecker::type
private
unsigned int CounterChecker::verbosity
private

level of verbosity

Definition at line 82 of file CounterChecker.h.

Referenced by Analyze().