ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::STG_YMeansperSector Class Reference

#include <STG_YMeansperSector.h>

Inheritance diagram for dqm_algorithms::STG_YMeansperSector:
Collaboration diagram for dqm_algorithms::STG_YMeansperSector:

Public Member Functions

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

Protected Attributes

std::string m_name

Detailed Description

Definition at line 16 of file STG_YMeansperSector.h.

Constructor & Destructor Documentation

◆ STG_YMeansperSector()

dqm_algorithms::STG_YMeansperSector::STG_YMeansperSector ( )

Definition at line 41 of file STG_YMeansperSector.cxx.

43 : m_name("STG_YMeansperSector")
44 {
45 dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
46 }

◆ ~STG_YMeansperSector()

dqm_algorithms::STG_YMeansperSector::~STG_YMeansperSector ( )
virtual

Definition at line 49 of file STG_YMeansperSector.cxx.

51 {
52 }

Member Function Documentation

◆ clone()

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

Definition at line 56 of file STG_YMeansperSector.cxx.

◆ execute()

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

Definition at line 64 of file STG_YMeansperSector.cxx.

66 {
67 //No status flags are set
68 dqm_core::Result* result = new dqm_core::Result();
69 result->status_ = dqm_core::Result::Undefined;
70 const TH2 * histogram;
71
72 if( object.IsA()->InheritsFrom( "TH2" ) ) {
73 histogram = static_cast<const TH2*>(&object);
74 if (histogram->GetDimension() > 2 ){
75 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
76 }
77 } else {
78 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2" );
79 }
80 TProfile *h2 = histogram->ProfileX();
81 int Xbins = histogram->GetXaxis()->GetNbins();
82 int Ybins = histogram->GetYaxis()->GetNbins();
83
84 float Meanlow = 0;
85 float Meanhigh = 0.0;
86 float redMean = 0.0;
87 if (Ybins < 15) {
88 Meanlow = dqm_algorithms::tools::GetFirstFromMap( "MeanL", config.getParameters(), 3.5);
89 Meanhigh = dqm_algorithms::tools::GetFirstFromMap( "MeanH", config.getParameters(), 5.5);
90 redMean = dqm_algorithms::tools::GetFirstFromMap( "MeanRed", config.getParameters(), 9.0);
91
92
93 } else if (Ybins > 100) {
94 Meanlow = dqm_algorithms::tools::GetFirstFromMap( "MeanL", config.getParameters(), -7.5);
95 Meanhigh = dqm_algorithms::tools::GetFirstFromMap( "MeanH", config.getParameters(), 17.5);
96 redMean = dqm_algorithms::tools::GetFirstFromMap( "MeanRed", config.getParameters(), 50.0);
97 }
98
99 float MeanY[36];
100 bool redflag = false;
101 bool yellowflag = false;
102 bool greenflag = false;
103 int Passed=0;
104 for (int i = 1; i <= Xbins; i++) {
105 MeanY[i]=h2->GetBinContent(i);
106 if (MeanY[i]==0) {
107 Passed = Passed +1;
108 continue;
109 }
110 if (MeanY[i] > Meanlow && MeanY[i] < Meanhigh) Passed = Passed +1;
111 if (abs(MeanY[i]) > abs(redMean)) redflag=true;
112 }
113 double gthreshold;
114 double rthreshold;
115 try {
116 rthreshold = dqm_algorithms::tools::GetFromMap( "NSectors", config.getRedThresholds() );
117 gthreshold = dqm_algorithms::tools::GetFromMap( "NSectors", config.getGreenThresholds() );
118 }
119 catch ( dqm_core::Exception & ex ) {
120 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
121 }
122 if (Passed -2 > gthreshold && not redflag) greenflag=true;
123 else if (Passed -2 > rthreshold && not redflag) yellowflag=true;
124 else redflag=true;
125 if ( greenflag ) {
126 result->status_ = dqm_core::Result::Green;
127 } else if ( yellowflag ) {
128 result->status_ = dqm_core::Result::Yellow;
129 } else {
130 result->status_ = dqm_core::Result::Red;
131 }
132
133 return result;
134 }
std::string histogram
Definition chains.cxx:52
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
#define IsA
Declare the TObject style functions.

◆ printDescription()

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

Definition at line 27 of file STG_YMeansperSector.cxx.

29 {
30 std::string message;
31 message += "\n";
32 message += "Algorithm: \"" + m_name + "\"\n";
33 message += "Description: Checks the Ymeans per sector of every histogram\n";
34 message += "If the Ymeans are outside the range the sector is flagged red. If one of the sectors is very far from the Ymean the whole histogram is flagged red\n";
35 message += " Overflow (and Underflow) bins are not included\n";
36 message += "\n";
37
38 out << message;
39 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::STG_YMeansperSector::m_name
protected

Definition at line 30 of file STG_YMeansperSector.h.


The documentation for this class was generated from the following files: