145 art::ServiceHandle<geo::Geometry const> geom;
146 auto const clock_data =
147 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
148 auto const det_prop =
149 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clock_data);
151 art::Handle<std::vector<recob::Wire>> wireVecHandle;
155 float TotWireCharge = 0;
157 for (
size_t wireIter = 0; wireIter < wireVecHandle->size(); wireIter++) {
158 art::Ptr<recob::Wire> wire(wireVecHandle, wireIter);
159 std::vector<float> signal(wire->Signal());
161 for (
auto timeIter = signal.begin(); timeIter + 2 < signal.end(); timeIter++) {
163 if (*timeIter < 2) {
continue; }
165 TotWireCharge += *timeIter;
172 art::Handle<std::vector<recob::Hit>> hitHandle;
175 std::vector<art::Ptr<recob::Hit>> hits;
176 art::fill_ptr_vector(hits, hitHandle);
180 fnHits = hitHandle->size();
183 for (
size_t numHit = 0; numHit < hitHandle->size(); ++numHit) {
185 art::Ptr<recob::Hit>
hit(hitHandle, numHit);
187 fWire[hitCount] =
hit->WireID().Wire;
195 fGOF[hitCount] =
hit->GoodnessOfFit();
198 TotCharge +=
hit->Integral();
206 unsigned int plane = 0;
207 Float_t TruthHitTime = 0, TruthHitCalculated = 0;
211 double drift_velocity = det_prop.DriftVelocity(det_prop.Efield(), det_prop.Temperature());
213 for (
size_t nh = 0; nh < hitHandle->size(); nh++) {
215 art::Ptr<recob::Hit> hitPoint(hitHandle, nh);
216 plane = hitPoint->WireID().Plane;
221 std::vector<sim::TrackIDE> trackides;
222 std::vector<double> xyz;
224 art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
225 trackides = bt_serv->HitToTrackIDEs(clock_data, hitPoint);
226 xyz = bt_serv->HitToXYZ(clock_data, hitPoint);
228 catch (cet::exception
const&) {
229 mf::LogWarning(
"GausHitFinderAna") <<
"BackTrackerService Failed";
240 TruthHitTime = det_prop.ConvertXToTicks(
241 xyz[0], plane, hitPoint->WireID().TPC, hitPoint->WireID().Cryostat);
247 const double origin[3] = {0.};
249 geom->Plane(plane).LocalToWorld(origin, pos);
250 double planePos_timeCorr = (pos[0] / drift_velocity) * (1. / time_tick) + 60;
253 TruthHitCalculated = ((xyz[0]) / (drift_velocity * time_tick)) + planePos_timeCorr;
257 double hitresid = ((TruthHitTime - hitPoint->PeakTime()) / hitPoint->SigmaPeakTime());
261 ((TruthHitCalculated - hitPoint->PeakTime()) / hitPoint->SigmaPeakTime());
Float_t fPeakTime[kMaxHits]
Int_t fMultiplicity[kMaxHits]
Float_t fPeakTimeUncert[kMaxHits]
TH1F * fHitResidualAllAlt
std::string fCalDataModuleLabel
Float_t fCharge[kMaxHits]
TH1F * fNumberOfHitsPerEvent
Float_t fTotalHitChargePerEvent
Float_t fEndTime[kMaxHits]
std::string fHitFinderModuleLabel
Float_t fTruePeakPos[kMaxHits]
std::size_t count(Cont const &cont)
Float_t fStartTime[kMaxHits]
Float_t fChargeUncert[kMaxHits]
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
constexpr Point origin()
Returns a origin position with a point of the specified type.