15 #include "nuevdb/EventDisplayBase/EventHolder.h"
16 #include "nuevdb/EventDisplayBase/View2D.h"
18 #include "art/Framework/Principal/Handle.h"
19 #include "art/Framework/Services/Registry/ServiceHandle.h"
20 #include "art/Utilities/ToolMacros.h"
22 #include "TPolyLine.h"
34 void configure(
const fhicl::ParameterSet& pset)
override;
42 double peaktime)
const;
47 std::vector<double> tau1,
48 std::vector<double> tau2,
49 std::vector<double> amplitude,
50 std::vector<double> peaktime)
const;
75 art::ServiceHandle<evd::RawDrawingOptions const> rawOpt;
76 art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
77 art::ServiceHandle<geo::Geometry const> geo;
80 const art::Event*
event = evdb::EventHolder::Instance()->GetEvent();
85 for (
size_t imod = 0; imod < recoOpt->fHitLabels.size(); ++imod)
87 art::InputTag
const which = recoOpt->fHitLabels[imod];
89 art::Handle< std::vector<recob::Hit> > hitVecHandle;
90 event->getByLabel(which, hitVecHandle);
93 art::PtrVector<recob::Hit> hitPtrVec;
94 bool stillSearching(
true);
95 int fitParamsOffset(0);
98 for(
size_t hitIdx = 0; hitIdx < hitVecHandle->size(); hitIdx++)
100 art::Ptr<recob::Hit>
hit(hitVecHandle, hitIdx);
102 if (hit->Channel() == channel)
104 hitPtrVec.push_back(hit);
105 stillSearching =
false;
107 else if (!stillSearching)
break;
109 if (stillSearching) fitParamsOffset++;
113 if (hitPtrVec.empty())
continue;
117 const auto& fitParamVecs = hitResults->vectors();
120 std::vector<double> hitPeakTimeVec;
121 std::vector<double> hitTau1Vec;
122 std::vector<double> hitTau2Vec;
123 std::vector<double> hitPeakAmpVec;
124 std::vector<int> hitStartTVec;
125 std::vector<int> hitEndTVec;
126 std::vector<int> hitNMultiHitVec;
127 std::vector<int> hitLocalIdxVec;
130 for (
size_t idx = 0; idx < hitPtrVec.size(); ++idx)
132 const auto& fitParams = fitParamVecs[fitParamsOffset + idx];
133 const auto&
hit = hitPtrVec[idx];
135 hitPeakTimeVec.push_back(fitParams[0]);
136 hitTau1Vec.push_back(fitParams[1]);
137 hitTau2Vec.push_back(fitParams[2]);
138 hitPeakAmpVec.push_back(fitParams[3]);
139 hitStartTVec.push_back(
hit->StartTick());
140 hitEndTVec.push_back(
hit->EndTick());
141 hitNMultiHitVec.push_back(
hit->Multiplicity());
142 hitLocalIdxVec.push_back(
hit->LocalIndex());
146 for(
size_t idx = 0; idx < hitPeakTimeVec.size(); idx++)
148 if (hitNMultiHitVec[idx] > 1 && hitLocalIdxVec[idx] == 0)
150 TPolyLine& p2 = view2D.AddPolyLine(1001,kRed,3,1);
153 for(
int j = 0; j<1001; ++j)
155 double x = hitStartTVec[idx] + j * (hitEndTVec[idx+hitNMultiHitVec[idx]-1]-hitStartTVec[idx])/1000;
156 double y =
EvalMultiExpoFit(x,idx,hitNMultiHitVec[idx],hitTau1Vec,hitTau2Vec,hitPeakAmpVec,hitPeakTimeVec);
157 p2.SetPoint(j, x, y);
166 TPolyLine&
p1 = view2D.AddPolyLine(1001,kOrange+7,3,1);
169 for(
int j = 0; j<1001; ++j){
170 double x = hitStartTVec[idx - hitLocalIdxVec[idx]] + j * (hitEndTVec[idx + hitNMultiHitVec[idx] - hitLocalIdxVec[idx] - 1] - hitStartTVec[idx - hitLocalIdxVec[idx]]) / 1000;
171 double y =
EvalExpoFit(x,hitTau1Vec[idx],hitTau2Vec[idx],hitPeakAmpVec[idx],hitPeakTimeVec[idx]);
172 p1.SetPoint(j, x, y);
188 double peaktime)
const
190 return (amplitude *
exp(0.4*(x-peaktime)/tau1) / ( 1 +
exp(0.4*(x-peaktime)/tau2) ) );
197 std::vector<double> tau1,
198 std::vector<double> tau2,
199 std::vector<double> amplitude,
200 std::vector<double> peaktime)
const
204 for(
int i = HitNumber; i < HitNumber+NHits; i++)
206 x_sum += (amplitude[i] *
exp(0.4*(x-peaktime[i])/tau1[i]) / ( 1 +
exp(0.4*(x-peaktime[i])/tau2[i]) ) );
process_name opflash particleana ie x
Declaration of signal hit object.
static std::unique_ptr< FVectorReader > create(const art::Event &evt, const art::InputTag &tag)
process_name opflash particleana ie ie y
unsigned int ChannelID_t
Type representing the ID of a readout channel.
physics associatedGroupsWithLeft p1
art framework interface to geometry description