00001 #include "MapsSensor.hh"
00002 #include "TRandom2.h"
00003 #include "TFile.h"
00004 #include <iostream>
00005 int main() {
00006 MapsSensor* mySensor = new MapsSensor(0, 0);
00007 TRandom2 t2;
00008 unsigned thresh(100);
00009 for (unsigned h(0); h < 100000; h++) {
00010 double x, y, z;
00011 t2.Sphere(x, y, z, 1);
00012 double t(t2.Uniform());
00013 MapsSensor::coord c(x*168, y*168);
00014 if (z > 0) {
00015 mySensor->registerTrackConfirm(thresh, c, static_cast<unsigned>(t
00016 *8000));
00017
00018 } else {
00019 std::cout << __PRETTY_FUNCTION__ << __PRETTY_LINE__ << ": disabled!\n
00020 //mySensor->registerTrackMiss(thresh, static_cast<unsigned>(t*8000));
00021
00022 }
00023 }
00024
00025 thresh = 130;
00026 for (unsigned h(0); h < 100000; h++) {
00027 double x, y, z;
00028 t2.Sphere(x, y, z, 1);
00029 double t(t2.Uniform());
00030 MapsSensor::coord c(x*168, y*168);
00031 if (z > 0) {
00032 mySensor->registerTrackConfirm(thresh, c, static_cast<unsigned>(t
00033 *8000));
00034
00035 } else {
00036 std::cout << __PRETTY_FUNCTION__ << __PRETTY_LINE__ << ": disabled!\n
00037
00038
00039 }
00040 }
00041
00042
00043 thresh = 160;
00044 for (unsigned h(0); h < 100000; h++) {
00045 double x, y, z;
00046 t2.Sphere(x, y, z, 1);
00047 double t(t2.Uniform());
00048 MapsSensor::coord c(x*168, y*168);
00049 if (z > 0) {
00050 mySensor->registerTrackConfirm(thresh, c, static_cast<unsigned>(t
00051 *8000));
00052
00053 } else {
00054 std::cout << __PRETTY_FUNCTION__ << __PRETTY_LINE__ << ": disabled!\n";
00055
00056
00057 }
00058 std::pair<double, double> resid(t2.Gaus(0, 5), t2.Gaus(2, 5));
00059 mySensor->setResidual(resid);
00060
00061 }
00062
00063 TFile* file = new TFile("TestMapsSensor.root", "recreate");
00064 std::cout << "\n" << *mySensor << " efficiency at th = 100: \t"
00065 << mySensor->getEfficiency(thresh) << "\n";
00066 TH1F effTimes;
00067 std::cout << "Calling get efficiency timestamps...\n";
00068 mySensor->getEfficiencyTimestamps(effTimes);
00069 std::cout << "Done!\n";
00070 TH1F ineffTimes;
00071 mySensor->getInefficiencyTimestamps(ineffTimes);
00072 effTimes.Write();
00073 ineffTimes.Write();
00074
00075 std::cout << "Getting efficiency curve...\n";
00076 TH1F efficiency;
00077 mySensor->getEfficiencyCurve(efficiency, 10, 100, 200);
00078 efficiency.Write();
00079
00080 std::cout << "Getting residual curve...\n";
00081 TH2F residuals;
00082 mySensor->getResidualXYPlot(residuals);
00083 residuals.Write();
00084
00085 std::cout << "Getting efficiency xy plot...\n";
00086 TH2F effxy;
00087 mySensor->getEfficiencyXYPlot(effxy);
00088 effxy.Write();
00089
00090
00091 std::cout << "Getting inefficiency xy plot...\n";
00092 TH2F ineffxy;
00093 mySensor->getInefficiencyXYPlot(ineffxy);
00094 ineffxy.Write();
00095
00096 file->Write();
00097 file->Close();
00098 }