Hi, is there something wrong with this method? Always when Neven > 1e6 this starts reading the hd and freeze my computer. It read the hd because its using too much memory? Because i just see that using processor, and i can’t get what is the problem.

Thanks,

Gabriel

TH2D* TPDF::GenerateH(ULong_t Neven, TString name, Int_t xbin, Double_t xmin, Double_t xmax, Int_t ybin, Double_t ymin, Double_t ymax)

{

Double_t x, y;

Double_t M;

TH2D* h=new TH2D(name,“histo”,xbin,xmin,xmax,ybin,ymin,ymax);

TRandom3 r(0);

for (ULong_t i=0; i< Neven; i++) {

```
for (;;) {
x=(xmax-xmin)*r.Rndm()+xmin;
y=(ymax-ymin)*r.Rndm()+ymin;
//Get a signal random M and return a,b under pdf
M=decay->GetMRandSig();
if (decay->IsPS(x,y,M)) {
if (r.Rndm() <= Pdf(x,y)) {
h->Fill(x,y);
break;
}
}
}
```

}

TPDF::h=h;

return h;

}