LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
BackTrackerService.h
Go to the documentation of this file.
1 // \file BackTrackerService.h
3 // \A service for backtracking reconstruction information to its truth information
4 //
5 // \author jason.stock@mines.sdsmt.edu
6 // Based on the original BackTracker by Brian Rebel (brebel@fnal.gov
7 //
9 #ifndef CHEAT_BACKTRACKERSERVICESERVICE_H
10 #define CHEAT_BACKTRACKERSERVICESERVICE_H
11 
13 
14 namespace detinfo {
15  class DetectorClocksData;
16 }
17 
22 
25 
26 namespace art {
27  class ActivityRegistry;
28  class Event;
29 }
30 
32 
33 #include "fhiclcpp/types/Comment.h"
34 #include "fhiclcpp/types/Name.h"
35 #include "fhiclcpp/types/Table.h"
36 
37 namespace fhicl {
38  class ParameterSet;
39 }
40 
41 #include <set>
42 #include <vector>
43 
44 namespace cheat {
45  class BackTrackerService : private BackTracker {
46  public:
47  struct fhiclConfig {
49  fhicl::Name("BackTracker"),
50  fhicl::Comment("This is the fhicl configuration of the BackTracker service provider.")};
51  };
52 
54  const provider_type* provider() const { return static_cast<provider_type const*>(this); }
55 
58 
59  //Temporrary rebuild function (until I can make this lazy again.
60 
61  void Rebuild(const art::Event& evt);
62 
63  const std::vector<art::Ptr<sim::SimChannel>>& SimChannels() const;
64 
65  std::vector<const sim::IDE*> TrackIdToSimIDEs_Ps(int const& id) const;
66  std::vector<const sim::IDE*> TrackIdToSimIDEs_Ps(int const& id, const geo::View_t view) const;
67 
68  art::Ptr<sim::SimChannel> FindSimChannel(raw::ChannelID_t channel) const;
69 
70  std::vector<sim::TrackIDE> ChannelToTrackIDEs(detinfo::DetectorClocksData const& clockData,
71  raw::ChannelID_t channel,
72  const double hit_start_time,
73  const double hit_end_time) const;
74 
75  std::vector<sim::TrackIDE> HitToTrackIDEs(detinfo::DetectorClocksData const& clockData,
76  recob::Hit const& hit) const;
77  std::vector<sim::TrackIDE> HitToTrackIDEs(detinfo::DetectorClocksData const& clockData,
78  art::Ptr<recob::Hit> const& hit) const;
79 
80  std::vector<int> HitToTrackIds(detinfo::DetectorClocksData const& clockData,
81  recob::Hit const& hit) const;
82 
83  std::vector<sim::TrackIDE> HitToEveTrackIDEs(detinfo::DetectorClocksData const& clockData,
84  recob::Hit const& hit) const;
85  std::vector<sim::TrackIDE> HitToEveTrackIDEs(detinfo::DetectorClocksData const& clockData,
86  art::Ptr<recob::Hit> const& hit) const;
87 
88  std::vector<art::Ptr<recob::Hit>> TrackIdToHits_Ps(
89  detinfo::DetectorClocksData const& clockData,
90  int tkId,
91  std::vector<art::Ptr<recob::Hit>> const& hitsIn) const;
92  // std::vector<art::Ptr<recob::Hit>> TrackIdToHits_Ps(const int& tkId)
93  // const;
94 
95  std::vector<std::vector<art::Ptr<recob::Hit>>> TrackIdsToHits_Ps(
96  detinfo::DetectorClocksData const& clockData,
97  std::vector<int> const& tkIds,
98  std::vector<art::Ptr<recob::Hit>> const& hitsIn) const;
99 
100  std::vector<sim::IDE> HitToAvgSimIDEs(detinfo::DetectorClocksData const& clockData,
101  recob::Hit const& hit) const;
102  std::vector<sim::IDE> HitToAvgSimIDEs(detinfo::DetectorClocksData const& clockData,
103  art::Ptr<recob::Hit> hit) const;
104 
105  std::vector<const sim::IDE*> HitToSimIDEs_Ps(detinfo::DetectorClocksData const& clockData,
106  recob::Hit const& hit) const;
107  std::vector<const sim::IDE*> HitToSimIDEs_Ps(detinfo::DetectorClocksData const& clockData,
108  art::Ptr<recob::Hit> const& hit) const;
109 
110  std::vector<double> SimIDEsToXYZ(std::vector<sim::IDE> const& ides) const;
111  std::vector<double> SimIDEsToXYZ(std::vector<const sim::IDE*> const& ide_Ps) const;
112 
113  std::vector<double> HitToXYZ(detinfo::DetectorClocksData const& clockData,
114  const recob::Hit& hit) const;
115  std::vector<double> HitToXYZ(detinfo::DetectorClocksData const& clockData,
116  art::Ptr<recob::Hit> const& hit) const;
117 
118  double HitCollectionPurity(detinfo::DetectorClocksData const& clockData,
119  std::set<int> const& trackIds,
120  std::vector<art::Ptr<recob::Hit>> const& hits) const;
121  double HitChargeCollectionPurity(detinfo::DetectorClocksData const& clockData,
122  std::set<int> const& trackIds,
123  std::vector<art::Ptr<recob::Hit>> const& hits) const;
124 
125  double HitCollectionEfficiency(detinfo::DetectorClocksData const& clockData,
126  std::set<int> const& trackIds,
128  std::vector<art::Ptr<recob::Hit>> const& allhits,
129  geo::View_t const& view) const;
130  double HitChargeCollectionEfficiency(detinfo::DetectorClocksData const& clockData,
131  std::set<int> const& trackIds,
133  std::vector<art::Ptr<recob::Hit>> const& allhits,
134  geo::View_t const& view) const;
135 
136  std::set<int> GetSetOfTrackIds() const;
137  std::set<int> GetSetOfEveIds() const;
138 
139  std::set<int> GetSetOfTrackIds(detinfo::DetectorClocksData const& clockData,
140  std::vector<art::Ptr<recob::Hit>> const& hits) const;
141  std::set<int> GetSetOfEveIds(detinfo::DetectorClocksData const& clockData,
142  std::vector<art::Ptr<recob::Hit>> const& hits) const;
143 
144  std::vector<double> SpacePointHitsToWeightedXYZ(
145  detinfo::DetectorClocksData const& clockData,
146  std::vector<art::Ptr<recob::Hit>> const& hits) const;
147  std::vector<art::Ptr<recob::Hit>> SpacePointToHits_Ps(
148  art::Ptr<recob::SpacePoint> const& spt) const;
149  std::vector<double> SpacePointToXYZ(detinfo::DetectorClocksData const& clockData,
150  art::Ptr<recob::SpacePoint> const& spt) const;
151 
152  private:
153  const art::Event* fEvt = nullptr;
154 
155  // Prep functions go here.
156  void priv_PrepEvent(const art::Event& evt, art::ScheduleContext);
157  void priv_PrepSimChannels(const art::Event& evt);
158  // void priv_PrepAllHitList ();
159  void priv_PrepFailed();
160 
161  bool priv_CanRun(const art::Event& evt);
162 
163  bool priv_SimChannelsReady() { return BackTracker::SimChannelsReady(); }
164  // bool priv_AllHitListReady() { return
165  // BackTracker::AllHitListReady();}
166 
167  }; // class BackTrackerService
168 
169 } // end namespace cheat
171 
172 #endif // CHEAT_BACKTRACKERSERVICESERVICE_H
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Declaration of signal hit object.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
void hits()
Definition: readHits.C:15
#define DECLARE_ART_SERVICE(svc, scope)
parameter set interface
const provider_type * provider() const
General LArSoft Utilities.
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
code to link reconstructed objects back to the MC truth information
Definition: BackTracker.cc:22
Contains all timing reference information for the detector.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
Definition: MVAAlg.h:12
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28