183 for (Int_t i=0; i<s.
fMaxdim; i++)
206 if (s.
fX)
fX=
new TArrayD(
fN);
207 if (s.
fY)
fY=
new TArrayD(
fN);
208 if (s.
fZ)
fZ=
new TArrayD(
fN);
209 if (s.
fT)
fT=
new TArrayD(
fN);
212 for (Int_t i=0; i<
fDim; i++)
220 for (Int_t j=0; j<
fDim; j++)
230 for (Int_t i=0; i<
fN; i++)
268 for (Int_t i=0; i<
fDim; i++)
276 for (Int_t j=0; j<
fDim; j++)
353 cout <<
" *NcSample::SetNames* Names not modified, since data were already present." << endl;
376 cout <<
" *NcSample::Enter* Error : Not a 1-dim sample." << endl;
401 if (!
fX)
fX=
new TArrayD(10);
402 if (
fX->GetSize() <
fN)
fX->Set(
fN+10);
422 cout <<
" *NcSample::Remove* Error : Not a 1-dim sample." << endl;
435 for (Int_t i=0; i<=
fN; i++)
438 if (fabs(x-val)>1.e-10)
continue;
440 for (Int_t j=i+1; j<=
fN; j++)
470 cout <<
" *NcSample::Enter* Error : Not a 2-dim sample." << endl;
503 if (!
fX)
fX=
new TArrayD(10);
504 if (
fX->GetSize() <
fN)
fX->Set(
fN+10);
506 if (!
fY)
fY=
new TArrayD(10);
507 if (
fY->GetSize() <
fN)
fY->Set(
fN+10);
527 cout <<
" *NcSample::Remove* Error : Not a 2-dim sample." << endl;
544 for (Int_t i=0; i<=
fN; i++)
547 if (fabs(x-val)>1.e-10)
continue;
549 if (fabs(y-val)>1.e-10)
continue;
551 for (Int_t j=i+1; j<=
fN; j++)
582 cout <<
" *NcSample::Enter* Error : Not a 3-dim sample." << endl;
625 if (!
fX)
fX=
new TArrayD(10);
626 if (
fX->GetSize() <
fN)
fX->Set(
fN+10);
628 if (!
fY)
fY=
new TArrayD(10);
629 if (
fY->GetSize() <
fN)
fY->Set(
fN+10);
631 if (!
fZ)
fZ=
new TArrayD(10);
632 if (
fZ->GetSize() <
fN)
fZ->Set(
fN+10);
652 cout <<
" *NcSample::Remove* Error : Not a 3-dim sample." << endl;
675 for (Int_t i=0; i<=
fN; i++)
678 if (fabs(x-val)>1.e-10)
continue;
680 if (fabs(y-val)>1.e-10)
continue;
682 if (fabs(z-val)>1.e-10)
continue;
684 for (Int_t j=i+1; j<=
fN; j++)
713 cout <<
" *NcSample::Enter* Error : Not a 4-dim sample." << endl;
768 if (!
fX)
fX=
new TArrayD(10);
769 if (
fX->GetSize() <
fN)
fX->Set(
fN+10);
771 if (!
fY)
fY=
new TArrayD(10);
772 if (
fY->GetSize() <
fN)
fY->Set(
fN+10);
774 if (!
fZ)
fZ=
new TArrayD(10);
775 if (
fZ->GetSize() <
fN)
fZ->Set(
fN+10);
777 if (!
fT)
fT=
new TArrayD(10);
778 if (
fT->GetSize() <
fN)
fT->Set(
fN+10);
798 cout <<
" *NcSample::Remove* Error : Not a 4-dim sample." << endl;
829 for (Int_t i=0; i<=
fN; i++)
832 if (fabs(x-val)>1.e-10)
continue;
834 if (fabs(y-val)>1.e-10)
continue;
836 if (fabs(z-val)>1.e-10)
continue;
838 if (fabs(t-val)>1.e-10)
continue;
840 for (Int_t j=i+1; j<=
fN; j++)
882 if (
fDim<1 ||
fN<=0 || i<1 || i>
fN)
return;
884 if (mode && (j<1 || j>
fDim))
886 cout <<
" *NcSample::RemoveEntry* Error : Invalide argument j=" << j << endl;
892 cout <<
" *NcSample::RemoveEntry* Error : Storage of data entries was not activated." << endl;
962 for (Int_t m=i; m<=j; m++)
985 for (Int_t m=i; m<=j; m++)
1008 if (mode && (i<1 || i>
fDim))
1010 cout <<
" *NcSample::Order* Error : Invalide argument i=" << i << endl;
1016 cout <<
" *NcSample::Order* Error : Dimension less than 1." << endl;
1022 cout <<
" *NcSample::Order* Error : Storage of data entries was not activated." << endl;
1036 Int_t iword=10*abs(mode)+i;
1037 if (mode<0) iword*=-1;
1070 for (Int_t j=0; j<
fN; j++)
1072 if (i==1) val=
fX->At(j);
1073 if (i==2) val=
fY->At(j);
1074 if (i==3) val=
fZ->At(j);
1075 if (i==4) val=
fT->At(j);
1084 for (Int_t j=0; j<
fN; j++)
1086 if (i==1) val=
fX->At(j);
1087 if (i==2) val=
fY->At(j);
1088 if (i==3) val=
fZ->At(j);
1089 if (i==4) val=
fT->At(j);
1100 for (Int_t k=0; k<j; k++)
1102 if (mode>0 && val>=
fArr->At(k))
continue;
1103 if (mode<0 && val<=fArr->At(k))
continue;
1105 for (Int_t m=j-1; m>=k; m--)
1136 for (Int_t i=0; i<
fMaxdim; i++)
1138 if (
fNames[i]==name) idx=i+1;
1162 for (Int_t k=0; k<
fDim; k++)
1176 for (Int_t i=0; i<
fDim; i++)
1178 for (Int_t j=0; j<
fDim; j++)
1183 if (rmsij != 0)
fCor[i][j]=
fCov[i][j]/rmsij;
1222 cout <<
" *NcSample::GetVariableName* Error : Invalid index " << i << endl;
1242 cout <<
" *NcSample::GetSum* Error : Invalid index " << i << endl;
1273 cout <<
" *NcSample::GetMean* Error : Invalid index " << i << endl;
1307 cout <<
" *NcSample::GetRMS* Error : Invalid index " << i << endl;
1312 Double_t val=
fSum2[i-1][i-1]/float(
fN);
1313 if (val>=0) rms=sqrt(val);
1348 cout <<
" *NcSample::GetVar* Error : Invalid index " << i << endl;
1387 cout <<
" *NcSample::GetSigma* Error : Invalid index " << i << endl;
1392 if (model) val=
fSigma[i-1];
1421 if (i<1 || i>
fDim || j<1 || j>
fDim)
1423 cout <<
" *NcSample::GetCov* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
1427 return fCov[i-1][j-1];
1452 if (i<1 || i>
fDim || j<1 || j>
fDim)
1454 cout <<
" *NcSample::GetCor* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
1458 return fCor[i-1][j-1];
1492 const char* name=GetName();
1493 const char* title=GetTitle();
1495 cout <<
" *" << ClassName() <<
"::Data*";
1496 if (strlen(name)) cout <<
" Info for sample Name : " << name;
1497 if (strlen(title)) cout <<
" Title : " << title;
1499 cout <<
" Access to the individual data entries is";
1500 if (!
fStore) cout <<
" not";
1501 cout <<
" possible (StoreMode=" <<
fStore <<
")" << endl;
1507 cout <<
" *** At entering data the dynamic FIFO storage was limited to " <<
fNmax <<
" entries";
1511 cout <<
" *** At entering new data the dynamic FIFO storage will be limited to " <<
fNmax <<
" entries";
1513 if (!
fMoveVariable) cout <<
" using the order of original entering.";
1520 if (i<0 || i>
fDim || j<0 || j>
fDim)
1522 cout <<
" Inconsistent input i=" << i <<
" and j=" << j <<
" for dimension " <<
fDim << endl;
1525 if (!i && !j) cout <<
" Statistics and correlations of all variables";
1526 if (i && !j) cout <<
" Statistics of variable " << i;
1527 if (!i && j) cout <<
" Statistics of variable " << j;
1528 if (i && j) cout <<
" Correlation statistics of the variables " << i <<
" and " << j;
1533 cout <<
" No data has been entered." << endl;
1541 for (Int_t iv=1; iv<=
fDim; iv++)
1549 for (Int_t iv=1; iv<=
fDim; iv++)
1551 for (Int_t jv=iv+1;jv<=
fDim; jv++)
1559 if (i && !j)
List(i);
1562 if (!i && j)
List(j);
1565 if (i && j)
List(i,j);
1620 cout <<
" *NcSample::ListOrdered* Error : Storage of data entries was not activated." << endl;
1626 cout <<
" *NcSample::ListOrdered* No entries were stored." << endl;
1632 cout <<
" *NcSample::ListOrdered* Error : Dimension less than 1." << endl;
1636 if (mode && (i<1 || i>
fDim))
1638 cout <<
" *NcSample::ListOrdered* Error : Invalid argument i=" << i << endl;
1644 const char* name=GetName();
1645 const char* title=GetTitle();
1647 cout <<
" *NcSample::ListOrdered* Ordered listing for the sample";
1648 if (strlen(name)) cout <<
" Name : " << name;
1649 if (strlen(title)) cout <<
" Title : " << title;
1653 cout <<
" *** At entering data the dynamic FIFO storage was limited to " <<
fNmax <<
" entries";
1654 if (!
fMoveVariable) cout <<
" using the order of original entering.";
1660 cout <<
" Listing of the stored entries in";
1661 if (!mode) cout <<
" order of original entering." << endl;
1662 if (mode<0) cout <<
" decreasing order of variable : " << i <<
" (" <<
fNames[i-1] <<
")" << endl;
1663 if (mode>0) cout <<
" increasing order of variable : " << i <<
" (" <<
fNames[i-1] <<
")" << endl;
1664 if (mode) cout <<
" The number between brackets indicates the original data entry number." << endl;
1667 for (Int_t j=0; j<
fN; j++)
1671 if (index<0 || index>=
fN)
continue;
1673 cout <<
" Index : " << (j+1);
1674 if (mode) cout <<
" (" << (index+1) <<
") ";
1675 cout <<
" " <<
fNames[0] <<
"=" <<
fX->At(index);
1676 if (
fDim>1) cout <<
" " <<
fNames[1] <<
"=" <<
fY->At(index);
1677 if (
fDim>2) cout <<
" " <<
fNames[2] <<
"=" <<
fZ->At(index);
1678 if (
fDim>3) cout <<
" " <<
fNames[3] <<
"=" <<
fT->At(index);
1715 cout <<
" *NcSample::List(i)* Error : Invalid index " << i << endl;
1719 cout <<
" Variable " <<
fNames[i-1] <<
" : N=" <<
fN;
1720 cout <<
" Sum=" <<
fSum[i-1] <<
" Mean=" <<
fMean[i-1];
1721 cout <<
" Deviation(rms)=" <<
fRMSdev[i-1] <<
" Sigma=" <<
fSigma[i-1];
1730 cout <<
" Spread(w.r.t. median)=" <<
GetSpread(i,0) <<
" Spread(w.r.t. mean)=" <<
GetSpread(i,1);
1745 if (i<1 || i>
fDim || j<1 || j>
fDim)
1747 cout <<
" *NcSample::List(i,j)* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
1752 cout <<
" Correlation(coefficient)=" <<
fCor[i-1][j-1] <<
" Covariance=" <<
fCov[i-1][j-1] << endl;
1798 cout <<
" Storage mode can only be set before first data." << endl;
1800 else if ((!mode && nmax) || mode<0 || mode>1 || nmax<0 || abs(i)>
fDim)
1802 cout <<
" Inconsistent input : mode=" << mode <<
" nmax=" << nmax <<
" i=" << i << endl;
1857 cout <<
" *NcSample::GetQuantile* Error : Invalid index " << i << endl;
1863 cout <<
" *NcSample::GetQuantile* Error : Storage of data entries was not activated." << endl;
1867 if (
fN<=0)
return 0;
1869 if (f<0 || f>1)
return 0;
1871 Double_t quantile=0;
1875 if (i==1) quantile=
fX->At(0);
1876 if (i==2) quantile=
fY->At(0);
1877 if (i==3) quantile=
fZ->At(0);
1878 if (i==4) quantile=
fT->At(0);
1889 Double_t rindex=double(
fN)*f;
1890 Int_t index=int(rindex);
1893 quantile=
fArr->At(index);
1897 quantile=(
fArr->At(index-1)+
fArr->At(index))/2.;
1993 if (model<0 || model>2)
1995 cout <<
" *NcSample::GetSpread* Error : Unsupported parameter model=" << model << endl;
2001 cout <<
" *NcSample::GetSpread* Error : Invalid index " << i << endl;
2007 cout <<
" *NcSample::GetSpread* Error : Storage of data entries was not activated." << endl;
2011 if (
fN<=1)
return -1;
2014 if (model==1) central=
GetMean(i);
2015 if (model==2) central=vref;
2018 for (Int_t j=0; j<
fN; j++)
2020 spread+=fabs(central-(
fArr->At(j)));
2023 spread=spread/float(
fN);
2066 cout <<
" *NcSample::GetMinimum* Error : Invalid index " << i << endl;
2074 cout <<
" *NcSample::GetMinimum* Error : Storage of data entries was not activated." << endl;
2078 if (
fN<=0)
return 0;
2082 if (i==1) min=
fX->At(0);
2083 if (i==2) min=
fY->At(0);
2084 if (i==3) min=
fZ->At(0);
2086 for (Int_t k=1; k<
fN; k++)
2088 if (i==1 &&
fX->At(k)<min) min=
fX->At(k);
2089 if (i==2 &&
fY->At(k)<min) min=
fY->At(k);
2090 if (i==3 &&
fZ->At(k)<min) min=
fZ->At(k);
2122 cout <<
" *NcSample::GetMaximum* Error : Invalid index " << i << endl;
2130 cout <<
" *NcSample::GetMaximum* Error : Storage of data entries was not activated." << endl;
2134 if (
fN<=0)
return 0;
2138 if (i==1) max=
fX->At(0);
2139 if (i==2) max=
fY->At(0);
2140 if (i==3) max=
fZ->At(0);
2142 for (Int_t k=1; k<
fN; k++)
2144 if (i==1 &&
fX->At(k)>max) max=
fX->At(k);
2145 if (i==2 &&
fY->At(k)>max) max=
fY->At(k);
2146 if (i==3 &&
fZ->At(k)>max) max=
fZ->At(k);
2191 if (!histo)
return 0;
2193 if (f<0 || f>1)
return 0;
2197 Double_t quantile=0;
2204 for (Int_t i=1; i<=histo->GetNbinsX(); i++)
2206 val=histo->GetBinContent(i);
2221 histo->ComputeIntegral();
2222 Int_t nq=histo->GetQuantiles(2,q,p);
2230 Int_t mbin=histo->FindBin(q[0]);
2231 xlow=histo->GetBinCenter(mbin);
2232 mbin=histo->FindBin(q[1]);
2233 xup=histo->GetBinCenter(mbin);
2237 quantile=(xlow+xup)/2.;
2290 if (model<0 || model>2)
2292 cout <<
" *NcSample::GetSpread* Error : Unsupported parameter model=" << model << endl;
2296 if (!histo)
return -1;
2298 Int_t nbins=histo->GetNbinsX();
2300 if (nbins<1)
return -1;
2309 for (Int_t i=1; i<=nbins; i++)
2311 val=histo->GetBinContent(i);
2319 if (model==1) central=histo->GetMean();
2320 if (model==2) central=vref;
2324 for (Int_t jbin=1; jbin<=nbins; jbin++)
2326 x=histo->GetBinCenter(jbin);
2327 y=histo->GetBinContent(jbin);
2330 spread+=fabs(x-central)*y;
2334 if (ysum>0) spread=spread/ysum;
2360 TString name=GetName();
2364 cout <<
" *NcSample::GetEntry* Error : Storage mode not activated." << endl;
2370 cout <<
" *NcSample::GetEntry* Error : Invalid index number i=" << i;
2371 if (name!=
"") printf(
" for NcSample %-s",name.Data());
2378 cout <<
" *NcSample::GetEntry* Error : Invalid variable number j=" << j;
2379 if (name!=
"") printf(
" for NcSample %-s",name.Data());
2384 if (mode && (k<1 || k>
fDim))
2386 cout <<
" *NcSample::GetEntry* Error : Invalid argument k=" << k;
2387 if (name!=
"") printf(
" for NcSample %-s",name.Data());
2403 if (j==1) value=
fX->At(index);
2404 if (j==2) value=
fY->At(index);
2405 if (j==3) value=
fZ->At(index);
2406 if (j==4) value=
fT->At(index);
2459 cout <<
" *NcSample::GetSubset* Error : Pointer for output NcSample object is zero." << endl;
2467 cout <<
" *NcSample::GetSubset* Error : Storage mode not activated." << endl;
2471 if (ifirst<1 || ifirst>
fN || ilast>
fN || ilast<ifirst)
2473 cout <<
" *NcSample::GetSubset* Error : Invalid input ifirst=" << ifirst <<
" ilast=" << ilast << endl;
2477 if (mode && (k<1 || k>
fDim))
2479 cout <<
" *NcSample::GetSubset* Error : Invalid argument k=" << k << endl;
2486 Double_t* values=
new Double_t[
fDim];
2487 for (Int_t i=ifirst; i<=ilast; i++)
2489 for (Int_t j=1; j<=
fDim; j++)
2494 if (
fDim==2) s->
Enter(values[0],values[1]);
2495 if (
fDim==3) s->
Enter(values[0],values[1],values[2]);
2496 if (
fDim==4) s->
Enter(values[0],values[1],values[2],values[3]);
2554 if (order>0) order=1;
2555 if (order<0) order=-1;
2559 sdt.SetName(
"DtSample");
2564 if (nc<1)
return sdt;
2567 if (nen<=nc)
return sdt;
2571 str.Form(
"Interval sampling for variable %-s between %-i consecutive entries (nc=%-i)",varname.Data(),nc+1,nc);
2572 sdt.SetNameTitle(
"DtSample",str);
2578 for (Int_t ien=1; ien<=nen; ien++)
2580 if (ien+nc>nen)
break;
2664 TString s=
"Sampling Histogram for NcSample ";
2666 s+=
";Sampling number;";
2669 TString sf=f->GetExpFormula(
"p");
2670 sf.ReplaceAll(
"x",
fNames[i-1]);
2678 TH1D hist(
"",s,
fN,0,
fN);
2682 cout <<
" *NcSample::GetSamplingHistogram* Error : Storage mode has not been activated." << endl;
2688 cout <<
" *NcSample::GetSamplingHistogram* Error : Invalid index encountered i=" << i << endl;
2693 for (Int_t ip=1; ip<=
fN; ip++)
2696 if (f) y=f->Eval(y);
2697 hist.SetBinContent(ip,y);
2773 TString s=
"1D Histogram for NcSample ";
2780 s+=
" weighted by : ";
2783 TString sf=f->GetExpFormula(
"p");
2784 sf.ReplaceAll(
"x",
fNames[j-1]);
2797 if (nbx) dx=(xup-xlow)/
double(nbx);
2802 TH1D hist(
"",s.Data(),nbx,xlow,xup);
2807 cout <<
" *NcSample::Get1DHistogram* Error : Storage mode has not been activated." << endl;
2813 cout <<
" *NcSample::Get1DHistogram* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
2819 for (Int_t ip=1; ip<=
fN; ip++)
2825 if (f) y=f->Eval(y);
2878 TString s=
"2D Histogram for NcSample ";
2887 s+=
" weighted by : ";
2890 TString sf=f->GetExpFormula(
"p");
2891 sf.ReplaceAll(
"x",
fNames[k-1]);
2906 if (nbx) dx=(xup-xlow)/
double(nbx);
2908 if (nby) dy=(yup-ylow)/
double(nby);
2914 TH2D hist(
"",s.Data(),nbx,xlow,xup,nby,ylow,yup);
2916 hist.SetMarkerStyle(20);
2917 hist.SetMarkerSize(1);
2921 cout <<
" *NcSample::Get2DHistogram* Error : Storage mode has not been activated." << endl;
2927 cout <<
" *NcSample::Get2DHistogram* Error : Invalid index encountered i=" << i <<
" j=" << j <<
" k=" << k << endl;
2934 for (Int_t ip=1; ip<=
fN; ip++)
2941 if (f) z=f->Eval(z);
2996 TString s=
"3D Histogram for NcSample ";
3003 TString sf=f->GetExpFormula(
"p");
3004 sf.ReplaceAll(
"x",
fNames[m-1]);
3028 if (nbx) dx=(xup-xlow)/
double(nbx);
3030 if (nby) dy=(yup-ylow)/
double(nby);
3032 if (nbz) dz=(zup-zlow)/
double(nbz);
3039 TH3D hist(
"",s.Data(),nbx,xlow,xup,nby,ylow,yup,nbz,zlow,zup);
3041 hist.SetMarkerStyle(20);
3042 hist.SetMarkerSize(1);
3046 cout <<
" *NcSample::Get3DHistogram* Error : Storage mode has not been activated." << endl;
3052 cout <<
" *NcSample::Get2DHistogram* Error : Invalid index encountered i=" << i <<
" j=" << j <<
" k=" << k <<
" m=" << m << endl;
3060 for (Int_t ip=1; ip<=
fN; ip++)
3068 if (f) t=f->Eval(t);
3080TH3D
NcSample::Get3DHistogram(TString nameA,TString nameB,TString nameC,TString nameD,Bool_t sumw2,Int_t nbx,Int_t nby,Int_t nbz,TF1* f)
3121 gr.SetName(
"NcSample");
3125 cout <<
" *NcSample::GetGraph* Error : Storage mode has not been activated." << endl;
3131 cout <<
" *NcSample::GetGraph* Error : Invalid index encountered i=" << i << endl;
3137 for (Int_t ip=0; ip<
fN; ip++)
3141 if (f) y=f->Eval(y);
3142 gr.SetPoint(ip,x,y);
3145 TString s=
"TGraph for NcSample ";
3147 s+=
" : X-axis=Sampling number ";
3152 sf=f->GetExpFormula(
"p");
3153 sf.ReplaceAll(
"x",
fNames[i-1]);
3156 s+=
";Sampling number;";
3159 gr.SetTitle(s.Data());
3161 gr.SetMarkerStyle(20);
3162 gr.SetMarkerSize(1);
3163 gr.SetDrawOption(
"AP");
3219 gr.SetName(
"NcSample");
3223 cout <<
" *NcSample::GetGraph* Error : Storage mode has not been activated." << endl;
3227 if (i<1 || i>
fDim || j<1 || j>
fDim)
3229 cout <<
" *NcSample::GetGraph* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
3235 for (Int_t ip=0; ip<
fN; ip++)
3239 if (f) y=f->Eval(y);
3240 gr.SetPoint(ip,x,y);
3243 TString s=
"TGraph for NcSample ";
3251 sf=f->GetExpFormula(
"p");
3252 sf.ReplaceAll(
"x",
fNames[j-1]);
3260 gr.SetTitle(s.Data());
3262 gr.SetMarkerStyle(20);
3263 gr.SetMarkerSize(1);
3264 gr.SetDrawOption(
"AP");
3353 cout <<
" *NcSample::GetGraphErrors* Error : No input Graph is specified." << endl;
3357 TString name=gr->GetName();
3362 if ((ix || iy) && !
fStore)
3364 cout <<
" *NcSample::GetGraphErrors* Error : Storage mode has not been activated." << endl;
3368 if (ix<0 || ix>
fDim || iy<0 || iy>
fDim)
3370 cout <<
" *NcSample::GetGraphErros* Error : Invalid index encountered ix=" << ix <<
" iy=" << iy << endl;
3375 Int_t np=gr->GetN();
3379 cout <<
" *NcSample::GetGraphErrors* Error : Input Graph does not contain any data points." << endl;
3383 if ((ix || iy) && np!=
fN)
3385 cout <<
" *NcSample::GetGraphErrors* Error : Entries don't match Nsample=" <<
fN <<
" Ngraph=" << np << endl;
3393 for (Int_t ip=0; ip<np; ip++)
3395 gr->GetPoint(ip,x,y);
3422 gre.SetPoint(ip,x,y);
3423 gre.SetPointError(ip,ex,ey);
3436 sfx+=fx->GetExpFormula(
"p");
3437 if (ix) sfx.ReplaceAll(
"x",
fNames[ix-1]);
3452 sfy+=fy->GetExpFormula(
"p");
3455 sfy.ReplaceAll(
"x",
fNames[iy-1]);
3459 sfy.ReplaceAll(
"x",
"y");
3465 TString s=
"TGraphErrors for Graph : ";
3474 axis=gr->GetXaxis();
3478 s+=axis->GetTitle();
3480 axis=gr->GetYaxis();
3484 s+=axis->GetTitle();
3487 gre.SetTitle(s.Data());
3489 gre.SetMarkerStyle(20);
3490 gre.SetMarkerSize(0.5);
3491 gre.SetDrawOption(
"AP");
3590 cout <<
" *NcSample::GetGraph* Error : Storage mode has not been activated." << endl;
3596 cout <<
" *NcSample::GetGraph* Error : No data entries are stored." << endl;
3600 if (i<1 || i>
fDim || j<1 || j>
fDim || (mode && (k<1 || k>
fDim)))
3602 cout <<
" *NcSample::GetGraph* Error : Invalid index encountered i=" << i <<
" j=" << j <<
" k=" << k << endl;
3612 xlow-=0.1*fabs(xlow);
3614 ylow-=0.1*fabs(ylow);
3623 fGraphT=
new TGraphTime(
fN,xlow,ylow,xup,yup);
3630 for (Int_t istep=0; istep<
fN; istep++)
3632 if (!smp) jpstart=istep;
3633 for (Int_t jp=jpstart; jp<=istep; jp++)
3637 m=
new TMarker(x,y,20);
3638 m->SetMarkerSize(1);
3643 TString s=
"TGraphTime for NcSample ";
3649 fGraphT->SetNameTitle(
"",s.Data());
3717 gr.SetName(
"NcSample");
3721 cout <<
" *NcSample::GetGraph* Error : Storage mode has not been activated." << endl;
3727 cout <<
" *NcSample::GetGraph* Error : No data entries are stored." << endl;
3733 cout <<
" *NcSample::GetGraph* Error : Invalid index encountered i=" << i <<
" j=" << j <<
" k=" << k << endl;
3740 for (Int_t ip=0; ip<
fN; ip++)
3745 if (f) z=f->Eval(z);
3746 gr.SetPoint(ip,x,y,z);
3749 TString s=
"TGraph2D for NcSample ";
3759 sf=f->GetExpFormula(
"p");
3760 sf.ReplaceAll(
"x",
fNames[k-1]);
3770 gr.SetTitle(s.Data());
3772 gr.SetMarkerStyle(20);
3773 gr.SetMarkerSize(1);
3774 gr.SetDrawOption(
"P");
3829 return GetGraph(nameA,nameB,nameC,&func);
3885 cout <<
" *NcSample::GetGraph2DErrors* Error : No input Graph is specified." << endl;
3889 TString name=gr->GetName();
3894 if ((ix || iy || iz) && !
fStore)
3896 cout <<
" *NcSample::GetGraph2DErrors* Error : Storage mode has not been activated." << endl;
3900 if (ix<0 || ix>
fDim || iy<0 || iy>
fDim || iz<0 || iz>
fDim)
3902 cout <<
" *NcSample::GetGraph2DErrors* Error : Invalid index encountered ix=" << ix <<
" iy=" << iy <<
" iz=" << iz << endl;
3907 Int_t np=gr->GetN();
3911 cout <<
" *NcSample::GetGraph2DErrors* Error : Input Graph does not contain any data points." << endl;
3915 if ((ix || iy || iz) && np!=
fN)
3917 cout <<
" *NcSample::GetGraph2DErrors* Error : Entries don't match Nsample=" <<
fN <<
" Ngraph=" << np << endl;
3921 Double_t* xarr=gr->GetX();
3922 Double_t* yarr=gr->GetY();
3923 Double_t* zarr=gr->GetZ();
3930 for (Int_t ip=0; ip<np; ip++)
3974 gre.SetPoint(ip,x,y,z);
3975 gre.SetPointError(ip,ex,ey,ez);
3988 sfx+=fx->GetExpFormula(
"p");
3989 if (ix) sfx.ReplaceAll(
"x",
fNames[ix-1]);
4004 sfy+=fy->GetExpFormula(
"p");
4007 sfy.ReplaceAll(
"x",
fNames[iy-1]);
4011 sfy.ReplaceAll(
"x",
"y");
4027 sfz+=fz->GetExpFormula(
"p");
4030 sfz.ReplaceAll(
"x",
fNames[iz-1]);
4034 sfz.ReplaceAll(
"x",
"z");
4040 TString s=
"TGraphErrors for Graph : ";
4051 axis=gr->GetXaxis();
4055 s+=axis->GetTitle();
4057 axis=gr->GetYaxis();
4061 s+=axis->GetTitle();
4063 axis=gr->GetZaxis();
4067 s+=axis->GetTitle();
4070 gre.SetTitle(s.Data());
4072 gre.SetMarkerStyle(20);
4073 gre.SetMarkerSize(0.5);
4074 gre.SetDrawOption(
"err P");
4151 gr.SetName(
"NcSample");
4153 if (!f && (j<1 || j>
fDim))
return gr;
4157 cout <<
" *NcSample::GetQQplot* Error : Storage mode has not been activated." << endl;
4163 cout <<
" *NcSample::GetQQplot* Error : No data entries are stored." << endl;
4167 if (i<1 || i>
fDim || (!f && (j<1 || j>
fDim)))
4169 cout <<
" *NcSample::GetQQplot* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
4174 if (i==1) arri=
fX->GetArray();
4175 if (i==2) arri=
fY->GetArray();
4176 if (i==3) arri=
fZ->GetArray();
4177 if (i==4) arri=
fT->GetArray();
4182 if (j==1) arrj=
fX->GetArray();
4183 if (j==2) arrj=
fY->GetArray();
4184 if (j==3) arrj=
fZ->GetArray();
4185 if (j==4) arrj=
fT->GetArray();
4187 if (arri && arrj) gr=TGraphQQ(
fN,arri,
fN,arrj);
4191 if (arri) gr=TGraphQQ(
fN,arri,f);
4194 TString s=
"QQ-plot (TGraphQQ) for NcSample ";
4201 TString sf=f->GetExpFormula(
"p");
4202 sf.ReplaceAll(
"x",
"a");
4213 gr.SetTitle(s.Data());
4215 gr.SetMarkerStyle(20);
4216 gr.SetMarkerSize(1);
4257 printf(
" *%-s::Load* Error : No TGraph specified ==> No action taken. \n",ClassName());
4261 if (!clr &&
fDim!=2)
4263 printf(
" *%-s::Load* Error : Dimension %-i does not match a TGraph. \n",ClassName(),
fDim);
4269 Int_t npoints=g->GetN();
4270 Double_t* x=g->GetX();
4271 Double_t* y=g->GetY();
4273 if (!x || !y || npoints<1)
return;
4275 for (Int_t i=0; i<npoints; i++)
4298 printf(
" *%-s::Load* Error : No TGraph2D specified ==> No action taken. \n",ClassName());
4302 if (!clr &&
fDim!=3)
4304 printf(
" *%-s::Load* Error : Dimension %-i does not match a TGraph2D. \n",ClassName(),
fDim);
4310 Int_t npoints=g->GetN();
4311 Double_t* x=g->GetX();
4312 Double_t* y=g->GetY();
4313 Double_t* z=g->GetZ();
4315 if (!x || !y || !z || npoints<1)
return;
4317 for (Int_t i=0; i<npoints; i++)
4319 Enter(x[i],y[i],z[i]);
4340 printf(
" *%-s::Load* Error : No histogram specified ==> No action taken. \n",ClassName());
4344 Int_t hdim=h->GetDimension();
4348 printf(
" *%-s::Load* Error : Histograms of dimension %-i are not supported. \n",ClassName(),hdim);
4352 if (!clr &&
fDim!=1)
4354 printf(
" *%-s::Load* Error : Dimension %-i does not match a 1-dimensional histogram. \n",ClassName(),
fDim);
4360 Int_t nbins=h->GetNbinsX();
4363 for (Int_t i=1; i<=nbins; i++)
4365 val=h->GetBinContent(i);
4387 printf(
" *%-s::Load* Error : No data array specified ==> No action taken. \n",ClassName());
4391 if (!clr &&
fDim!=1)
4393 printf(
" *%-s::Load* Error : Dimension %-i does not match a 1-dimensional data array. \n",ClassName(),
fDim);
4399 Int_t n=arr->GetSize();
4402 for (Int_t i=0; i<n; i++)
4489 if (i<1 || i>
fDim || !mode || abs(mode)>4)
return -9999;
4496 Double_t rmsdev=sqrt(var);
4498 Double_t stdev=rmsdev;
4499 if (mode<0) stdev=sigma;
4501 if (stdev<=0)
return -9999;
4511 snr=(ymax-ymin)/stdev;
4515 snr=(ymax-ymin)/(2.*stdev);
4518 if (dB && snr>0) snr=10.*log10(snr);
4528 Double_t psignal=mean*mean;
4529 Double_t pnoise=stdev*stdev;
4531 if (psignal>0 && pnoise>0)
4533 snr=10.*(log10(psignal)-log10(pnoise));
4534 if (abs(mode)==1) snr=snr/2.;
4625 return GetSNR(i,mode,dB);
4655 if (i<1 || i>
fDim || abs(mode)<1 || abs(mode)>2)
return -1;
4660 if (abs(mode)==2) value=(vmax-vmin)/2.;
4666 if (value) cv=fabs(stdev/value);
4698 return GetCV(i,mode);
4731 cout <<
" *NcSample::Animation* Inconsistent input data." << endl;
4747 fCanvas=
new TCanvas(
"fCanvas",
"Sampling animation");
4749 TGraph* gr=
new TGraph();
4752 TString s=
"Sampling animation for NcSample ";
4754 gr->SetTitle(s.Data());
4755 gr->SetMarkerStyle(20);
4756 gr->SetMarkerSize(1);
4760 for (Int_t ip=0; ip<
fN; ip++)
4764 gr->SetPoint(ip,x,y);
4766 if (!ip) gr->Draw(opt.Data());
4770 gr->GetXaxis()->SetTitle(s.Data());
4773 gr->GetYaxis()->SetTitle(s.Data());
4778 gSystem->Sleep(delay);
4845 cout <<
" *NcSample::Animation* Inconsistent input data." << endl;
4861 fCanvas=
new TCanvas(
"fCanvas",
"Sampling animation");
4863 TGraph2D* gr=
new TGraph2D(
fN);
4866 TString s=
"Sampling animation for NcSample ";
4868 gr->SetTitle(s.Data());
4869 gr->SetMarkerStyle(20);
4870 gr->SetMarkerSize(1);
4875 for (Int_t ip=0; ip<
fN; ip++)
4880 gr->SetPoint(ip,x,y,z);
4882 if (!ip) gr->Draw(opt.Data());
4886 gr->GetXaxis()->SetTitle(s.Data());
4889 gr->GetYaxis()->SetTitle(s.Data());
4892 gr->GetZaxis()->SetTitle(s.Data());
4897 gSystem->Sleep(delay);
4901void NcSample::Animation(TString nameA,TString nameB,TString nameC,Int_t mode,TString nameD,Int_t delay,TString opt)
5000 if (mode<0 || mode>3)
5002 cout <<
" *NcSample::Digitize* Inconsistent input mode=" << mode << endl;
5006 if (!nbits || nbits>60 || nbits<-60 || fabs(vcal)<=0)
5008 cout <<
" *NcSample::Digitize* Inconsistent input nbits=" << nbits <<
" vcal=" << vcal << endl;
5012 if ((mode==1 || mode==3) && nbits==1)
5014 cout <<
" *NcSample::Digitize* Inconsistent input nbits=" << nbits <<
" mode=" << mode << endl;
5018 Bool_t logmode=kFALSE;
5019 if (nbits<0) logmode=kTRUE;
5023 Long_t nlevels=pow(2,nbits);
5024 Double_t range=fabs(vcal);
5025 if (mode==1 || mode==3) range*=2.;
5026 Double_t step=fabs(vcal);
5027 if (mode==0) step=range/double(nlevels-1);
5028 if (mode==1) step=range/double(nlevels-2);
5030 if (step<=0)
return 0;
5033 Long_t nstepsmax=nlevels-1;
5034 if ((mode==0 || mode==2) && vcal<0)
5036 nstepsmin=-nlevels+1;
5039 if (mode==1 || mode==3)
5041 nstepsmin=-nlevels/2;
5042 nstepsmax=nlevels/2-1;
5045 Double_t digvalmin=double(nstepsmin)*step;
5046 Double_t digvalmax=double(nstepsmax)*step;
5048 cout <<
" *NcSample::Digitize* Parameters of the " << nbits <<
"-bits";
5049 if (logmode) cout <<
" Log10";
5050 cout <<
" ADC digitization";
5051 if (i>0 && i<=
fDim) cout <<
" of variable : " << i <<
" (" <<
fNames[i-1] <<
")";
5054 if (logmode) s=
"Log10";
5055 if (mode==0 || mode==2)
5057 cout <<
" Digitized " << s <<
" full scale range : [" << digvalmin <<
"," << digvalmax <<
"] Step size : " << step << endl;
5059 if (mode==1 || mode==3)
5061 cout <<
" Digitized " << s <<
" full scale range : [" << (digvalmin+step) <<
"," << digvalmax <<
"] Step size : " << step;
5062 cout <<
" Actual range : [" << digvalmin <<
"," << digvalmax <<
"]" << endl;
5067 Double_t linvalmin=pow(10,digvalmin);
5068 Double_t linvalmax=pow(10,digvalmax);
5069 if (mode==0 || mode==2)
5071 cout <<
" Digitized linear full scale range : [" << linvalmin <<
"," << linvalmax <<
"]" << endl;
5073 if (mode==1 || mode==3)
5075 cout <<
" Digitized linear full scale range : [" << (linvalmin*pow(10,step)) <<
"," << linvalmax <<
"]";
5076 cout <<
" Actual range : [" << linvalmin <<
"," << linvalmax <<
"]" << endl;
5080 Double_t retval=step;
5083 if (vcal<0) retval=digvalmin;
5084 if (vcal>0) retval=digvalmax;
5086 if (mode==3) retval=digvalmax;
5091 cout <<
" *NcSample::Digitize* Error : Storage mode has not been activated." << endl;
5098 if (logmode && minval<=0)
5101 cout <<
" *NcSample::Digitize* Non-positive input value(s) for Log10 ADC i=" << i <<
" minimum=" << minval << endl;
5108 cout <<
" *NcSample::Digitize* Value i=" << i <<
" is outside range. Only listing of ADC specs." << endl;
5115 for (Int_t j=1; j<=
fN; j++)
5119 if (logmode) val=log10(val);
5123 if (nsteps<nstepsmin) nsteps=nstepsmin;
5124 if (nsteps>nstepsmax) nsteps=nstepsmax;
5126 digval=double(nsteps)*step;
5128 if (logmode) digval=pow(10,digval);
5130 if (i==1)
fX->AddAt(digval,j-1);
5131 if (i==2)
fY->AddAt(digval,j-1);
5132 if (i==3)
fZ->AddAt(digval,j-1);
5133 if (i==4)
fT->AddAt(digval,j-1);
5206 return Digitize(i,nbits,vcal,mode);
5209TArrayL64
NcSample::ADC(Int_t nbits,Double_t range,Double_t Vbias,TArray* Vsig,TH1* hist,Int_t B,Int_t C)
const
5294 TArrayL64 arradc(0);
5295 if (hist) hist->Reset();
5298 if (Vsig) nVsig=Vsig->GetSize();
5300 if (nbits<=0 || nbits>60 || !range || fabs(Vbias)>fabs(range) || B<0 || (B && C<1))
5302 printf(
"\n *%-s::ADC* Inconsistent input nbits=%-i range=%-g Vbias=%-g B=%-i C=%-i \n",ClassName(),nbits,range,Vbias,B,C);
5308 Long64_t N=pow(2,nbits);
5310 Long64_t adcmax=N-1;
5318 if (B==1) rB=exp(1);
5320 Double_t radcmax=adcmax;
5339 if (range<0) Vfs=pow(rB,-rC)*pow(rB,radcmax*rC/rN)*Vref;
5340 if (range>0) Vref=pow(rB,rC)*pow(rB,-radcmax*rC/rN)*Vfs;
5341 LSB=Vref*pow(rB,-rC)*(pow(rB,rC/rN)-1.);
5344 if (frac>0) ped=Long64_t(rN*(math.
Log(rB,frac)+rC)/rC);
5347 if (LSB<=0 || Vfs<=0)
5349 printf(
"\n *%-s::ADC* Inconsistent parameters : LSB=%-g Vfs=%-g \n",ClassName(),LSB,Vfs);
5353 if (!B) ped=Vbias/LSB;
5355 Double_t DR=20.*log10(Vfs/LSB);
5357 TString mode=
"linear";
5358 if (B==1) mode=
"Log_e";
5367 printf(
" *%-s::ADC* No input data have been provided --> Only the value of adc(Vbias) is returned. \n",ClassName());
5370 printf(
" Parameters for a %-i-bits %-s ADC with adc=[%-lli,%-lli] : \n",nbits,mode.Data(),adcmin,adcmax);
5371 printf(
" Vref=%-g Vfs=%-g LSB=%-g DR=%-g (dB) Vbias=%-g adc(Vbias)=%-lli \n",Vref,Vfs,LSB,DR,Vbias,ped);
5375 printf(
" Parameters for a %-i-bits %-s ADC with adc=[%-lli,%-lli] and a code efficiency factor of %-i: \n",nbits,mode.Data(),adcmin,adcmax,C);
5376 printf(
" Vref=%-g Vfs=%-g LSB=%-g DR=%-g (dB) Vbias=%-g adc(Vbias)=%-lli \n",Vref,Vfs,LSB,DR,Vbias,ped);
5388 title.Form(
"%-s %-i-bits %-s ADC with Vfs=%-g LSB=%-g;Sample number;ADC counts",ClassName(),nbits,mode.Data(),Vfs,LSB);
5389 hist->SetBins(nVsig,0,nVsig);
5390 hist->SetMarkerStyle(20);
5391 hist->SetTitle(title);
5397 for (Int_t j=0; j<nVsig; j++)
5399 val=Vbias+Vsig->GetAt(j);
5405 if (frac>0) radcval=(rN/rC)*(math.
Log(rB,frac)+rC);
5412 adcval=Long64_t(radcval);
5415 if (adcval<adcmin) adcval=adcmin;
5416 if (adcval>adcmax) adcval=adcmax;
5420 if (hist) hist->SetBinContent(j+1,adcval);
5426TArrayD
NcSample::DAC(Int_t nbits,Double_t range,Double_t Vbias,TArray* adcs,TArray* peds,TH1* hist,Int_t B,Int_t C)
const
5516 if (hist) hist->Reset();
5519 if (adcs) nadcs=adcs->GetSize();
5522 if (peds) npeds=peds->GetSize();
5524 if (nbits<=0 || nbits>60 || !range || fabs(Vbias)>fabs(range) || (peds && npeds<nadcs) || B<0 || (B && C<1))
5526 printf(
"\n *%-s::DAC* Inconsistent input nbits=%-i range=%-g Vbias=%-g nadcs=%-i npeds=%-i B=%-i C=%-i \n",ClassName(),nbits,range,Vbias,nadcs,npeds,B,C);
5532 Long64_t N=pow(2,nbits);
5534 Long64_t adcmax=N-1;
5542 if (B==1) rB=exp(1);
5544 Double_t radcmax=adcmax;
5563 if (range<0) Vfs=pow(rB,-rC)*pow(rB,radcmax*rC/rN)*Vref;
5564 if (range>0) Vref=pow(rB,rC)*pow(rB,-radcmax*rC/rN)*Vfs;
5565 LSB=Vref*pow(rB,-rC)*(pow(rB,rC/rN)-1.);
5568 if (frac>0) ped=Long64_t(rN*(math.
Log(rB,frac)+rC)/rC);
5571 if (LSB<=0 || Vfs<=0)
5573 printf(
"\n *%-s::DAC* Inconsistent parameters : LSB=%-g Vfs=%-g \n",ClassName(),LSB,Vfs);
5577 if (!B) ped=Vbias/LSB;
5579 Double_t DR=20.*log10(Vfs/LSB);
5581 TString mode=
"linear";
5582 if (B==1) mode=
"Log_e";
5591 printf(
" *%-s::DAC* No input data have been provided --> Only the value of adc(Vbias) is returned. \n",ClassName());
5594 printf(
" Parameters for a %-i-bits %-s DAC with adc=[%-lli,%-lli] : \n",nbits,mode.Data(),adcmin,adcmax);
5595 printf(
" Vref=%-g Vfs=%-g LSB=%-g DR=%-g (dB) Vbias=%-g adc(Vbias)=%-lli \n",Vref,Vfs,LSB,DR,Vbias,ped);
5599 printf(
" Parameters for a %-i-bits %-s DAC with adc=[%-lli,%-lli] and a code efficiency factor of %-i: \n",nbits,mode.Data(),adcmin,adcmax,C);
5600 printf(
" Vref=%-g Vfs=%-g LSB=%-g DR=%-g (dB) Vbias=%-g adc(Vbias)=%-lli \n",Vref,Vfs,LSB,DR,Vbias,ped);
5612 title.Form(
"%-s %-i-bits %-s DAC with Vfs=%-g LSB=%-g;Sample number;Amplitude",ClassName(),nbits,mode.Data(),Vfs,LSB);
5613 hist->SetBins(nadcs,0,nadcs);
5614 hist->SetMarkerStyle(20);
5615 hist->SetTitle(title);
5621 for (Int_t j=0; j<nadcs; j++)
5628 dacval=Vref*pow(rB,-rC)*pow(rB,radc*rC/rN);
5642 if (B || (!B && !peds))
5644 dacval=dacval-Vbias;
5649 if (hist) hist->SetBinContent(j+1,dacval);
5655Long64_t
NcSample::Transmit(Int_t i,Int_t nbits,Double_t range,Double_t Vbias,TArray* peds,TH1* hist,Int_t B,Int_t C)
5732 if (hist) hist->Reset();
5736 printf(
"\n *%-s::Transmit* Error : Storage mode has not been activated. \n",ClassName());
5737 printf(
" No digitization is performed. \n");
5743 printf(
"\n *%-s::Transmit* Invalid variable name or index (i=%-i) --> Only listing of ADC specs. \n",ClassName(),i);
5744 adcarr=
ADC(nbits,range,Vbias,0,0,B,C);
5750 printf(
"\n *%-s::Transmit* No data available for variable %-s (index=%-i) --> Only listing of ADC specs. \n",ClassName(),
fNames[i-1].
Data(),i);
5751 adcarr=
ADC(nbits,range,Vbias,0,0,B,C);
5756 Double_t Vin=minval+Vbias;
5760 TString mode=
"Log_e";
5766 printf(
"\n *%-s::Transmit* Non-positive input value(s) for %-s ADC --> No digitization is performed. \n",ClassName(),mode.Data());
5767 printf(
" Minimum+Vbias=%-g+%-g=%-g for variable with name %-s (index i=%-i). \n",minval,Vbias,Vin,
fNames[i-1].
Data(),i);
5779 adcarr=
ADC(nbits,range,Vbias,arrin,0,B,C);
5782 dacarr=
DAC(nbits,range,Vbias,&adcarr,peds,hist,B,C);
5786 TString title=hist->GetTitle();
5787 title.ReplaceAll(
"DAC",
"ADC-DAC (Transmit)");
5788 hist->SetTitle(title);
5791 Int_t ndac=dacarr.GetSize();
5794 printf(
"\n *%-s::Transmit* Inconsistent number of entries : Nsamplings=%-i Ndac=%-i --> No digitization is performed. \n",ClassName(),
fN,ndac);
5800 for (Int_t j=0; j<
fN; j++)
5803 arrin->AddAt(val,j);
5809Long64_t
NcSample::Transmit(TString name,Int_t nbits,Double_t range,Double_t Vbias,TArray* peds,TH1* hist,Int_t B,Int_t C)
5887 return Transmit(i,nbits,range,Vbias,peds,hist,B,C);
5911 NcSample s(
"SampleAndHold",
"Error occurred in SampleAndHold");
5914 if (step<=0 || vmax<=vmin)
5916 cout <<
" *NcSample::SampleAndHold* Error : Invalid input step=" << step <<
" vmin=" << vmin <<
" vmax=" << vmax << endl;
5920 TString str=
"For Function ";
5921 str+=f.GetExpFormula(
"p");
5922 str+=
" with step=%-10.3g";
5923 TString str2=str.Format(str.Data(),step);
5924 s.SetTitle(str2.Data());
5933 if (loc<0) xval=xlow;
5934 if (!loc) xval=xlow+step/2.;
5935 if (loc>0) xval=xlow+step;
5936 if (xval>vmax) xval=vmax;
5974 NcSample s(
"SampleAndSum",
"Error occurred in SampleAndSum");
5979 cout <<
" *NcSample::SampleAndSum* Error : Storage mode has not been activated." << endl;
5985 cout <<
" *NcSample::SampleAndSum* Error : Invalid index encountered i=" << i <<
" j=" << j << endl;
5991 cout <<
" *NcSample::SampleAndSum* Error : Invalid step size step=" << step << endl;
5995 TString xname=
fNames[i-1];
5996 TString yname=
"Counts";
5997 if (j>0) yname=
fNames[j-1];
6001 TString str=
"For Variable ";
6003 str+=
" with step=%-10.3g";
6004 TString str2=str.Format(str.Data(),step);
6005 s.SetTitle(str2.Data());
6017 Int_t nbx=(xmax-xmin)/step;
6020 Double_t* bins=
new Double_t[nbx+1];
6022 for (Int_t idx=0; idx<=nbx; idx++)
6028 TH1D hist(
"",
"",nbx,bins);
6033 for (Int_t ient=1; ient<=
fN; ient++)
6037 hist.Fill(xval,yval);
6041 Int_t nbins=hist.GetNbinsX();
6042 Double_t binwidth=hist.GetBinWidth(1);
6043 for (Int_t k=1; k<=nbins; k++)
6045 if (loc) xval=hist.GetBinLowEdge(k);
6046 if (!loc) xval=hist.GetBinCenter(k);
6047 if (loc>0) xval+=binwidth;
6048 yval=hist.GetBinContent(k);
6105 if (strlen(name)) q->SetName(name);
Various mathematical tools for scientific analysis.
Double_t Log(Double_t B, Double_t x) const
Sampling and statistics tools for various multi-dimensional data samples.
Long64_t Transmit(Int_t i, Int_t nbits, Double_t range, Double_t Vbias=0, TArray *peds=0, TH1 *hist=0, Int_t B=0, Int_t C=3)
TGraphQQ GetQQplot(Int_t i, Int_t j, TF1 *f=0)
void Order(Int_t mode, Int_t i)
Double_t GetSNR(Int_t i, Int_t mode=2, Bool_t db=kTRUE) const
TCanvas * fCanvas
! Multi-purpose canvas for e.g. animation displays
Int_t GetStoreMode() const
Double_t fRMSdev[fMaxdim]
TH3D Get3DHistogram(Int_t i, Int_t j, Int_t k, Int_t m=0, Bool_t sumw2=kFALSE, Int_t nbx=100, Int_t nby=100, Int_t nbz=100, TF1 *f=0)
void Data(Int_t i=0, Int_t j=0)
Double_t GetCov(Int_t i, Int_t j) const
virtual TObject * Clone(const char *name="") const
TObject * fAnimObject
! Multi-purpose pointer for animation objects
void GetSubset(NcSample *s, Int_t ifirst, Int_t ilast, Int_t mode=0, Int_t k=0)
Double_t GetMinimum(Int_t i) const
TArrayL64 ADC(Int_t nbits, Double_t range, Double_t Vbias=0, TArray *Vsig=0, TH1 *hist=0, Int_t B=0, Int_t C=3) const
Int_t GetIndex(TString name) const
TH1D Get1DHistogram(Int_t i, Int_t j=0, Bool_t sumw2=kFALSE, Int_t nbx=100, TF1 *f=0)
Double_t GetCor(Int_t i, Int_t j) const
TArrayD * fArr
! Temp. storage array for ordered values
Double_t fCor[fMaxdim][fMaxdim]
Double_t fSum2[fMaxdim][fMaxdim]
Double_t GetSigma(Int_t i, Int_t model=0) const
TGraphTime * fGraphT
! Temp. pointer to return a TGraphTime object
Double_t GetMedian(Int_t i)
void Animation(Int_t i, Int_t j, Int_t mode, Int_t k, Int_t delay, TString opt="AP")
TGraphErrors GetGraphErrors(TGraph *g, Int_t ix=0, Int_t iy=0, TF1 *fx=0, TF1 *fy=0)
TH1D GetSamplingHistogram(Int_t i, TF1 *f=0)
Int_t GetStoreNmax() const
NcSample SampleAndHold(TF1 f, Double_t step, Double_t vmin, Double_t vmax, Int_t loc=-1) const
Int_t fOrdered
! Indicator of the status of the current ordering
Double_t GetRMS(Int_t i) const
void SetNames(TString name1="X", TString name2="Y", TString name3="Z", TString name4="T")
Double_t Digitize(Int_t i, Int_t nbits, Double_t vcal, Int_t mode)
NcSample GetDtSample(Int_t i, Int_t nc, Int_t store=1, Int_t nmax=0, Int_t order=0)
Double_t fCov[fMaxdim][fMaxdim]
Double_t GetMean(Int_t i) const
TArrayD DAC(Int_t nbits, Double_t range, Double_t Vbias=0, TArray *adcs=0, TArray *peds=0, TH1 *hist=0, Int_t B=0, Int_t C=3) const
void RemoveEntry(Int_t i, Int_t mode, Int_t j)
void ListOrdered(Int_t mode, Int_t i)
TString GetVariableName(Int_t i) const
TArrayI * fIndices
! Temp. storage array for the indices of the ordered entries
Int_t GetDimension() const
TGraph GetGraph(Int_t i, TF1 *f=0)
Double_t GetVar(Int_t i, Int_t model=0) const
void SetStoreMode(Int_t mode=1, Int_t nmax=0, Int_t i=0)
Double_t GetMaximum(Int_t i) const
void Load(TGraph *g, Int_t clr=1)
Double_t GetCV(Int_t i, Int_t mode=1) const
Double_t GetSpread(Int_t i, Int_t model=0, Double_t vref=0)
Double_t GetQuantile(Double_t f, Int_t i)
Double_t GetEntry(Int_t i, Int_t j, Int_t mode=0, Int_t k=0)
TGraph2DErrors GetGraph2DErrors(TGraph2D *g, Int_t ix=0, Int_t iy=0, Int_t iz=0, TF1 *fx=0, TF1 *fy=0, TF1 *fz=0)
NcSample(const char *name="", const char *title="")
TH2D Get2DHistogram(Int_t i, Int_t j, Int_t k=0, Bool_t sumw2=kFALSE, Int_t nbx=100, Int_t nby=100, TF1 *f=0)
Double_t GetSum(Int_t i) const
NcSample SampleAndSum(Int_t i, Double_t step, Int_t loc=0, Int_t j=0, Double_t vmin=0, Double_t vmax=-1)