本文整理汇总了C++中TRandom::Rannor方法的典型用法代码示例。如果您正苦于以下问题:C++ TRandom::Rannor方法的具体用法?C++ TRandom::Rannor怎么用?C++ TRandom::Rannor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRandom
的用法示例。
在下文中一共展示了TRandom::Rannor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_random
//______________________________________________________________________
void generate_random(Int_t i)
{
const Double_t dr = 3.5;
r.Rannor(r1, r4);
r.Rannor(r7, r9);
r2 = (2 * dr * r.Rndm(i)) - dr;
r3 = (2 * dr * r.Rndm(i)) - dr;
r5 = (2 * dr * r.Rndm(i)) - dr;
r6 = (2 * dr * r.Rndm(i)) - dr;
r8 = (2 * dr * r.Rndm(i)) - dr;
}
示例2: simpleTree
void simpleTree()
{
using std::cout;
using std::cerr;
using std::endl;
int event;
double px;
double py;
double pz;
double random;
TFile output("simpleTree.root", "RECREATE");
if (!output.IsOpen())
{
cerr << "failed to open output file." << endl;
return;
}
// Create Tree
TTree tree("T", "simple tree");
tree.Branch("event", &event, "event/I");
tree.Branch("px", &px, "px/F");
tree.Branch("py", &py, "py/F");
tree.Branch("pz", &pz, "pz/F");
tree.Branch("random", &random, "random/F");
// Initialize Random generator
TRandom rnd;
// Fill Tree
for(event = 0; 1000 > event; ++event)
{
rnd.Rannor(px, py);
pz = px * px + py * py;
random = rnd.Rndm();
tree.Fill();
}
tree.Write();
}
示例3: circular
void circular() {
auto T = new TTree("T","test circular buffers");
TRandom r;
Float_t px,py,pz;
Double_t randomNum;
UShort_t i;
T->Branch("px",&px,"px/F");
T->Branch("py",&py,"px/F");
T->Branch("pz",&pz,"px/F");
T->Branch("random",&randomNum,"random/D");
T->Branch("i",&i,"i/s");
T->SetCircular(20000); //keep a maximum of 20000 entries in memory
for (i = 0; i < 65000; i++) {
r.Rannor(px,py);
pz = px*px + py*py;
randomNum = r.Rndm();
T->Fill();
}
T->Print();
}