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 
12 #include <vector>
13 
19 #include "fhiclcpp/ParameterSet.h"
21 
22 // Included Services
26 
27 namespace cheat {
28  class BackTrackerService : private BackTracker {
29  public:
30  struct fhiclConfig {
32  fhicl::Name("BackTracker"),
33  fhicl::Comment("This is the fhicl configuration of the BackTracker service provider.")};
34  };
35 
37  const provider_type*
38  provider() const
39  {
40  return static_cast<provider_type const*>(this);
41  }
42 
45 
46  //Temporrary rebuild function (until I can make this lazy again.
47 
48  void Rebuild(const art::Event& evt);
49 
50  const std::vector<art::Ptr<sim::SimChannel>>& SimChannels() const;
51 
52  std::vector<const sim::IDE*> TrackIdToSimIDEs_Ps(int const& id) const;
53  std::vector<const sim::IDE*> TrackIdToSimIDEs_Ps(int const& id, const geo::View_t view) const;
54 
56 
57  std::vector<sim::TrackIDE> ChannelToTrackIDEs(detinfo::DetectorClocksData const& clockData,
58  raw::ChannelID_t channel,
59  const double hit_start_time,
60  const double hit_end_time) const;
61 
62  std::vector<sim::TrackIDE> HitToTrackIDEs(detinfo::DetectorClocksData const& clockData,
63  recob::Hit const& hit) const;
64  std::vector<sim::TrackIDE> HitToTrackIDEs(detinfo::DetectorClocksData const& clockData,
65  art::Ptr<recob::Hit> const& hit) const;
66 
67  std::vector<int> HitToTrackIds(detinfo::DetectorClocksData const& clockData,
68  recob::Hit const& hit) const;
69 
70  std::vector<sim::TrackIDE> HitToEveTrackIDEs(detinfo::DetectorClocksData const& clockData,
71  recob::Hit const& hit) const;
72  std::vector<sim::TrackIDE> HitToEveTrackIDEs(detinfo::DetectorClocksData const& clockData,
73  art::Ptr<recob::Hit> const& hit) const;
74 
75  std::vector<art::Ptr<recob::Hit>> TrackIdToHits_Ps(
76  detinfo::DetectorClocksData const& clockData,
77  int tkId,
78  std::vector<art::Ptr<recob::Hit>> const& hitsIn) const;
79  // std::vector<art::Ptr<recob::Hit>> TrackIdToHits_Ps(const int& tkId)
80  // const;
81 
82  std::vector<std::vector<art::Ptr<recob::Hit>>> TrackIdsToHits_Ps(
83  detinfo::DetectorClocksData const& clockData,
84  std::vector<int> const& tkIds,
85  std::vector<art::Ptr<recob::Hit>> const& hitsIn) const;
86 
87  std::vector<sim::IDE> HitToAvgSimIDEs(detinfo::DetectorClocksData const& clockData,
88  recob::Hit const& hit) const;
89  std::vector<sim::IDE> HitToAvgSimIDEs(detinfo::DetectorClocksData const& clockData,
90  art::Ptr<recob::Hit> hit) const;
91 
92  std::vector<const sim::IDE*> HitToSimIDEs_Ps(detinfo::DetectorClocksData const& clockData,
93  recob::Hit const& hit) const;
94  std::vector<const sim::IDE*> HitToSimIDEs_Ps(detinfo::DetectorClocksData const& clockData,
95  art::Ptr<recob::Hit> const& hit) const;
96 
97  std::vector<double> SimIDEsToXYZ(std::vector<sim::IDE> const& ides) const;
98  std::vector<double> SimIDEsToXYZ(std::vector<const sim::IDE*> const& ide_Ps) const;
99 
100  std::vector<double> HitToXYZ(detinfo::DetectorClocksData const& clockData,
101  const recob::Hit& hit) const;
102  std::vector<double> HitToXYZ(detinfo::DetectorClocksData const& clockData,
103  art::Ptr<recob::Hit> const& hit) const;
104 
105  double HitCollectionPurity(detinfo::DetectorClocksData const& clockData,
106  std::set<int> const& trackIds,
107  std::vector<art::Ptr<recob::Hit>> const& hits) const;
109  std::set<int> const& trackIds,
110  std::vector<art::Ptr<recob::Hit>> const& hits) const;
111 
113  std::set<int> const& trackIds,
114  std::vector<art::Ptr<recob::Hit>> const& hits,
115  std::vector<art::Ptr<recob::Hit>> const& allhits,
116  geo::View_t const& view) const;
118  std::set<int> const& trackIds,
119  std::vector<art::Ptr<recob::Hit>> const& hits,
120  std::vector<art::Ptr<recob::Hit>> const& allhits,
121  geo::View_t const& view) const;
122 
123  std::set<int> GetSetOfTrackIds() const;
124  std::set<int> GetSetOfEveIds() const;
125 
126  std::set<int> GetSetOfTrackIds(detinfo::DetectorClocksData const& clockData,
127  std::vector<art::Ptr<recob::Hit>> const& hits) const;
128  std::set<int> GetSetOfEveIds(detinfo::DetectorClocksData const& clockData,
129  std::vector<art::Ptr<recob::Hit>> const& hits) const;
130 
131  std::vector<double> SpacePointHitsToWeightedXYZ(
132  detinfo::DetectorClocksData const& clockData,
133  std::vector<art::Ptr<recob::Hit>> const& hits) const;
134  std::vector<art::Ptr<recob::Hit>> SpacePointToHits_Ps(
135  art::Ptr<recob::SpacePoint> const& spt) const;
136  std::vector<double> SpacePointToXYZ(detinfo::DetectorClocksData const& clockData,
137  art::Ptr<recob::SpacePoint> const& spt) const;
138 
139  private:
140  const art::Event* fEvt = nullptr;
141 
142  // Prep functions go here.
144  void priv_PrepSimChannels(const art::Event& evt);
145  // void priv_PrepAllHitList ();
146  void priv_PrepFailed();
147 
148  bool priv_CanRun(const art::Event& evt);
149 
150  bool
152  {
154  }
155  // bool priv_AllHitListReady() { return
156  // BackTracker::AllHitListReady();}
157 
158  }; // class BackTrackerService
159 
160 } // end namespace cheat
162 
163 #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
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
struct vector vector
ChannelGroupService::Name Name
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
art framework interface to geometry description
std::vector< int > HitToTrackIds(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
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)
#define DECLARE_ART_SERVICE(svc, scope)
static Config * config
Definition: config.cpp:1054
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
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)
Detector simulation of raw signals on wires.
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
code to link reconstructed objects back to the MC truth information
Definition: BackTracker.cc:22
#define Comment
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
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
Header for the ParticleInvenotry Service Provider.
const std::vector< art::Ptr< sim::SimChannel > > & SimChannels() const
Access the description of detector geometry.
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:7
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