49{
51
52 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
55 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
56 }
57 } else {
58 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
59 }
60
70 if (
histogram->GetEntries() < minstat ) {
71 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
74 }
75
76 double gthreshold;
77 double rthreshold;
78 try {
81 }
82 catch( dqm_core::Exception & ex ) {
83 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
84 }
85
87 std::vector<double> stripsMedian;
88 std::vector<double> stripsAvg;
89 std::vector<double> stripsVariance;
90 double maxInMap=0;
91 for (
int i = range[0];
i <=
range[1]; ++
i ) {
92 std::vector<double> onestrip;
93 double stripSum=0;
94 for (
int j = range[2]; j <=
range[3]; ++j ) {
95 if (
histogram->GetBinContent(i,j) == ignoreval)
continue;
96 float binvalue =
histogram->GetBinContent(i,j);
97 onestrip.push_back(binvalue);
98 stripSum += binvalue;
99 if(binvalue > maxInMap) {
100 maxInMap = binvalue;
101 }
102 }
103 stripsAvg.push_back(stripSum/onestrip.size());
105 }
106 for (
int i = range[0];
i <=
range[1]; ++
i ) {
107 float sumdiff2=0;
109 for (
int j = range[2]; j <=
range[3]; ++j ) {
110 if (
histogram->GetBinContent(i,j) == ignoreval)
continue;
111 double binvalue =
histogram->GetBinContent(i,j);
113 sumdiff2 +=std::pow(
diff,2);
115 }
116 double variance=-1;
117 if(counter!=0) variance = sumdiff2 /
counter ;
118 stripsVariance.push_back(variance);
119 }
120 dqm_core::Result*
result =
new dqm_core::Result();
121 std::vector<bin> redbins;
122 std::vector<bin> yellowbins;
123 std::vector<bin> Allbins;
124 for (
int k = range[0];
k <=
range[1]; ++
k ) {
125 for (
int l = range[2];
l <=
range[3]; ++
l ) {
126 double binvalue =
histogram->GetBinContent(k,l);
127 if (binvalue== ignoreval) continue;
128 double strip_median = stripsMedian[
k-
range[0]];
129 if(stripsMedian[k-range[0]]==0 && stripsVariance[k-range[0]]==0) continue;
130 else if(stripsMedian[k-range[0]]==0 && stripsVariance[k-range[0]]!=0 && stripsAvg[k-range[0]]!=0) strip_median = stripsAvg[
k-
range[0]];
131 else if(stripsMedian[k-range[0]]==0 && stripsVariance[k-range[0]]!=0 && stripsAvg[k-range[0]]==0) continue;
132 double outstandingRatio=0;
133 if(std::abs(strip_median) > 0.00001 ) outstandingRatio= (binvalue-strip_median)/std::sqrt(std::abs(strip_median));
134 else continue;
137 bin onebin = {
eta,
phi,
k,
l,binvalue,outstandingRatio};
138 Allbins.push_back(onebin);
139 if (maxInMap == 0) continue;
140 if(std::abs(outstandingRatio) > rthreshold ) {
141 if( VisualMode && (binvalue / maxInMap < suppressRedFactor) )
142 continue;
143 redbins.push_back(onebin);
144 }
145 else if(std::abs(outstandingRatio) > gthreshold ){
146 if( VisualMode && (binvalue / maxInMap < suppressFactor) )
147 continue;
148 yellowbins.push_back(onebin);
149 }
150 }
151 }
152 int count_red_c = 0;
153 int count_yellow_c = 0;
154 std::vector<std::vector<colorbin> > ColorBinMap;
155if(ClusterResult){
156
157 for (
int k = range[0];
k <=
range[1]; ++
k ) {
158 std::vector<colorbin> oneColorStrip;
159 for (
int l = range[2];
l <=
range[3]; ++
l ) {
160 colorbin oneColorBin = {
static_cast<double>(
k),
static_cast<double>(l), -1, -1, -1,
green, 1};
161 oneColorStrip.push_back(oneColorBin);
162 }
163 ColorBinMap.push_back(std::move(oneColorStrip));
164 }
165
166
167 for(
unsigned int i=0;
i<redbins.size();
i++){
168 int k=redbins[
i].m_ix;
169 int l=redbins[
i].m_iy;
170
171 ColorBinMap[
k-
range[0]][
l-
range[2]].m_eta = redbins[
i].m_eta;
172
173 ColorBinMap[
k-
range[0]][
l-
range[2]].m_phi = redbins[
i].m_phi;
174 ColorBinMap[
k-
range[0]][
l-
range[2]].m_value = redbins[
i].m_value;
176
177 }
178
179
180 for(
unsigned int i=0;
i<yellowbins.size();
i++){
181 int k=yellowbins[
i].m_ix;
182 int l=yellowbins[
i].m_iy;
183 ColorBinMap[
k-
range[0]][
l-
range[2]].m_eta = yellowbins[
i].m_eta;
184 ColorBinMap[
k-
range[0]][
l-
range[2]].m_phi = yellowbins[
i].m_phi;
185 ColorBinMap[
k-
range[0]][
l-
range[2]].m_value = yellowbins[
i].m_value;
187 }
188
189
190
191 std::vector<colorcluster > clusterArray;
192 for(
unsigned int i=0;
i<redbins.size();
i++){
193 const int k=redbins[
i].m_ix;
194 const int l=redbins[
i].m_iy;
195 if(ColorBinMap[k-range[0]][l-range[2]].m_color !=
green){
196 colorcluster onecluster =
MakeCluster(range[0],range[2],redbins[i],ColorBinMap);
197 if(onecluster.
m_size > 1) clusterArray.push_back(onecluster);
198 }
199 }
200 for(
unsigned int i=0;
i<yellowbins.size();
i++){
201 const int k=yellowbins[
i].m_ix;
202 const int l=yellowbins[
i].m_iy;
203 if(ColorBinMap[k-range[0]][l-range[2]].m_color !=
green){
204 colorcluster onecluster =
MakeCluster(range[0],range[2],yellowbins[i],ColorBinMap);
205 if(onecluster.
m_size > 1) clusterArray.push_back(onecluster);
206 }
207 }
208
209
210 for(
unsigned int i=0;
i<clusterArray.size();
i++){
212 if(clusterArray[i].m_color==
red){
214 "CR{}-(eta,phi)(r)(size)=({:.3f},{:.3f})({:.3f})({})",
215 count_red_c,
216 clusterArray[i].m_eta,
217 clusterArray[i].m_phi,
218 clusterArray[i].m_radius,
219 clusterArray[i].m_size);
220 count_red_c++;
221 }
222 else if(clusterArray[i].m_color==
yellow){
224 "CY{}-(eta,phi)(r)(size)=({:.3f},{:.3f})({:.3f})({})",
225 count_yellow_c,
226 clusterArray[i].m_eta,
227 clusterArray[i].m_phi,
228 clusterArray[i].m_radius,
229 clusterArray[i].m_size);
230 count_yellow_c++;
231 }
233 }
234 result->tags_[
"NRedClusters"] = count_red_c;
235 result->tags_[
"NYellowClusters"] = count_yellow_c;
236
237 }
238
239
243
244 int count_red=0;
245 for(
unsigned int i=0;
i<redbins.size();
i++){
246 if(ClusterResult && ColorBinMap[redbins[i].m_ix-range[0]][redbins[i].m_iy-range[2]].m_status==0 ) continue;
247 if(publish){
249 sprintf(tmp,"R%i-(eta,phi)[OSRatio]=(%0.3f,%0.3f)[%0.2e]",count_red,redbins[i].m_eta,redbins[i].m_phi,redbins[i].m_outstandingRatio);
252 }
253 count_red++;
254 if(NpublishRed > 0){
255 if(count_red > NpublishRed) break;
256 }
257 }
258
259
260 int count_yellow=0;
261 for(
unsigned int i=0;
i<yellowbins.size();
i++){
262 if(ClusterResult &&ColorBinMap[yellowbins[i].m_ix-range[0]][yellowbins[i].m_iy-range[2]].m_status==0) continue;
263 if(publish && (count_red+count_yellow) < Nmaxpublish ){
265 sprintf(tmp,"Y%i-(eta,phi)[OSRatio]=(%0.3f,%0.3f)[%.2e]",count_yellow,yellowbins[i].m_eta,yellowbins[i].m_phi,yellowbins[i].m_outstandingRatio);
268 }
269 count_yellow++;
270 }
271 result->tags_[
"NRedBins"] = count_red;
272 result->tags_[
"NYellowBins"] = count_yellow;
273
274 if(count_red+count_yellow==0 && Allbins.size()>=5 ){
275 for(
int i=0;
i<5;
i++){
276 char tmptmp[500];
277 sprintf(tmptmp,"LeadingBin%i-(eta,phi)=(%0.3f,%0.3f)",i,Allbins[i].m_eta,Allbins[i].m_phi);
278 std::string tagtag = tmptmp;
279 result->tags_[tagtag] = Allbins[
i].m_value;
280 }
281
282 }
283
284
285 if(count_red>0 || count_red_c>0)
result->status_ = dqm_core::Result::Red;
286 else if (count_yellow>0||count_yellow_c>0)
result->status_ = dqm_core::Result::Yellow;
287 else result->status_ = dqm_core::Result::Green;
288
290
291}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
l
Printing final latex table to .tex output file.
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.