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

#include <SideBand_Relative.h>

Inheritance diagram for dqm_algorithms::SideBand_Relative:
Collaboration diagram for dqm_algorithms::SideBand_Relative:

Public Member Functions

 SideBand_Relative ()
 
virtual SideBandclone ()
 
virtual dqm_core::Resultexecute (const std::string &, const TObject &obj, const dqm_core::AlgorithmConfig &conf)
 
void printDescription (std::ostream &out)
 

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 16 of file SideBand_Relative.h.

Constructor & Destructor Documentation

◆ SideBand_Relative()

dqm_algorithms::SideBand_Relative::SideBand_Relative ( )
inline

Definition at line 18 of file SideBand_Relative.h.

18 : SideBand("SideBand_Relative") {};

Member Function Documentation

◆ clone()

dqm_algorithms::SideBand * dqm_algorithms::SideBand::clone ( )
virtualinherited

Definition at line 30 of file SideBand.cxx.

30  {
31  return new SideBand( m_name );
32 }

◆ execute()

dqm_core::Result * dqm_algorithms::SideBand::execute ( const std::string &  name,
const TObject &  obj,
const dqm_core::AlgorithmConfig &  conf 
)
virtualinherited

Definition at line 34 of file SideBand.cxx.

37 {
38  const TH1* histo;
39  if ( obj.IsA()->InheritsFrom("TH2") || obj.IsA()->InheritsFrom("TH3") )
40  {
41  throw dqm_core::BadConfig( ERS_HERE , name , " dimension > 1 ");
42  }
43  if ( obj.IsA()->InheritsFrom("TH1") )
44  {
45  ERS_DEBUG(2,"Got TH1 called: "<<obj.GetName()<<" of type:"<<obj.IsA()->GetName());
46  histo=static_cast<const TH1*>(&obj);
47  }
48  else
49  {
50  throw dqm_core::BadConfig( ERS_HERE ,name , " does not inherit from TH1");
51  }
52  // Configure the DQ algorithm
53  const bool UseUnderFlow = static_cast<bool>(dqm_algorithms::tools::GetFirstFromMap("UseUnderFlow", config.getParameters(), 0));
54  const bool UseOverFlow = static_cast<bool>(dqm_algorithms::tools::GetFirstFromMap("UseOverFlow", config.getParameters(), 0));
55  // the following is a duplicate of dqm_algorithms::tools::GetBinRange, but with different parameter names
56  const double notFound = -99999;
57  const double xmin = dqm_algorithms::tools::GetFirstFromMap("Min", config.getParameters(), notFound);
58  const double xmax = dqm_algorithms::tools::GetFirstFromMap("Max", config.getParameters(), notFound);
59  const int minbin = (xmin == notFound) ? 1 : histo->GetXaxis()->FindBin(xmin);
60  const int maxbin = (xmax == notFound) ? histo->GetNbinsX() : histo->GetXaxis()->FindBin(xmax);
61 
62  double grThr, reThr; // Green and Red thresholds
63  try
64  {
65  grThr = dqm_algorithms::tools::GetFromMap("Threshold",config.getGreenThresholds() );
66  reThr = dqm_algorithms::tools::GetFromMap("Threshold",config.getRedThresholds() );
67  }
68  catch ( dqm_core::Exception & ex )
69  {
70  throw dqm_core::BadConfig(ERS_HERE,name,"Paramter: 'Threshold' is mandatory, cannot continue");
71  }
72 
73  if ( m_name== "SideBand_Relative" && (grThr>1.0 || reThr>1.0) )
74  //non sense case: compare fraction and threshold >100%
75  {
76  throw dqm_core::BadConfig(ERS_HERE,m_name,"Configuration Error: Threshold>100%");
77  }
78 #if DEBUG_LEVEL > 1
79  std::stringstream configuration;
80  configuration
81  << " - UseUnderFlow = " << UseUnderFlow << " - UseOverFlow = " << UseOverFlow
82  << " - Min = " << xmin << " - Max = " << xmax
83  << " - Green Threshold = " << grThr << " - Red Threshold = " << reThr;
84  ERS_DEBUG(2,"Configuration:"<<configuration.str());
85 #endif
86  // Just a translation in something more readable...
87  const bool AbsoluteValue = ( m_name == "SideBand_Absolute" );
88  Double_t tot = histo->Integral( 1, histo->GetNbinsX() );
89  Double_t inside = histo->Integral( minbin , maxbin );
90  if ( UseUnderFlow ) tot+=histo->GetBinContent(0);
91  if ( UseOverFlow ) tot+=histo->GetBinContent(histo->GetNbinsX()+1);
92  Double_t sideband = tot-inside;
93  if ( !AbsoluteValue ) { // Compare fraction of events in sideband
94  // if (tot != 0) {
95  if (tot > 0. || tot < 0.) {// should be safer than !=
96  sideband /= tot;
97  }
98  }
99  ERS_DEBUG(2,"Total:"<<tot<<" SideBand:"<<sideband);
101  result->tags_.insert(std::make_pair("TotalIntegral",tot));
102  result->tags_.insert(std::make_pair("SideBands",sideband));
103 
104 
105  if (reThr> grThr) {
106  if ( sideband>reThr ){
107  ERS_DEBUG(1,"[RED] Result : "<<sideband);
108  result->status_=dqm_core::Result::Red;
109  return result;
110  } else if ( sideband > grThr ){
111  ERS_DEBUG(1,"[YELLOW] Result : "<<sideband);
112  result->status_=dqm_core::Result::Yellow;
113  return result;
114  }
115  }else {
116  if ( sideband < reThr ){
117  ERS_DEBUG(1,"[RED] Result : "<<sideband);
118  result->status_=dqm_core::Result::Red;
119  return result;
120  } else if ( sideband < grThr ){
121  ERS_DEBUG(1,"[YELLOW] Result : "<<sideband);
122  result->status_=dqm_core::Result::Yellow;
123  return result;
124  }
125  }
126 
127  ERS_DEBUG(1,"[GREEN] Result");
129  return result;
130 }

