7 #ifndef CRT_ONLINEPLOTTER_CPP 8 #define CRT_ONLINEPLOTTER_CPP 16 #include "TProfile2D.h" 19 #include <unordered_map> 95 std::cout <<
"Elapsed time for this run is " << deltaT <<
" seconds. Total elapsed time is " << totalDeltaTInSeconds <<
" seconds.\n";
98 const auto timeInv = 1./deltaT;
106 std::unordered_map<unsigned int, size_t> usbToHits;
109 for(
auto module = 0; module < nModules; ++module)
116 const auto usb = foundUSB->second;
123 auto& forever =
found->second;
124 usbToHits[usb] +=
count;
125 forever.fMeanADC->Fill(totalDeltaTInSeconds,
132 for(
const auto bin: usbToHits)
155 for(
const auto&
trigger: triggers)
157 const auto timestamp =
trigger.Timestamp();
177 const auto module =
trigger.Channel();
178 const auto& hits =
trigger.Hits();
179 for(
const auto&
hit: hits)
208 fMeanRate =
dir.template make<TH2D>(
"MeanRate",
"Mean Rates;Channel;Module;Rate", 64, 0, 64, 32, 0, 32);
211 fMeanADC =
dir.template make<TProfile2D>(
"MeanADC",
"Mean ADC Values;Channel;Module;Rate [Hz]", 64, 0, 64, 32, 0, 32, 0., 4096);
214 fMeanRatePerBoard =
dir.template make<TH1D>(
"MeanRateBoard",
"Mean Rate per Board;Board;Rate [Hz]",
216 fMeanADCPerBoard =
dir.template make<TProfile>(
"MeanADCBoard",
"Mean ADC Value per Board;Board;ADC",
247 fMeanRate =
dir.template make<TH1D>(
"MeanRateHistory",
"Mean Rate History;Time [s];Rate [Hz]",
249 fMeanADC =
dir.template make<TProfile>(
"MeanADCHistory",
"Mean ADC History;Time [s];ADC",
266 #endif //CRT_ONLINEPLOTTER_CPP OnlinePlotter(TFS &tfs, const double tickLength=16)
void ReactEndRun(const std::string &)
def mkdir(path, mode=0o777)
std::unordered_map< unsigned int, ForeverPlots > fUSBToForeverPlots
PerRunPlots(DIRECTORY &&dir)
ForeverPlots(DIRECTORY &&dir)
const double fClockTicksToNs
void ReactBeginRun(const std::string &)
decltype(fFileService->mkdir("test")) DIRECTORY
void AnalyzeEvent(const std::vector< CRT::Trigger > &triggers)
static int max(int a, int b)
Detector simulation of raw signals on wires.
std::unordered_map< unsigned int, unsigned int > fModuleToUSB
std::unique_ptr< PerRunPlots > fCurrentRunPlots
QTextStream & bin(QTextStream &s)
std::string to_string(ModuleType const mt)
PerRunPlots fWholeJobPlots
TProfile * fMeanADCPerBoard