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

#include <CSCNoisyDead.h>

Inheritance diagram for dqm_algorithms::CSCNoisyDead:
Collaboration diagram for dqm_algorithms::CSCNoisyDead:

Public Member Functions

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

Detailed Description

Definition at line 18 of file CSCNoisyDead.h.

Constructor & Destructor Documentation

◆ CSCNoisyDead()

dqm_algorithms::CSCNoisyDead::CSCNoisyDead ( )

Definition at line 21 of file CSCNoisyDead.cxx.

22{
23 dqm_core::AlgorithmManager::instance().registerAlgorithm( "CSCNoisyDead", this );
24}

◆ ~CSCNoisyDead()

dqm_algorithms::CSCNoisyDead::~CSCNoisyDead ( )

Definition at line 26 of file CSCNoisyDead.cxx.

27{
28}

Member Function Documentation

◆ clone()

dqm_algorithms::CSCNoisyDead * dqm_algorithms::CSCNoisyDead::clone ( )

Definition at line 31 of file CSCNoisyDead.cxx.

32{
33 return new CSCNoisyDead();
34}

◆ execute()

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

Definition at line 38 of file CSCNoisyDead.cxx.

41{
42 const TH2 * histogram;
43
44 if(object.IsA()->InheritsFrom( "TH2" )) {
45 histogram = static_cast<const TH2*>(&object);
46 if (histogram->GetDimension() != 2 ){
47 throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " );
48 }
49 } else {
50 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2");
51 }
52
53 double high = dqm_algorithms::tools::GetFirstFromMap( "HighRange", config.getParameters(), 0.2);
54 double low = dqm_algorithms::tools::GetFirstFromMap( "LowRange", config.getParameters(), 0.2);
55
56 int gthreshold;
57 int rthreshold;
58 try {
59 rthreshold = dqm_algorithms::tools::GetFromMap( "NStrips", config.getRedThresholds() );
60 gthreshold = dqm_algorithms::tools::GetFromMap( "NStrips", config.getGreenThresholds() );
61 }
62 catch( dqm_core::Exception & ex ) {
63 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
64 }
65
66 double phi_s_sum, phi_l_sum, eta_s_sum, eta_l_sum;
67
68 double phi_s_avg[48], phi_l_avg[48], eta_s_avg[192], eta_l_avg[192];
69
70 int NphiDead = 0;
71 int NphiNoisy = 0;
72 int NetaDead = 0;
73 int NetaNoisy = 0;
74 int NBad=0;
75
76 for (int i = 0; i < 48; i++) {
77 phi_s_avg[i] = 0;
78 phi_l_avg[i] = 0;
79 }
80
81 for (int i = 0; i < 192; i++) {
82 eta_s_avg[i] = 0;
83 eta_l_avg[i] = 0;
84 }
85
86 // Average over Phi strips
87 for(size_t x = 0; x < 48; x++) {
88 int xbin = histogram->GetXaxis()->FindBin(x-48);
89 phi_s_sum = 0;
90 phi_l_sum = 0;
91 if (histogram->GetNbinsY() >= 85){
92 for(size_t y = 6; y < 86; y++) {
93 if( y%5 != 0 ) {
94
95 // int lay = y%5;
96
97 double content = histogram->GetBinContent(xbin,y);
98
99 if(y%10 > 5) {
100 phi_l_sum += content;
101 }else {
102 phi_s_sum += content;
103 }
104 }
105 }
106 }
107 phi_s_avg[x] = (phi_s_sum/32.0);
108 phi_l_avg[x] = (phi_l_sum/32.0);
109 } // End phi strips average
110
111 // Average over Eta strips
112 for(size_t x = 0; x < 192; x++) {
113 int xbin = histogram->GetXaxis()->FindBin(x+1);
114 eta_s_sum = 0;
115 eta_l_sum = 0;
116 for(size_t y = 6; y < 86; y++) {
117 if( y%5 != 0 ) {
118
119 // int lay = y%5;
120
121 double content = histogram->GetBinContent(xbin,y);
122
123 if(y%10 > 5) {
124 eta_l_sum += content;
125 }else {
126 eta_s_sum += content;
127 }
128 }
129 }
130 eta_s_avg[x] = (eta_s_sum/32.0);
131 eta_l_avg[x] = (eta_l_sum/32.0);
132 } // End eta strips average
133
134 // Compare Phi strips to average
135 for(size_t x = 0; x < 48; x++) {
136 int xbin = histogram->GetXaxis()->FindBin(int(x)-48);
137 phi_s_sum = 0;
138 phi_l_sum = 0;
139 for(size_t y = 6; y < 86; y++) {
140 if( y%5 != 0 ) {
141
142 // int lay = y%5;
143
144 double content = histogram->GetBinContent(xbin,y);
145
146 if(y%10 > 5) {
147 if(content > (1+high)*phi_l_avg[x]){
148 NphiNoisy++;
149 }else if(content < (1-low)*phi_l_avg[x]){
150 NphiDead++;
151 }
152 }else {
153 if(content > (1+high)*phi_s_avg[x]){
154 NphiNoisy++;
155 }else if(content < (1-low)*phi_s_avg[x]){
156 NphiDead++;
157 }
158 }
159 }
160 }
161 } // End phi strips comparison
162
163 // Compare Eta strips to average
164 for(size_t x = 0; x < 192; x++) {
165 int xbin = histogram->GetXaxis()->FindBin(x+1);
166 eta_s_sum = 0;
167 eta_l_sum = 0;
168 for(size_t y = 6; y < 86; y++) {
169 if( y%5 != 0 ) {
170
171 // int lay = y%5;
172
173 double content = histogram->GetBinContent(xbin,y);
174
175 if(y%10 > 5) {
176 if(content > (1+high)*eta_l_avg[x]){
177 NetaNoisy++;
178 }else if(content < (1-low)*eta_l_avg[x]){
179 NetaDead++;
180 }
181 }else {
182 if(content > (1+high)*eta_s_avg[x]){
183 NetaNoisy++;
184 }else if(content < (1-low)*eta_s_avg[x]){
185 NetaDead++;
186 }
187 }
188 }
189 }
190 } // End phi strips comparison
191
192 dqm_core::Result* result = new dqm_core::Result();
193 NBad = NphiNoisy + NphiDead + NetaNoisy + NetaDead;
194 result->tags_.insert(std::make_pair("NBad",NBad));
195 result->tags_.insert(std::make_pair("NphiNoisy",NphiNoisy));
196 result->tags_.insert(std::make_pair("NphiDead",NphiDead));
197 result->tags_.insert(std::make_pair("NetaNoisy",NetaNoisy));
198 result->tags_.insert(std::make_pair("NetaDead",NetaDead));
199
200 if (NBad >= rthreshold){
201 result->status_ = dqm_core::Result::Red;
202 }else if (NBad < gthreshold){
203 result->status_ = dqm_core::Result::Green;
204 }else{
205 result->status_ = dqm_core::Result::Yellow;
206 }
207
208 return result;
209
210/*
211
212 dqm_core::Result* result = new dqm_core::Result();
213 int max = 1;
214 if(testrows){ max += histogram->GetNbinsY(); } else { max += histogram->GetNbinsX(); }
215 std::vector<float> rowtotal;
216 rowtotal.clear();
217 for(int i =0; i<max; ++i){ rowtotal.push_back(0.0); }
218
219 if(checkstrip==0 && redcount >= yellowcount && redcount !=0 ){
220 result->tags_["RedBins"] = redcount;
221 result->status_ = dqm_core::Result::Red;
222 return result;
223 }
224 if(checkstrip==0 && yellowcount !=0 ){
225 result->tags_["YellowBins"] = yellowcount;
226 result->status_ = dqm_core::Result::Yellow;
227 return result;
228 }
229
230 if(checkstrip && dorate && redrows >= yellowrows && redrows !=0 ){
231 result->tags_["RedRows"] = redrows;
232 result->status_ = dqm_core::Result::Red;
233 return result;
234 }
235 if(checkstrip && dorate && yellowrows !=0 ){
236 result->tags_["YellowRows"] = yellowrows;
237 result->status_ = dqm_core::Result::Yellow;
238 return result;
239 }
240
241
242 result->status_ = dqm_core::Result::Green;
243 return result;
244*/
245}
#define y
#define x
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)
str content
Definition grepfile.py:56
#define IsA
Declare the TObject style functions.

◆ printDescription()

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

Definition at line 248 of file CSCNoisyDead.cxx.

249{
250
251 out<<"CSCNoisyDead: Checks to see how many CSC layers are dead or noisy"<<std::endl;
252
253 out<<"Mandatory Parameter: HighRange : Fraction above average considered noisy"<<std::endl;
254 out<<"Mandatory Parameter: LowRange : Fraction below average considered dead"<<std::endl;
255
256 out<<"Mandatory Green/Red Threshold : NStrips : "<<std::endl;
257
258}

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