◆ printDescription()

void dqm_algorithms::SideBand::printDescription ( std::ostream &  out)
inherited

Definition at line 132 of file SideBand.cxx.

132  {
133  std::stringstream msg;
134  msg<<m_name<<": Checks the integral of a histogram outside a specified range ";
135  if ( m_name=="SideBand_Absolute" )
136  msg<<" using an absolute threshold.";
137  else
138  msg<<" using a relative threshold.";
139  msg<<"\n\n";
140  out << msg.str() <<
141  "Parameter: UseUnderFlow: if != 0 include also underflow bin\n"
142  "Parameter: UseOverFlow: if != 0 include also overflow bin\n"
143  "Parameter: Min: Specify Lower limit (unset means full range)\n"
144  "Parameter: Max: Specify Upper limit (unset means full range)\n"
145  "Threshold: Threshold: How large or small the sidebands should be.\n"
146  " The comparison type (greater-than or less-than) depends on\n"
147  " the relative order of the green and red threshold value." << std::endl;
148 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::SideBand::m_name
privateinherited

Definition at line 51 of file SideBand.h.


The documentation for this struct was generated from the following file:
get_generator_info.result
result
Definition: get_generator_info.py:21
dqm_algorithms::SideBand::m_name
std::string m_name
Definition: SideBand.h:51
dqm_algorithms::SideBand::SideBand
SideBand(const std::string &name)
Definition: SideBand.cxx:26
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
xmin
double xmin
Definition: listroot.cxx:60
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
Trk::inside
@ inside
Definition: PropDirection.h:29
xmax
double xmax
Definition: listroot.cxx:61
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
python.PyAthena.obj
obj
Definition: PyAthena.py:132
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7