17 constexpr
double Zmass = 91.1876;
24 m_minMuonEffWindow(0.8),
25 m_maxMuonEffWindow(1.05)
30 declareInterface<MuonDQAFitFunc>(
this);
39 double width_error=0.;
42 TF1 *ZmumFit =
new TF1(
"ZmumFit",
"gaus",89.,93.);
45 ZmumFit->SetParameter(1,3.097);
46 ZmumFit->SetParameter(2,0.05);
47 h1[
i]->Fit(
"ZmumFit",
"RQNM");
49 mass_error=ZmumFit->GetParError(1);
50 width=ZmumFit->GetParameter(2);
51 width_error=ZmumFit->GetParError(2);
52 hmass->SetBinContent(
i+1,
mass);
53 hmass->SetBinError(
i+1,mass_error);
54 hwidth->SetBinContent(
i+1,
width);
55 hwidth->SetBinError(
i+1,width_error);
56 if( (std::abs(
mass)+mass_error)>maxmass ) maxmass=std::abs(
mass)+mass_error;
57 if( (std::abs(
width)+width_error)>maxwidth ) maxwidth=std::abs(
width)+width_error;
60 if (maxmass>0.1) maxmass=0.1;
61 if (maxwidth>0.2) maxwidth=0.2;
62 hmass->SetAxisRange(-maxmass,maxmass,
"Y");
63 hwidth->SetAxisRange(0.,maxwidth,
"Y");
71 nBins = h_Num->GetNbinsX();
73 int nPass =
int(h_Num->GetBinContent(
bin+1));
74 int nFail =
int(h_Denom->GetBinContent(
bin+1)) - nPass;
75 double x = h_Denom->GetBinCenter(
bin+1);
76 for (
int pass=0; pass!=nPass; ++pass) {
92 nBins = h_Num->GetNbinsX();
93 nBinsY = h_Num->GetNbinsY();
96 int nPass =
int(h_Num->GetBinContent(
bin+1,
binY+1));
97 int nFail =
int(h_Denom->GetBinContent(
bin+1,
binY+1)) - nPass;
98 double x = h_Denom->GetXaxis()->GetBinCenter(
bin+1);
99 double y = h_Denom->GetYaxis()->GetBinCenter(
binY+1);
100 for (
int pass=0; pass!=nPass; ++pass) {
117 float min=hProf->GetMinimum();
118 float max=hProf->GetMaximum();
119 float margin=0.05*(
max-
min);
120 if(
min > windowMin)
min=windowMin-margin;
121 if(
max < windowMax)
max=windowMax+margin;
122 hProf->SetMinimum(
min);
123 hProf->SetMaximum(
max);
130 float min=hProf->GetMinimum();
131 float max=hProf->GetMaximum();
132 float margin=0.05*(
max-
min);
133 if(
min > windowMin)
min=windowMin-margin;
134 if(
max < windowMax)
max=windowMax+margin;
135 hProf->SetMinimum(
min);
136 hProf->SetMaximum(
max);
146 int nBins_2d = h2d->GetNbinsX();
147 int nBins_1d = h1d->GetNbinsX();
149 if(nBins_2d!=nBins_1d)
ATH_MSG_DEBUG(
"Mean/RMS Histograms not set up correctly - nBins mismatch");
155 h1d->SetBit(TH1::kIsAverage);
157 for(
int j = 1; j!=nBins_2d+1; j++){
159 TH1F* hproj = (
TH1F*)h2d->ProjectionY(
"Proj",j,j,
"e");
162 if(hproj->GetEntries()<=0) {
168 h1d->SetBinContent(j,hproj->GetMean());
169 h1d->SetBinError(j,hproj->GetMeanError());
173 h1d->SetBinContent(j,hproj->GetRMS());
174 h1d->SetBinError(j,hproj->GetRMSError());
176 else ATH_MSG_DEBUG(
"Incorrect switch in MeanRMSProjectionsBarrel()");
190 int nBins = hProf->GetNbinsX();
192 for(
int j = 1; j!=
nBins+1; j++){
194 float bincentre = (
float)hProf->GetBinCenter(j);
197 float binerr = (
float)hProf->GetBinError(j);
200 float binentries = (
float)hProf->GetBinEntries(j);
203 float rms = (
float)binerr*(std::sqrt(binentries));
205 hRms->Fill(bincentre,
rms);
219 int nBins = hProf_char->GetNbinsX();
221 for(
int j = 1; j!=
nBins+1; j++){
224 const char* BinLabel_char = hProf_char->GetXaxis()->GetBinLabel(j);
227 float binerr = (
float)hProf_char->GetBinError(j);
230 float binentries = (
float)hProf_char->GetBinEntries(j);
233 float rms = (
float)binerr*(std::sqrt(binentries));
235 hRms_char->SetCanExtend(TH1::kAllAxes);
236 hRms_char->Fill(BinLabel_char,
rms);
240 hRms_char->LabelsDeflate(
"X");
241 if (hRms_char->GetEntries() > 0) hRms_char->LabelsOption(
"v");
256 h1d->SetBit(TH1::kIsAverage);
258 int nBins_2d = h2d->GetNbinsX();
259 int nBins_1d = h1d->GetNbinsX();
261 if(nBins_2d!=nBins_1d)
ATH_MSG_DEBUG(
"Mean/Width Histograms not set up correctly - nBins mismatch");
263 for(
int i = 1;
i!=nBins_2d+1;
i++){
265 TH1F* hProj = (
TH1F*)h2d->ProjectionY(
"Proj",
i,
i,
"e");
268 if(hProj->GetEntries()<=0) {
273 TF1 *
fit =
new TF1(
"fit",
"gaus",MinFit,MaxFit);
275 hProj->Fit(
"fit",
"RQNM");
276 float Mean =
fit->GetParameter(1);
277 float MeanSigma =
fit->GetParError(1);
278 float Width =
fit->GetParameter(2);
279 float WidthSigma =
fit->GetParError(2);
282 h1d->SetBinContent(
i,
Mean);
283 h1d->SetBinError(
i,MeanSigma);
286 h1d->SetBinContent(
i,Width);
287 h1d->SetBinError(
i,WidthSigma);
289 else ATH_MSG_DEBUG(
"Incorrect switch in FillGausMeanOrWidth");
311 h1d->SetBit(TH1::kIsAverage);
313 int nBins_2d = h2d->GetNbinsX();
314 int nBins_1d = h1d->GetNbinsX();
316 if(nBins_2d!=nBins_1d)
ATH_MSG_DEBUG(
"Mean/Width Histograms not set up correctly - nBins mismatch");
318 for(
int i = 1;
i!=nBins_2d+1;
i++){
320 TH1F* hProj = (
TH1F*)h2d->ProjectionY(
"Proj",
i,
i,
"e");
322 int numNonEmptyBins = 0;
323 for (
int ii = 0; ii < (
int)hProj->GetNbinsX()+1; ++ii)
325 if (hProj->GetBinContent(ii)>0.) ++numNonEmptyBins;
330 if((hProj->GetEntries()<=0)||(numNonEmptyBins<2)) {
335 TF1 *
fit =
new TF1(
"fit",
"gaus",MinFit,MaxFit);
337 hProj->Fit(
"fit",
"RQNM");
338 float Mean =
fit->GetParameter(1);
340 float Width =
fit->GetParameter(2);
343 h1d->SetBinContent(
i,
Mean);
344 h1d->SetBinError(
i, Width);
350 h1d->SetEntries(h2d->GetEntries());
367 h2->SetBit(TH1::kIsAverage);
370 if(
h1->GetEntries()<=0)
return;
372 TF1 *
fit =
new TF1(
"fit",
"gaus",MinFit,MaxFit);
373 h1->Fit(
"fit",
"RQNM");
374 float Mean =
fit->GetParameter(1);
376 float Width =
fit->GetParameter(2);
379 h2->SetBinContent(nbin,
Mean);
380 h2->SetBinError(nbin,Width);
382 h2->SetEntries(
h1->GetEntries());