15void tprofile2polyRealisticModuleError(
Int_t numEvents = 1000000)
27 dir.
Append(
"/hist/data/tprofile2poly_tutorial.data");
28 infile.open(dir.
Data());
32 std::cerr << dir.
Data() << std::endl;
33 std::cerr <<
"Error code: " << std::strerror(errno) << std::endl;
37 std::vector<std::pair<Double_t, Double_t>> allCoords;
39 while (infile >>
a >>
b)
40 allCoords.emplace_back(
a,
b);
42 if (allCoords.size() % 3 != 0) {
43 std::cout <<
"[ERROR] Bad file" << std::endl;
48 for (
Int_t i = 0; i < allCoords.size(); i += 3) {
49 x[0] = allCoords[i + 0].first;
50 y[0] = allCoords[i + 0].second;
51 x[1] = allCoords[i + 1].first;
52 y[1] = allCoords[i + 1].second;
53 x[2] = allCoords[i + 2].first;
54 y[2] = allCoords[i + 2].second;
55 th2p->AddBin(3,
x,
y);
62 for (
int j = 0; j < numEvents; ++j) {
71 if (th2p->IsInsideBin(4, r1, r2)) val = rok - rbad1;
72 if (th2p->IsInsideBin(20, r1, r2)) val = rok - rbad2;
73 if (th2p->IsInsideBin(13, r1, r2)) val = rok + rbad1;
74 if (th2p->IsInsideBin(37, r1, r2)) val = rok + rbad2;
77 th2p->Fill(r1, r2, val);
78 avg->Fill(r1, r2, val);
79 err->Fill(r1, r2, val);
85 th2p->SetTitle(
"total hits");
90 avg->SetTitle(
"average charge");
95 err->SetContentToError();
96 err->SetTitle(
"error");
2D Histogram with Polygonal Bins
2D Profile Histogram with Polygonal Bins.
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
const char * Data() const
TString & Append(const char *cs)