#include "MapsSensor.hh" #include "TRandom2.h" #include "TFile.h" #include int main() { MapsSensor* mySensor = new MapsSensor(0, 0); TRandom2 t2; unsigned thresh(100); for (unsigned h(0); h < 100000; h++) { double x, y, z; t2.Sphere(x, y, z, 1); double t(t2.Uniform()); MapsSensor::coord c(x*168, y*168); if (z > 0) { mySensor->registerTrackConfirm(thresh, c, static_cast(t *8000)); } else { std::cout << __PRETTY_FUNCTION__ << __PRETTY_LINE__ << ": disabled!\n //mySensor->registerTrackMiss(thresh, static_cast(t*8000)); } } thresh = 130; for (unsigned h(0); h < 100000; h++) { double x, y, z; t2.Sphere(x, y, z, 1); double t(t2.Uniform()); MapsSensor::coord c(x*168, y*168); if (z > 0) { mySensor->registerTrackConfirm(thresh, c, static_cast(t *8000)); } else { std::cout << __PRETTY_FUNCTION__ << __PRETTY_LINE__ << ": disabled!\n //mySensor->registerTrackMiss(thresh, static_cast(t*8000)); } } thresh = 160; for (unsigned h(0); h < 100000; h++) { double x, y, z; t2.Sphere(x, y, z, 1); double t(t2.Uniform()); MapsSensor::coord c(x*168, y*168); if (z > 0) { mySensor->registerTrackConfirm(thresh, c, static_cast(t *8000)); } else { std::cout << __PRETTY_FUNCTION__ << __PRETTY_LINE__ << ": disabled!\n"; //mySensor->registerTrackMiss(thresh, static_cast(t*8000)); } std::pair resid(t2.Gaus(0, 5), t2.Gaus(2, 5)); mySensor->setResidual(resid); } TFile* file = new TFile("TestMapsSensor.root", "recreate"); std::cout << "\n" << *mySensor << " efficiency at th = 100: \t" << mySensor->getEfficiency(thresh) << "\n"; TH1F effTimes; std::cout << "Calling get efficiency timestamps...\n"; mySensor->getEfficiencyTimestamps(effTimes); std::cout << "Done!\n"; TH1F ineffTimes; mySensor->getInefficiencyTimestamps(ineffTimes); effTimes.Write(); ineffTimes.Write(); std::cout << "Getting efficiency curve...\n"; TH1F efficiency; mySensor->getEfficiencyCurve(efficiency, 10, 100, 200); efficiency.Write(); std::cout << "Getting residual curve...\n"; TH2F residuals; mySensor->getResidualXYPlot(residuals); residuals.Write(); std::cout << "Getting efficiency xy plot...\n"; TH2F effxy; mySensor->getEfficiencyXYPlot(effxy); effxy.Write(); std::cout << "Getting inefficiency xy plot...\n"; TH2F ineffxy; mySensor->getInefficiencyXYPlot(ineffxy); ineffxy.Write(); file->Write(); file->Close(); }