27 writeIfValid(
TH1F* pH) {
28 if (pH) pH->Write(
"", TObject::kOverwrite);
32 fillIfValid(
TH1F* pH,
float val) {
33 if (pH) pH->Fill(
val);
38 getBinContentIfValid(
TH1F* pH,
int binIdx) {
40 if (pH)
result = pH->GetBinContent(binIdx);
45 getBinErrorIfValid(
TH1F* pH,
int binIdx) {
47 if (pH)
result = pH->GetBinError(binIdx);
51 panelOk(
const TH1F* pPanel,
int ib){
53 if (pPanel and (pPanel->GetBinContent(
ib + 1) == 0) ){
67 safelyTakeLog(
auto f){
75 return (
idx>pH->GetNbinsX() / 2);
90 bool applyEffThreshold =
true;
91 bool EffThreshold =
false;
93 float Minimum_efficiency = 0.5;
94 TFile*
f = TFile::Open(inFilename.c_str(),
"UPDATE");
96 std::cerr <<
"MonitoringFile::RPCPostProcess(): "
97 <<
"Input file not opened \n";
100 if (
f->GetSize() < 1000.) {
101 std::cerr <<
"MonitoringFile::RPCPostProcess(): "
102 <<
"Input file empty \n";
109 TIter next_run(
f->GetListOfKeys());
111 while ((key_run =
dynamic_cast<TKey*
>(next_run())) != 0) {
112 TObject* obj_run = key_run->ReadObj();
113 TDirectory* tdir_run =
dynamic_cast<TDirectory*
>(obj_run);
115 std::string tdir_run_name(tdir_run->GetName());
116 if (tdir_run_name.find(
"run") != std::string::npos) {
117 run_dir = std::move(tdir_run_name);
120 std::cout <<
"run_number rpc monitoring " <<
run_number << std::endl;
122 std::string pathRawMon = run_dir +
"/Muon/MuonRawDataMonitoring/RPC/";
123 std::string pathTrackMon = run_dir +
"/Muon/MuonRawDataMonitoring/RPCStandAloneTrackMon/";
125 std::string dir_ov_raw = pathRawMon +
"Overview/";
126 std::string dir_sum_raw = pathRawMon +
"Summary/";
127 std::string dir_dqmf_raw = pathRawMon +
"Dqmf/";
129 std::string dir_sideA_track = pathTrackMon +
"RPCBA/";
130 std::string dir_sideC_track = pathTrackMon +
"RPCBC/";
131 std::string dir_glob_track = pathTrackMon +
"GLOBAL/";
132 std::string dir_sum_track = pathTrackMon +
"Summary/";
133 std::string dir_dqmf_track = pathTrackMon +
"Dqmf/";
134 std::string dir_trigger_track = pathTrackMon +
"TriggerEfficiency/";
136 double n_hit_f, n_tr_p, panel_eff, panel_err_eff;
137 double nEta,
nPhi, nEtaPhi, gapEff = 0.0, gapErrEff = 0.0;
138 double res_mean, res2_mean, res_RMS;
140 double panelCS, panelCS2, panelCS_entries, panelCS_mean, panelCS2_mean, panelCS_RMS;
141 double Time_mean, Time2_mean, Time_RMS;
142 double noiseCorr, noiseCorrErr;
143 double noiseTot, noiseTotErr;
147 std::string METracks_name = dir_trigger_track +
"hMEtracks";
148 std::string MuctpiThr0_name = dir_trigger_track +
"hRPCMuctpiThr0";
149 std::string MuctpiThr1_name = dir_trigger_track +
"hRPCMuctpiThr1";
150 std::string MuctpiThr2_name = dir_trigger_track +
"hRPCMuctpiThr2";
151 std::string MuctpiThr3_name = dir_trigger_track +
"hRPCMuctpiThr3";
152 std::string MuctpiThr4_name = dir_trigger_track +
"hRPCMuctpiThr4";
153 std::string MuctpiThr5_name = dir_trigger_track +
"hRPCMuctpiThr5";
154 std::string PadThr0_name = dir_trigger_track +
"hRPCPadThr0";
155 std::string PadThr1_name = dir_trigger_track +
"hRPCPadThr1";
156 std::string PadThr2_name = dir_trigger_track +
"hRPCPadThr2";
157 std::string PadThr3_name = dir_trigger_track +
"hRPCPadThr3";
158 std::string PadThr4_name = dir_trigger_track +
"hRPCPadThr4";
159 std::string PadThr5_name = dir_trigger_track +
"hRPCPadThr5";
160 std::string PhiEtaCoinThr0_name = dir_trigger_track +
"hRPCPhiEtaCoinThr0";
161 std::string PhiEtaCoinThr1_name = dir_trigger_track +
"hRPCPhiEtaCoinThr1";
162 std::string PhiEtaCoinThr2_name = dir_trigger_track +
"hRPCPhiEtaCoinThr2";
163 std::string PhiEtaCoinThr3_name = dir_trigger_track +
"hRPCPhiEtaCoinThr3";
164 std::string PhiEtaCoinThr4_name = dir_trigger_track +
"hRPCPhiEtaCoinThr4";
165 std::string PhiEtaCoinThr5_name = dir_trigger_track +
"hRPCPhiEtaCoinThr5";
167 std::string MuctpiThr_eff0_name = dir_trigger_track +
"hRPCMuctpiThr_eff0";
168 std::string MuctpiThr_eff1_name = dir_trigger_track +
"hRPCMuctpiThr_eff1";
169 std::string MuctpiThr_eff2_name = dir_trigger_track +
"hRPCMuctpiThr_eff2";
170 std::string MuctpiThr_eff3_name = dir_trigger_track +
"hRPCMuctpiThr_eff3";
171 std::string MuctpiThr_eff4_name = dir_trigger_track +
"hRPCMuctpiThr_eff4";
172 std::string MuctpiThr_eff5_name = dir_trigger_track +
"hRPCMuctpiThr_eff5";
173 std::string PadThr_eff0_name = dir_trigger_track +
"hRPCPadThr_eff0";
174 std::string PadThr_eff1_name = dir_trigger_track +
"hRPCPadThr_eff1";
175 std::string PadThr_eff2_name = dir_trigger_track +
"hRPCPadThr_eff2";
176 std::string PadThr_eff3_name = dir_trigger_track +
"hRPCPadThr_eff3";
177 std::string PadThr_eff4_name = dir_trigger_track +
"hRPCPadThr_eff4";
178 std::string PadThr_eff5_name = dir_trigger_track +
"hRPCPadThr_eff5";
179 std::string PhiEtaCoinThr_eff0_name = dir_trigger_track +
"hRPCPhiEtaCoinThr_eff0";
180 std::string PhiEtaCoinThr_eff1_name = dir_trigger_track +
"hRPCPhiEtaCoinThr_eff1";
181 std::string PhiEtaCoinThr_eff2_name = dir_trigger_track +
"hRPCPhiEtaCoinThr_eff2";
182 std::string PhiEtaCoinThr_eff3_name = dir_trigger_track +
"hRPCPhiEtaCoinThr_eff3";
183 std::string PhiEtaCoinThr_eff4_name = dir_trigger_track +
"hRPCPhiEtaCoinThr_eff4";
184 std::string PhiEtaCoinThr_eff5_name = dir_trigger_track +
"hRPCPhiEtaCoinThr_eff5";
188 METracks_name.c_str()) &&
190 TH1I* hist_METracks = (TH1I*) (
f->Get(METracks_name.c_str()));
191 TH1I* hist_MuctpiThr0 = (TH1I*) (
f->Get(MuctpiThr0_name.c_str()));
192 TH1I* hist_MuctpiThr1 = (TH1I*) (
f->Get(MuctpiThr1_name.c_str()));
193 TH1I* hist_MuctpiThr2 = (TH1I*) (
f->Get(MuctpiThr2_name.c_str()));
194 TH1I* hist_MuctpiThr3 = (TH1I*) (
f->Get(MuctpiThr3_name.c_str()));
195 TH1I* hist_MuctpiThr4 = (TH1I*) (
f->Get(MuctpiThr4_name.c_str()));
196 TH1I* hist_MuctpiThr5 = (TH1I*) (
f->Get(MuctpiThr5_name.c_str()));
197 TH1I* hist_PadThr0 = (TH1I*) (
f->Get(PadThr0_name.c_str()));
198 TH1I* hist_PadThr1 = (TH1I*) (
f->Get(PadThr1_name.c_str()));
199 TH1I* hist_PadThr2 = (TH1I*) (
f->Get(PadThr2_name.c_str()));
200 TH1I* hist_PadThr3 = (TH1I*) (
f->Get(PadThr3_name.c_str()));
201 TH1I* hist_PadThr4 = (TH1I*) (
f->Get(PadThr4_name.c_str()));
202 TH1I* hist_PadThr5 = (TH1I*) (
f->Get(PadThr5_name.c_str()));
203 TH1I* hist_PhiEtaCoinThr0 = (TH1I*) (
f->Get(PhiEtaCoinThr0_name.c_str()));
204 TH1I* hist_PhiEtaCoinThr1 = (TH1I*) (
f->Get(PhiEtaCoinThr1_name.c_str()));
205 TH1I* hist_PhiEtaCoinThr2 = (TH1I*) (
f->Get(PhiEtaCoinThr2_name.c_str()));
206 TH1I* hist_PhiEtaCoinThr3 = (TH1I*) (
f->Get(PhiEtaCoinThr3_name.c_str()));
207 TH1I* hist_PhiEtaCoinThr4 = (TH1I*) (
f->Get(PhiEtaCoinThr4_name.c_str()));
208 TH1I* hist_PhiEtaCoinThr5 = (TH1I*) (
f->Get(PhiEtaCoinThr5_name.c_str()));
209 TH1I* hist_MuctpiThr_eff0 = (TH1I*) (
f->Get(MuctpiThr_eff0_name.c_str()));
210 TH1I* hist_MuctpiThr_eff1 = (TH1I*) (
f->Get(MuctpiThr_eff1_name.c_str()));
211 TH1I* hist_MuctpiThr_eff2 = (TH1I*) (
f->Get(MuctpiThr_eff2_name.c_str()));
212 TH1I* hist_MuctpiThr_eff3 = (TH1I*) (
f->Get(MuctpiThr_eff3_name.c_str()));
213 TH1I* hist_MuctpiThr_eff4 = (TH1I*) (
f->Get(MuctpiThr_eff4_name.c_str()));
214 TH1I* hist_MuctpiThr_eff5 = (TH1I*) (
f->Get(MuctpiThr_eff5_name.c_str()));
215 TH1I* hist_PadThr_eff0 = (TH1I*) (
f->Get(PadThr_eff0_name.c_str()));
216 TH1I* hist_PadThr_eff1 = (TH1I*) (
f->Get(PadThr_eff1_name.c_str()));
217 TH1I* hist_PadThr_eff2 = (TH1I*) (
f->Get(PadThr_eff2_name.c_str()));
218 TH1I* hist_PadThr_eff3 = (TH1I*) (
f->Get(PadThr_eff3_name.c_str()));
219 TH1I* hist_PadThr_eff4 = (TH1I*) (
f->Get(PadThr_eff4_name.c_str()));
220 TH1I* hist_PadThr_eff5 = (TH1I*) (
f->Get(PadThr_eff5_name.c_str()));
221 TH1I* hist_PhiEtaCoinThr_eff0 = (TH1I*) (
f->Get(PhiEtaCoinThr_eff0_name.c_str()));
222 TH1I* hist_PhiEtaCoinThr_eff1 = (TH1I*) (
f->Get(PhiEtaCoinThr_eff1_name.c_str()));
223 TH1I* hist_PhiEtaCoinThr_eff2 = (TH1I*) (
f->Get(PhiEtaCoinThr_eff2_name.c_str()));
224 TH1I* hist_PhiEtaCoinThr_eff3 = (TH1I*) (
f->Get(PhiEtaCoinThr_eff3_name.c_str()));
225 TH1I* hist_PhiEtaCoinThr_eff4 = (TH1I*) (
f->Get(PhiEtaCoinThr_eff4_name.c_str()));
226 TH1I* hist_PhiEtaCoinThr_eff5 = (TH1I*) (
f->Get(PhiEtaCoinThr_eff5_name.c_str()));
228 int nb = hist_METracks->GetNbinsX();
229 double Ly_eff, Ly_effErr;
230 auto calculateErr = [](
float hitOn,
float trPrj) ->
double {
231 return std::sqrt(std::abs(hitOn) / trPrj) *
232 std::sqrt(1. - std::abs(hitOn) / trPrj) / std::sqrt(trPrj);
235 float n_Ly_hitOn = hist_MuctpiThr0->GetBinContent(
ib + 1);
236 float n_Ly_TrPrj = hist_METracks->GetBinContent(
ib + 1);
237 if (n_Ly_TrPrj<= 0)
continue;
239 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
241 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
242 hist_MuctpiThr_eff0->SetBinContent(
ib + 1, Ly_eff);
243 hist_MuctpiThr_eff0->SetBinError(
ib + 1, Ly_effErr);
246 n_Ly_hitOn = hist_MuctpiThr1->GetBinContent(
ib + 1);
247 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
248 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
249 hist_MuctpiThr_eff1->SetBinContent(
ib + 1, Ly_eff);
250 hist_MuctpiThr_eff1->SetBinError(
ib + 1, Ly_effErr);
252 n_Ly_hitOn = hist_MuctpiThr2->GetBinContent(
ib + 1);
253 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
255 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
256 hist_MuctpiThr_eff2->SetBinContent(
ib + 1, Ly_eff);
257 hist_MuctpiThr_eff2->SetBinError(
ib + 1, Ly_effErr);
259 n_Ly_hitOn = hist_MuctpiThr3->GetBinContent(
ib + 1);
260 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
262 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
263 hist_MuctpiThr_eff3->SetBinContent(
ib + 1, Ly_eff);
264 hist_MuctpiThr_eff3->SetBinError(
ib + 1, Ly_effErr);
266 n_Ly_hitOn = hist_MuctpiThr4->GetBinContent(
ib + 1);
267 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
269 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
270 hist_MuctpiThr_eff4->SetBinContent(
ib + 1, Ly_eff);
271 hist_MuctpiThr_eff4->SetBinError(
ib + 1, Ly_effErr);
273 n_Ly_hitOn = hist_MuctpiThr5->GetBinContent(
ib + 1);
274 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
276 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
277 hist_MuctpiThr_eff5->SetBinContent(
ib + 1, Ly_eff);
278 hist_MuctpiThr_eff5->SetBinError(
ib + 1, Ly_effErr);
280 n_Ly_hitOn = hist_PadThr0->GetBinContent(
ib + 1);
281 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
283 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
284 hist_PadThr_eff0->SetBinContent(
ib + 1, Ly_eff);
285 hist_PadThr_eff0->SetBinError(
ib + 1, Ly_effErr);
287 n_Ly_hitOn = hist_PadThr1->GetBinContent(
ib + 1);
288 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
290 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
291 hist_PadThr_eff1->SetBinContent(
ib + 1, Ly_eff);
292 hist_PadThr_eff1->SetBinError(
ib + 1, Ly_effErr);
294 n_Ly_hitOn = hist_PadThr2->GetBinContent(
ib + 1);
295 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
297 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
298 hist_PadThr_eff2->SetBinContent(
ib + 1, Ly_eff);
299 hist_PadThr_eff2->SetBinError(
ib + 1, Ly_effErr);
301 n_Ly_hitOn = hist_PadThr3->GetBinContent(
ib + 1);
302 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
304 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
305 hist_PadThr_eff3->SetBinContent(
ib + 1, Ly_eff);
306 hist_PadThr_eff3->SetBinError(
ib + 1, Ly_effErr);
308 n_Ly_hitOn = hist_PadThr4->GetBinContent(
ib + 1);
309 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
311 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
312 hist_PadThr_eff4->SetBinContent(
ib + 1, Ly_eff);
313 hist_PadThr_eff4->SetBinError(
ib + 1, Ly_effErr);
315 n_Ly_hitOn = hist_PadThr5->GetBinContent(
ib + 1);
316 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
318 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
319 hist_PadThr_eff5->SetBinContent(
ib + 1, Ly_eff);
320 hist_PadThr_eff5->SetBinError(
ib + 1, Ly_effErr);
322 n_Ly_hitOn = hist_PhiEtaCoinThr0->GetBinContent(
ib + 1);
323 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
325 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
326 hist_PhiEtaCoinThr_eff0->SetBinContent(
ib + 1, Ly_eff);
327 hist_PhiEtaCoinThr_eff0->SetBinError(
ib + 1, Ly_effErr);
329 n_Ly_hitOn = hist_PhiEtaCoinThr1->GetBinContent(
ib + 1);
330 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
332 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
333 hist_PhiEtaCoinThr_eff1->SetBinContent(
ib + 1, Ly_eff);
334 hist_PhiEtaCoinThr_eff1->SetBinError(
ib + 1, Ly_effErr);
336 n_Ly_hitOn = hist_PhiEtaCoinThr2->GetBinContent(
ib + 1);
337 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
339 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
340 hist_PhiEtaCoinThr_eff2->SetBinContent(
ib + 1, Ly_eff);
341 hist_PhiEtaCoinThr_eff2->SetBinError(
ib + 1, Ly_effErr);
343 n_Ly_hitOn = hist_PhiEtaCoinThr3->GetBinContent(
ib + 1);
344 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
346 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
347 hist_PhiEtaCoinThr_eff3->SetBinContent(
ib + 1, Ly_eff);
348 hist_PhiEtaCoinThr_eff3->SetBinError(
ib + 1, Ly_effErr);
350 n_Ly_hitOn = hist_PhiEtaCoinThr4->GetBinContent(
ib + 1);
351 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
353 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
354 hist_PhiEtaCoinThr_eff4->SetBinContent(
ib + 1, Ly_eff);
355 hist_PhiEtaCoinThr_eff4->SetBinError(
ib + 1, Ly_effErr);
357 n_Ly_hitOn = hist_PhiEtaCoinThr5->GetBinContent(
ib + 1);
358 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
360 Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
361 hist_PhiEtaCoinThr_eff5->SetBinContent(
ib + 1, Ly_eff);
362 hist_PhiEtaCoinThr_eff5->SetBinError(
ib + 1, Ly_effErr);
367 TDirectory*
dir =
f->GetDirectory(dir_trigger_track.c_str());
370 hist_MuctpiThr_eff0->Write(
"", TObject::kOverwrite);
371 hist_MuctpiThr_eff1->Write(
"", TObject::kOverwrite);
372 hist_MuctpiThr_eff2->Write(
"", TObject::kOverwrite);
373 hist_MuctpiThr_eff3->Write(
"", TObject::kOverwrite);
374 hist_MuctpiThr_eff4->Write(
"", TObject::kOverwrite);
375 hist_MuctpiThr_eff5->Write(
"", TObject::kOverwrite);
376 hist_PadThr_eff0->Write(
"", TObject::kOverwrite);
377 hist_PadThr_eff1->Write(
"", TObject::kOverwrite);
378 hist_PadThr_eff2->Write(
"", TObject::kOverwrite);
379 hist_PadThr_eff3->Write(
"", TObject::kOverwrite);
380 hist_PadThr_eff4->Write(
"", TObject::kOverwrite);
381 hist_PadThr_eff5->Write(
"", TObject::kOverwrite);
382 hist_PhiEtaCoinThr_eff0->Write(
"", TObject::kOverwrite);
383 hist_PhiEtaCoinThr_eff1->Write(
"", TObject::kOverwrite);
384 hist_PhiEtaCoinThr_eff2->Write(
"", TObject::kOverwrite);
385 hist_PhiEtaCoinThr_eff3->Write(
"", TObject::kOverwrite);
386 hist_PhiEtaCoinThr_eff4->Write(
"", TObject::kOverwrite);
387 hist_PhiEtaCoinThr_eff5->Write(
"", TObject::kOverwrite);
393 std::string LyHit_name, LyPrj_name, LyEff_name;
394 LyHit_name = dir_glob_track +
"Hit_on_Track_Layer";
395 LyPrj_name = dir_glob_track +
"Track_Projected_on_Layer";
396 LyEff_name = dir_glob_track +
"Layer_Efficiency";
400 TH1I* hist_LyHit = (TH1I*) (
f->Get(LyHit_name.c_str()));
401 TH1I* hist_LyPrj = (TH1I*) (
f->Get(LyPrj_name.c_str()));
402 TH1F* hist_LyEff = (
TH1F*) (
f->Get(LyEff_name.c_str()));
404 int nb = hist_LyEff->GetNbinsX();
405 double Ly_eff, Ly_effErr;
407 float n_Ly_hitOn = hist_LyHit->GetBinContent(
ib + 1);
408 float n_Ly_TrPrj = hist_LyPrj->GetBinContent(
ib + 1);
410 if (n_Ly_TrPrj > 0) {
411 Ly_eff =
float(n_Ly_hitOn) /
float(n_Ly_TrPrj);
412 Ly_effErr = sqrt(fabs(n_Ly_hitOn) / n_Ly_TrPrj) *
413 sqrt(1. - fabs(n_Ly_hitOn) / n_Ly_TrPrj) /
415 hist_LyEff->SetBinContent(
ib + 1, Ly_eff);
416 hist_LyEff->SetBinError(
ib + 1, Ly_effErr);
421 TDirectory*
dir =
f->GetDirectory(dir_glob_track.c_str());
427 std::string LyHit_SideA_name, LyPrj_SideA_name, LyEff_SideA_name;
428 LyHit_SideA_name = dir_sideA_track +
"Layer_HitOnTrack_sideA";
429 LyPrj_SideA_name = dir_sideA_track +
"Layer_TrackProj_sideA";
430 LyEff_SideA_name = dir_sideA_track +
"Layer_Efficiency_sideA";
435 TH1I* hist_LyHit_SideA = (TH1I*) (
f->Get(LyHit_SideA_name.c_str()));
436 TH1I* hist_LyPrj_SideA = (TH1I*) (
f->Get(LyPrj_SideA_name.c_str()));
437 TH1F* hist_LyEff_SideA = (
TH1F*) (
f->Get(LyEff_SideA_name.c_str()));
439 int nb = hist_LyEff_SideA->GetNbinsX();
440 double Ly_eff_SideA, Ly_effErr_SideA;
442 float n_Ly_hitOn_SideA = hist_LyHit_SideA->GetBinContent(
ib + 1);
443 float n_Ly_TrPrj_SideA = hist_LyPrj_SideA->GetBinContent(
ib + 1);
445 if (n_Ly_TrPrj_SideA > 0) {
446 Ly_eff_SideA =
float(n_Ly_hitOn_SideA) /
float(n_Ly_TrPrj_SideA);
448 Ly_effErr_SideA = sqrt(fabs(n_Ly_hitOn_SideA) / n_Ly_TrPrj_SideA) *
449 sqrt(1. - fabs(n_Ly_hitOn_SideA) / n_Ly_TrPrj_SideA) /
450 sqrt(n_Ly_TrPrj_SideA);
451 hist_LyEff_SideA->SetBinContent(
ib + 1, Ly_eff_SideA);
452 hist_LyEff_SideA->SetBinError(
ib + 1, Ly_effErr_SideA);
457 TDirectory*
dir =
f->GetDirectory(dir_sideA_track.c_str());
463 std::string LyHit_SideC_name, LyPrj_SideC_name, LyEff_SideC_name;
464 LyHit_SideC_name = dir_sideC_track +
"Layer_HitOnTrack_sideC";
465 LyPrj_SideC_name = dir_sideC_track +
"Layer_TrackProj_sideC";
466 LyEff_SideC_name = dir_sideC_track +
"Layer_Efficiency_sideC";
471 TH1I* hist_LyHit_SideC = (TH1I*) (
f->Get(LyHit_SideC_name.c_str()));
472 TH1I* hist_LyPrj_SideC = (TH1I*) (
f->Get(LyPrj_SideC_name.c_str()));
473 TH1F* hist_LyEff_SideC = (
TH1F*) (
f->Get(LyEff_SideC_name.c_str()));
475 int nb = hist_LyEff_SideC->GetNbinsX();
476 double Ly_eff_SideC, Ly_effErr_SideC;
478 float n_Ly_hitOn_SideC = hist_LyHit_SideC->GetBinContent(
ib + 1);
479 float n_Ly_TrPrj_SideC = hist_LyPrj_SideC->GetBinContent(
ib + 1);
481 if (n_Ly_TrPrj_SideC > 0) {
482 Ly_eff_SideC =
float(n_Ly_hitOn_SideC) /
float(n_Ly_TrPrj_SideC);
484 Ly_effErr_SideC = sqrt(fabs(n_Ly_hitOn_SideC) / n_Ly_TrPrj_SideC) *
485 sqrt(1. - fabs(n_Ly_hitOn_SideC) / n_Ly_TrPrj_SideC) /
486 sqrt(n_Ly_TrPrj_SideC);
487 hist_LyEff_SideC->SetBinContent(
ib + 1, Ly_eff_SideC);
488 hist_LyEff_SideC->SetBinError(
ib + 1, Ly_effErr_SideC);
492 TDirectory*
dir =
f->GetDirectory(dir_sideC_track.c_str());
499 int rpc_eventstotal = 0;
501 TH1I* rpc_hits = (TH1I*) (
f->Get((dir_ov_raw +
"Number_of_RPC_hits_per_event").c_str()));
502 rpc_eventstotal =
int(rpc_hits->GetEntries());
507 std::string AverageEff_C_name = dir_sideC_track +
"Efficiency_Distribution_sideC";
508 std::string AverageEff_A_name = dir_sideA_track +
"Efficiency_Distribution_sideA";
509 std::string AverageGapEff_C_name = dir_sideC_track +
"GapEfficiency_Distribution_sideC";
510 std::string AverageGapEff_A_name = dir_sideA_track +
"GapEfficiency_Distribution_sideA";
511 std::string AverageNoiseCorr_C_name = dir_sideC_track +
"NoiseCorr_Distribution_sideC";
512 std::string AverageNoiseCorr_A_name = dir_sideA_track +
"NoiseCorr_Distribution_sideA";
513 std::string AverageNoiseTot_C_name = dir_sideC_track +
"NoiseTot_Distribution_sideC";
514 std::string AverageNoiseTot_A_name = dir_sideA_track +
"NoiseTot_Distribution_sideA";
515 std::string AverageCS_C_name = dir_sideC_track +
"CS_Distribution_sideC";
516 std::string AverageCS_A_name = dir_sideA_track +
"CS_Distribution_sideA";
517 std::string AverageRes_CS1_C_name = dir_sideC_track +
"Res_CS1_Distribution_sideC";
518 std::string AverageRes_CS1_A_name = dir_sideA_track +
"Res_CS1_Distribution_sideA";
519 std::string AverageRes_CS2_C_name = dir_sideC_track +
"Res_CS2_Distribution_sideC";
520 std::string AverageRes_CS2_A_name = dir_sideA_track +
"Res_CS2_Distribution_sideA";
521 std::string AverageRes_CSmore2_C_name = dir_sideC_track +
"Res_CSmore2_Distribution_sideC";
522 std::string AverageRes_CSmore2_A_name = dir_sideA_track +
"Res_CSmore2_Distribution_sideA";
523 std::string AverageRes_CS1rms_C_name = dir_sideC_track +
"Res_CS1rms_Distribution_sideC";
524 std::string AverageRes_CS1rms_A_name = dir_sideA_track +
"Res_CS1rms_Distribution_sideA";
525 std::string AverageRes_CS2rms_C_name = dir_sideC_track +
"Res_CS2rms_Distribution_sideC";
526 std::string AverageRes_CS2rms_A_name = dir_sideA_track +
"Res_CS2rms_Distribution_sideA";
527 std::string AverageRes_CSmore2rms_C_name = dir_sideC_track +
"Res_CSmore2rms_Distribution_sideC";
528 std::string AverageRes_CSmore2rms_A_name = dir_sideA_track +
"Res_CSmore2rms_Distribution_sideA";
529 std::string AverageOccupancy_C_name = dir_sideC_track +
"Occupancy_Distribution_sideC";
530 std::string AverageOccupancy_A_name = dir_sideA_track +
"Occupancy_Distribution_sideA";
531 std::string AverageTime_C_name = dir_sideC_track +
"Time_Distribution_sideC";
532 std::string AverageTime_A_name = dir_sideA_track +
"Time_Distribution_sideA";
535 auto initialiseHisto = [
f](
const std::string&
name) ->
TH1F* {
541 TH1F* h_AverageEff_C = initialiseHisto(AverageEff_C_name);
542 TH1F* h_AverageEff_A = initialiseHisto(AverageEff_A_name);
543 TH1F* h_AverageGapEff_C = initialiseHisto(AverageGapEff_C_name);
544 TH1F* h_AverageGapEff_A = initialiseHisto(AverageGapEff_A_name);
545 TH1F* h_AverageNoiseCorr_C = initialiseHisto(AverageNoiseCorr_C_name);
546 TH1F* h_AverageNoiseCorr_A = initialiseHisto(AverageNoiseCorr_A_name);
547 TH1F* h_AverageNoiseTot_C = initialiseHisto(AverageNoiseTot_C_name);
548 TH1F* h_AverageNoiseTot_A = initialiseHisto(AverageNoiseTot_A_name);
549 TH1F* h_AverageCS_C = initialiseHisto(AverageCS_C_name);
550 TH1F* h_AverageCS_A = initialiseHisto(AverageCS_A_name);
551 TH1F* h_AverageRes_CS1_C = initialiseHisto(AverageRes_CS1_C_name);
552 TH1F* h_AverageRes_CS1_A = initialiseHisto(AverageRes_CS1_A_name);
553 TH1F* h_AverageRes_CS2_C = initialiseHisto(AverageRes_CS2_C_name);
554 TH1F* h_AverageRes_CS2_A = initialiseHisto(AverageRes_CS2_A_name);
555 TH1F* h_AverageRes_CSmore2_C = initialiseHisto(AverageRes_CSmore2_C_name);
556 TH1F* h_AverageRes_CSmore2_A = initialiseHisto(AverageRes_CSmore2_A_name);
557 TH1F* h_AverageRes_CS1rms_C = initialiseHisto(AverageRes_CS1rms_C_name);
558 TH1F* h_AverageRes_CS1rms_A = initialiseHisto(AverageRes_CS1rms_A_name);
559 TH1F* h_AverageRes_CS2rms_C = initialiseHisto(AverageRes_CS2rms_C_name);
560 TH1F* h_AverageRes_CS2rms_A = initialiseHisto(AverageRes_CS2rms_A_name);
561 TH1F* h_AverageRes_CSmore2rms_C = initialiseHisto(AverageRes_CSmore2rms_C_name);
562 TH1F* h_AverageRes_CSmore2rms_A = initialiseHisto(AverageRes_CSmore2rms_A_name);
563 TH1F* h_AverageOccupancy_C = initialiseHisto(AverageOccupancy_C_name);
564 TH1F* h_AverageOccupancy_A = initialiseHisto(AverageOccupancy_A_name);
565 TH1F* h_AverageTime_C = initialiseHisto(AverageTime_C_name);
566 TH1F* h_AverageTime_A = initialiseHisto(AverageTime_A_name);
568 auto resetIfValid = [](
TH1F* pH) ->
void {
575 resetIfValid(h_AverageEff_C);
576 resetIfValid(h_AverageEff_A);
577 resetIfValid(h_AverageGapEff_C);
578 resetIfValid(h_AverageGapEff_A);
579 resetIfValid(h_AverageNoiseCorr_C);
580 resetIfValid(h_AverageNoiseCorr_A);
581 resetIfValid(h_AverageNoiseTot_C);
582 resetIfValid(h_AverageNoiseTot_A);
583 resetIfValid(h_AverageCS_C);
584 resetIfValid(h_AverageCS_A);
585 resetIfValid(h_AverageRes_CS1_C);
586 resetIfValid(h_AverageRes_CS1_A);
587 resetIfValid(h_AverageRes_CS2_C);
588 resetIfValid(h_AverageRes_CS2_A);
589 resetIfValid(h_AverageRes_CSmore2_C);
590 resetIfValid(h_AverageRes_CSmore2_A);
591 resetIfValid(h_AverageRes_CS1rms_C);
592 resetIfValid(h_AverageRes_CS1rms_A);
593 resetIfValid(h_AverageRes_CS2rms_C);
594 resetIfValid(h_AverageRes_CS2rms_A);
595 resetIfValid(h_AverageRes_CSmore2rms_C);
596 resetIfValid(h_AverageRes_CSmore2rms_A);
597 resetIfValid(h_AverageOccupancy_C);
598 resetIfValid(h_AverageOccupancy_A);
599 resetIfValid(h_AverageTime_C);
600 resetIfValid(h_AverageTime_A);
603 int countpanelindb = 0;
604 int countpaneleff0 = 0;
605 int countpaneltrack0 = 0;
606 for (
int i_sec = 0; i_sec != 15 * 1 + 1; i_sec++) {
607 char sector_char[100];
608 std::string sector_name;
609 sprintf(sector_char,
"_Sector%.2d", i_sec + 1);
610 sector_name = sector_char;
611 std::cout <<
" RPC sector_name processing " << sector_name << std::endl;
613 std::string TrackProj_name = dir_sum_track +
"SummaryTrackProj" + sector_name;
614 std::string HitOnTrack_name = dir_sum_track +
"SummaryHitOnTrack" + sector_name;
615 std::string HitOnTrackCross_name = dir_sum_track +
"SummaryHitOnTrack_withCrossStrip" + sector_name;
616 std::string Eff_name = dir_sum_track +
"SummaryEfficiency" + sector_name;
617 std::string GapEff_name = dir_sum_track +
"SummaryGapEfficiency" + sector_name;
618 std::string NoiseCorr_name = dir_sum_track +
"SummaryNoiseCorr" + sector_name;
619 std::string NoiseCorr_s_name = dir_sum_track +
"SummaryNoiseCorr_NotNorm" + sector_name;
620 std::string NoiseTot_name = dir_sum_track +
"SummaryNoiseTot" + sector_name;
621 std::string NoiseTot_s_name = dir_sum_track +
"SummaryNoiseTot_NotNorm" + sector_name;
622 std::string Res_CS1_name = dir_sum_track +
"SummaryRes_CS1" + sector_name;
623 std::string Res_CS1_s_name = dir_sum_track +
"SummaryRes_CS1_NotNorm" + sector_name;
624 std::string Res_CS1_square_name = dir_sum_track +
"SummaryRes_CS1_square" + sector_name;
625 std::string Res_CS1_entries_name = dir_sum_track +
"SummaryRes_CS1_entries" + sector_name;
626 std::string Res_CS2_name = dir_sum_track +
"SummaryRes_CS2" + sector_name;
627 std::string Res_CS2_s_name = dir_sum_track +
"SummaryRes_CS2_NotNorm" + sector_name;
628 std::string Res_CS2_square_name = dir_sum_track +
"SummaryRes_CS2_square" + sector_name;
629 std::string Res_CS2_entries_name = dir_sum_track +
"SummaryRes_CS2_entries" + sector_name;
630 std::string Res_CSmore2_name = dir_sum_track +
"SummaryRes_CSmore2" + sector_name;
631 std::string Res_CSmore2_s_name = dir_sum_track +
"SummaryRes_CSmore2_NotNorm" + sector_name;
632 std::string Res_CSmore2_square_name = dir_sum_track +
"SummaryRes_CSmore2_square" + sector_name;
633 std::string Res_CSmore2_entries_name = dir_sum_track +
"SummaryRes_CSmore2_entries" + sector_name;
634 std::string CS_name = dir_sum_track +
"SummaryCS" + sector_name;
635 std::string CS_s_name = dir_sum_track +
"SummaryCS_NotNorm" + sector_name;
636 std::string CS_square_name = dir_sum_track +
"SummaryCS_square" + sector_name;
637 std::string CS_entries_name = dir_sum_track +
"SummaryCS_entries" + sector_name;
638 std::string CS1_entries_name = dir_sum_track +
"SummaryCS1_entries" + sector_name;
639 std::string CS2_entries_name = dir_sum_track +
"SummaryCS2_entries" + sector_name;
640 std::string Time_name = dir_sum_track +
"SummaryTime" + sector_name;
641 std::string Time_s_name = dir_sum_track +
"SummaryTime_NotNorm" + sector_name;
642 std::string Time_square_name = dir_sum_track +
"SummaryTime_square" + sector_name;
643 std::string Occupancy_name = dir_sum_track +
"SummaryOccupancy" + sector_name;
644 std::string Occupancy_s_name = dir_sum_track +
"SummaryOccupancy_NotNorm" + sector_name;
645 std::string PanelId_name = dir_sum_track +
"SummaryPanelID" + sector_name;
648 std::string EffSecDist_name = dir_sum_track +
"SummaryEffDistriPerSector" + sector_name;
649 std::string GapEffSecDist_name = dir_sum_track +
"SummaryGapEffDistriPerSector" + sector_name;
650 std::string NoiseCorrSecDist_name = dir_sum_track +
"SummaryNoiseCorrDistriPerSector" + sector_name;
651 std::string NoiseTotSecDist_name = dir_sum_track +
"SummaryNoiseTotDistriPerSector" + sector_name;
652 std::string CSSecDist_name = dir_sum_track +
"SummaryCSDistriPerSector" + sector_name;
653 std::string Res_CS1SecDist_name = dir_sum_track +
"SummaryRes_CS1DistriPerSector" + sector_name;
654 std::string Res_CS2SecDist_name = dir_sum_track +
"SummaryRes_CS2DistriPerSector" + sector_name;
655 std::string Res_CSmore2SecDist_name = dir_sum_track +
"SummaryRes_CSmore2DistriPerSector" + sector_name;
656 std::string Res_CS1_rmsSecDist_name = dir_sum_track +
"SummaryRes_CS1rmsDistriPerSector" + sector_name;
657 std::string Res_CS2_rmsSecDist_name = dir_sum_track +
"SummaryRes_CS2rmsDistriPerSector" + sector_name;
658 std::string Res_CSmore2_rmsSecDist_name = dir_sum_track +
"SummaryRes_CSmore2rmsDistriPerSector" +
660 std::string TimeSecDist_name = dir_sum_track +
"SummaryTimeDistriPerSector" + sector_name;
661 std::string OccupancySecDist_name = dir_sum_track +
"SummaryOccupancyDistriPerSector" + sector_name;
663 auto initialiseHisto = [
f](
const std::string&
name) ->
TH1F* {
668 TH1F* h_TrackProj = initialiseHisto(TrackProj_name);
669 TH1F* h_HitOnTrack = initialiseHisto(HitOnTrack_name);
670 TH1F* h_HitOnTrackCross = initialiseHisto(HitOnTrackCross_name);
671 TH1F* h_Eff = initialiseHisto(Eff_name);
672 TH1F* h_GapEff = initialiseHisto(GapEff_name);
673 TH1F* h_NoiseCorr = initialiseHisto(NoiseCorr_name);
674 TH1F* h_NoiseCorr_s = initialiseHisto(NoiseCorr_s_name);
675 TH1F* h_NoiseTot = initialiseHisto(NoiseTot_name);
676 TH1F* h_NoiseTot_s = initialiseHisto(NoiseTot_s_name);
677 TH1F* h_Res_CS1 = initialiseHisto(Res_CS1_name);
678 TH1F* h_Res_CS1_s = initialiseHisto(Res_CS1_s_name);
679 TH1F* h_Res_CS1_square = initialiseHisto(Res_CS1_square_name);
680 TH1F* h_Res_CS1_entries = initialiseHisto(Res_CS1_entries_name);
681 TH1F* h_Res_CS2 = initialiseHisto(Res_CS2_name);
682 TH1F* h_Res_CS2_s = initialiseHisto(Res_CS2_s_name);
683 TH1F* h_Res_CS2_square = initialiseHisto(Res_CS2_square_name);
684 TH1F* h_Res_CS2_entries = initialiseHisto(Res_CS2_entries_name);
685 TH1F* h_Res_CSmore2 = initialiseHisto(Res_CSmore2_name);
686 TH1F* h_Res_CSmore2_s = initialiseHisto(Res_CSmore2_s_name);
687 TH1F* h_Res_CSmore2_square = initialiseHisto(Res_CSmore2_square_name);
688 TH1F* h_Res_CSmore2_entries = initialiseHisto(Res_CSmore2_entries_name);
689 TH1F* h_CS = initialiseHisto(CS_name);
690 TH1F* h_CS_s = initialiseHisto(CS_s_name);
691 TH1F* h_CS_square = initialiseHisto(CS_square_name);
692 TH1F* h_CS_entries = initialiseHisto(CS_square_name);
693 TH1F* h_CS1_entries = initialiseHisto(CS1_entries_name);
694 TH1F* h_CS2_entries = initialiseHisto(CS2_entries_name);
695 TH1F* h_Time = initialiseHisto(Time_name);
696 TH1F* h_Time_s = initialiseHisto(Time_s_name);
697 TH1F* h_Time_square = initialiseHisto(Time_square_name);
698 TH1F* h_Occupancy = initialiseHisto(Occupancy_name);
699 TH1F* h_Occupancy_s = initialiseHisto(Occupancy_s_name);
700 TH1F* h_PanelId = initialiseHisto(PanelId_name);
702 TH1F* h_EffSecDist = initialiseHisto(EffSecDist_name);
703 TH1F* h_GapEffSecDist = initialiseHisto(GapEffSecDist_name);
704 TH1F* h_NoiseCorrSecDist = initialiseHisto(NoiseCorrSecDist_name);
705 TH1F* h_NoiseTotSecDist = initialiseHisto(NoiseTotSecDist_name);
706 TH1F* h_CSSecDist = initialiseHisto(CSSecDist_name);
707 TH1F* h_Res_CS1SecDist = initialiseHisto(Res_CS1SecDist_name);
708 TH1F* h_Res_CS2SecDist = initialiseHisto(Res_CS2SecDist_name);
709 TH1F* h_Res_CSmore2SecDist = initialiseHisto(Res_CSmore2SecDist_name);
710 TH1F* h_Res_CS1_rmsSecDist = initialiseHisto(Res_CS1_rmsSecDist_name);
711 TH1F* h_Res_CS2_rmsSecDist = initialiseHisto(Res_CS2_rmsSecDist_name);
712 TH1F* h_Res_CSmore2_rmsSecDist = initialiseHisto(Res_CSmore2_rmsSecDist_name);
713 TH1F* h_TimeSecDist = initialiseHisto(TimeSecDist_name);
714 TH1F* h_OccupancySecDist = initialiseHisto(OccupancySecDist_name);
716 auto resetIfValid = [](
TH1F* pH) ->
void {
720 resetIfValid(h_EffSecDist);
721 resetIfValid(h_GapEffSecDist);
722 resetIfValid(h_NoiseCorrSecDist);
723 resetIfValid(h_NoiseTotSecDist);
724 resetIfValid(h_CSSecDist);
725 resetIfValid(h_Res_CS1SecDist);
726 resetIfValid(h_Res_CS2SecDist);
727 resetIfValid(h_Res_CSmore2SecDist);
728 resetIfValid(h_Res_CS1_rmsSecDist);
729 resetIfValid(h_Res_CS2_rmsSecDist);
730 resetIfValid(h_Res_CSmore2_rmsSecDist);
731 resetIfValid(h_TimeSecDist);
732 resetIfValid(h_OccupancySecDist);
736 if (h_TrackProj && h_HitOnTrack && h_Eff) {
737 for (
int ib = 0;
ib != h_TrackProj->GetNbinsX();
ib++) {
738 if (not panelOk(h_PanelId,
ib))
continue;
739 n_hit_f = h_HitOnTrack->GetBinContent(
ib + 1);
740 n_tr_p = h_TrackProj->GetBinContent(
ib + 1);
744 panel_eff = n_hit_f / n_tr_p;
749 panel_err_eff = sqrt(fabs(n_hit_f) / n_tr_p) *
750 sqrt(1. - fabs(n_hit_f) / n_tr_p) /
755 h_Eff->SetBinContent(
ib + 1, panel_eff);
756 h_Eff->SetBinError(
ib + 1, panel_err_eff);
757 if (h_EffSecDist) h_EffSecDist->Fill(panel_eff);
758 bool aSide = isASide(h_TrackProj,
ib);
759 fillAorC(aSide, h_AverageEff_A, h_AverageEff_C, panel_eff);
762 TDirectory*
dir =
f->GetDirectory(dir_sum_track.c_str());
767 if (h_TrackProj && h_HitOnTrack && h_HitOnTrackCross && h_GapEff) {
774 bmin =
int( h_GapEff->GetXaxis()->GetXmin());
775 for (
int ib = 0;
ib != h_TrackProj->GetNbinsX();
ib++) {
776 if (not panelOk(h_PanelId,
ib))
continue;
778 if ((
bmin +
ib) % 2 != 0)
continue;
781 nEta = h_HitOnTrack->GetBinContent(
ib + 1);
782 nPhi = h_HitOnTrack->GetBinContent(
ib + 1 +
sign);
783 nEtaPhi = h_HitOnTrackCross->GetBinContent(
ib + 1);
784 n_tr_p = h_TrackProj->GetBinContent(
ib + 1);
787 gapEff = (
nEta +
nPhi - nEtaPhi) / n_tr_p;
788 gapErrEff = sqrt(fabs(
nEta +
nPhi - nEtaPhi) / n_tr_p) *
789 sqrt(1. - fabs(
nEta +
nPhi - nEtaPhi) / n_tr_p) /
795 h_GapEff->SetBinContent(
ib + 1, gapEff);
796 h_GapEff->SetBinError(
ib + 1, gapErrEff);
797 const bool isA = isASide(h_TrackProj,
ib);
798 fillAorC(isA, h_AverageGapEff_A, h_AverageGapEff_C, gapEff);
799 fillIfValid(h_GapEffSecDist, gapEff);
801 TDirectory*
dir =
f->GetDirectory(dir_sum_track.c_str());
811 if (h_Res_CS1 && h_Res_CS1_s && h_Res_CS1_square && h_Res_CS1_entries) {
812 for (
int ib = 0;
ib != h_Res_CS1->GetNbinsX();
ib++) {
813 if (not panelOk(h_PanelId,
ib))
continue;
814 if ((h_Res_CS1_entries->GetBinContent(
ib + 1)) != 0) {
815 res_mean = (h_Res_CS1_s->GetBinContent(
ib + 1)) / (h_Res_CS1_entries->GetBinContent(
ib + 1));
816 res2_mean = (h_Res_CS1_square->GetBinContent(
ib + 1)) / (h_Res_CS1_entries->GetBinContent(
ib + 1));
817 res_RMS = sqrt((fabs(res2_mean - res_mean * res_mean)) / (h_Res_CS1_entries->GetBinContent(
ib + 1)));
818 h_Res_CS1->SetBinContent(
ib + 1, res_mean);
819 h_Res_CS1->SetBinError(
ib + 1, res_RMS);
820 fillIfValid(h_Res_CS1SecDist, res_mean);
821 fillIfValid(h_Res_CS1_rmsSecDist, res_RMS);
822 bool isA = isASide(h_Res_CS1,
ib);
823 fillAorC(isA, h_AverageRes_CS1_A, h_AverageRes_CS1_C, res_mean);
824 fillAorC(isA, h_AverageRes_CS1rms_A, h_AverageRes_CS1rms_C, res_RMS);
827 TDirectory* dirRes1 =
f->GetDirectory(dir_sum_track.c_str());
828 writeToFile(dirRes1, h_Res_CS1, h_Res_CS1SecDist, h_Res_CS1_rmsSecDist);
835 if (h_Res_CS2 && h_Res_CS2_s && h_Res_CS2_square && h_Res_CS2_entries) {
836 for (
int ib = 0;
ib != h_Res_CS2->GetNbinsX();
ib++) {
837 if (not panelOk(h_PanelId,
ib))
continue;
838 if ((h_Res_CS2_entries->GetBinContent(
ib + 1)) != 0) {
839 res_mean = (h_Res_CS2_s->GetBinContent(
ib + 1)) / (h_Res_CS2_entries->GetBinContent(
ib + 1));
840 res2_mean = (h_Res_CS2_square->GetBinContent(
ib + 1)) / (h_Res_CS2_entries->GetBinContent(
ib + 1));
841 res_RMS = sqrt(fabs((res2_mean - res_mean * res_mean) / (h_Res_CS2_entries->GetBinContent(
ib + 1))));
842 h_Res_CS2->SetBinContent(
ib + 1, res_mean);
843 h_Res_CS2->SetBinError(
ib + 1, res_RMS);
844 fillIfValid(h_Res_CS2SecDist, res_mean);
845 fillIfValid(h_Res_CS2_rmsSecDist, res_RMS);
846 bool isA = isASide(h_Res_CS2,
ib);
847 fillAorC(isA, h_AverageRes_CS2_A, h_AverageRes_CS2_C, res_mean);
848 fillAorC(isA, h_AverageRes_CS2rms_A, h_AverageRes_CS2rms_C, res_RMS);
851 TDirectory* dirRes2 =
f->GetDirectory(dir_sum_track.c_str());
852 writeToFile(dirRes2, h_Res_CS2, h_Res_CS2SecDist, h_Res_CS2_rmsSecDist);
859 if (h_Res_CSmore2 && h_Res_CSmore2_s && h_Res_CSmore2_square && h_Res_CSmore2_entries) {
860 for (
int ib = 0;
ib != h_Res_CSmore2->GetNbinsX();
ib++) {
861 if (not panelOk(h_PanelId,
ib))
continue;
862 if ((h_Res_CSmore2_entries->GetBinContent(
ib + 1)) != 0) {
863 res_mean = (h_Res_CSmore2_s->GetBinContent(
ib + 1)) / (h_Res_CSmore2_entries->GetBinContent(
ib + 1));
864 res2_mean = (h_Res_CSmore2_square->GetBinContent(
ib + 1)) /
865 (h_Res_CSmore2_entries->GetBinContent(
ib + 1));
866 res_RMS = sqrt(fabs((res2_mean - res_mean * res_mean) / (h_Res_CSmore2_entries->GetBinContent(
869 h_Res_CSmore2->SetBinContent(
ib + 1, res_mean);
870 h_Res_CSmore2->SetBinError(
ib + 1, res_RMS);
871 fillIfValid(h_Res_CSmore2SecDist, res_mean);
872 fillIfValid(h_Res_CSmore2_rmsSecDist, res_RMS);
873 bool isA = isASide(h_Res_CSmore2,
ib);
874 fillAorC(isA, h_AverageRes_CSmore2_A, h_AverageRes_CSmore2_C, res_mean);
875 fillAorC(isA, h_AverageRes_CSmore2rms_A, h_AverageRes_CSmore2rms_C, res_RMS);
878 TDirectory* dirResp2 =
f->GetDirectory(dir_sum_track.c_str());
879 writeToFile(dirResp2, h_Res_CSmore2, h_Res_CSmore2SecDist, h_Res_CSmore2_rmsSecDist);
883 if ((rpc_eventstotal > 0) && h_Occupancy && h_Occupancy_s) {
884 for (
int ib = 0;
ib != h_Occupancy->GetNbinsX();
ib++) {
885 if (not panelOk(h_PanelId,
ib))
continue;
886 panel_occ = h_Occupancy_s->GetBinContent(
ib + 1);
887 panel_occ = panel_occ /
float(rpc_eventstotal);
889 h_Occupancy->SetBinContent(
ib + 1, panel_occ);
890 h_Occupancy->SetBinError(
ib + 1, sqrt(panel_occ));
891 panel_occ = safelyTakeLog(panel_occ);
892 fillIfValid(h_OccupancySecDist, panel_occ);
893 bool isA = isASide(h_PanelId,
ib);
894 fillAorC(isA, h_AverageOccupancy_A, h_AverageOccupancy_C, panel_occ);
897 TDirectory* dirOcc =
f->GetDirectory(dir_sum_track.c_str());
898 writeToFile(dirOcc, h_Occupancy, h_OccupancySecDist);
903 if (h_CS && h_CS_s && h_CS_square && h_CS_entries) {
904 for (
int ib = 0;
ib != h_CS->GetNbinsX();
ib++) {
905 if (not panelOk(h_PanelId,
ib))
continue;
906 panelCS_entries = h_CS_entries->GetBinContent(
ib + 1);
907 panelCS = h_CS_s->GetBinContent(
ib + 1);
908 panelCS2 = h_CS_square->GetBinContent(
ib + 1);
909 if (panelCS_entries != 0) {
910 panelCS_mean = panelCS / panelCS_entries;
911 panelCS2_mean = panelCS2 / panelCS_entries;
912 panelCS_RMS = sqrt(fabs((panelCS2_mean - panelCS_mean * panelCS_mean) / panelCS_entries));
913 h_CS->SetBinContent(
ib + 1, panelCS_mean);
914 h_CS->SetBinError(
ib + 1, panelCS_RMS);
915 fillIfValid(h_CSSecDist, panelCS_mean);
916 bool isA = isASide(h_CS,
ib);
917 fillAorC(isA, h_AverageCS_A, h_AverageCS_C, panelCS_mean);
921 TDirectory* dirCS =
f->GetDirectory(dir_sum_track.c_str());
926 if (h_Time && h_Time_s && h_Time_square && h_CS_entries) {
927 for (
int ib = 0;
ib != h_Time->GetNbinsX();
ib++) {
928 if (not panelOk(h_PanelId,
ib))
continue;
929 if (h_CS_entries->GetBinContent(
ib + 1) != 0) {
930 Time_mean = (h_Time_s->GetBinContent(
ib + 1)) / (h_CS_entries->GetBinContent(
ib + 1));
931 Time2_mean = (h_Time_square->GetBinContent(
ib + 1)) / (h_CS_entries->GetBinContent(
ib + 1));
932 Time_RMS = sqrt(fabs((Time2_mean - Time_mean * Time_mean) / (h_CS_entries->GetBinContent(
ib + 1))));
934 h_Time->SetBinContent(
ib + 1, Time_mean);
935 h_Time->SetBinError(
ib + 1, Time_RMS);
937 fillIfValid(h_TimeSecDist, Time_mean);
938 bool isA = isASide(h_Time,
ib);
939 fillAorC(isA, h_AverageTime_A, h_AverageTime_C, Time_mean);
943 TDirectory* dirTime =
f->GetDirectory(dir_sum_track.c_str());
947 noiseErrNorm = 18257.42;
948 if ((rpc_eventstotal > 0) && h_NoiseCorr && h_NoiseCorr_s && h_NoiseTot && h_NoiseTot_s && h_CS_entries) {
950 for (
int ib = 0;
ib != h_NoiseCorr->GetNbinsX();
ib++) {
951 if (not panelOk(h_PanelId,
ib))
continue;
952 if (h_CS_entries->GetBinContent(
ib + 1) == 0)
continue;
953 noiseCorr = h_NoiseCorr_s->GetBinContent(
ib + 1);
954 noiseCorrErr = sqrt(noiseCorr) * noiseErrNorm /
float(rpc_eventstotal);
955 noiseCorr = (noiseCorr * 1000000) /
float(rpc_eventstotal);
956 h_NoiseCorr->SetBinContent(
ib + 1, noiseCorr);
957 h_NoiseCorr->SetBinError(
ib + 1, noiseCorrErr);
958 fillIfValid(h_NoiseCorrSecDist, noiseCorr);
960 noiseTot = h_NoiseTot_s->GetBinContent(
ib + 1);
961 noiseTotErr = sqrt(noiseTot) * noiseErrNorm /
float(rpc_eventstotal);
962 noiseTot = (noiseTot * 1000000) /
float(rpc_eventstotal);
963 h_NoiseTot->SetBinContent(
ib + 1, noiseTot);
964 h_NoiseTot->SetBinError(
ib + 1, noiseTotErr);
966 fillIfValid(h_NoiseTotSecDist, noiseTot);
967 bool isA = isASide(h_NoiseCorr,
ib);
968 fillAorC(isA, h_AverageNoiseTot_A, h_AverageNoiseTot_C, noiseTot);
969 fillAorC(isA, h_AverageNoiseCorr_A, h_AverageNoiseCorr_C, noiseCorr);
971 TDirectory* dirNoise =
f->GetDirectory(dir_sum_track.c_str());
974 h_NoiseCorr->Write(
"", TObject::kOverwrite);
975 h_NoiseTot->Write(
"", TObject::kOverwrite);
976 writeIfValid(h_NoiseCorrSecDist);
977 writeIfValid(h_NoiseTotSecDist);
984 float effeta = -9999;
985 float effphi = -9999;
986 char arr_effeta [14] = {};
987 char arr_effphi [14] = {};
988 float erreffeta = -1;
989 float erreffphi = -1;
990 char arr_erreffeta [14] = {};
991 char arr_erreffphi [14] = {};
992 float reseta_cs1 = -9999;
993 float resphi_cs1 = -9999;
994 char arr_reseta_cs1 [14] = {};
995 char arr_resphi_cs1 [14] = {};
996 float errreseta_cs1 = -1;
997 float errresphi_cs1 = -1;
998 char arr_errreseta_cs1 [14] = {};
999 char arr_errresphi_cs1 [14] = {};
1000 float reseta_cs2 = -9999;
1001 float resphi_cs2 = -9999;
1002 char arr_reseta_cs2 [14] = {};
1003 char arr_resphi_cs2 [14] = {};
1004 float errreseta_cs2 = -1;
1005 float errresphi_cs2 = -1;
1006 char arr_errreseta_cs2 [14] = {};
1007 char arr_errresphi_cs2 [14] = {};
1008 float reseta_csother = -9999;
1009 float resphi_csother = -9999;
1010 char arr_reseta_csother [14] = {};
1011 char arr_resphi_csother [14] = {};
1012 float errreseta_csother = -1;
1013 float errresphi_csother = -1;
1014 char arr_errreseta_csother [14] = {};
1015 char arr_errresphi_csother [14] = {};
1016 float timeeta = -9999;
1017 float timephi = -9999;
1018 char arr_timeeta [14] = {};
1019 char arr_timephi [14] = {};
1020 float errtimeeta = -1;
1021 float errtimephi = -1;
1022 char arr_errtimeeta [14] = {};
1023 char arr_errtimephi [14] = {};
1024 float noiseeta = -9999;
1025 float noisephi = -9999;
1026 char arr_noiseeta [14] = {};
1027 char arr_noisephi [14] = {};
1028 float errnoiseeta = -1;
1029 float errnoisephi = -1;
1030 char arr_errnoiseeta [14] = {};
1031 char arr_errnoisephi [14] = {};
1032 float noiseeta_cor = -9999;
1033 float noisephi_cor = -9999;
1034 char arr_noiseeta_cor [14] = {};
1035 char arr_noisephi_cor [14] = {};
1036 float errnoiseeta_cor = -1;
1037 float errnoisephi_cor = -1;
1038 char arr_errnoiseeta_cor [14] = {};
1039 char arr_errnoisephi_cor [14] = {};
1040 float cl_sizeeta = -9999;
1041 float cl_sizephi = -9999;
1042 char arr_cl_sizeeta [14] = {};
1043 char arr_cl_sizephi [14] = {};
1044 float errcl_sizeeta = -1;
1045 float errcl_sizephi = -1;
1046 char arr_errcl_sizeeta [14] = {};
1047 char arr_errcl_sizephi [14] = {};
1049 float eta_effphi = 0;
1050 float phi_effeta = 0;
1053 int Binposition = 0;
1054 int TableVersion = 1;
1057 int NumberOfInfo = 1;
1065 coolrpc.
coolDbFolder(
"sqlite://;schema=RPCDQMFOFFLINE.db;dbname=RPC_DQA",
"/OFFLINE/OFFLINE_DQMF");
1067 if (h_Eff) nbin = h_Eff->GetNbinsX();
1068 auto writeToCString = [](
float val,
char* array0) ->
void {
1070 sprintf(array0,
"%f ",
val);
1074 for (
int ibin = 1; ibin != nbin + 1; ibin++) {
1075 if (h_PanelId) PanelCode = (
int) h_PanelId->GetBinContent(ibin);
1076 if (PanelCode == 0)
continue;
1077 if (ibin % 2 == 0) {
1078 if (h_TrackProj) n_tr_pphi = (
int) h_TrackProj->GetBinContent(ibin);
1079 if (n_tr_pphi < 1000)
continue;
1081 effphi = getBinContentIfValid(h_Eff, ibin);
1082 writeToCString(effphi, arr_effphi);
1083 erreffphi = getBinErrorIfValid(h_Eff, ibin);
1084 writeToCString(erreffphi, arr_erreffphi);
1086 resphi_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1087 writeToCString(resphi_cs1, arr_resphi_cs1);
1088 errresphi_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1089 writeToCString(errresphi_cs1, arr_errresphi_cs1);
1091 resphi_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1092 writeToCString(resphi_cs2, arr_resphi_cs2);
1093 errresphi_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1094 writeToCString(errresphi_cs2, arr_errresphi_cs2);
1096 resphi_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1097 writeToCString(resphi_csother, arr_resphi_csother);
1098 errresphi_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1099 writeToCString(errresphi_csother, arr_errresphi_csother);
1101 timephi = getBinContentIfValid(h_Time, ibin);
1102 writeToCString(timephi, arr_timephi);
1103 errtimephi = getBinErrorIfValid(h_Time, ibin);
1104 writeToCString(errtimephi, arr_errtimephi);
1106 noisephi = getBinContentIfValid(h_NoiseTot, ibin);
1107 writeToCString(noisephi, arr_noisephi);
1108 errnoisephi = getBinErrorIfValid(h_NoiseTot, ibin);
1109 writeToCString(errnoisephi, arr_errnoisephi);
1111 noisephi_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1112 writeToCString(noisephi_cor, arr_noisephi_cor);
1113 errnoisephi_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1114 writeToCString(errnoisephi_cor, arr_errnoisephi_cor);
1116 cl_sizephi = getBinContentIfValid(h_CS, ibin);
1117 writeToCString(cl_sizephi, arr_cl_sizephi);
1118 errcl_sizephi = getBinErrorIfValid(h_CS, ibin);
1119 writeToCString(errcl_sizephi, arr_errcl_sizephi);
1122 n_tr_peta = (
int) h_TrackProj->GetBinContent(ibin);
1124 if (n_tr_peta < 1000)
continue;
1126 effeta = getBinContentIfValid(h_Eff, ibin);
1127 writeToCString(effeta, arr_effeta);
1128 erreffeta = getBinErrorIfValid(h_Eff, ibin);
1129 writeToCString(erreffeta, arr_erreffeta);
1131 reseta_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1132 writeToCString(reseta_cs1, arr_reseta_cs1);
1133 errreseta_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1134 writeToCString(errreseta_cs1, arr_errreseta_cs1);
1136 reseta_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1137 writeToCString(reseta_cs2, arr_reseta_cs2);
1138 errreseta_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1139 writeToCString(errreseta_cs2, arr_errreseta_cs2);
1141 reseta_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1142 writeToCString(reseta_csother, arr_reseta_csother);
1143 errreseta_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1144 writeToCString(errreseta_csother, arr_errreseta_csother);
1146 timeeta = getBinContentIfValid(h_Time, ibin);
1147 writeToCString(timeeta, arr_timeeta);
1148 errtimeeta = getBinErrorIfValid(h_Time, ibin);
1149 writeToCString(errtimeeta, arr_errtimeeta);
1151 noiseeta = getBinContentIfValid(h_NoiseTot, ibin);
1152 writeToCString(noiseeta, arr_noiseeta);
1153 errnoiseeta = getBinErrorIfValid(h_NoiseTot, ibin);
1154 writeToCString(errnoiseeta, arr_errnoiseeta);
1156 noiseeta_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1157 writeToCString(noiseeta_cor, arr_noiseeta_cor);
1158 errnoiseeta_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1159 writeToCString(errnoiseeta_cor, arr_errnoiseeta_cor);
1161 cl_sizeeta = getBinContentIfValid(h_CS, ibin);
1162 writeToCString(cl_sizeeta, arr_cl_sizeeta);
1163 errcl_sizeeta = getBinErrorIfValid(h_CS, ibin);
1164 writeToCString(errcl_sizeeta, arr_errcl_sizeeta);
1171 char recPhi1 [4000];
1172 char recPhi2 [4000];
1173 char detPhi1 [4000];
1174 char detPhi2 [4000];
1175 sprintf(recEta,
"%5d %5d %5d %5d %s %s %s %s %s %s %s %s %s %s ", TableVersion,
1176 n_tr_peta, NumberOfInfo,
StripCluster, arr_effeta, arr_erreffeta, arr_reseta_cs1,
1177 arr_errreseta_cs1, arr_reseta_cs2, arr_errreseta_cs2, arr_reseta_csother,
1178 arr_errreseta_csother, arr_timeeta, arr_errtimeeta);
1179 sprintf(detEta,
"%s %s %s %s %s %s ", arr_noiseeta, arr_errnoiseeta,
1180 arr_noiseeta_cor, arr_errnoiseeta_cor, arr_cl_sizeeta, arr_errcl_sizeeta);
1181 sprintf(recPhi1,
"%5d %5d %5d %s %s %s %s %s ", n_tr_pphi, NumberOfInfo,
1182 StripCluster, arr_effphi, arr_resphi_cs1, arr_resphi_cs2, arr_resphi_csother,
1184 sprintf(recPhi2,
"%s %s %s %s %s ", arr_erreffphi, arr_errresphi_cs1,
1185 arr_errresphi_cs2, arr_errresphi_csother, arr_errtimephi);
1186 sprintf(detPhi1,
"%s %s %s %s %s %s ", arr_noisephi, arr_errnoisephi,
1187 arr_noisephi_cor, arr_errnoisephi_cor, arr_cl_sizephi, arr_errcl_sizephi);
1188 sprintf(detPhi2,
"0 ");
1200 int TableVersionCondDB = 2;
1201 float gapeffeta = -9999;
1202 char arr_gapeffeta [10];
1203 float errgapeffeta = -1;
1204 char arr_errgapeffeta [10];
1205 float gapeffphi = -9999;
1206 char arr_gapeffphi [10];
1207 float errgapeffphi = -1;
1208 char arr_errgapeffphi [10];
1209 float gapeff = -9999;
1210 float errgapeff = -1;
1211 float entriesCSeta = -1;
1212 int entriesCS1eta = -1;
1213 int entriesCS2eta = -1;
1214 float entriesCSphi = -1;
1215 int entriesCS1phi = -1;
1216 int entriesCS2phi = -1;
1217 float rateCS1eta = -1;
1218 char arr_rateCS1eta [10];
1219 float rateCS2eta = -1;
1220 char arr_rateCS2eta [10];
1221 float rateCSmore2eta = -1;
1222 char arr_rateCSmore2eta [10];
1223 float rateCS1phi = -1;
1224 char arr_rateCS1phi [10];
1225 float rateCS2phi = -1;
1226 char arr_rateCS2phi [10];
1227 float rateCSmore2phi = -1;
1228 char arr_rateCSmore2phi [10];
1232 coolrpc.
coolDbFolder(
"sqlite://;schema=RPCConditionDB.db;dbname=RPC_DQA",
"/OFFLINE/FINAL");
1233 std::string dir_cool_raw = run_dir +
"/Muon/MuonRawDataMonitoring/RPC/CoolDB/";
1234 TDirectory* coolFolder =
f->GetDirectory(dir_cool_raw.c_str());
1236 if (coolFolder != 0) {
1237 std::vector<std::string> layerList;
1238 layerList.push_back(
"LowPt0");
1239 layerList.push_back(
"LowPt1");
1240 layerList.push_back(
"Pivot0");
1241 layerList.push_back(
"Pivot1");
1242 layerList.push_back(
"HighPt0");
1243 layerList.push_back(
"HighPt1");
1244 int NumberLayerStrip = 0;
1245 int PanelStripId = 0;
1246 int StripProfileContenent = 0;
1248 auto stripValue=[](
float occ){
1252 }
else if (occ > 0 && occ < 0.9) {
1254 }
else if (occ > 0.9){
1260 for (std::vector<std::string>::const_iterator iter = layerList.begin(); iter != layerList.end(); ++iter) {
1261 for (
int i_dblPhi = 0; i_dblPhi != 2 * 1 + 1; ++i_dblPhi) {
1263 sprintf(coolName,
"Sector%.2d_%s_dblPhi%d", i_sec + 1, (*iter).c_str(), i_dblPhi + 1);
1264 std::string stripId_name = dir_cool_raw + coolName +
"_PanelId";
1265 std::string stripProfile_name = dir_cool_raw + coolName +
"_Profile";
1266 TH1F* h_stripId = NULL;
1267 TH1F* h_stripProfile = NULL;
1270 h_stripId = (
TH1F*) (
f->Get(stripId_name.c_str()));
1273 h_stripProfile = (
TH1F*) (
f->Get(stripProfile_name.c_str()));
1276 if (h_stripId && h_stripProfile) {
1277 int SingleStripsValue = 0;
1278 int StripsOnPanel = 1;
1279 char SingleStripsStatus [80];
1280 char SingleStripsStatusOK[80];
1281 std::string PanelStripsStatus;
1282 std::string PanelStripsStatusOK;
1284 NumberLayerStrip = h_stripProfile->GetNbinsX();
1285 for (
int Nstrips = 1; Nstrips != NumberLayerStrip + 1; Nstrips++) {
1286 PanelStripId = (
int) h_stripId->GetBinContent(Nstrips);
1287 StripProfileContenent = (
int) h_stripProfile->GetBinContent(Nstrips);
1288 float StripOccupancy = (
float) (StripProfileContenent) / rpc_eventstotal;
1289 SingleStripsValue = stripValue(StripOccupancy);
1291 if (h_stripId->GetBinCenter(Nstrips) > 0) {
1292 sprintf(SingleStripsStatus,
"%d 000.0 0.000|", SingleStripsValue);
1293 sprintf(SingleStripsStatusOK,
"5 000.0 0.000|");
1295 sprintf(SingleStripsStatus,
"|000.0 0.000 %d", SingleStripsValue);
1296 sprintf(SingleStripsStatusOK,
"|000.0 0.000 5");
1298 PanelStripsStatus = PanelStripsStatus + SingleStripsStatus;
1299 PanelStripsStatusOK = PanelStripsStatusOK + SingleStripsStatusOK;
1303 if ((
int) h_stripId->GetBinContent(Nstrips) ==
1304 (
int) h_stripId->GetBinContent(Nstrips + 1)) StripsOnPanel++;
1306 if ((
int) h_stripId->GetBinContent(Nstrips) != (
int) h_stripId->GetBinContent(Nstrips + 1)) {
1308 if (h_stripId->GetBinCenter(Nstrips) < 0) {
1309 std::reverse(PanelStripsStatus.begin(), PanelStripsStatus.end());
1310 std::reverse(PanelStripsStatusOK.begin(), PanelStripsStatusOK.end());
1313 for (
int ibin = 1; ibin != nbin + 1; ibin++) {
1314 if (h_PanelId) PanelCode = (
int) h_PanelId->GetBinContent(ibin);
1315 if (PanelCode != PanelStripId)
continue;
1316 if (ibin % 2 != 0) {
1318 n_tr_peta = (
int) h_TrackProj->GetBinContent(ibin);
1321 if (h_PanelId) Binposition = (
int) h_PanelId->GetBinCenter(ibin);
1322 int ibin_perp = (Binposition > 0) ? ibin + 1: ibin - 1;
1323 eta_effphi = getBinContentIfValid(h_Eff, ibin_perp);
1325 gapeff = getBinContentIfValid(h_GapEff, ibin);
1326 errgapeff = getBinErrorIfValid(h_GapEff, ibin);
1327 effeta = getBinContentIfValid(h_Eff, ibin);
1328 erreffeta = getBinErrorIfValid(h_Eff, ibin);
1331 errgapeffeta = errgapeff;
1332 EffThreshold = (effeta < Minimum_efficiency) || (eta_effphi < Minimum_efficiency);
1334 reseta_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1335 errreseta_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1337 reseta_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1338 errreseta_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1340 reseta_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1341 errreseta_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1343 noiseeta = getBinContentIfValid(h_NoiseTot, ibin);
1344 errnoiseeta = getBinErrorIfValid(h_NoiseTot, ibin);
1346 noiseeta_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1347 errnoiseeta_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1349 cl_sizeeta = getBinContentIfValid(h_CS, ibin);
1350 errcl_sizeeta = getBinErrorIfValid(h_CS, ibin);
1352 entriesCSeta = getBinContentIfValid(h_CS_entries, ibin);
1353 entriesCS1eta = getBinContentIfValid(h_CS1_entries, ibin);
1354 entriesCS2eta = getBinContentIfValid(h_CS2_entries, ibin);
1356 if (entriesCSeta > 0) {
1357 rateCS1eta = entriesCS1eta / entriesCSeta;
1358 rateCS2eta = entriesCS2eta / entriesCSeta;
1359 rateCSmore2eta = (entriesCSeta - (entriesCS1eta + entriesCS2eta)) / entriesCSeta;
1362 if (applyEffThreshold) {
1363 if (effeta < Minimum_efficiency && eta_effphi < Minimum_efficiency) {
1364 effeta = Minimum_efficiency;
1365 gapeffeta = Minimum_efficiency;
1368 PanelStripsStatus = PanelStripsStatusOK;
1370 errcl_sizeeta = 0.1,
1374 }
else if (effeta < Minimum_efficiency && eta_effphi > Minimum_efficiency) {
1375 effeta = Minimum_efficiency;
1376 gapeffeta = eta_effphi;
1379 PanelStripsStatus = PanelStripsStatusOK;
1381 errcl_sizeeta = 0.1,
1385 }
else if (effeta > Minimum_efficiency && eta_effphi < Minimum_efficiency) {
1390 sprintf(arr_effeta,
"%f ", effeta);
1392 sprintf(arr_erreffeta,
"%f ", erreffeta);
1393 arr_erreffeta [5] = 0;
1394 sprintf(arr_gapeffeta,
"%f ", gapeffeta);
1395 arr_gapeffeta [5] = 0;
1396 sprintf(arr_errgapeffeta,
"%f ", errgapeffeta);
1397 arr_errgapeffeta [5] = 0;
1398 sprintf(arr_reseta_cs1,
"%f ", reseta_cs1);
1399 arr_reseta_cs1 [5] = 0;
1400 sprintf(arr_errreseta_cs1,
"%f ", errreseta_cs1);
1401 arr_errreseta_cs1 [5] = 0;
1402 sprintf(arr_reseta_cs2,
"%f ", reseta_cs2);
1403 arr_reseta_cs2 [5] = 0;
1404 sprintf(arr_errreseta_cs2,
"%f ", errreseta_cs2);
1405 arr_errreseta_cs2 [5] = 0;
1406 sprintf(arr_reseta_csother,
"%f ", reseta_csother);
1407 arr_reseta_csother [5] = 0;
1408 sprintf(arr_errreseta_csother,
"%f ", errreseta_csother);
1409 arr_errreseta_csother[5] = 0;
1410 sprintf(arr_noiseeta,
"%f ", noiseeta);
1411 arr_noiseeta [5] = 0;
1412 sprintf(arr_errnoiseeta,
"%f ", errnoiseeta);
1413 arr_errnoiseeta [5] = 0;
1414 sprintf(arr_noiseeta_cor,
"%f ", noiseeta_cor);
1415 arr_noiseeta_cor [5] = 0;
1416 sprintf(arr_errnoiseeta_cor,
"%f ", errnoiseeta_cor);
1417 arr_errnoiseeta_cor [5] = 0;
1418 sprintf(arr_cl_sizeeta,
"%f ", cl_sizeeta);
1419 arr_cl_sizeeta [5] = 0;
1420 sprintf(arr_errcl_sizeeta,
"%f ", errcl_sizeeta);
1421 arr_errcl_sizeeta [5] = 0;
1422 sprintf(arr_rateCS1eta,
"%f ", rateCS1eta);
1423 arr_rateCS1eta [5] = 0;
1424 sprintf(arr_rateCS2eta,
"%f ", rateCS2eta);
1425 arr_rateCS2eta [5] = 0;
1426 sprintf(arr_rateCSmore2eta,
"%f ", rateCSmore2eta);
1427 arr_rateCSmore2eta [5] = 0;
1429 char PanelRes [255];
1430 char StripStatus [4096];
1432 sprintf(PanelRes,
"%d %d %d %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
1433 TableVersionCondDB, n_tr_peta, StripsOnPanel, arr_effeta, arr_erreffeta,
1434 arr_gapeffeta, arr_errgapeffeta, arr_reseta_cs1, arr_errreseta_cs1, arr_reseta_cs2,
1435 arr_errreseta_cs2, arr_reseta_csother, arr_errreseta_csother, arr_noiseeta,
1436 arr_errnoiseeta, arr_noiseeta_cor, arr_errnoiseeta_cor, arr_cl_sizeeta,
1437 arr_errcl_sizeeta, arr_rateCS1eta, arr_rateCS2eta, arr_rateCSmore2eta);
1438 sprintf(StripStatus,
"%s", PanelStripsStatus.c_str());
1439 std::string cool_tagCondDB =
"RecoCondDB";
1444 if (printout and EffThreshold and h_GapEff) std::cout << stripProfile_name <<
1445 " under THR " << EffThreshold <<
" " << PanelCode <<
" ibin " << ibin <<
" h_EffEta " <<
1446 h_Eff->GetBinContent(ibin) <<
" h_EffPhi " << h_Eff->GetBinContent(ibin_perp) <<
1447 " h_GapEffEta " << h_GapEff->GetBinContent(ibin) <<
" h_GapEffPhi " <<
1448 h_GapEff->GetBinContent(ibin_perp) <<
" cool_EtaEff " << effeta <<
" cool_GapEffEta " <<
1449 gapeffeta <<
" --- Eta Summary " << PanelRes <<
" --- StripStatus " << StripStatus <<
1452 EffThreshold) std::cout <<
"inCOOL_ETA_id_ntrk_panelEff_gapEff " << PanelCode <<
" " <<
1453 n_tr_peta <<
" " << (
int) (n_tr_peta * effeta) <<
" " << (
int) (n_tr_peta * gapeffeta) <<
1456 if (effeta == 0.0) countpaneleff0++;
1457 if (n_tr_peta == 0) countpaneltrack0++;
1459 if (h_TrackProj) n_tr_pphi = (
int) h_TrackProj->GetBinContent(ibin);
1462 if (h_PanelId) Binposition = (
int) h_PanelId->GetBinCenter(ibin);
1463 int ibin_perp = (Binposition > 0) ? ibin - 1: ibin + 1;
1464 gapeff = getBinContentIfValid(h_GapEff, ibin_perp);
1465 errgapeff = getBinErrorIfValid(h_GapEff, ibin_perp);
1466 phi_effeta = getBinContentIfValid(h_Eff, ibin_perp);
1468 effphi = getBinContentIfValid(h_Eff, ibin);
1469 erreffphi = getBinErrorIfValid(h_Eff, ibin);
1471 errgapeffphi = errgapeff;
1472 EffThreshold = (effphi < Minimum_efficiency) || (phi_effeta < Minimum_efficiency);
1475 resphi_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1476 errresphi_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1478 resphi_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1479 errresphi_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1481 resphi_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1482 errresphi_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1484 noisephi = getBinContentIfValid(h_NoiseTot, ibin);
1485 errnoisephi = getBinErrorIfValid(h_NoiseTot, ibin);
1487 noisephi_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1488 errnoisephi_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1490 cl_sizephi = getBinContentIfValid(h_CS, ibin);
1491 errcl_sizephi = getBinErrorIfValid(h_CS, ibin);
1493 entriesCSphi = getBinContentIfValid(h_CS_entries, ibin);
1494 entriesCS1phi = getBinContentIfValid(h_CS1_entries, ibin);
1495 entriesCS2phi = getBinContentIfValid(h_CS2_entries, ibin);
1496 if (entriesCSphi > 0) {
1497 rateCS1phi = entriesCS1phi / entriesCSphi;
1498 rateCS2phi = entriesCS2phi / entriesCSphi;
1499 rateCSmore2phi = (entriesCSphi - (entriesCS1phi + entriesCS2phi)) / entriesCSphi;
1503 if (applyEffThreshold) {
1504 if (effphi < Minimum_efficiency && phi_effeta < Minimum_efficiency) {
1505 effphi = Minimum_efficiency;
1506 gapeffphi = Minimum_efficiency;
1509 PanelStripsStatus = PanelStripsStatusOK;
1511 errcl_sizephi = 0.1,
1515 }
else if (effphi < Minimum_efficiency && phi_effeta > Minimum_efficiency) {
1516 effphi = Minimum_efficiency;
1517 gapeffphi = phi_effeta;
1520 PanelStripsStatus = PanelStripsStatusOK;
1522 errcl_sizephi = 0.1,
1526 }
else if (effphi > Minimum_efficiency && phi_effeta < Minimum_efficiency) {
1529 PanelStripsStatus = PanelStripsStatusOK;
1533 sprintf(arr_effphi,
"%f ", effphi);
1535 sprintf(arr_erreffphi,
"%f ", erreffphi);
1536 arr_erreffphi [5] = 0;
1537 sprintf(arr_gapeffphi,
"%f ", gapeffphi);
1538 arr_gapeffphi [5] = 0;
1539 sprintf(arr_errgapeffphi,
"%f ", errgapeffphi);
1540 arr_errgapeffphi [5] = 0;
1541 sprintf(arr_resphi_cs1,
"%f ", resphi_cs1);
1542 arr_resphi_cs1 [5] = 0;
1543 sprintf(arr_errresphi_cs1,
"%f ", errresphi_cs1);
1544 arr_errresphi_cs1 [5] = 0;
1545 sprintf(arr_resphi_cs2,
"%f ", resphi_cs2);
1546 arr_resphi_cs2 [5] = 0;
1547 sprintf(arr_errresphi_cs2,
"%f ", errresphi_cs2);
1548 arr_errresphi_cs2 [5] = 0;
1549 sprintf(arr_resphi_csother,
"%f ", resphi_csother);
1550 arr_resphi_csother [5] = 0;
1551 sprintf(arr_errresphi_csother,
"%f ", errresphi_csother);
1552 arr_errresphi_csother[5] = 0;
1553 sprintf(arr_noisephi,
"%f ", noisephi);
1554 arr_noisephi [5] = 0;
1555 sprintf(arr_errnoisephi,
"%f ", errnoisephi);
1556 arr_errnoisephi [5] = 0;
1557 sprintf(arr_noisephi_cor,
"%f ", noisephi_cor);
1558 arr_noisephi_cor [5] = 0;
1559 sprintf(arr_errnoisephi_cor,
"%f ", errnoisephi_cor);
1560 arr_errnoisephi_cor [5] = 0;
1561 sprintf(arr_cl_sizephi,
"%f ", cl_sizephi);
1562 arr_cl_sizephi [5] = 0;
1563 sprintf(arr_errcl_sizephi,
"%f ", errcl_sizephi);
1564 arr_errcl_sizephi [5] = 0;
1565 sprintf(arr_rateCS1phi,
"%f ", rateCS1phi);
1566 arr_rateCS1phi [5] = 0;
1567 sprintf(arr_rateCS2phi,
"%f ", rateCS2phi);
1568 arr_rateCS2phi [5] = 0;
1569 sprintf(arr_rateCSmore2phi,
"%f ", rateCSmore2phi);
1570 arr_rateCSmore2phi [5] = 0;
1572 char PanelRes [255];
1573 char StripStatus [4096];
1574 sprintf(PanelRes,
"%d %d %d %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
1575 TableVersionCondDB, n_tr_pphi,
1576 StripsOnPanel, arr_effphi, arr_erreffphi, arr_gapeffphi, arr_errgapeffphi,
1577 arr_resphi_cs1, arr_errresphi_cs1, arr_resphi_cs2,
1578 arr_errresphi_cs2, arr_resphi_csother, arr_errresphi_csother, arr_noisephi,
1579 arr_errnoisephi, arr_noisephi_cor, arr_errnoisephi_cor,
1580 arr_cl_sizephi, arr_errcl_sizephi, arr_rateCS1phi, arr_rateCS2phi,
1581 arr_rateCSmore2phi);
1582 sprintf(StripStatus,
"%s", PanelStripsStatus.c_str());
1583 std::string
cool_tag =
"RecoCondDB";
1590 EffThreshold) std::cout << stripProfile_name <<
" under THR " << EffThreshold <<
" " <<
1591 PanelCode <<
" ibin " << ibin <<
" h_EffPhi " << h_Eff->GetBinContent(ibin)
1593 h_Eff->GetBinContent(ibin_perp) <<
" h_GapEffPhi " << h_GapEff->GetBinContent(ibin) <<
1594 " h_GapEffEta " << h_GapEff->GetBinContent(ibin_perp) <<
" cool_PhiEff "
1595 << effphi <<
" cool_GapEffPhi " << gapeffphi <<
1596 " --- Phi Summary " << PanelRes <<
" --- StripStatus " << StripStatus << std::endl;
1598 if (printout && EffThreshold) std::cout <<
"inCOOL_PHI_id_ntrk_panelEff_gapEff " << PanelCode <<
" " << n_tr_pphi <<
" " << (
int) (n_tr_pphi * effphi) <<
" " << (
int) (n_tr_pphi * gapeffphi) << std::endl;
1600 if (effphi == 0.0) countpaneleff0++;
1601 if (n_tr_pphi == 0) countpaneltrack0++;
1604 PanelStripsStatus.clear();
1605 PanelStripsStatusOK.clear();
1608 PanelStripsStatus.clear();
1609 PanelStripsStatusOK.clear();
1616 std::cout <<
"Count RC panels in DB " << countpanelindb <<
" Count RPCpanels in DB with zero efficiency " << countpaneleff0 <<
" Count RPCpanels in DB with zero track " << countpaneltrack0 << std::endl;
1618 std::cout <<
"Count RC panels in DB " << countpanelindb <<
" Count RPCpanels in DB with zero efficiency " << countpaneleff0 <<
" Count RPCpanels in DB with zero track " << countpaneltrack0 << std::endl;
1620 TDirectory* dirA =
f->GetDirectory(dir_sideA_track.c_str());
1624 writeIfValid(h_AverageEff_A);
1625 writeIfValid(h_AverageGapEff_A);
1626 writeIfValid(h_AverageRes_CS1_A);
1627 writeIfValid(h_AverageRes_CS1rms_A);
1628 writeIfValid(h_AverageRes_CS2_A);
1629 writeIfValid(h_AverageRes_CS2rms_A);
1630 writeIfValid(h_AverageRes_CSmore2_A);
1631 writeIfValid(h_AverageRes_CSmore2rms_A);
1632 writeIfValid(h_AverageOccupancy_A);
1633 writeIfValid(h_AverageCS_A);
1634 writeIfValid(h_AverageTime_A);
1635 writeIfValid(h_AverageNoiseCorr_A);
1636 writeIfValid(h_AverageNoiseTot_A);
1638 TDirectory* dirC =
f->GetDirectory(dir_sideC_track.c_str());
1641 writeIfValid(h_AverageEff_C);
1642 writeIfValid(h_AverageGapEff_C);
1643 writeIfValid(h_AverageRes_CS1_C);
1644 writeIfValid(h_AverageRes_CS1rms_C);
1645 writeIfValid(h_AverageRes_CS2_C);
1646 writeIfValid(h_AverageRes_CS2rms_C);
1647 writeIfValid(h_AverageRes_CSmore2_C);
1648 writeIfValid(h_AverageRes_CSmore2rms_C);
1649 writeIfValid(h_AverageOccupancy_C);
1650 writeIfValid(h_AverageCS_C);
1651 writeIfValid(h_AverageTime_C);
1652 writeIfValid(h_AverageNoiseCorr_C);
1653 writeIfValid(h_AverageNoiseTot_C);
1667 if (!(
f->Get(HistoName))) {