Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
dqm_algorithms::MDTTubeCheckError Class Reference

#include <MDTTubeCheckError.h>

Inheritance diagram for dqm_algorithms::MDTTubeCheckError:
Collaboration diagram for dqm_algorithms::MDTTubeCheckError:

Public Member Functions

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

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 20 of file MDTTubeCheckError.h.

Constructor & Destructor Documentation

◆ MDTTubeCheckError()

dqm_algorithms::MDTTubeCheckError::MDTTubeCheckError ( )

Definition at line 37 of file MDTTubeCheckError.cxx.

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

◆ ~MDTTubeCheckError()

dqm_algorithms::MDTTubeCheckError::~MDTTubeCheckError ( )
virtual

Definition at line 44 of file MDTTubeCheckError.cxx.

45 {
46 }

Member Function Documentation

◆ clone()

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

Definition at line 50 of file MDTTubeCheckError.cxx.

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

◆ execute()

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

Definition at line 57 of file MDTTubeCheckError.cxx.

58 {
59  const TH1* histogram;
60  const TH1* refhist=0;
61 
62  if( object.IsA()->InheritsFrom( "TH1" ) ) {
63  histogram = static_cast<const TH1*>(&object);
64  if (histogram->GetDimension() >= 2 ){
65  throw dqm_core::BadConfig( ERS_HERE, name, "dimension >= 2 " );
66  }
67  } else {
68  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
69  }
70 
71  //Get Parameters and Thresholds
72  double minstat;
73  double bin_threshold;
74  double nErr;
75  double LowStatErr;
76  double LowStatThre;
77  double refcheck;
78  double greenTh;
79  double redTh;
80  try {
81  bin_threshold = dqm_algorithms::tools::GetFirstFromMap( "BinThreshold", config.getParameters());
82  nErr = dqm_algorithms::tools::GetFirstFromMap( "nErrBin", config.getParameters());
83  LowStatErr = dqm_algorithms::tools::GetFirstFromMap( "LowStatErr", config.getParameters(), 99999.);
84  LowStatThre = dqm_algorithms::tools::GetFirstFromMap( "LowStatThre", config.getParameters(), 0.);
85  refcheck = dqm_algorithms::tools::GetFirstFromMap( "ReferenceCheck", config.getParameters());
86  minstat = dqm_algorithms::tools::GetFirstFromMap("MinStat", config.getParameters(), -1);
87  redTh = dqm_algorithms::tools::GetFromMap( "NBins", config.getRedThresholds());
88  greenTh = dqm_algorithms::tools::GetFromMap( "NBins", config.getGreenThresholds() );
89  }
90  catch ( dqm_core::Exception & ex ) {
91  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
92  }
93 
94  //Get Reference Histo
95  if (refcheck>0) {
96  try {
97  refhist = static_cast<const TH1*>( config.getReference() );
98  }
99  catch ( dqm_core::Exception & ex ) {
100  throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
101  }
102  if (histogram->GetDimension() != refhist->GetDimension() ) {
103  throw dqm_core::BadRefHist( ERS_HERE, name, "Reference VS histo: Different dimension!" );
104  }
105  if (histogram->GetNbinsX() != refhist->GetNbinsX() ) {
106  throw dqm_core::BadRefHist( ERS_HERE, name, "Reference VS histo: Different number of bins!" );
107  }
108  }
109 
110  //Check of statistics
111  if (histogram->GetEntries() < minstat ) {
112  ERS_INFO("Histogram does not satisfy MinStat requirement " <<histogram->GetName());
114  result->tags_["InsufficientEntries"] = histogram->GetEntries();
115  return result;
116  }
117  ERS_DEBUG(1,"Statistics: "<< histogram->GetEntries()<< " entries ");
118 
119  int count = 0;
120  std::vector<int> range;
121  if (histogram->GetDimension() == 1){
123  } else {
124  ERS_INFO("Histogram has not dimension 1 : " <<histogram->GetName());
125  throw dqm_core::Exception( ERS_HERE, histogram->GetName() );
126  }
127  if (range[1] == 0) {
128  ERS_INFO("Empty histogram: " <<histogram->GetName());
131  ERS_DEBUG(1,"Undefined");
132  return result;
133  }
134 
135  std::vector<int> Tubes;
136  int EmptyTubes =0;
137  int LowStatTubes =0;
138  for ( int i = range[0]; i <= range[1]; ++i ) {
139  double Content = histogram->GetBinContent(i);
140  double ErrCont = histogram->GetBinError(i);
141  if (ErrCont > LowStatErr) LowStatTubes++;
142  if (Content+std::abs(ErrCont) != 0.) {
143  if ((Content + nErr*ErrCont) < bin_threshold ) {
144  if (refcheck>0) {
145  double RefCont = refhist->GetBinContent(i);
146  double RefErrCont = refhist->GetBinError(i);
147  double Diff = std::abs(Content - RefCont);
148  double ErrDiff = sqrt(ErrCont*ErrCont + RefErrCont*RefErrCont);
149  if (Diff > nErr*ErrDiff) {
150  ++count;
151  Tubes.push_back(i);
152  }
153  } else {
154  ++count;
155  Tubes.push_back(i);
156  }
157  }
158  } else { ++EmptyTubes; }
159  }
160  ERS_DEBUG(1,"Number of bins " << name << " different from a treshold of " << bin_threshold << " is " << count );
161 
163  result->tags_["NChangedStatusTubes"] = count;
164  if (Tubes.size()>0) {
165  for (int k=0; k<(int)Tubes.size(); k++) {
166  std::string ToDB="ChangedStatusTube_";
167  ToDB += std::to_string(k+1);
168  result->tags_[ToDB] = Tubes[k];
169  ERS_DEBUG(1,"MDT Tube which changed status: "<<ToDB<<" = "<<Tubes[k] );
170  }
171  }
172 
173  if ((EmptyTubes == range[1]) || ((LowStatTubes/range[1]) > LowStatThre)) {
175  ERS_DEBUG(1,"Undefined");
176  } else if (count >= redTh) {
177  result->status_ = dqm_core::Result::Red;
178  ERS_DEBUG(1,"Red");
179  } else if ( count > greenTh) {
180  result->status_ = dqm_core::Result::Yellow;
181  ERS_DEBUG(1,"Yellow");
182  } else {
183  result->status_ = dqm_core::Result::Green;
184  ERS_DEBUG(1,"Green");
185  }
186  return result;
187 }

