#include <iostream>
#include <fstream>
using namespace std;
void tprofile2polyRealisticModuleError(
Int_t numEvents = 1000000)
{
ifstream infile;
dir.
Append(
"/hist/data/tprofile2poly_tutorial.data");
if (!infile)
{
std::cerr << dir.
Data() << std::endl;
std::cerr << "Error code: " << strerror(errno) << std::endl;
return;
}
vector<pair<Double_t, Double_t>> allCoords;
while (infile >>
a >>
b) {
pair<Double_t, Double_t> coord(
a,
b);
allCoords.push_back(coord);
}
if (allCoords.size() % 3 != 0) {
cout << "[ERROR] Bad file" << endl;
return;
}
for (
Int_t i = 0; i < allCoords.size(); i += 3) {
x[0] = allCoords[i + 0].first;
y[0] = allCoords[i + 0].second;
x[1] = allCoords[i + 1].first;
y[1] = allCoords[i + 1].second;
x[2] = allCoords[i + 2].first;
y[2] = allCoords[i + 2].second;
}
for (int j = 0; j < numEvents; ++j) {
if (th2p->IsInsideBin(4, r1, r2)) val = rok - rbad1;
if (th2p->IsInsideBin(20, r1, r2)) val = rok - rbad2;
if (th2p->IsInsideBin(13, r1, r2)) val = rok + rbad1;
if (th2p->IsInsideBin(37, r1, r2)) val = rok + rbad2;
th2p->Fill(r1, r2, val);
avg->Fill(r1, r2, val);
err->Fill(r1, r2, val);
}
th2p->SetStats(0);
th2p->SetTitle("total hits");
th2p->Draw("COLZ");
avg->SetStats(0);
avg->SetTitle("average charge");
avg->Draw("COLZ");
err->SetStats(0);
err->SetContentToError();
err->SetTitle("error");
err->Draw("COLZ");
}
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)