ATLAS Offline Software
BasicGraphCheck.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 <TGraph.h>
13 #include <TClass.h>
14 #include <ers/ers.h>
15 
16 #include <dqm_core/AlgorithmManager.h>
17 
18 namespace
19 {
20  dqm_algorithms::BasicGraphCheck GraphFilling( "Graph_Not_Empty" );
21  dqm_algorithms::BasicGraphCheck GraphEmpty( "Graph_Empty" );
22 
23 }
24 
25 
27  : m_name( name )
28 {
29  dqm_core::AlgorithmManager::instance().registerAlgorithm(name, this);
30 }
31 
34 {
35 
36  return new BasicGraphCheck( m_name );
37 }
38 
39 
42  const TObject & object,
43  const dqm_core::AlgorithmConfig & config)
44 {
45  const TGraph * graph;
46 
47  if( object.IsA()->InheritsFrom( "TGraph" ) ) {
48  graph = static_cast<const TGraph*>(&object);
49  } else {
50  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TGraph" );
51  }
52 
53  double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1 );
54 
55  if (graph->GetN() < minstat ) {
57  result->tags_["InsufficientN"] = graph->GetN();
58  return result;
59  }
60 
61  if (m_name == "Graph_Not_Empty") {
62  if (graph->GetN() != 0) {
63  ERS_DEBUG(1, "Graph " <<graph->GetName()<<" is Not Empty");
65  }else {
66  ERS_DEBUG(1, "Graph " <<graph->GetName()<<" is Empty");
68  }
69  } else if (m_name == "Graph_Empty") {
70  if (graph->GetN() == 0) {
71  ERS_DEBUG(1, "Graph " <<graph->GetName()<<" is Empty");
73  }else {
74  ERS_DEBUG(1, "Graph " <<graph->GetName()<<" is Not Empty");
76  }
77  } else {
78  return new dqm_core::Result();
79  }
80 
81 
82 }
83 
84 void
86 {
87  if ( m_name == "Graph_Not_Empty"){
88  out<<"Graph_Not_Empty: Checks that graph is not empty\n"<<std::endl;
89  } else if ( m_name == "Graph_Empty"){
90  out<<"Graph_Empty: Checks that graph is empty\n"<<std::endl;
91  }
92 
93  out<<"Optional Parameter: MinStat: Minimum graph statistics needed to perform Algorithm\n"<<std::endl;
94 }
95 
dqm_algorithms::BasicGraphCheck::BasicGraphCheck
BasicGraphCheck(const std::string &name)
Definition: BasicGraphCheck.cxx:26
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
dqm_algorithms::BasicGraphCheck
Definition: BasicGraphCheck.h:19
dqm_algorithms::BasicGraphCheck::printDescription
void printDescription(std::ostream &out)
Definition: BasicGraphCheck.cxx:85
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
dqm_algorithms::BasicGraphCheck::clone
BasicGraphCheck * clone()
Definition: BasicGraphCheck.cxx:33
dqm_algorithms::BasicGraphCheck::execute
dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition: BasicGraphCheck.cxx:41
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
BasicGraphCheck.h