ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
dqm_algorithms::CTP_AllBinsAreEmptyExceptZero Class Reference

#include <CTP_AllBinsAreEmptyExceptZero.h>

Inheritance diagram for dqm_algorithms::CTP_AllBinsAreEmptyExceptZero:
Collaboration diagram for dqm_algorithms::CTP_AllBinsAreEmptyExceptZero:

Public Member Functions

 CTP_AllBinsAreEmptyExceptZero ()
 
virtual ~CTP_AllBinsAreEmptyExceptZero ()=default
 
virtual dqm_core::Algorithm * clone () override
 
virtual dqm_core::Resultexecute (const std::string &name, const TObject &data, const dqm_core::AlgorithmConfig &config) override
 
virtual void printDescription (std::ostream &out)
 

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 15 of file CTP_AllBinsAreEmptyExceptZero.h.

Constructor & Destructor Documentation

◆ CTP_AllBinsAreEmptyExceptZero()

dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::CTP_AllBinsAreEmptyExceptZero ( )

Definition at line 34 of file CTP_AllBinsAreEmptyExceptZero.cxx.

35  : m_name("CTP_AllBinsAreEmptyExceptZero")
36 {
37  dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
38 }

◆ ~CTP_AllBinsAreEmptyExceptZero()

virtual dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::~CTP_AllBinsAreEmptyExceptZero ( )
virtualdefault

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::clone ( )
overridevirtual

Definition at line 41 of file CTP_AllBinsAreEmptyExceptZero.cxx.

42 {
43  return new CTP_AllBinsAreEmptyExceptZero(*this);
44 }

◆ execute()

dqm_core::Result * dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::execute ( const std::string &  name,
const TObject &  data,
const dqm_core::AlgorithmConfig &  config 
)
overridevirtual

Definition at line 48 of file CTP_AllBinsAreEmptyExceptZero.cxx.

49 {
50  using namespace std;
51 
52  const TH1 *hist;
53 
54  if(object.IsA()->InheritsFrom( "TH1" )) {
55  hist = static_cast<const TH1*>( &object );
56  if (hist->GetDimension() > 1 ){
57  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 1 " );
58  }
59  } else {
60  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
61  }
62 
63  //Get Parameters and Thresholds
64  double threshold = 0;
65 
66  try {
67  threshold = dqm_algorithms::tools::GetFirstFromMap("threshold", config.getParameters(), 0);
68  }
69  catch ( dqm_core::Exception & ex ) {
70  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
71  }
72 
73  //Algo
75  std::map<std::string,double> tags; //defined in https://gitlab.cern.ch/atlas-tdaq-software/dqm_core/-/blob/master/dqm_core/Result.h
76 
77  //assume all good, until find a bad one
79  int nbinsx = hist->GetXaxis()->GetNbins();
80  int badBins = 0;
81 
82  for(int iBin = 1; iBin <= nbinsx-1; ++iBin) //foreach bin of the projection (0=underflow)
83  {
84  // If bin content is nonzero, and 0 does not lie in between bin edges
85  if( hist->GetBinContent(iBin) > threshold && hist->GetBinLowEdge(iBin) * hist->GetBinLowEdge(iBin+1) > 0 )
86  {
87  result->status_ = dqm_core::Result::Red;
88  ++ badBins;
89  }
90  }
91  tags["# Bad bins"] = badBins;
92 
93  //set the result tags
94  result->tags_ = tags;
95 
96  // Return the result
97  return result;
98 }

◆ printDescription()

void dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::printDescription ( std::ostream &  out)
virtual

Definition at line 102 of file CTP_AllBinsAreEmptyExceptZero.cxx.

102  {
103  std::string message;
104  message += "\n";
105  message += "Algorithm: \"" + m_name + "\"\n";
106  message += "Description: Check that the only non-empty bin is the one centered in zero.\n";
107  out << message;
108 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::m_name
private

Definition at line 27 of file CTP_AllBinsAreEmptyExceptZero.h.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
plotmaker.hist
hist
Definition: plotmaker.py:148
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ReweightUtils.message
message
Definition: ReweightUtils.py:15
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
tags
std::vector< std::string > tags
Definition: hcg.cxx:102
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::CTP_AllBinsAreEmptyExceptZero
CTP_AllBinsAreEmptyExceptZero()
Definition: CTP_AllBinsAreEmptyExceptZero.cxx:34
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
threshold
Definition: chainparser.cxx:74
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::m_name
std::string m_name
Definition: CTP_AllBinsAreEmptyExceptZero.h:27
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339