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

#include <MDTPercentUnderThresh.h>

Inheritance diagram for dqm_algorithms::MDTPercentUnderThresh:
Collaboration diagram for dqm_algorithms::MDTPercentUnderThresh:

Public Member Functions

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

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 16 of file MDTPercentUnderThresh.h.

Constructor & Destructor Documentation

◆ MDTPercentUnderThresh()

dqm_algorithms::MDTPercentUnderThresh::MDTPercentUnderThresh ( )

Definition at line 37 of file MDTPercentUnderThresh.cxx.

38  : m_name("MDTpercent_under_thresh")
39 {
40  dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
41 }

◆ ~MDTPercentUnderThresh()

dqm_algorithms::MDTPercentUnderThresh::~MDTPercentUnderThresh ( )
virtual

Definition at line 44 of file MDTPercentUnderThresh.cxx.

45 {
46 }

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::MDTPercentUnderThresh::clone ( )
virtual

Definition at line 50 of file MDTPercentUnderThresh.cxx.

51 {
52  return new MDTPercentUnderThresh(*this);
53 }

◆ execute()

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

Definition at line 57 of file MDTPercentUnderThresh.cxx.

58 {
59  const TH1 * hist;
60 
61  if( object.IsA()->InheritsFrom( "TH1" ) ) {
62  hist = static_cast<const TH1*>(&object);
63  if (hist->GetDimension() >= 2 ){
64  throw dqm_core::BadConfig( ERS_HERE, name, "dimension >= 2 " );
65  }
66  } else {
67  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
68  }
69 
70  //Get Parameters and Thresholds
71  double minstat;
72  double thresh;
73  double greenTh;
74  double redTh;
75  try {
76  thresh = dqm_algorithms::tools::GetFirstFromMap( "Thresh", config.getParameters());
77  minstat = dqm_algorithms::tools::GetFirstFromMap("MinStat", config.getParameters(), 0);
78  redTh = dqm_algorithms::tools::GetFromMap( "Percent", config.getRedThresholds());
79  greenTh = dqm_algorithms::tools::GetFromMap( "Percent", config.getGreenThresholds() );
80  }
81  catch ( dqm_core::Exception & ex ) {
82  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
83  }
84 
85  //Check of statistics
86  if (hist->GetEntries() < minstat ) {
87  ERS_INFO("Histogram does not satisfy MinStat requirement " <<hist->GetName());
89  result->tags_["InsufficientEntries"] = hist->GetEntries();
90  return result;
91  }
92  ERS_DEBUG(1,"Statistics: "<< hist->GetEntries()<< " entries ");
93 
94  //Algo
95 
96  Double_t hit_under_th=0;
97 
98  Double_t N = hist->GetEntries();
99 
100  if(N == 0) {
102  result->tags_["Empty_Histogram_found_N_Entries"] = N;
104  return result;
105  };
106 
107  int i=0;
108 
109  do{
110  i++;
111  if(i>hist->GetNbinsX()){
113  result->tags_["Config_error_maximum_bin_exceed_looking_for_bin_number"] = i;
115  return result;
116  };
117  hit_under_th += hist->GetBinContent(i);
118  }while(hist->GetBinCenter(i)<thresh);
119 
120  double percent = 100 - 100*((double) hit_under_th)/((double) N);
121 
122  //Result
123 
125  result->tags_["Entries_above_thresh(%)"] = percent;
126 
127  if( percent >= greenTh ) {
128  result->status_ = dqm_core::Result::Green;
129  }
130  else if( percent <greenTh && percent>redTh ) {
131  result->status_ = dqm_core::Result::Yellow;
132  }
133  else {
134  result->status_ = dqm_core::Result::Red;
135  }
136 
137  // Return the result
138  return result;
139 }

◆ printDescription()

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

Definition at line 143 of file MDTPercentUnderThresh.cxx.

143  {
144  std::string message;
145  message += "\n";
146  message += "Algorithm: \"" + m_name + "\"\n";
147  message += "Description: Compute the percent of entries above a threshold and and compare it with user defined green and red Threshold\n";
148  message += "Mandatory Parameters: Green/Red Threshold: Percent: Percent of the entries above threshold requested";
149  message += "Optional Parameters: MinStat = Minimum histogram statistics needed to perform Algorithm\n";
150  message += " thresh = threshold\n";
151  message += "\n";
152 
153  out << message;
154 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::MDTPercentUnderThresh::m_name
private

Definition at line 28 of file MDTPercentUnderThresh.h.


The documentation for this class was generated from the following files:
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
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:35
EvoMonitoring.percent
def percent(a, b)
Definition: EvoMonitoring.py:33
plotmaker.hist
hist
Definition: plotmaker.py:148
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
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
lumiFormat.i
int i
Definition: lumiFormat.py:92
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TH1
Definition: rootspy.cxx:268
dqm_algorithms::MDTPercentUnderThresh::MDTPercentUnderThresh
MDTPercentUnderThresh()
Definition: MDTPercentUnderThresh.cxx:37
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::MDTPercentUnderThresh::m_name
std::string m_name
Definition: MDTPercentUnderThresh.h:28
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339