ATLAS Offline Software
BasicHistoCheckModuleStatus.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <dqm_core/AlgorithmConfig.h>
12 #include <TH1.h>
13 #include <TF1.h>
14 #include <TClass.h>
15 #include <ers/ers.h>
16 
17 #include <dqm_core/AlgorithmManager.h>
18 
19 namespace
20 {
21  dqm_algorithms::BasicHistoCheckModuleStatus BinsFilled( "ModuleStatus_All_Bins_Filled" );
22 
23 }
24 
25 
27  : m_name( name )
28 {
29  dqm_core::AlgorithmManager::instance().registerAlgorithm(name, this);
30 }
31 
34 {
35 
36  return new BasicHistoCheckModuleStatus( m_name );
37 }
38 
39 
42  const TObject & object,
43  const dqm_core::AlgorithmConfig & config)
44 {
45  const TH1 * histogram;
46 
47  if( object.IsA()->InheritsFrom( "TH1" ) ) {
48  histogram = static_cast<const TH1*>(&object);
49  if (histogram->GetDimension() > 3 ){
50  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 3 " );
51  }
52  } else {
53  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
54  }
55 
56  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
57 
58  if (histogram->GetEntries() < minstat ) {
60  result->tags_["InsufficientEntries"] = histogram->GetEntries();
61  return result;
62  }
63 
64 
65 
66  if ( m_name == "ModuleStatus_All_Bins_Filled" ) {
67  unsigned int nbinsX_filled = 0;
68  const unsigned int binsx = histogram->GetNbinsX();
69  //const unsigned int binsy = histogram->GetNbinsY();
70  //const unsigned int binsz = histogram->GetNbinsZ();
71  for ( unsigned int i(1); i <= binsx; ++i ) {
72  //for ( unsigned int j(1); j <= binsy; ++j ) {
73  //for ( unsigned int k(1); k<= binsz; ++k ) {
74  double content= histogram -> GetBinContent(i);
75  if ( content == 0) {
76  // ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has empty bins");
77 // return new dqm_core::Result(dqm_core::Result::Red);
78 
79  nbinsX_filled++;
80  }
81 
82  }
83 
84  if(histogram->GetEffectiveEntries() == 0){
85 
86  ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" does not have all filled bins");
87  return new dqm_core::Result(dqm_core::Result::Disabled);
88 
89  }
90 
91 
92  if(nbinsX_filled >0 && nbinsX_filled < binsx){
93  ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has empty bins");
95  }
96 
97 
98  ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has all filled bins");
100 
101  }
102 
103  else {
104  return new dqm_core::Result();
105  }
106 
107 
108 }
109 
110 void
112 {
113  if ( m_name == "All_Bins_Filled"){
114  out<<"All_Bins_Filled: Checks that all bins of histogram are filled\n"<<std::endl;
115  }
116 
117  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;
118 }
119 
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
dqm_algorithms::BasicHistoCheckModuleStatus::printDescription
void printDescription(std::ostream &out)
Definition: BasicHistoCheckModuleStatus.cxx:111
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
grepfile.content
string content
Definition: grepfile.py:56
lumiFormat.i
int i
Definition: lumiFormat.py:85
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
dqm_algorithms::BasicHistoCheckModuleStatus::clone
BasicHistoCheckModuleStatus * clone()
Definition: BasicHistoCheckModuleStatus.cxx:33
dqm_algorithms::BasicHistoCheckModuleStatus::execute
dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition: BasicHistoCheckModuleStatus.cxx:41
dqm_algorithms::BasicHistoCheckModuleStatus::BasicHistoCheckModuleStatus
BasicHistoCheckModuleStatus(const std::string &name)
Definition: BasicHistoCheckModuleStatus.cxx:26
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AlgorithmHelper.h
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
BasicHistoCheckModuleStatus.h
histogram
std::string histogram
Definition: chains.cxx:52
dqm_algorithms::BasicHistoCheckModuleStatus
Definition: BasicHistoCheckModuleStatus.h:19