23 #include "TPolyLine.h" 37 double EvalExpoFit(
double x,
double tau1,
double tau2,
double amplitude,
double peaktime)
const;
42 std::vector<double> tau1,
43 std::vector<double> tau2,
44 std::vector<double> amplitude,
45 std::vector<double> peaktime)
const;
76 for (
size_t imod = 0; imod < recoOpt->
fHitLabels.size(); ++imod) {
80 event->getByLabel(which, hitVecHandle);
84 bool stillSearching(
true);
85 int fitParamsOffset(0);
88 for (
size_t hitIdx = 0; hitIdx < hitVecHandle->size(); hitIdx++) {
91 if (hit->
Channel() == channel) {
93 stillSearching =
false;
95 else if (!stillSearching)
98 if (stillSearching) fitParamsOffset++;
102 if (hitPtrVec.
empty())
continue;
106 const auto& fitParamVecs = hitResults->vectors();
109 std::vector<double> hitPeakTimeVec;
110 std::vector<double> hitTau1Vec;
111 std::vector<double> hitTau2Vec;
112 std::vector<double> hitPeakAmpVec;
113 std::vector<int> hitStartTVec;
114 std::vector<int> hitEndTVec;
115 std::vector<int> hitNMultiHitVec;
116 std::vector<int> hitLocalIdxVec;
119 for (
size_t idx = 0; idx < hitPtrVec.
size(); ++idx) {
120 const auto& fitParams = fitParamVecs[fitParamsOffset + idx];
121 const auto&
hit = hitPtrVec[idx];
123 hitPeakTimeVec.push_back(fitParams[0]);
124 hitTau1Vec.push_back(fitParams[1]);
125 hitTau2Vec.push_back(fitParams[2]);
126 hitPeakAmpVec.push_back(fitParams[3]);
127 hitStartTVec.push_back(
hit->StartTick());
128 hitEndTVec.push_back(
hit->EndTick());
129 hitNMultiHitVec.push_back(
hit->Multiplicity());
130 hitLocalIdxVec.push_back(
hit->LocalIndex());
134 for (
size_t idx = 0; idx < hitPeakTimeVec.size(); idx++) {
135 if (hitNMultiHitVec[idx] > 1 && hitLocalIdxVec[idx] == 0) {
136 TPolyLine& p2 = view2D.
AddPolyLine(1001, kRed, 3, 1);
139 for (
int j = 0; j < 1001; ++j) {
140 double x = hitStartTVec[idx] +
141 j * (hitEndTVec[idx + hitNMultiHitVec[idx] - 1] - hitStartTVec[idx]) / 1000;
143 x, idx, hitNMultiHitVec[idx], hitTau1Vec, hitTau2Vec, hitPeakAmpVec, hitPeakTimeVec);
144 p2.SetPoint(j, x, y);
153 TPolyLine& p1 = view2D.
AddPolyLine(1001, kOrange + 7, 3, 1);
156 for (
int j = 0; j < 1001; ++j) {
157 double x = hitStartTVec[idx - hitLocalIdxVec[idx]] +
159 (hitEndTVec[idx + hitNMultiHitVec[idx] - hitLocalIdxVec[idx] - 1] -
160 hitStartTVec[idx - hitLocalIdxVec[idx]]) /
163 x, hitTau1Vec[idx], hitTau2Vec[idx], hitPeakAmpVec[idx], hitPeakTimeVec[idx]);
164 p1.SetPoint(j, x, y);
180 double peaktime)
const 182 return (amplitude * exp(0.4 * (x - peaktime) / tau1) / (1 + exp(0.4 * (x - peaktime) / tau2)));
189 std::vector<double> tau1,
190 std::vector<double> tau2,
191 std::vector<double> amplitude,
192 std::vector<double> peaktime)
const 196 for (
int i = HitNumber; i < HitNumber + NHits; i++) {
197 x_sum += (amplitude[i] * exp(0.4 * (x - peaktime[i]) / tau1[i]) /
198 (1 + exp(0.4 * (x - peaktime[i]) / tau2[i])));
const art::Event * GetEvent() const
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Declaration of signal hit object.
static std::unique_ptr< FVectorReader > create(const art::Event &evt, const art::InputTag &tag)
A collection of drawable 2-D objects.
Singleton to hold the current art::Event for the event display.
void push_back(Ptr< U > const &p)
static EventHolder * Instance()
Detector simulation of raw signals on wires.
std::vector< art::InputTag > fHitLabels
module labels that produced hits
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Namespace collecting geometry-related classes utilities.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
art framework interface to geometry description
Event finding and building.