18 0.1 , 0.1 , 0.1 , 0.3 , 0.7 , 1 , 1.2 , 1.5 , 1.8 , 2 , 10 , 10 , 10,
19 0.1 , 0.1 , 0.2 , 0.5 , 0.85 , 1.1 , 1.35 , 1.65 , 1.9 , 6 , 10 , 10 , 10,
20 0.1 , 0.1 , 0.1 , 0.3 , 0.7 , 1 , 1.2 , 1.5 , 1.8 , 2 , 10 , 10 , 10,
21 0.1 , 0.1 , 0.1 , 0.3 , 0.7 , 1 , 1.2 , 1.5 , 1.8 , 2 , 10 , 10 , 10,
22 0.1 , 0.1 , 0.2 , 0.5 , 0.85 , 1.1 , 1.35 , 1.65 , 1.9 , 6 , 10 , 10 , 10,
23 0.1 , 0.1 , 0.12 , 0.38 , 0.79 , 1.08 , 1.35 , 1.68 , 1.94 , 8.4 , 10 , 10 , 10,
24 0.1 , 0.118 , 0.28 , 0.62 , 0.91 , 1.12 , 1.35 , 1.62 , 1.86 , 3.6 , 10 , 10 , 10,
25 0.1 , 0.1 , 0.1733333 , 0.46 , 0.83 , 1.093333 , 1.35 , 1.66 , 1.913333 , 6.8 , 10 , 10 , 10,
26 0.1 , 0.1 , 0.18 , 0.47 , 0.835 , 1.095 , 1.35 , 1.6575 , 1.91 , 6.6 , 10 , 10 , 10 };
32 double x[] = {0.1,0.3,0.7,1.,1.2,1.5,1.8,2.,10,10};
35 double p[] = { 0.,0.01,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.99,1.0 };
40 std::random_shuffle(x, x+10);
42 std::cout <<
"shuffle data " << std::endl;
43 std::cout <<
" data = { ";
44 for (
int i = 0; i <
n; ++i)
45 std::cout << x[i] <<
" ";
57 for (
int i = 0; i <
np; ++i) {
60 std::cout << std::endl;
61 for (
int i = 0; i <
np; ++i) {
62 printf(
" %5.3f ",quant[i]);
64 std::cout << std::endl;
71 std::cout <<
"Testing for type " <<
type <<
" :\t\t";
72 for (
int i = 0; i <
np; ++i) {
73 double r_result =
result[ (type-1)*np + i];
77 std::cout <<
" Failed for prob = " << p[i] <<
" - R gives " << r_result <<
" TMath gives " << quant[i] << std::endl;
82 std::cout <<
"\t OK !\n";
84 std::cout <<
"\nTest Failed for type " << type << std::endl;
89 int main(
int argc,
char *argv[]) {
92 int type = atoi(argv[1]);
95 return (ret) ? 0 : -1;
99 std::cout <<
"Test ordered data ....\n";
101 for (
int itype = 0; itype < 10; ++itype) {
104 std::cout <<
"\nTest data in random order....\n";
105 for (
int itype = 0; itype < 10; ++itype) {
110 std::cout <<
"Test sample quantiles FAILED " << std::endl;
bool testQuantiles(int type=0, bool sorted=true)
int main(int argc, char *argv[])
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=0, Int_t type=7)
Computes sample quantiles, corresponding to the given probabilities Parameters: x -the data sample n ...
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)