CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
utils.StatisticalTest Class Reference
Inheritance diagram for utils.StatisticalTest:
utils.BinToBin utils.BinToBin1percent utils.Chi2 utils.KS

Public Member Functions

def __init__ (self, threshold)
 
def do_test (self)
 
def get_rank (self)
 
def get_status (self)
 
def set_operands (self, h1, h2)
 

Public Attributes

 h1
 
 h2
 
 is_init
 
 name
 
 rank
 2D! return test_codes["2D"] More...
 
 threshold
 

Detailed Description

Definition at line 109 of file utils.py.

Constructor & Destructor Documentation

def utils.StatisticalTest.__init__ (   self,
  threshold 
)

Definition at line 110 of file utils.py.

110  def __init__(self,threshold):
111  self.name=""
112  self.h1=None
113  self.h2=None
114  self.threshold=float(threshold)
115  self.rank=-1
116  self.is_init=False
117 
def __init__(self, threshold)
Definition: utils.py:110
rank
2D! return test_codes["2D"]
Definition: utils.py:115

Member Function Documentation

def utils.StatisticalTest.do_test (   self)

Definition at line 172 of file utils.py.

Referenced by utils.StatisticalTest.get_rank().

172  def do_test(self):
173  pass
174 
175 #-------------------------------------------------------------------------------
176 
def do_test(self)
Definition: utils.py:172
def utils.StatisticalTest.get_rank (   self)

Definition at line 122 of file utils.py.

References utils.StatisticalTest.do_test(), utils.getNbins(), FitSlicesYTool.h1, ConfigurableHisto.h1, DQMSourceExample.h1, utils.StatisticalTest.h1, PlotAlignmentValidation::DMRPlotInfo.h1, FitSlicesYTool.h2, EgammaTowerIsolationNew< NC >::Sum.h2, ConfigurableHisto.h2, DQMSourceExample.h2, EgammaTowerIsolationNew< NC >.h2, utils.StatisticalTest.h2, PlotAlignmentValidation::DMRPlotInfo.h2, utils.is_empty(), utils.StatisticalTest.is_init, utils.StatisticalTest.rank, l1t::EMTFTrack.rank, and dirstructure.Comparison.rank.

Referenced by utils.StatisticalTest.get_status().

122  def get_rank(self):
123  if not self.is_init:
124  if self.rank < 0:
125  type1=type(self.h1)
126  type2=type(self.h2)
127  if (type1 != type2):
128  logger(1,"*** ERROR: object types in comparison don't match: %s!=%s" %(type1,type2))
129  self.rank=test_codes["DIFF_TYPES"]
130  elif not self.h2.InheritsFrom("TH1"):
131  logger(1,"*** ERROR: object type is not histogram but a %s" %(type1))
132  self.rank=test_codes["NO_HIST"]
133  # if histos are empty
134  #elif self.h1.InheritsFrom("TH2") and not "BinToBin" in self.name:
135  ## 2D!
136  #return test_codes["2D"]
137  else:
138  is_empty1=is_empty(self.h1)
139  is_empty2=is_empty(self.h2)
140  are_empty=is_empty1 and is_empty2
141  one_empty=is_empty1 or is_empty2
142 
143  Nbins1= getNbins(self.h1)
144  Nbins2= getNbins(self.h2)
145 
146  if are_empty:
147  #return -103
148  # Conversation with JeanRoch and David 5 April
149  return 1
150  elif one_empty:
151  # Due conversation with Giovanni on 2015-09-10
152  return 0
153 
154  # if histos have different number of bins
155  if Nbins1!=Nbins2:
156  return test_codes["DIFF_BIN"]
157 
158  self.rank=self.do_test()
159  self.is_init=True
160  return self.rank
161 
def get_rank(self)
Definition: utils.py:122
def do_test(self)
Definition: utils.py:172
Definition: logger.py:1
def getNbins(h)
Definition: utils.py:92
def is_empty(h)
Definition: utils.py:177
rank
2D! return test_codes["2D"]
Definition: utils.py:115
def utils.StatisticalTest.get_status (   self)

Definition at line 162 of file utils.py.

