LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
GnocchiCalorimetry_module.cc
Go to the documentation of this file.
1 // A gnew Calorimetry module
2 //
3 // Re-write of the Calorimetry module ported into art by E. Chruch
4 // from the original (ArgoNeuT) calorimetry module by Ornella Palamara and Maddalena Antonello.
5 //
6 // Gray Putnam
7 // grayputnam@uchicago.edu
8 
9 #include <cmath>
10 #include <limits> // std::numeric_limits<>
11 #include <numeric> // std::accumulate
12 #include <optional>
13 #include <string>
14 
19 
22 #include "larcorealg/CoreUtils/NumericUtils.h" // util::absDiff()
25 #include "lardata/ArtDataHelper/TrackUtils.h" // lar::util::TrackPitchInView()
33 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
34 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h"
35 
38 
39 // ROOT includes
40 #include <TF1.h>
41 #include <TGraph.h>
42 #include <TMath.h>
43 #include <vector>
44 
53 #include "cetlib/pow.h" // cet::sum_of_squares()
54 #include "fhiclcpp/ParameterSet.h"
57 
58 namespace {
59  constexpr unsigned int int_max_as_unsigned_int{std::numeric_limits<int>::max()};
60  typedef std::pair<unsigned, std::vector<unsigned>> OrganizedHits;
61 }
62 
63 namespace calo {
64 
66  public:
67  struct Config {
69  using Name = fhicl::Name;
70 
71  enum ChargeMethod : unsigned {
76  };
77 
79  Comment("Module label for track producer.")};
80 
82  Comment("Module label for T0 time producer."),
83  ""};
84 
86  Name("PFPModuleLabel"),
87  Comment("Module label for PFP producer. To be used to associate T0 with tracks."),
88  ""};
89 
91  Name("AssocHitModuleLabel"),
92  Comment("Module label for association between tracks and hits. If not set, defaults to "
93  "TrackModuleLabel."),
94  ""};
95 
97  Name("ChargeMethod"),
98  Comment("Method used to extract charge from a hit. Options: 0==Amplitude(), 1==Integral(), "
99  "2==SummedADC(), 3==SummedIntegral(). See the ChargeMethod enum.")};
100 
102  Name("FieldDistortion"),
103  Comment("True if field distortion (i.e. from space charge) is included in the input.")};
104 
106  Name("FieldDistortionEfield"),
107  Comment("True if field distortion (i.e. from space charge) is included in the input.")};
108 
110  Name("TrackIsFieldDistortionCorrected"),
111  Comment("Whether the space-points on the input tracks have their points corrected for the "
112  "field distortions. "
113  "I.e. whether the track trajectory points represent charge as seen by wires or the "
114  "3D particle trajectory.")};
115 
117  Comment("Which cryostat number the input tracks occupy.")};
118 
120  Name("FieldDistortionCorrectionXSign"),
121  Comment("Sign of the field distortion correction to be applied in the X direction. "
122  "Positive by default."),
123  1.f};
124 
126  Name("CaloAlg"),
127  Comment("Configuration for the calo::CalorimetryAlg")};
128 
130  Name("NormTools"),
131  Comment("List of INormalizeCharge tool configurations to use.")};
132  };
133 
135 
136  explicit GnocchiCalorimetry(Parameters const& config);
137 
138  void produce(art::Event& evt) override;
139 
140  private:
143  std::vector<std::unique_ptr<INormalizeCharge>> fNormTools;
144 
145  // helper functions
146  std::vector<std::vector<OrganizedHits>> OrganizeHits(
148  const std::vector<const recob::TrackHitMeta*>& thms,
149  const recob::Track& track,
150  unsigned nplanes);
151  std::vector<std::vector<OrganizedHits>> OrganizeHitsIndividual(
153  const std::vector<const recob::TrackHitMeta*>& thms,
154  const recob::Track& track,
155  unsigned nplanes);
156  std::vector<std::vector<OrganizedHits>> OrganizeHitsSnippets(
158  const std::vector<const recob::TrackHitMeta*>& thms,
159  const recob::Track& track,
160  unsigned nplanes);
161  bool HitIsValid(const recob::TrackHitMeta* thm, const recob::Track& track);
164  const recob::TrackHitMeta* meta);
166  const recob::Hit& hit,
167  const recob::TrackHitMeta* meta);
170  double GetPitch(const recob::Track& track,
171  const recob::Hit& hit,
172  const recob::TrackHitMeta* meta);
173  double GetCharge(const recob::Hit& hit, const std::vector<recob::Hit const*>& sharedHits);
174  double GetEfield(const detinfo::DetectorPropertiesData& dprop,
175  const recob::Track& track,
177  const recob::TrackHitMeta* meta);
178  double Normalize(double dQdx,
179  const art::Event& e,
180  const recob::Hit& h,
181  const geo::Point_t& location,
182  const geo::Vector_t& direction,
183  double t0);
184  };
185 
186 } // end namespace calo
187 
190 {
191  produces<std::vector<anab::Calorimetry>>();
192  produces<art::Assns<recob::Track, anab::Calorimetry>>();
193  std::vector<fhicl::ParameterSet> norm_tool_configs =
194  fConfig.NormTools.get<std::vector<fhicl::ParameterSet>>();
195  for (const fhicl::ParameterSet& p : norm_tool_configs) {
196  fNormTools.push_back(art::make_tool<INormalizeCharge>(p));
197  }
198 }
199 
201 {
202  // Get services
203  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
204  auto const det_prop =
206 
207  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout>()->Get();
208  size_t nplanes = wireReadoutGeom.Nplanes();
209 
210  // Define output collections
211  std::unique_ptr<std::vector<anab::Calorimetry>> outputCalo(new std::vector<anab::Calorimetry>);
212  std::unique_ptr<art::Assns<recob::Track, anab::Calorimetry>> outputCaloAssn(
214 
215  // collect input
216  art::Handle<std::vector<recob::Track>> trackListHandle;
217  std::vector<art::Ptr<recob::Track>> tracklist;
218  if (evt.getByLabel(fConfig.TrackModuleLabel(), trackListHandle)) {
219  art::fill_ptr_vector(tracklist, trackListHandle);
220  }
221 
222  // get the label to collect this hits
223  const std::string& hitLabel = (fConfig.AssocHitModuleLabel() == "") ?
226  art::FindManyP<recob::Hit, recob::TrackHitMeta> fmHits(trackListHandle, evt, hitLabel);
227 
228  // must be valid if the T0 module label is non-empty
229  art::FindManyP<anab::T0> fmT0s(trackListHandle, evt, fConfig.T0ModuleLabel());
230  art::FindManyP<recob::PFParticle> fmPFPs(trackListHandle, evt, fConfig.TrackModuleLabel());
231  std::vector<art::Ptr<recob::PFParticle>> pfpList;
232  if (fConfig.PFPModuleLabel().size()) {
233  for (std::size_t itrk = 0, sz = fmPFPs.size(); itrk < sz; ++itrk) {
234  // assuming every recob::Track has exactly one associated recob::PFParticle
235  pfpList.push_back(fmPFPs.at(itrk).at(0));
236  }
237  }
238  art::FindManyP<anab::T0> fmPFPT0s(pfpList, evt, fConfig.T0ModuleLabel());
239 
240  for (auto const& nt : fNormTools)
241  nt->setup(evt);
242 
243  // iterate over all the tracks
244  for (unsigned trk_i = 0; trk_i < tracklist.size(); trk_i++) {
245  const recob::Track& track = *tracklist[trk_i];
246 
247  // collect input for this track
248  const std::vector<art::Ptr<recob::Hit>>& hits = fmHits.at(trk_i);
249  const std::vector<const recob::TrackHitMeta*>& thms = fmHits.data(trk_i);
250 
251  double T0 = 0;
252  if (fConfig.T0ModuleLabel().size()) {
253  if (fConfig.PFPModuleLabel().size()) {
254  const std::vector<art::Ptr<anab::T0>>& this_t0s = fmPFPT0s.at(trk_i);
255  if (this_t0s.size()) T0 = this_t0s.at(0)->Time();
256  }
257  else {
258  const std::vector<art::Ptr<anab::T0>>& this_t0s = fmT0s.at(trk_i);
259  if (this_t0s.size()) T0 = this_t0s.at(0)->Time();
260  }
261  }
262 
263  // organize the hits by plane
264  std::vector<std::vector<OrganizedHits>> hit_indices = OrganizeHits(hits, thms, track, nplanes);
265 
266  for (unsigned plane_i = 0; plane_i < nplanes; plane_i++) {
267 
268  float kinetic_energy = 0.;
269  std::vector<float> dEdxs;
270  std::vector<float> dQdxs;
271  std::vector<float> resranges;
272  std::vector<float> deadwireresranges;
273  float range = 0.;
274  std::vector<float> pitches;
275  std::vector<geo::Point_t> xyzs;
276  std::vector<size_t> tp_indices;
277  geo::PlaneID plane;
278 
279  // setup the plane ID
280  plane.Plane = plane_i;
281  plane.TPC = 0; // arbitrary -- tracks can cross TPC boundaries
282  plane.Cryostat = fConfig.Cryostat();
283  plane.isValid = true;
284 
285  std::vector<float> lengths;
286  for (unsigned hit_i = 0; hit_i < hit_indices[plane_i].size(); hit_i++) {
287  unsigned hit_index = hit_indices[plane_i][hit_i].first;
288 
289  std::vector<recob::Hit const*> sharedHits = {};
290  sharedHits.reserve(hit_indices[plane_i][hit_i].second.size());
291  for (const unsigned shared_hit_index : hit_indices[plane_i][hit_i].second)
292  sharedHits.push_back(hits[shared_hit_index].get());
293 
294  // Get the location of this point
295  geo::Point_t location = GetLocation(track, hits[hit_index], thms[hit_index]);
296 
297  // Get the pitch
298  double pitch = GetPitch(track, *hits[hit_index], thms[hit_index]);
299 
300  // And the charge
301  double charge = GetCharge(*hits[hit_index], sharedHits);
302 
303  // Get the EField
304  double EField = GetEfield(det_prop, track, hits[hit_index], thms[hit_index]);
305 
306  // Angle to the drift electric field (in x direction), in units of degrees
307  geo::Vector_t direction = track.DirectionAtPoint(thms[hit_index]->Index());
308  double phi = acos(abs(direction.x())) * 180 / M_PI;
309 
310  double dQdx = charge / pitch;
311 
312  // Normalize out the detector response
313  dQdx = Normalize(dQdx,
314  evt,
315  *hits[hit_index],
316  track.LocationAtPoint(thms[hit_index]->Index()),
317  track.DirectionAtPoint(thms[hit_index]->Index()),
318  T0);
319 
320  // turn into dEdx
322  fCaloAlg.dEdx_AMP(clock_data,
323  det_prop,
324  dQdx,
325  hits[hit_index]->PeakTime(),
326  hits[hit_index]->WireID().Plane,
327  T0,
328  EField,
329  phi) :
330  fCaloAlg.dEdx_AREA(clock_data,
331  det_prop,
332  dQdx,
333  hits[hit_index]->PeakTime(),
334  hits[hit_index]->WireID().Plane,
335  T0,
336  EField,
337  phi);
338 
339  // save the length between each pair of hits
340  if (xyzs.size() == 0) { lengths.push_back(0.); }
341  else {
342  lengths.push_back((location - xyzs.back()).r());
343  }
344 
345  // save stuff
346  dEdxs.push_back(dEdx);
347  dQdxs.push_back(dQdx);
348  pitches.push_back(pitch);
349  xyzs.push_back(location);
350  kinetic_energy += dEdx * pitch;
351 
352  // TODO: FIXME
353  // It seems weird that the "trajectory-point-index" actually is the
354  // index of the hit... is this a bug in the documentation
355  // of anab::Calorimetry?
356  //
357  // i.e. -- I think this piece of code should actually be:
358  // tp_indices.push_back(thms[hit_index]->Index());
359  tp_indices.push_back(hits[hit_index].key());
360 
361  } // end iterate over hits
362 
363  // turn the lengths vector into a residual-range vector and total length
364  if (lengths.size() > 1) {
365  range = std::accumulate(lengths.begin(), lengths.end(), 0.);
366 
367  // check the direction that the hits are going in the track:
368  // upstream (end-start) or downstream (start-end)
369  bool is_downstream =
370  (track.Trajectory().Start() - xyzs[0]).r() +
371  (track.Trajectory().End() - xyzs.back()).r() <
372  (track.Trajectory().End() - xyzs[0]).r() + (track.Trajectory().Start() - xyzs.back()).r();
373 
374  resranges.resize(lengths.size());
375  if (is_downstream) {
376  resranges[lengths.size() - 1] = lengths.back() / 2.;
377  for (int i_len = lengths.size() - 2; i_len >= 0; i_len--) {
378  resranges[i_len] = resranges[i_len + 1] + lengths[i_len + 1];
379  }
380  }
381  else {
382  resranges[0] = lengths[1] / 2.;
383  for (unsigned i_len = 1; i_len < lengths.size(); i_len++) {
384  resranges[i_len] = resranges[i_len - 1] + lengths[i_len];
385  }
386  }
387  }
388 
389  // save the Calorimetry output
390  //
391  // Bogus if less than two hits on this plane
392  if (lengths.size() > 1) {
393  outputCalo->push_back(anab::Calorimetry(kinetic_energy,
394  dEdxs,
395  dQdxs,
396  resranges,
397  deadwireresranges,
398  range,
399  pitches,
400  xyzs,
401  tp_indices,
402  plane));
403  }
404  else {
405  outputCalo->push_back(
406  anab::Calorimetry(util::kBogusD, {}, {}, {}, {}, util::kBogusD, {}, {}, {}, plane));
407  }
408 
409  util::CreateAssn(evt, *outputCalo, tracklist[trk_i], *outputCaloAssn);
410 
411  } // end iterate over planes
412 
413  } // end iterate over tracks
414 
415  evt.put(std::move(outputCalo));
416  evt.put(std::move(outputCaloAssn));
417 
418  return;
419 }
420 
421 std::vector<std::vector<OrganizedHits>> calo::GnocchiCalorimetry::OrganizeHits(
423  const std::vector<const recob::TrackHitMeta*>& thms,
424  const recob::Track& track,
425  unsigned nplanes)
426 {
427  // charge is computed per hit -- we organize hits indivudally
430  return OrganizeHitsIndividual(hits, thms, track, nplanes);
431  }
432  // charge is computed per snippet -- we organize hits by snippet
433  else {
434  return OrganizeHitsSnippets(hits, thms, track, nplanes);
435  }
436 }
437 
438 std::vector<std::vector<OrganizedHits>> calo::GnocchiCalorimetry::OrganizeHitsIndividual(
440  const std::vector<const recob::TrackHitMeta*>& thms,
441  const recob::Track& track,
442  unsigned nplanes)
443 {
444  std::vector<std::vector<OrganizedHits>> ret(nplanes);
445  for (unsigned i = 0; i < hits.size(); i++) {
446  if (HitIsValid(thms[i], track)) { ret[hits[i]->WireID().Plane].push_back({i, {}}); }
447  }
448 
449  return ret;
450 }
451 
452 std::vector<std::vector<OrganizedHits>> calo::GnocchiCalorimetry::OrganizeHitsSnippets(
454  const std::vector<const recob::TrackHitMeta*>& thms,
455  const recob::Track& track,
456  unsigned nplanes)
457 {
458  // In this case, we need to only accept one hit in each snippet
459  // Snippets are counted by the Start, End, and Wire. If all these are the same for a hit, then they are on the same snippet.
460  //
461  // If there are multiple valid hits on the same snippet, we need a way to pick the best one.
462  // (TODO: find a good way). The current method is to take the one with the highest charge integral.
463  struct HitIdentifier {
464  int startTick;
465  int endTick;
466  int wire;
467  float integral;
468 
469  // construct
470  explicit HitIdentifier(const recob::Hit& hit)
471  : startTick(hit.StartTick())
472  , endTick(hit.EndTick())
473  , wire(hit.WireID().Wire)
474  , integral(hit.Integral())
475  {}
476 
477  // Defines whether two hits are on the same snippet
478  inline bool operator==(const HitIdentifier& rhs) const
479  {
480  return startTick == rhs.startTick && endTick == rhs.endTick && wire == rhs.wire;
481  }
482 
483  // Defines which hit to pick between two both on the same snippet
484  inline bool operator>(const HitIdentifier& rhs) const { return integral > rhs.integral; }
485  };
486 
487  std::vector<std::vector<OrganizedHits>> ret(nplanes);
488  std::vector<std::vector<HitIdentifier>> hit_idents(nplanes);
489  for (unsigned i = 0; i < hits.size(); i++) {
490  if (HitIsValid(thms[i], track)) {
491  HitIdentifier this_ident(*hits[i]);
492 
493  // check if we have found a hit on this snippet before
494  bool found_snippet = false;
495  auto const plane = hits[i]->WireID().Plane;
496  for (unsigned j = 0; j < ret[plane].size(); j++) {
497  if (this_ident == hit_idents[plane][j]) {
498  found_snippet = true;
499  if (this_ident > hit_idents[plane][j]) {
500  ret[plane][j].second.push_back(ret[plane][j].first);
501  ret[plane][j].first = i;
502  hit_idents[plane][j] = this_ident;
503  }
504  else {
505  ret[plane][j].second.push_back(i);
506  }
507  break;
508  }
509  }
510  if (!found_snippet) {
511  ret[plane].push_back({i, {}});
512  hit_idents[plane].push_back(this_ident);
513  }
514  }
515  }
516  return ret;
517 }
518 
520 {
521  if (thm->Index() == int_max_as_unsigned_int) return false;
522  return track.HasValidPoint(thm->Index());
523 }
524 
527  const recob::TrackHitMeta* meta)
528 {
529  geo::Point_t loc = track.LocationAtPoint(meta->Index());
531  loc;
532 }
533 
535  const geo::TPCID& tpc)
536 {
537  auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
538 
539  geo::Point_t ret = loc;
540 
541  if (sce->EnableCalSpatialSCE() && fConfig.FieldDistortion()) {
542  geo::Vector_t offset = sce->GetCalPosOffsets(ret, tpc.TPC);
543 
544  ret.SetX(ret.X() + fConfig.FieldDistortionCorrectionXSign() * offset.X());
545  ret.SetY(ret.Y() + offset.Y());
546  ret.SetZ(ret.Z() + offset.Z());
547  }
548 
549  return ret;
550 }
551 
553  const recob::Hit& hit,
554  const recob::TrackHitMeta* meta)
555 {
556  geo::Point_t loc = track.LocationAtPoint(meta->Index());
558  loc;
559 }
560 
562  const geo::TPCID& tpc)
563 {
564  auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
566 
567  geo::Point_t ret = loc;
568 
569  if (sce->EnableCalSpatialSCE() && fConfig.FieldDistortion()) {
570  // Returned X is the drift -- multiply by the drift direction to undo this
571  int corr = geom->TPC(tpc).DriftDir().X();
572 
573  geo::Vector_t offset = sce->GetPosOffsets(ret);
574 
575  ret.SetX(ret.X() + corr * fConfig.FieldDistortionCorrectionXSign() * offset.X());
576  ret.SetY(ret.Y() + offset.Y());
577  ret.SetZ(ret.Z() + offset.Z());
578  }
579 
580  return ret;
581 }
582 
584  const recob::Hit& hit,
585  const recob::TrackHitMeta* meta)
586 {
587  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout>()->Get();
588  auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
589 
590  double angleToVert = wireReadoutGeom.WireAngleToVertical(hit.View(), hit.WireID().asPlaneID()) -
591  0.5 * ::util::pi<>();
592 
594  auto const& plane =
595  wireReadoutGeom.Plane({hit.WireID().Cryostat, hit.WireID().TPC, hit.WireID().Plane});
596 
597  // "dir" should be the direction that the wires see. If the track already has the field
598  // distortion corrections applied, then we need to de-apply them to get the direction as
599  // seen by the wire planes
600  if (sce->EnableCalSpatialSCE() && fConfig.FieldDistortion() &&
602  geo::Point_t loc = track.LocationAtPoint(meta->Index());
603 
604  // compute the dir of the track trajectory
605  geo::Vector_t track_dir = track.DirectionAtPoint(meta->Index());
606  geo::Point_t loc_mdx = loc - track_dir * plane.WirePitch() / 2.;
607  geo::Point_t loc_pdx = loc + track_dir * plane.WirePitch() / 2.;
608 
609  loc_mdx = TrajectoryToWirePosition(loc_mdx, hit.WireID());
610  loc_pdx = TrajectoryToWirePosition(loc_pdx, hit.WireID());
611 
612  // Direction at wires
613  dir = (loc_pdx - loc_mdx) / (loc_mdx - loc_pdx).r();
614  }
615  // If there is no space charge or the track is not yet corrected, then the dir
616  // is the track is what we want
617  else {
618  dir = track.DirectionAtPoint(meta->Index());
619  }
620 
621  double cosgamma = std::abs(std::sin(angleToVert) * dir.Y() + std::cos(angleToVert) * dir.Z());
622  double pitch{0.};
623  if (cosgamma) { pitch = plane.WirePitch() / cosgamma; }
624 
625  // now take the pitch computed on the wires and correct it back to the particle trajectory
626  geo::Point_t loc_w = GetLocationAtWires(track, hit, meta);
627 
628  geo::Point_t locw_pdx_traj = WireToTrajectoryPosition(loc_w + pitch * dir, hit.WireID());
629  geo::Point_t loc = WireToTrajectoryPosition(loc_w, hit.WireID());
630 
631  pitch = (locw_pdx_traj - loc).R();
632 
633  return pitch;
634 }
635 
637  const std::vector<recob::Hit const*>& sharedHits)
638 {
639  switch (fConfig.ChargeMethod()) {
644  return std::accumulate(
645  sharedHits.cbegin(),
646  sharedHits.cend(),
647  hit.Integral(),
648  [](double sum, recob::Hit const* sharedHit) { return sum + sharedHit->Integral(); });
649  default: return 0.;
650  }
651  return 0.;
652 }
653 
655  const art::Event& e,
656  const recob::Hit& h,
657  const geo::Point_t& location,
658  const geo::Vector_t& direction,
659  double t0)
660 {
661  double ret = dQdx;
662  for (auto const& nt : fNormTools) {
663  ret = nt->Normalize(ret, e, h, location, direction, t0);
664  }
665 
666  return ret;
667 }
668 
670  const recob::Track& track,
672  const recob::TrackHitMeta* meta)
673 {
674  auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
675 
676  double EField = dprop.Efield();
677  if (sce->EnableSimEfieldSCE() && fConfig.FieldDistortionEfield()) {
678  // Gets relative E field Distortions
679  geo::Vector_t EFieldOffsets = sce->GetEfieldOffsets(GetLocation(track, hit, meta));
680  // Add 1 in X direction as this is the direction of the drift field
681  EFieldOffsets = EFieldOffsets + geo::Vector_t{1, 0, 0};
682  // Convert to Absolute E Field from relative
683  EFieldOffsets = EField * EFieldOffsets;
684  // We only care about the magnitude for recombination
685  EField = EFieldOffsets.r();
686  }
687  return EField;
688 }
689 
TRandom r
Definition: spectrum.C:23
code to link reconstructed objects back to the MC truth information
std::vector< std::vector< OrganizedHits > > OrganizeHitsIndividual(const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< const recob::TrackHitMeta * > &thms, const recob::Track &track, unsigned nplanes)
GnocchiCalorimetry(Parameters const &config)
Functions to help with numbers.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:160
void produce(art::Event &evt) override
constexpr bool operator>(Interval< Q, Cat > const a, Quantity< Args... > const b) noexcept
Definition: intervals.h:507
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Definition: Track.h:132
Declaration of signal hit object.
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
Definition: Track.h:160
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:194
bool HasValidPoint(size_t i) const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:145
constexpr auto abs(T v)
Returns the absolute value of the argument.
Class to keep data related to recob::Hit associated with recob::Track.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:195
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:254
geo::View_t View() const
View for the plane of the hit.
Definition: Hit.h:286
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:430
geo::WireID const & WireID() const
Initial tdc tick for hit.
Definition: Hit.h:290
data_const_reference data(size_type i) const
Definition: FindManyP.h:446
Data related to recob::Hit associated with recob::Track.The purpose is to collect several variables t...
Definition: TrackHitMeta.h:43
double Normalize(double dQdx, const art::Event &e, const recob::Hit &h, const geo::Point_t &location, const geo::Vector_t &direction, double t0)
float PeakAmplitude() const
The estimated amplitude of the hit at its peak, in ADC units.
Definition: Hit.h:238
double Efield(unsigned int planegap=0) const
kV/cm
fhicl::Atom< std::string > TrackModuleLabel
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
fhicl::Atom< std::string > T0ModuleLabel
void hits()
Definition: readHits.C:15
double dEdx_AMP(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
double GetCharge(const recob::Hit &hit, const std::vector< recob::Hit const * > &sharedHits)
std::vector< std::vector< OrganizedHits > > OrganizeHitsSnippets(const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< const recob::TrackHitMeta * > &thms, const recob::Track &track, unsigned nplanes)
std::vector< std::unique_ptr< INormalizeCharge > > fNormTools
double GetEfield(const detinfo::DetectorPropertiesData &dprop, const recob::Track &track, const art::Ptr< recob::Hit > hit, const recob::TrackHitMeta *meta)
double GetPitch(const recob::Track &track, const recob::Hit &hit, const recob::TrackHitMeta *meta)
geo::Point_t WireToTrajectoryPosition(const geo::Point_t &loc, const geo::TPCID &tpc)
geo::Point_t GetLocationAtWires(const recob::Track &track, const recob::Hit &hit, const recob::TrackHitMeta *meta)
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:373
raw::TDCtick_t StartTick() const
Initial tdc tick for hit.
Definition: Hit.h:218
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2671
Detector simulation of raw signals on wires.
Encapsulate the geometry of a wire .
raw::TDCtick_t EndTick() const
Final tdc tick for hit.
Definition: Hit.h:222
fhicl::Table< calo::CalorimetryAlg::Config > CalorimetryAlgConfig
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
float ROISummedADC() const
The sum of calibrated ADC counts of the ROI (0. by default)
Definition: Hit.h:246
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane .
Provides recob::Track data product.
TDirectory * dir
Definition: macro.C:5
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
geo::Point_t TrajectoryToWirePosition(const geo::Point_t &loc, const geo::TPCID &tpc)
unsigned int Index() const
Hit index along the track trajectory.
Definition: TrackHitMeta.h:52
fhicl::Atom< std::string > PFPModuleLabel
Vector_t DirectionAtPoint(size_t i) const
Access to track direction at different points.
Definition: Track.h:168
constexpr double kBogusD
obviously bogus double value
geo::Point_t GetLocation(const recob::Track &track, const art::Ptr< recob::Hit > hit, const recob::TrackHitMeta *meta)
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
TCEvent evt
Definition: DataStructs.cxx:8
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:315
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
Definition: GeometryCore.h:448
Collection of Physical constants used in LArSoft.
Double_t sum
Definition: plot.C:31
Float_t e
Definition: plot.C:35
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
fhicl::Atom< std::string > AssocHitModuleLabel
Vector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:84
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
bool HitIsValid(const recob::TrackHitMeta *thm, const recob::Track &track)
Float_t track
Definition: plot.C:35
Utility functions to extract information from recob::Track
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
Definition: counter.h:277
std::vector< std::vector< OrganizedHits > > OrganizeHits(const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< const recob::TrackHitMeta * > &thms, const recob::Track &track, unsigned nplanes)
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
calorimetry
constexpr PlaneID const & asPlaneID() const
Conversion to WireID (for convenience of notation).
Definition: geo_types.h:466
This is an interface for an art Tool which scales charge by some factor given information about its a...