41 f1 = random->Integer(N);
42 p1 = random->Integer(N);
45 f2 = random->Integer(N);
46 p2 = random->Integer(N);
48 while(p1 == p2 || p2 > f2);
58 std::cout <<
"Hello" << std::endl;
61 int populationSize = 500;
64 TRandom3 *rnd =
new TRandom3(1234);
68 TH1 *hProb =
new TH1F(
"hProb",
"", nbins, 0, populationSize);
74 for(
int mc=0; mc<nmc; mc++) {
82 hProb->Scale(1./(2.*nmc*populationSize/nbins));
85 gStyle->SetOptStat(0);
86 TString cname =
"C_ParentProb";
87 TCanvas *C =
new TCanvas(cname, cname);
89 hProb->SetLineColor(1);
90 hProb->SetMarkerStyle(20);
91 hProb->SetMarkerSize(0.8);
92 hProb->SetLineWidth(2);
93 hProb->GetXaxis()->SetTitle(
"Rank");
94 hProb->GetYaxis()->SetTitle(
"Probability density");
95 hProb->GetXaxis()->SetTitleSize(0.05);
96 hProb->GetYaxis()->SetTitleSize(0.05);
97 hProb->GetXaxis()->SetTitleOffset(0.9);
98 hProb->GetYaxis()->SetTitleOffset(0.9);
102 TF1 *fLinear =
new TF1(
"fLinear",
"pol1", 0, populationSize);
103 hProb->Fit(fLinear,
"NOQ");
104 fLinear->SetLineColor(2);
105 fLinear->Draw(
"same");
108 TLegend *L =
new TLegend(0.6,0.7,0.89,0.89);
109 L->AddEntry(hProb,
"Measured PDF",
"lp");
110 L->AddEntry(fLinear,
"Linear fit:",
"l");
111 L->AddEntry(
"", TString::Format(
"y = %.2g x + %.2g", fLinear->GetParameter(1), fLinear->GetParameter(0)),
"");
115 C->SaveAs(cname+
".png");
116 C->SaveAs(cname+
".root");
void testParentSelection()
Tests the parent selection criteria.
void selectParents(TRandom3 *random, int &p1, int &p2, int N)
Implements the parent selection criteria.