void test_random() { using namespace RooFit; //------------reading the roofit result to extract covariance matrix-------------// TFile *f = new TFile("sigf_SM.root","READ"); RooFitResult *r = (RooFitResult*)f->Get("sigf"); r->Print(); //--------covariance matrix-----------------// const TMatrixDSym &cov = r->covarianceMatrix(); // cov.Print(); //---------------declaring the random numbers-------// TRandom3 *rnd[12]; for(int i=0;i<12;i++) { rnd[i] = new TRandom3(); } double mean[12] = {0.679,0.1313,0.94125,0.4988,13.097,9.3146,2.2049,0.83226,18.973,7.268,2.2058,5.2193}; double sigma[12] ; int sel_indx[12] = {0,1,2,3,10,11,12,13,15,16,17,18}; for(int i=0;i<12;i++) { sigma[i] = sqrt(cov(sel_indx[i],sel_indx[i])); } //---------covariance matrix for the 12 parameters---------// TArrayD cov_l1(144); TMatrixDSym cov_l1m(12,12); //matrix to store the reduced covariance matrix int fill_indx=0; for(int i=0;i<12;i++) { for(int j=0;j<12;j++) { //cout<Gaus(mean[i],sigma[i]); } randx.SetMatrixArray(randxa.GetArray()); //----------applying the cholesky decomposition------- TDecompChol rd(cov_l1m); // TMatrixD randy = rd*randx; // randy is to store the correlated random numbers }