7 #ifndef CRT_ONLINEPLOTTER_CPP 8 #define CRT_ONLINEPLOTTER_CPP 17 #include "TDirectory.h" 51 std::cout <<
"New event\n";
55 for(
const auto&
trigger: triggers)
57 std::cout <<
"On module " <<
trigger.Channel() <<
":\n";
58 const auto& hits =
trigger.Hits();
59 for(
const auto&
hit: hits)
61 std::cout <<
"\tGot a hit on strip " <<
hit.Channel() <<
"\n";
71 if(
hit.ADC() > stripToHits[id]) stripToHits[
id] =
hit.ADC();
84 for(
const auto& framePair: stripToHits)
88 if(framePair.second.size() > 1)
90 for(
const auto& planePair: framePair.second)
92 for(
const auto& modulePair: planePair.second)
95 if(modulePair.second.size() > 1)
97 auto layerPair = modulePair.second.begin();
98 auto& stripPairs = layerPair->second;
99 const auto firstMax = std::max_element(stripPairs.begin(), stripPairs.end(), [](
const auto& first,
const auto&
second)
101 return first.second <
second.second;
105 auto& secondStripPairs = layerPair->second;
106 const auto secondMax = std::max_element(secondStripPairs.begin(), secondStripPairs.end(), [](
const auto& first,
const auto&
second)
108 return first.second <
second.second;
111 if(firstMax->first.Overlaps(secondMax->first))
113 const auto& firstID = firstMax->first;
114 stripToOverlappingHits[firstID].push_back(*firstMax);
116 const auto& secondID = secondMax->first;
117 stripToOverlappingHits[secondID].push_back(*secondMax);
126 for(
const auto& framePair: stripToOverlappingHits)
128 if(framePair.second.size() > 1)
131 for(
const auto& planePair: framePair.second)
133 const std::vector<std::pair<CRT::StripID, int64_t>>& strips = planePair.second;
134 for(
const auto& stripPair: strips)
138 const auto&
id = stripPair.first;
139 auto foundStrip =
fStrips.find(stripPair.first);
140 if(foundStrip ==
fStrips.end())
145 auto& strip = foundStrip->second;
146 strip.fOverlappingADCs->Fill(stripPair.second);
155 using DIRECTORY = decltype(fFileService->mkdir(
"null"));
163 "ADC Values for 2D-Matched Hits;ADC;Hits",
174 std::unique_ptr<CRT::Geometry>
fGeom;
182 #endif //CRT_ONLINEPLOTTER_CPP std::map< CRT::ModuleID, DIRECTORY > fModuleToDir
void AnalyzeEvent(const std::vector< CRT::Trigger > &triggers)
detail::Node< void, uint8_t > FrameID
decltype(fFileService->mkdir("null")) DIRECTORY
std::map< CRT::StripID, StripPlots > fStrips
Detector simulation of raw signals on wires.
virtual ~ValidationPlotter()=default
std::unique_ptr< CRT::Geometry > fGeom
StripPlots(DIRECTORY &dir, const size_t channel)
std::map< CRT::StripID, size_t > fStripToChannel
ValidationPlotter(TFS &tfs, std::unique_ptr< CRT::Geometry > &&geom)
second_as<> second
Type of time stored in seconds, in double precision.
std::string to_string(ModuleType const mt)