ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::BinsOutOfRange Struct Reference

#include <BinsOutOfRange.h>

Inheritance diagram for dqm_algorithms::BinsOutOfRange:
Collaboration diagram for dqm_algorithms::BinsOutOfRange:

Public Member Functions

 BinsOutOfRange ()
 ~BinsOutOfRange ()
BinsOutOfRangeclone ()
dqm_core::Result * execute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
void printDescription (std::ostream &out)

Detailed Description

Definition at line 19 of file BinsOutOfRange.h.

Constructor & Destructor Documentation

◆ BinsOutOfRange()

dqm_algorithms::BinsOutOfRange::BinsOutOfRange ( )

Definition at line 26 of file BinsOutOfRange.cxx.

27{
28 dqm_core::AlgorithmManager::instance().registerAlgorithm("BinsOutOfRange", this);
29}

◆ ~BinsOutOfRange()

dqm_algorithms::BinsOutOfRange::~BinsOutOfRange ( )

Definition at line 31 of file BinsOutOfRange.cxx.

32{
33}

Member Function Documentation

◆ clone()

dqm_algorithms::BinsOutOfRange * dqm_algorithms::BinsOutOfRange::clone ( )

Definition at line 36 of file BinsOutOfRange.cxx.

37{
38
39 return new BinsOutOfRange();
40}

◆ execute()

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

Definition at line 44 of file BinsOutOfRange.cxx.

47{
48 const TH1* histogram;
49
50 if( object.IsA()->InheritsFrom( "TH1" ) ) {
51 histogram = static_cast<const TH1*>(&object);
52 if (histogram->GetDimension() > 2 ){
53 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
54 }
55 } else {
56 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
57 }
58
59 const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
60 const double ignoreval = dqm_algorithms::tools::GetFirstFromMap( "ignoreval", config.getParameters(), -99999);
61 const bool publish = (bool) dqm_algorithms::tools::GetFirstFromMap( "PublishBins", config.getParameters(), 1);
62 const int Nmaxpublish = (int) dqm_algorithms::tools::GetFirstFromMap( "MaxPublish", config.getParameters(), 20);
63 const double RANGE_D = dqm_algorithms::tools::GetFirstFromMap( "RANGE_D", config.getParameters(), -50);
64 const double RANGE_U = dqm_algorithms::tools::GetFirstFromMap( "RANGE_U", config.getParameters(), 50);
65 if ( histogram->GetEntries() < minstat ) {
66 dqm_core::Result *result = new dqm_core::Result(dqm_core::Result::Undefined);
67 result->tags_["InsufficientEntries"] = histogram->GetEntries();
68 return result;
69 }
70
71 double gthreshold;
72 double rthreshold;
73 try {
74 rthreshold = dqm_algorithms::tools::GetFromMap( "NbadBins", config.getRedThresholds() );
75 gthreshold = dqm_algorithms::tools::GetFromMap( "NbadBins", config.getGreenThresholds() );
76 }
77 catch( dqm_core::Exception & ex ) {
78 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
79 }
80
81 std::vector<int> range=dqm_algorithms::tools::GetBinRange(histogram, config.getParameters());
82 std::vector<bin3> badbinstrip;
83 for ( int k = range[0]; k <= range[1]; ++k ) {
84 for ( int l = range[2]; l <= range[3]; ++l ) {
85 double binvalue = histogram->GetBinContent(k,l);
86 if (binvalue== ignoreval) continue;
87 double eta = histogram->GetXaxis()->GetBinCenter(k);
88 double phi = histogram->GetYaxis()->GetBinCenter(l);
89 if(binvalue > RANGE_D && binvalue < RANGE_U ) continue;
90 bin3 onebin = {eta,phi,k,l,binvalue};
91 badbinstrip.push_back(onebin);
92 }
93 }
94
95 std::sort(badbinstrip.begin(),badbinstrip.end(),mySortfunc);
96 dqm_core::Result* result = new dqm_core::Result();
97// publish problematic bins
98 int count=0;
99 for(unsigned int i=0;i<badbinstrip.size();i++){
100 if(publish){
101 char tmp[500];
102 sprintf(tmp,"%i-(eta,phi)=(%0.3f,%0.3f)",count,badbinstrip[i].m_eta,badbinstrip[i].m_phi);
103 std::string tag = tmp;
104 result->tags_[tag] = badbinstrip[i].m_value;
105 }
106 count++;
107 if(count>Nmaxpublish) break;
108 }
109
110 result->tags_["NBadBins"] = count;
111
112 if(count>rthreshold ) result->status_ = dqm_core::Result::Red;
113 else if (count>gthreshold) result->status_ = dqm_core::Result::Yellow;
114 else result->status_ = dqm_core::Result::Green;
115
116 return result;
117
118}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
bool mySortfunc(const bin &i, const bin &j)
std::string histogram
Definition chains.cxx:52
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
l
Printing final latex table to .tex output file.
std::vector< int > GetBinRange(const TH1 *histogram, const std::map< std::string, double > &params)
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)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
setBGCode setTAP setLVL2ErrorBits bool
#define IsA
Declare the TObject style functions.

◆ printDescription()

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

Definition at line 122 of file BinsOutOfRange.cxx.

123{
124
125 out<<"BinsOutOfRange: Print out the badbins which are out of range [range_d,range_u] "<<std::endl;
126 out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
127 out<<"Optional Parameter: ignoreval: valued to be ignored for being processed"<<std::endl;
128 out<<"Optional Parameter: MaxPublish: Max number of bins to save (default 20)"<<std::endl;
129
130}

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