40 std::vector<TH2D *>
vh2;
44 template<
class Random>
47 TH2D *
h2 =
new TH2D(
"h2",name,300,0,0.000003,300,0.,1.);
61 const Int_t NR = 20000;
62 const Int_t NR2 = NR/2;
69 for (
Int_t j=0;j<NR;j+=2) {
70 if (rn[j]*rn[j]+rn[j+1]*rn[j+1] <= 1) npi++;
71 if (rn[j] < 0.001) h2->
Fill(rn[j],rn[j+1]);
76 if (i && i % (n/10) == 0) {
79 diffpi = norm*npi -
pi;
81 if (k ==0) gr->
Draw(
"lp");
93 legend->
AddEntry(gr,
Form(
"%-14s: %6.1f ns/call",name,nanos),
"lp");
96 printf(
"RANDOM = %s : RT=%7.3f s, Cpu=%7.3f s\n",name,timer.
RealTime(),cpu);
141 TH2F *frame =
new TH2F(
"h",
"",100,0,1.1*n,100,-dy,dy);
148 legend =
new TLegend(0.6,0.7,0.88,0.88);
153 std::cout <<
"seed is " << seed << std::endl;
195 Double_t reftime = (4629.530 + 5358.100 + 5785.240 + 26012.17)/5000.;
199 printf(
"******************************************************************\n");
200 printf(
"* ROOTMARKS =%6.1f * Root%-8s %d/%d\n",rootmarks,
gROOT->GetVersion(),
201 gROOT->GetVersionDate(),
gROOT->GetVersionTime());
202 printf(
"******************************************************************\n");
205 c1->
Print(
"pirndm.root");
206 c1->
Print(
"pirndm.gif");
213 for ( nx = 1; nx <
ny; nx++) {
214 double r =
double(vh2.size())/nx;
215 ny = int(r - 0.01) + 1;
218 std::cout << nx <<
" " << ny <<
" " << vh2.size() << std::endl;
221 for (
unsigned int i = 0; i < vh2.size(); ++i) {
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
virtual void SetLineWidth(Width_t lwidth)
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Random number generator class based on M.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
This class displays a legend box (TPaveText) containing several legend entries.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
virtual void SetFillStyle(Style_t fstyle)
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
void Stop()
Stop the stopwatch.
The Ranlux Random number generator class.
This is the base class for the ROOT Random number generators.
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
virtual void SetMarkerColor(Color_t mcolor=1)
A Pave (see TPave) with a text centered in the Pave.
virtual void SetLineColor(Color_t lcolor)
void ErrorBand(Long64_t n)
R__EXTERN TSystem * gSystem
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
2-D histogram with a float per channel (see TH1 documentation)}
char * Form(const char *fmt,...)
std::vector< TH2D * > vh2
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
void piRandom(const char *name, Random *r, Long64_t n, Int_t color)
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
void SetDecimals(Bool_t dot=kTRUE)
Sets the decimals flag By default, blank characters are stripped, and then the label is correctly ali...
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
void SetFrameBorderSize(Width_t size=1)
A Graph is a graphics object made of two arrays X and Y with npoints each.
void SetFrameFillColor(Color_t color=1)
Double_t Sqrt(Double_t x)
virtual void Update()
Update canvas pad buffers.
void pirndm(Long64_t n1=1, unsigned int seed=0)
Int_t Fill(Double_t)
Invalid Fill method.
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
double norm(double *x, double *p)
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
void Modified(Bool_t flag=1)
Documentation for the Random class.
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
2-D histogram with a double per channel (see TH1 documentation)}