◆ printDescription()

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

Definition at line 191 of file MDTTubeCheckError.cxx.

192 {
193  std::string message;
194  message += "\n";
195  message += "Algorithm: \"" + m_name + "\"\n";
196  message += "Description: Check if the number of entries in bins is less than BinThreshold and compare with Reference Histo \n";
197  message += "Mandatory Parameter: BinThreshold: Look for bins less than BinTreshold; Count number of bins satifying requirement \n";
198  message += "Mandatory Parameter: nErrBin: n-sigma of acceptance for check with the BinTreshold \n";
199  message += "Mandatory Parameter: ReferenceCheck: 0 if no check on reference is requested \n";
200  message += "Mandatory Green/Red Threshold: NBins: number of bins satifying requirement\n";
201  message += "Optional Parameters: MinStat = Minimum histogram statistics needed to perform Algorithm\n";
202  message += " LowStatErr = error threshold for bin with too low statistics \n";
203  message += " LowStatThre = threshold for fraction of bins with too low statistics \n";
204  message += " xmin: minimum x range\n";
205  message += " xmax: maximum x range\n";
206  message += "\n";
207 
208  out << message;
209 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::MDTTubeCheckError::m_name
private

Definition at line 33 of file MDTTubeCheckError.h.


The documentation for this class was generated from the following files:
dqm_algorithms::tools::GetBinRange
std::vector< int > GetBinRange(const TH1 *histogram, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:380
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::MDTTubeCheckError::m_name
std::string m_name
Definition: MDTTubeCheckError.h:33
ReweightUtils.message
message
Definition: ReweightUtils.py:15
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
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:85
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
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:240
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
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
dqm_algorithms::MDTTubeCheckError::MDTTubeCheckError
MDTTubeCheckError()
Definition: MDTTubeCheckError.cxx:37
histogram
std::string histogram
Definition: chains.cxx:52
fitman.k
k
Definition: fitman.py:528