All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BackTrackerService.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////////
2 // \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 //
8 /////////////////////////////////////////////////////////////////////////////////
9 #ifndef CHEAT_BACKTRACKERSERVICESERVICE_H
10 #define CHEAT_BACKTRACKERSERVICESERVICE_H
11 
13 
14 namespace detinfo {
15  class DetectorClocksData;
16 }
17 
22 
23 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
24 #include "art/Persistency/Provenance/ScheduleContext.h"
25 
26 namespace art {
27  class ActivityRegistry;
28  class Event;
29 }
30 
31 #include "canvas/Persistency/Common/Ptr.h"
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 {
48  fhicl::Table<BackTracker::fhiclConfig> BackTrackerTable{
49  fhicl::Name("BackTracker"),
50  fhicl::Comment("This is the fhicl configuration of the BackTracker service provider.")};
51  };
52 
54  const provider_type*
55  provider() const
56  {
57  return static_cast<provider_type const*>(this);
58  }
59 
60  BackTrackerService(const fhicl::ParameterSet& pSet, art::ActivityRegistry& reg);
61  BackTrackerService(const fhiclConfig& config, art::ActivityRegistry& reg);
62 
63  //Temporrary rebuild function (until I can make this lazy again.
64 
65  void Rebuild(const art::Event& evt);
66 
67  const std::vector<art::Ptr<sim::SimChannel>>& SimChannels() const;
68 
69  std::vector<const sim::IDE*> TrackIdToSimIDEs_Ps(int const& id) const;
70  std::vector<const sim::IDE*> TrackIdToSimIDEs_Ps(int const& id, const geo::View_t view) const;
71 
72  art::Ptr<sim::SimChannel> FindSimChannel(raw::ChannelID_t channel) const;
73 
74  std::vector<sim::TrackIDE> ChannelToTrackIDEs(detinfo::DetectorClocksData const& clockData,
75  raw::ChannelID_t channel,
76  const double hit_start_time,
77  const double hit_end_time) const;
78 
79  std::vector<sim::TrackIDE> HitToTrackIDEs(detinfo::DetectorClocksData const& clockData,
80  recob::Hit const& hit) const;
81  std::vector<sim::TrackIDE> HitToTrackIDEs(detinfo::DetectorClocksData const& clockData,
82  art::Ptr<recob::Hit> const& hit) const;
83 
84  std::vector<int> HitToTrackIds(detinfo::DetectorClocksData const& clockData,
85  recob::Hit const& hit) const;
86 
87  std::vector<sim::TrackIDE> HitToEveTrackIDEs(detinfo::DetectorClocksData const& clockData,
88  recob::Hit const& hit) const;
89  std::vector<sim::TrackIDE> HitToEveTrackIDEs(detinfo::DetectorClocksData const& clockData,
90  art::Ptr<recob::Hit> const& hit) const;
91 
92  std::vector<art::Ptr<recob::Hit>> TrackIdToHits_Ps(
93  detinfo::DetectorClocksData const& clockData,
94  int tkId,
95  std::vector<art::Ptr<recob::Hit>> const& hitsIn) const;
96  // std::vector<art::Ptr<recob::Hit>> TrackIdToHits_Ps(const int& tkId)
97  // const;
98 
99  std::vector<std::vector<art::Ptr<recob::Hit>>> TrackIdsToHits_Ps(
100  detinfo::DetectorClocksData const& clockData,
101  std::vector<int> const& tkIds,
102  std::vector<art::Ptr<recob::Hit>> const& hitsIn) const;
103 
104  std::vector<sim::IDE> HitToAvgSimIDEs(detinfo::DetectorClocksData const& clockData,
105  recob::Hit const& hit) const;
106  std::vector<sim::IDE> HitToAvgSimIDEs(detinfo::DetectorClocksData const& clockData,
107  art::Ptr<recob::Hit> hit) const;
108 
109  std::vector<const sim::IDE*> HitToSimIDEs_Ps(detinfo::DetectorClocksData const& clockData,
110  recob::Hit const& hit) const;
111  std::vector<const sim::IDE*> HitToSimIDEs_Ps(detinfo::DetectorClocksData const& clockData,
112  art::Ptr<recob::Hit> const& hit) const;
113 
114  std::vector<double> SimIDEsToXYZ(std::vector<sim::IDE> const& ides) const;
115  std::vector<double> SimIDEsToXYZ(std::vector<const sim::IDE*> const& ide_Ps) const;
116 
117  std::vector<double> HitToXYZ(detinfo::DetectorClocksData const& clockData,
118  const recob::Hit& hit) const;
119  std::vector<double> HitToXYZ(detinfo::DetectorClocksData const& clockData,
120  art::Ptr<recob::Hit> const& hit) const;
121 
122  double HitCollectionPurity(detinfo::DetectorClocksData const& clockData,
123  std::set<int> const& trackIds,
124  std::vector<art::Ptr<recob::Hit>> const& hits) const;
126  std::set<int> const& trackIds,
127  std::vector<art::Ptr<recob::Hit>> const& hits) const;
128 
130  std::set<int> const& trackIds,
131  std::vector<art::Ptr<recob::Hit>> const& hits,
132  std::vector<art::Ptr<recob::Hit>> const& allhits,
133  geo::View_t const& view) const;
135  std::set<int> const& trackIds,
136  std::vector<art::Ptr<recob::Hit>> const& hits,
137  std::vector<art::Ptr<recob::Hit>> const& allhits,
138  geo::View_t const& view) const;
139 
140  std::set<int> GetSetOfTrackIds() const;
141  std::set<int> GetSetOfEveIds() const;
142 
143  std::set<int> GetSetOfTrackIds(detinfo::DetectorClocksData const& clockData,
144  std::vector<art::Ptr<recob::Hit>> const& hits) const;
145  std::set<int> GetSetOfEveIds(detinfo::DetectorClocksData const& clockData,
146  std::vector<art::Ptr<recob::Hit>> const& hits) const;
147 
148  std::vector<double> SpacePointHitsToWeightedXYZ(
149  detinfo::DetectorClocksData const& clockData,
150  std::vector<art::Ptr<recob::Hit>> const& hits) const;
151  std::vector<art::Ptr<recob::Hit>> SpacePointToHits_Ps(
152  art::Ptr<recob::SpacePoint> const& spt) const;
153  std::vector<double> SpacePointToXYZ(detinfo::DetectorClocksData const& clockData,
154  art::Ptr<recob::SpacePoint> const& spt) const;
155 
156  private:
157  const art::Event* fEvt = nullptr;
158 
159  // Prep functions go here.
160  void priv_PrepEvent(const art::Event& evt, art::ScheduleContext);
161  void priv_PrepSimChannels(const art::Event& evt);
162  // void priv_PrepAllHitList ();
163  void priv_PrepFailed();
164 
165  bool priv_CanRun(const art::Event& evt);
166 
167  bool
169  {
171  }
172  // bool priv_AllHitListReady() { return
173  // BackTracker::AllHitListReady();}
174 
175  }; // class BackTrackerService
176 
177 } // end namespace cheat
178 DECLARE_ART_SERVICE(cheat::BackTrackerService, LEGACY)
179 
180 #endif // CHEAT_BACKTRACKERSERVICESERVICE_H
std::vector< art::Ptr< recob::Hit > > TrackIdToHits_Ps(detinfo::DetectorClocksData const &clockData, int tkId, std::vector< art::Ptr< recob::Hit >> const &hitsIn) const
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< art::Ptr< recob::Hit > > SpacePointToHits_Ps(art::Ptr< recob::SpacePoint > const &spt) const
double HitChargeCollectionPurity(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits) const
BackTracker(const fhiclConfig &config, const cheat::ParticleInventory *partInv, const geo::GeometryCore *geom)
Definition: BackTracker.cc:25
Declaration of signal hit object.
double HitCollectionEfficiency(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits, std::vector< art::Ptr< recob::Hit >> const &allhits, geo::View_t const &view) const
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
process_name hit
Definition: cheaterreco.fcl:51
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
std::vector< int > HitToTrackIds(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
fhicl::Table< BackTracker::fhiclConfig > BackTrackerTable
art::Ptr< sim::SimChannel > FindSimChannel(raw::ChannelID_t channel) const
void Rebuild(const art::Event &evt)
std::set< int > GetSetOfTrackIds() const
BackTrackerService(const fhicl::ParameterSet &pSet, art::ActivityRegistry &reg)
bool SimChannelsReady() const
Definition: BackTracker.h:114
double HitCollectionPurity(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits) const
void priv_PrepSimChannels(const art::Event &evt)
const provider_type * provider() const
BEGIN_PROLOG vertical distance to the surface Name
std::vector< std::vector< art::Ptr< recob::Hit > > > TrackIdsToHits_Ps(detinfo::DetectorClocksData const &clockData, std::vector< int > const &tkIds, std::vector< art::Ptr< recob::Hit >> const &hitsIn) const
void priv_PrepEvent(const art::Event &evt, art::ScheduleContext)
Definition of data types for geometry description.
std::set< int > GetSetOfEveIds() const
bool priv_CanRun(const art::Event &evt)
double HitChargeCollectionEfficiency(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits, std::vector< art::Ptr< recob::Hit >> const &allhits, geo::View_t const &view) const
Contains all timing reference information for the detector.
std::vector< sim::IDE > HitToAvgSimIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
std::vector< double > SpacePointHitsToWeightedXYZ(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> const &hits) const
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
object containing MC truth information necessary for making RawDigits and doing back tracking ...
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
const std::vector< art::Ptr< sim::SimChannel > > & SimChannels() const
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::vector< double > SpacePointToXYZ(detinfo::DetectorClocksData const &clockData, art::Ptr< recob::SpacePoint > const &spt) const
std::vector< sim::TrackIDE > ChannelToTrackIDEs(detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const