58{
60 const TH1 * refhist(0);
61
62 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
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
72 double minstat;
73 double bin_threshold;
74 double refcheck;
75 double greenTh;
76 double redTh;
77 double LowStatLevel;
78 try {
85 }
86 catch ( dqm_core::Exception & ex ) {
87 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
88 }
89
90
91 if (refcheck>0) {
92 try {
93 refhist =
static_cast<const TH1*
>(
config.getReference() );
94 }
95 catch ( dqm_core::Exception & ex ) {
96 throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
97 }
98 if (
histogram->GetDimension() != refhist->GetDimension() ) {
99 throw dqm_core::BadRefHist( ERS_HERE, name, "Reference VS histo: Different dimension!" );
100 }
101 if (
histogram->GetNbinsX() != refhist->GetNbinsX() ) {
102 throw dqm_core::BadRefHist( ERS_HERE, name, "Reference VS histo: Different number of bins!" );
103 }
104 }
105
106
107 if (
histogram->GetEntries() < minstat ) {
108 ERS_INFO(
"Histogram does not satisfy MinStat requirement " <<
histogram->GetName());
109 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
112 }
113 ERS_DEBUG(1,
"Statistics: "<<
histogram->GetEntries()<<
" entries ");
114
115 int NewDead_count = 0;
116 int StillDead_count = 0;
117 int Revived_count = 0;
118 int LowStat_count = 0;
119 std::vector<int>
range;
122 } else {
123 ERS_INFO(
"Histogram has not dimension 1 : " <<
histogram->GetName());
124 throw dqm_core::Exception( ERS_HERE,
histogram->GetName() );
125 }
126
127 std::vector<int> Tubes;
128 for (
int i = range[0];
i <=
range[1]; ++
i ) {
130 if (content == LowStatLevel) {
131 ++LowStat_count;
132 } else if (content != 0.) {
133 if (refcheck>0) {
134 double RefCont = refhist->GetBinContent(i);
135 if ((content < bin_threshold) && ((RefCont >= bin_threshold) || (RefCont == LowStatLevel))) {
136 ++NewDead_count;
137 Tubes.push_back(i);
138 } else if ((content < bin_threshold) && ((RefCont < bin_threshold) || (RefCont == LowStatLevel))) {
139 ++StillDead_count;
140 } else if ((content >= bin_threshold) && (RefCont < bin_threshold)) {
141 ++Revived_count;
142 }
143 } else {
144 if (((content < bin_threshold) ) ) {
145 ++NewDead_count;
146 Tubes.push_back(i);
147 }
148 }
149 }
150 }
151 ERS_DEBUG(1,"Number of bins " << name << " different from a treshold of " << bin_threshold << " is " << NewDead_count );
152
153 dqm_core::Result*
result =
new dqm_core::Result();
154 if (LowStat_count > 0)
result->tags_[
"NTubes_withLowStat"] = LowStat_count;
155 if (Revived_count > 0)
result->tags_[
"NTubes_Revived"] = Revived_count;
156 result->tags_[
"NewDead_Tubes"] = NewDead_count;
157 if (Tubes.size()>0) {
158 for (
int k=0;
k<(
int)Tubes.size();
k++) {
159 std::string ToDB="ChangedStatusTube_";
160 ToDB += std::to_string(k+1);
161 result->tags_[ToDB] = Tubes[
k];
162 ERS_DEBUG(1,"MDT Tube which changed status: "<<ToDB<<" = "<<Tubes[k] );
163 }
164 }
165 if (NewDead_count >= redTh) {
166 result->status_ = dqm_core::Result::Red;
167 ERS_DEBUG(1,"Red");
168 } else if ( (NewDead_count > greenTh) || (Revived_count > 0)) {
169 result->status_ = dqm_core::Result::Yellow;
170 ERS_DEBUG(1,"Yellow");
171 } else if (LowStat_count > 0) {
172 result->status_ = dqm_core::Result::Undefined;
173 ERS_DEBUG(1,"Undefined");
174 } else if (StillDead_count == range[1]) {
175
176 result->status_ = dqm_core::Result::Undefined;
177 } else {
178 result->status_ = dqm_core::Result::Green;
179 ERS_DEBUG(1,"Green");
180 }
182}
#define IsA
Declare the TObject style functions.