18 #include "TPolyMarker3D.h" 39 double chargeIntegral(
double,
double,
double,
double,
int,
int)
const;
73 if (hitsVec.empty() || !hitAssnVec)
return;
78 using HitPosition = std::array<double, 6>;
79 std::map<int, std::vector<HitPosition>> colorToHitMap;
81 float minHitCharge(std::numeric_limits<float>::max());
82 float maxHitCharge(std::numeric_limits<float>::lowest());
91 for (
const auto& spacePoint : hitsVec) {
93 float hitCharge = spacePoint->ErrXYZ()[1];
95 minHitCharge = std::min(minHitCharge, hitCharge);
96 maxHitCharge = std::max(maxHitCharge, hitCharge);
101 if (maxHitCharge > minHitCharge) {
103 (maxHitCharge - minHitCharge));
105 for (
const auto& spacePoint : hitsVec) {
108 if (hitCharge > 0.) {
111 const double* pos = spacePoint->XYZ();
112 const double* err = spacePoint->ErrXYZ();
114 colorToHitMap[chargeColorIdx].push_back(
115 HitPosition() = {{pos[0], pos[1], pos[2], err[3], err[3], err[5]}});
119 for (
auto& hitPair : colorToHitMap) {
121 view->
AddPolyMarker3D(hitPair.second.size(), hitPair.first, kFullDotLarge, 0.25);
122 for (
const auto&
hit : hitPair.second)
134 double totalCharge(0.);
137 const std::vector<art::Ptr<recob::Hit>>& hit2DVec(hitAssnVec->at(spacePoint.
key()));
140 int lowIndex(std::numeric_limits<int>::min());
141 int hiIndex(std::numeric_limits<int>::max());
143 for (
const auto& hit2D : hit2DVec) {
144 int hitStart = hit2D->PeakTime() - 2. * hit2D->RMS() - 0.5;
145 int hitStop = hit2D->PeakTime() + 2. * hit2D->RMS() + 0.5;
147 lowIndex = std::max(hitStart, lowIndex);
148 hiIndex = std::min(hitStop + 1, hiIndex);
150 hitCharge += hit2D->Integral();
153 if (!hit2DVec.empty()) hitCharge /=
float(hit2DVec.size());
155 if (hitCharge > 0.) {
156 if (hiIndex > lowIndex) {
157 for (
const auto& hit2D : hit2DVec)
159 hit2D->PeakTime(), hit2D->PeakAmplitude(), hit2D->RMS(), 1., lowIndex, hiIndex);
161 totalCharge /= float(hit2DVec.size());
177 for (
int sigPos = low; sigPos < hi; sigPos++)
178 integral += peakAmp * TMath::Gaus(
double(sigPos) + 0.5, peakMean, peakWidth);
Declaration of signal hit object.
int GetColor(double x) const
std::vector< double > fRecoQHigh
high edge of ADC values for drawing raw digits
std::vector< double > fRecoQLow
low edge of ADC values for drawing raw digits
The color scales used by the event display.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
key_type key() const noexcept
T get(std::string const &key) const
const evdb::ColorScale & CalQ(geo::SigType_t st) const
Detector simulation of raw signals on wires.
std::size_t color(std::string const &procname)
A collection of 3D drawable objects.
TPolyMarker3D & AddPolyMarker3D(int n, int c, int st, double sz)
Signal from collection planes.