"use strict";(self.webpackChunkfirebird=self.webpackChunkfirebird||[]).push([[5086],{5086:(x,P,o)=>{o.r(P),o.d(P,{TEfficiencyPainter:()=>u});var y=o(467),l=o(6998),C=o(675),H=o(4693),w=o(230),D=o(1516),O=o(4149),L=o(8977);const d=(0,l.BIT)(14),p=(0,l.BIT)(15),T=(0,l.BIT)(17),v=(0,l.BIT)(18),m=(_,t)=>_.fBeta_bin_params.length>t?_.fBeta_bin_params[t].first:_.fBeta_alpha,h=(_,t)=>_.fBeta_bin_params.length>t?_.fBeta_bin_params[t].second:_.fBeta_beta;class u extends C.JW{getEfficiency(t,e){const f=t.fTotalHistogram.fArray[e],n=t.fPassedHistogram.fArray[e];if(t.TestBit(d)){const i=t.TestBit(T)?m(t,e):t.fBeta_alpha,s=t.TestBit(T)?h(t,e):t.fBeta_beta;let c,B;if(t.TestBit(v)){const E=f,M=t.fTotalHistogram.fSumw2?t.fTotalHistogram.fSumw2[e]:Math.abs(f);if(M<=0)return n/E;const A=E/M;c=n*A+i,B=(E-n)*A+s}else c=n+i,B=f-n+s;return t.TestBit(p)?((i,s)=>{if(i<=0||s<=0)return 0;if(i<=1||s<=1){if(i<s)return 0;if(i>s)return 1;if(i===s)return.5}return(i-1)/(i+s-2)})(c,B):((i,s)=>i<=0||s<=0?0:i/(i+s))(c,B)}return f?n/f:0}getEfficiencyErrorLow(t,e,a){const r=t.fTotalHistogram.fArray[e],f=t.fPassedHistogram.fArray[e];let n=0,i=0;return t.TestBit(d)&&(n=t.TestBit(T)?m(t,e):t.fBeta_alpha,i=t.TestBit(T)?h(t,e):t.fBeta_beta),a-this.fBoundary(r,f,t.fConfLevel,!1,n,i)}getEfficiencyErrorUp(t,e,a){const r=t.fTotalHistogram.fArray[e],f=t.fPassedHistogram.fArray[e];let n=0,i=0;return t.TestBit(d)&&(n=t.TestBit(T)?m(t,e):t.fBeta_alpha,i=t.TestBit(T)?h(t,e):t.fBeta_beta),this.fBoundary(r,f,t.fConfLevel,!0,n,i)-a}copyAttributes(t,e){["fLineColor","fLineStyle","fLineWidth","fFillColor","fFillStyle","fMarkerColor","fMarkerStyle","fMarkerSize"].forEach(a=>{t[a]=e[a]})}createGraph(){const t=(0,l.create)(H.clTGraphAsymmErrors);return t.fName="eff_graph",t}createHisto(t){const r=(0,l.createHistogram)(l.clTH2F,t.fTotalHistogram.fXaxis.fNbins,t.fTotalHistogram.fYaxis.fNbins);return Object.assign(r.fXaxis,t.fTotalHistogram.fXaxis),Object.assign(r.fYaxis,t.fTotalHistogram.fYaxis),r.fName="eff_histo",r}fillGraph(t,e){const a=this.getObject(),r=a.fTotalHistogram.fXaxis,f=r.fNbins,n=e.indexOf("e0")>=0;for(let i=0,s=0;i<f;++i){if(!n&&0===a.fTotalHistogram.getBinContent(i+1))continue;const c=this.getEfficiency(a,i+1);t.fX[s]=r.GetBinCenter(i+1),t.fY[s]=c,t.fEXlow[s]=r.GetBinCenter(i+1)-r.GetBinLowEdge(i+1),t.fEXhigh[s]=r.GetBinLowEdge(i+2)-r.GetBinCenter(i+1),t.fEYlow[s]=this.getEfficiencyErrorLow(a,i+1,c),t.fEYhigh[s]=this.getEfficiencyErrorUp(a,i+1,c),t.fNpoints=++s}t.fTitle=a.fTitle,this.copyAttributes(t,a)}fillHisto(t){const e=this.getObject(),a=t.fXaxis.fNbins,r=t.fYaxis.fNbins;for(let f=0;f<a+2;++f)for(let n=0;n<r+2;++n){const i=t.getBin(f,n);t.fArray[i]=this.getEfficiency(e,i)}t.fTitle=e.fTitle,t.fBits|=l.kNoStats,this.copyAttributes(t,e)}drawFunction(t){const e=this.getObject();return!e?.fFunctions||t>=e.fFunctions.arr.length?this:w.TF1Painter.draw(this.getPadPainter(),e.fFunctions.arr[t],e.fFunctions.opt[t]).then(a=>(a?.setSecondaryId(this,`func_${t}`),this.drawFunction(t+1)))}fillContextMenuItems(t){t.addRedrawMenu(this)}redrawWith(t,e){var a=this;return(0,y.A)(function*(){e||a.getPadPainter()?.removePrimitive(a,!0),(!t||!(0,l.isStr)(t))&&(t=""),t=t.toLowerCase();let r,f=!1;const n=a.getObject(),i=a.getDrawDom();if("b"===t[0])f=!0,r=(1===a.ndim?D.TH1Painter:O.TH2Painter).draw(i,n.fTotalHistogram,t.slice(1));else if(1===a.ndim){t||(t="ap"),t.indexOf("same")<0&&t.indexOf("a")<0&&(t+="a"),t.indexOf("p")<0&&(t+="p");const s=a.createGraph(n);a.fillGraph(s,t),r=H.TGraphPainter.draw(i,s,t)}else{t||(t="col");const s=a.createHisto(n);a.fillHisto(s,t),r=O.TH2Painter.draw(i,s,t)}return r.then(s=>(s?.setSecondaryId(a,"eff"),a.addToPadPrimitives(),f?a:a.drawFunction(0)))})()}static draw(t,e,a){return(0,y.A)(function*(){if(!e||!e.fTotalHistogram)return null;const r=new u(t,e);if(0===e.fTotalHistogram._typename.indexOf(l.clTH1))r.ndim=1;else{if(0!==e.fTotalHistogram._typename.indexOf(l.clTH2))return null;r.ndim=2}return r.fBoundary=(0,L.getTEfficiencyBoundaryFunc)(e.fStatisticOption,e.TestBit(d)),r.redrawWith(a,!0)})()}}}}]);