References utils.StatisticalTest.get_rank(), ElectronMVAID.ElectronMVAID.name, average.Average.name, counter.Counter.name, histograms.Histograms.name, AlignableObjectId::entry.name, FWLite.ElectronMVAID.name, TmModule.name, cond::persistency::TAG::NAME.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, core.autovars.NTupleVariable.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::RELEASE.name, MEPSet.name, cond::persistency::TAG::END_OF_VALIDITY.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, cond::persistency::TAG::INSERTION_TIME.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::MODIFICATION_TIME.name, FWTGeoRecoGeometry::Info.name, preexistingValidation.PreexistingValidation.name, OutputMEPSet.name, EventStringOutputBranches::NamedBranchPtr.name, SummaryTableOutputBranches::NamedBranchPtr.name, dataset.BaseDataset.name, fit::RootMinuitCommand.name, PrintSensitive.name, personalPlayback.Applet.name, Types._Untracked.name, ParameterSet.name, PixelDCSObject< T >::Item.name, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.name, DQMRivetClient::LumiOption.name, MagCylinder.name, analyzer.Analyzer.name, production_tasks.Task.name, CharmTagger::MVAVar.name, HcalForwardLibWriter::FileHandle.name, TriggerOutputBranches::NamedBranchPtr.name, ParSet.name, TableOutputBranches::NamedBranchPtr.name, edm::PathTimingSummary.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, RHStopTracer::StopPoint.name, PhysicsTools::Source.name, SingleObjectCondition.name, cond::persistency::GTProxyData.name, MyWatcher.name, core.autovars.NTupleObjectType.name, edm::PathSummary.name, lumi::TriggerInfo.name, cond::TimeTypeSpecs.name, alignment.Alignment.name, PixelEndcapLinkMaker::Item.name, dirstructure.Weighted.name, perftools::EdmEventSize::BranchRecord.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, DQMGenericClient::EfficOption.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, MEtoEDM< T >::MEtoEDMObject.name, cms::DDAlgoArguments.name, ExpressionHisto< T >.name, CaloTrkProcessing::Detector.name, PrintMaterialBudgetInfo.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, python.rootplot.utilities.Hist2D.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, PrintGeomInfoAction.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::VERSION.name, options.ConnectionHLTMenu.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, MVAVar.name, DisplayManager.DisplayManager.name, DQMGenericClient::ProfileOption.name, dqmoffline::l1t::HistDefinition.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, FWLite.WorkingPoints.name, DQMGenericClient::NormOption.name, BTagProbabilityToDiscriminator::Discriminator.name, emtf::Node.name, FastHFShowerLibrary.name, h4DSegm.name, PhysicsTools::Calibration::Variable.name, PhysicsTools::Variable::Value.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, DQMGenericClient::CDOption.name, TriggerObjectTableProducer::SelectedObject.name, CounterChecker.name, TrackerSectorStruct.name, cond::TagInfo_t.name, ProcTMVA::Method.name, TreeSaver::Var.name, DQMGenericClient::NoFlowOption.name, looper.Looper.name, python.rootplot.tree2hists.Plot.name, cond::persistency::IOV::TAG_NAME.name, EDMtoMEConverter.name, cond::persistency::IOV::SINCE.name, Mapper::definition< ScannerT >.name, cond::persistency::IOV::PAYLOAD_HASH.name, PhysicsTools::TreeReader::Value.name, classes.MonitorData.name, cond::persistency::IOV::INSERTION_TIME.name, HistogramManager.name, PhysicsTools::TrainProcessor.name, MuonGeometrySanityCheckPoint.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, PhysicsTools::MVATrainer.name, options.HLTProcessOptions.name, utils.StatisticalTest.name, h2DSegm.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, nanoaod::FlatTable::Column.name, geometry.Structure.name, config.Analyzer.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, NanoAODDQM::SelGroupConfig.name, SiStripMonitorDigi.name, core.autovars.NTupleObject.name, public_plots_tools.ColorScheme.name, PhysicsTools::Variable.name, config.Service.name, cond::persistency::TAG_LOG::TAG_NAME.name, cond::persistency::TAG_LOG::EVENT_TIME.name, cond::persistency::TAG_LOG::USER_NAME.name, cond::persistency::TAG_LOG::HOST_NAME.name, cond::persistency::TAG_LOG::COMMAND.name, cond::persistency::TAG_LOG::ACTION.name, PhysicsTools::TrainerMonitoring::Object.name, cond::persistency::TAG_LOG::USER_TEXT.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.name, personalPlayback.FrameworkJob.name, plotscripts.SawTeethFunction.name, dirstructure.Comparison.name, dqm_interfaces.DirID.name, python.rootplot.utilities.RootFile.name, crabFunctions.CrabTask.name, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, dqm_interfaces.DirWalkerFile.name, Id.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, utils.StatisticalTest.rank, l1t::EMTFTrack.rank, dirstructure.Comparison.rank, muonisolation::Cuts::CutSpec.threshold, EcalTPGFineGrainStripEE::Item.threshold, GaussNoiseFP420.threshold, SiGaussianTailNoiseAdder.threshold, JetVertexMain.threshold, HLTLogMonitorFilter::CategoryEntry.threshold, SingleObjectCondition.threshold, MatchJet.threshold, FastLineRecognition.threshold, CondFormats_ESObjects::dictionary.threshold, SingleObjectTrigger.threshold, TotemRPUVPatternFinder.threshold, MuIsolatorResultProducer< BT >::DepositConf.threshold, edm::service::MessageLoggerDefaults::Category.threshold, edm::service::MessageLoggerDefaults::Destination.threshold, edm::MessageLoggerQ.threshold, EcalEBTrigPrimTestAlgo.threshold, utils.StatisticalTest.threshold, edm::service::ELdestination.threshold, SiStripHitEffFromCalibTree.threshold, and EcalTrigPrimFunctionalAlgo.threshold.

162  def get_status(self):
163  status = SUCCESS
164  if self.get_rank()<0:
165  status=NULL
166  logger(0,"+++ Test %s FAILED: rank is %s and threshold is %s ==> %s" %(self.name, self.rank, self.threshold, status))
167  elif self.get_rank() < self.threshold:
168  status=FAIL
169  logger(0,"+++ Test %s: rank is %s and threshold is %s ==> %s" %(self.name, self.rank, self.threshold, status))
170  return status
171 
def get_status(self)
Definition: utils.py:162
def get_rank(self)
Definition: utils.py:122
Definition: logger.py:1
rank
2D! return test_codes["2D"]
Definition: utils.py:115
def utils.StatisticalTest.set_operands (   self,
  h1,
  h2 
)

Member Data Documentation

utils.StatisticalTest.h1
utils.StatisticalTest.h2
utils.StatisticalTest.is_init

Definition at line 116 of file utils.py.

Referenced by utils.StatisticalTest.get_rank().

utils.StatisticalTest.name
utils.StatisticalTest.rank

2D! return test_codes["2D"]

Definition at line 115 of file utils.py.

Referenced by utils.StatisticalTest.get_rank(), and utils.StatisticalTest.get_status().

utils.StatisticalTest.threshold

Definition at line 114 of file utils.py.

Referenced by utils.StatisticalTest.get_status().