16void hist042_TProfile2Poly_module_error(
Int_t numEvents = 1000000)
28 dir.
Append(
"/hist/data/tprofile2poly_tutorial.data");
33 std::cerr << dir.
Data() << std::endl;
34 std::cerr <<
"Error code: " << std::strerror(errno) << std::endl;
38 std::vector<std::pair<Double_t, Double_t>> allCoords;
40 while (infile >>
a >>
b)
41 allCoords.emplace_back(
a,
b);
43 if (allCoords.size() % 3 != 0) {
44 std::cout <<
"[ERROR] Bad file" << std::endl;
49 for (
Int_t i = 0; i < allCoords.size(); i += 3) {
50 x[0] = allCoords[i + 0].first;
51 y[0] = allCoords[i + 0].second;
52 x[1] = allCoords[i + 1].first;
53 y[1] = allCoords[i + 1].second;
54 x[2] = allCoords[i + 2].first;
55 y[2] = allCoords[i + 2].second;
56 th2p->AddBin(3,
x,
y);
63 for (
int j = 0; j < numEvents; ++j) {
72 if (th2p->IsInsideBin(4, r1, r2))
74 if (th2p->IsInsideBin(20, r1, r2))
76 if (th2p->IsInsideBin(13, r1, r2))
78 if (th2p->IsInsideBin(37, r1, r2))
82 th2p->Fill(r1, r2, val);
83 avg->Fill(r1, r2, val);
84 err->Fill(r1, r2, val);
90 th2p->SetTitle(
"total hits");
95 avg->SetTitle(
"average charge");
100 err->SetContentToError();
101 err->SetTitle(
"error");
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
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)