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

#include <HLTMETStatus.h>

Inheritance diagram for dqm_algorithms::HLTMETStatus:
Collaboration diagram for dqm_algorithms::HLTMETStatus:

Public Member Functions

 HLTMETStatus ()
 
HLTMETStatusclone ()
 
dqm_core::Resultexecute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
 
void printDescription (std::ostream &out)
 

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 20 of file HLTMETStatus.h.

Constructor & Destructor Documentation

◆ HLTMETStatus()

dqm_algorithms::HLTMETStatus::HLTMETStatus ( )

Definition at line 35 of file HLTMETStatus.cxx.

37 {
38  dqm_core::AlgorithmManager::instance().registerAlgorithm("AlgHLTMETStatus", this);
39 }

Member Function Documentation

◆ clone()

dqm_algorithms::HLTMETStatus * dqm_algorithms::HLTMETStatus::clone ( )

Definition at line 42 of file HLTMETStatus.cxx.

43 {
44 
45  return new HLTMETStatus();
46 }

◆ execute()

dqm_core::Result * dqm_algorithms::HLTMETStatus::execute ( const std::string &  name,
const TObject &  object,
const dqm_core::AlgorithmConfig &  config 
)

Definition at line 50 of file HLTMETStatus.cxx.

53 {
54  const TH1 * histogram;
55 
56  if( object.IsA()->InheritsFrom( "TH1" ) ) {
57  histogram = static_cast<const TH1*>(&object);
58  if (histogram->GetDimension() > 2 ){
59  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
60  }
61  } else {
62  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
63  }
65  // Get Green and Red Thresholds
66  double grThr = 0.05, reThr = 0.1; // Green and Red thresholds
67  try {
68  grThr = dqm_algorithms::tools::GetFromMap("Threshold",config.getGreenThresholds() );
69  reThr = dqm_algorithms::tools::GetFromMap("Threshold",config.getRedThresholds() );
70  } catch ( dqm_core::Exception & ex ) {
71  throw dqm_core::BadConfig(ERS_HERE,name,"Paramter: 'Threshold' is mandatory, cannot continue");
72  }
73 
74  //non sense case: compare fraction and threshold >100%
75  if ((grThr>1.0 || reThr>1.0) ) {
76  throw dqm_core::BadConfig(ERS_HERE,m_name,"Configuration Error: Threshold should be between [0.0, 1.0] 10% => 0.1");
77  }
78 
79 
81  // Get Parameters
82  size_t ntotBins = (size_t) histogram -> GetNbinsX();
83 
84  // read thresholds
85  size_t colflags[4];
86  colflags[0] = static_cast<size_t>(dqm_algorithms::tools::GetFirstFromMap("METYellowMin", config.getParameters(), 1));
87  colflags[1] = static_cast<size_t>(dqm_algorithms::tools::GetFirstFromMap("METYellowMax", config.getParameters(), ntotBins));
88  colflags[2] = static_cast<size_t>(dqm_algorithms::tools::GetFirstFromMap("METRedMin", config.getParameters(), 1));
89  colflags[3] = static_cast<size_t>(dqm_algorithms::tools::GetFirstFromMap("METRedMax", config.getParameters(), ntotBins));
90  // read options
91  bool doflags[2];
92  doflags[0] = static_cast<bool>(dqm_algorithms::tools::GetFirstFromMap("DoYellowFlag", config.getParameters(), 1));
93  doflags[1] = static_cast<bool>(dqm_algorithms::tools::GetFirstFromMap("DoRedFlag", config.getParameters(), 1));
94 
96  colflags[0] = ((colflags[0] > 0) && (colflags[0] <= ntotBins)) ? colflags[0] : 1;
97  colflags[1] = ((colflags[1] >= colflags[0]) && (colflags[1] <= ntotBins)) ? colflags[1] : ntotBins;
98  colflags[2] = ((colflags[2] > 0) && (colflags[2] <= ntotBins)) ? colflags[2] : 1;
99  colflags[3] = ((colflags[3] >= colflags[2]) && (colflags[3] <= ntotBins)) ? colflags[3] : ntotBins;
100  bool yellowLo2HiEmpty = true, redLo2HiEmpty = true;
101  int ycnt = 0, rcnt = 0;
102 
103  // we fill 1(error) or 0(no-error) for each bin for every event
104  // therefore we have to divide #of entries by #of bins
105  // to get the #of events
106  double nentries = histogram -> GetEntries();
107  double nevtstot = 1.; // no. of events
108  if(!std::isnan(nentries/ntotBins) || !std::isinf(nentries / ntotBins)) nevtstot = nentries/ntotBins;
109 
110  // yellow flag
111  double theYFracMax = -9., theRFracMax = -9.;
112  if(doflags[0]) {
113  for( size_t j = colflags[0]; j <= colflags[1]; j++ ) {
114  // if at least one of the bins > 0 : flag = YELLOW
115  double thebinc = histogram -> GetBinContent(j);
116  // fraction of events having this error-bit set
117  double thefrac = thebinc / nevtstot;
118 
119  // "Worst-case flag not to exceed YELLOW" flag:
120  // if threshold exceeds green threshold, set yellow
121  // if threshold exceeds red threshold, still set yellow
122  // reThr > grThr
123  if(thefrac > grThr) {
124  if(theYFracMax < thefrac) theYFracMax = thefrac;
125  yellowLo2HiEmpty = false;
126  ycnt ++;
127  }
128  }
129  }
130 
131  // red flag
132  if(doflags[1]) {
133  for( size_t j = colflags[2]; j <= colflags[3]; j++ ) {
134  // if at least one of the bins > 0 : flag = RED
135  double thebinc = histogram -> GetBinContent(j);
136  // fraction of events having this error-bit set
137  double thefrac = thebinc / nevtstot;
138  if(thefrac > reThr) {
139  if(theRFracMax < thefrac) theRFracMax = thefrac;
140  redLo2HiEmpty = false;
141  rcnt++;
142  }
143  }
144  }
145 
146  // set results
147  result->status_ = dqm_core::Result::Green;
148 
149  if(doflags[0] && !yellowLo2HiEmpty) {
150  result->status_ = dqm_core::Result::Yellow;
151  }
152 
153  if(doflags[1] && !redLo2HiEmpty) {
154  result->status_ = dqm_core::Result::Red;
155  }
156 
157  result->tags_["NumOfStatusBitsYellow"] = ycnt;
158  result->tags_["EventFractionYellow"] = theYFracMax;
159  result->tags_["NumOfStatusBitsRed"] = rcnt;
160  result->tags_["EventFractionRed"] = theRFracMax;
161 
163 
164  return result;
165 }

◆ printDescription()

void dqm_algorithms::HLTMETStatus::printDescription ( std::ostream &  out)

Definition at line 168 of file HLTMETStatus.cxx.

169 {
170 
171  out<<"HLT MET Status: Of the 32 status bits, check if any subset of bits are set. If so, flag YELLOW" << std::endl;
172  out<<"Bit #32 is global error bit, if set flag RED." << std::endl;
173 
174  out<<"Mandatory parameter: XBin: The label of the X bin that you would like to check\n"<<std::endl;
175 
176 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::HLTMETStatus::m_name
private

Definition at line 31 of file HLTMETStatus.h.


The documentation for this struct was generated from the following files:
dqm_algorithms::HLTMETStatus::HLTMETStatus
HLTMETStatus()
Definition: HLTMETStatus.cxx:35
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
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition: TRTCalib_makeplots.cxx:4019
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
dqm_algorithms::HLTMETStatus::m_name
std::string m_name
Definition: HLTMETStatus.h:31
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
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::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
histogram
std::string histogram
Definition: chains.cxx:52