15 void tprofile2polyRealisticModuleError(
Int_t numEvents = 1000000)
26 TString dir =
gROOT->GetTutorialDir();
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: " << strerror(errno) << std::endl;
37 vector<pair<Double_t, Double_t>> allCoords;
39 while (infile >>
a >>
b) {
40 pair<Double_t, Double_t> coord(
a,
b);
41 allCoords.push_back(coord);
44 if (allCoords.size() % 3 != 0) {
45 cout <<
"[ERROR] Bad file" << endl;
50 for (
Int_t i = 0; i < allCoords.size(); i += 3) {
51 x[0] = allCoords[i + 0].first;
52 y[0] = allCoords[i + 0].second;
53 x[1] = allCoords[i + 1].first;
54 y[1] = allCoords[i + 1].second;
55 x[2] = allCoords[i + 2].first;
56 y[2] = allCoords[i + 2].second;
57 th2p->AddBin(3,
x,
y);
64 for (
int j = 0; j < numEvents; ++j) {
73 if (th2p->IsInsideBin(4, r1, r2)) val = rok - rbad1;
74 if (th2p->IsInsideBin(20, r1, r2)) val = rok - rbad2;
75 if (th2p->IsInsideBin(13, r1, r2)) val = rok + rbad1;
76 if (th2p->IsInsideBin(37, r1, r2)) val = rok + rbad2;
79 th2p->Fill(r1, r2, val);
80 avg->Fill(r1, r2, val);
81 err->Fill(r1, r2, val);
87 th2p->SetTitle(
"total hits");
92 avg->SetTitle(
"average charge");
97 err->SetContentToError();
98 err->SetTitle(
"error");
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...
This is the base class for the ROOT Random number generators.
2D Profile Histogram with Polygonal Bins.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
2D Histogram with Polygonal Bins