long seed = 123456789;// would be better to read from an option file so you dont have
//to recompile every time you want to change it for a different run.
RanluxEngine randomEngine(seed,4); //Only call once at the start of code to initialise
double mean1 = 0.1;
double stdDev1 = 0.03;
double mean2 = 0.6;
double stdDev2 = 0.01;
It looks to me that you are missing the CINT dictionary for CLHEP. You should run in compile mode with ACLIC.
But, any special reason you need the generator from CLHEP ?
I remind you now in ROOT we included also RunLux (TRandom1) and some
main generators from GSL in libMathMore, see:
So there exists fuctionality that I can almost directly copy the code I posted with new equivalent functions for the shoot method I would use in CLHEP?
Using the Ranlux engine in ROOT (TRandom1) you would need to do :
{
#include "TRandom1.h"
long seed = 123456789;// would be better to read from an option file so you dont have
//to recompile every time you want to change it for a different run.
TRandom1 randomEngine(seed,4); //Only call once at the start of code to initialise
double mean1 = 0.1;
double stdDev1 = 0.03;
double mean2 = 0.6;
double stdDev2 = 0.01;
TH1F h("h","h",100,0,1);
TH1F h2("h2","h2",100,0,1);
for(int i=0;i<10000;i++) {
double randNum1 = randomEngine.Gaus(mean1,stdDev1);
double randNum2 = randomEngine.Gaus(mean2,stdDev2);
//do stuff with randNum1 and randNum2.......
h.Fill(randNum1);
h2.Fill(randNum2);
}
}
[quote=“moneta”]The thread you mentioned refer to TRandom, not TRandom1.
TRandom1 is based on the RANLUX generator of Luscher, which is the only generator with mathematically proven random properties.
The disavantage is that is much slower than TRandom3 ( approximatly a factor of 5 ).[/quote]
You are correct. (I’m still using mostly root 4.02 which does not have TRandom1, so I didn’t know about it). Those worried about speed should consider TRandom{2,3}; just avoid TRandom.