LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 
12 #include <vector>
13 
14 #include "BackTracker.h"
15 #include "fhiclcpp/ParameterSet.h"
19 
20 //Included Services
25 
26 
27 
28 namespace cheat{
30  {
31  public:
32 
33  struct fhiclConfig{
35  fhicl::Name("BackTracker"),
36  fhicl::Comment("This is the fhicl configuration of the BackTracker service provider.") };
37  };
38 
39 
41  const provider_type* provider() const
42  {return static_cast<provider_type const*>(this); }
43 
46 
47  //Temporrary rebuild function (until I can make this lazy again.
48 
49  void Rebuild( const art::Event& evt );
50 
51  const std::vector < art::Ptr < sim::SimChannel > >& SimChannels() ;
52 
53  const std::vector < const sim::IDE* > TrackIdToSimIDEs_Ps(int const& id) ;
54  const std::vector < const sim::IDE* > TrackIdToSimIDEs_Ps(int const& id, const geo::View_t view) ;
55 
57 
58  const std::vector < sim::TrackIDE > ChannelToTrackIDEs(raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) ;
59 
60  const std::vector < sim::TrackIDE > HitToTrackIDEs(recob::Hit const& hit) ;
61  const std::vector < sim::TrackIDE > HitToTrackIDEs(art::Ptr < recob::Hit > const& hit) ;
62 
63  const std::vector < int > HitToTrackIds(recob::Hit const& hit) ;
64 
65  const std::vector < sim::TrackIDE > HitToEveTrackIDEs(recob::Hit const& hit) ;
66  const std::vector < sim::TrackIDE > HitToEveTrackIDEs(art::Ptr < recob::Hit > const& hit) ;
67 
68  const std::vector < art::Ptr < recob::Hit > > TrackIdToHits_Ps( const int& tkId, std::vector < art::Ptr < recob::Hit > > const& hitsIn ) ;
69  const std::vector < art::Ptr < recob::Hit > > TrackIdToHits_Ps( const int& tkId ) ;
70 
71  const std::vector < std::vector < art::Ptr < recob::Hit > > > TrackIdsToHits_Ps( std::vector < int > const& tkIds, std:: vector < art::Ptr < recob::Hit > > const& hitsIn ) ;
72  const std::vector < std::vector < art::Ptr < recob::Hit > > > TrackIdsToHits_Ps( std::vector < int > const& tkIds ) ;
73 
74  const std::vector< sim::IDE > HitToAvgSimIDEs ( recob::Hit const& hit) ;
75  const std::vector< sim::IDE > HitToAvgSimIDEs ( art::Ptr<recob::Hit> hit) ;
76 
77  const std::vector< const sim::IDE* > HitToSimIDEs_Ps (recob::Hit const& hit) ;
78  const std::vector< const sim::IDE* > HitToSimIDEs_Ps (art::Ptr< recob::Hit > const& hit) ;
79 
80  const std::vector<double> SimIDEsToXYZ( std::vector< sim::IDE > const& ides) ;
81  const std::vector<double> SimIDEsToXYZ( std::vector< const sim::IDE* > const& ide_Ps) ;
82 
83  const std::vector<double> HitToXYZ(const recob::Hit& hit) ;
84  const std::vector<double> HitToXYZ(art::Ptr<recob::Hit> const& hit) ;
85 
86  const double HitCollectionPurity( std::set<int> const& trackIds, std::vector< art::Ptr<recob::Hit> > const& hits) ;
87  const double HitChargeCollectionPurity( std::set<int> const& trackIds, std::vector< art::Ptr<recob::Hit> > const& hits) ;
88 
89  const double HitCollectionEfficiency( 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) ;
90 
91  const double HitChargeCollectionEfficiency( std::set<int> trackIds, std::vector< art::Ptr<recob::Hit> > const& hits, std::vector< art::Ptr<recob::Hit> > const& allhits, geo::View_t const& view) ;
92 
93  const std::set<int> GetSetOfTrackIds() ;
94  const std::set<int> GetSetOfEveIds() ;
95 
96  const std::set<int> GetSetOfTrackIds( std::vector< art::Ptr< recob::Hit > > const& hits ) ;
97  const std::set<int> GetSetOfEveIds( std::vector< art::Ptr< recob::Hit > > const& hits ) ;
98 
99  const std::vector< double> SpacePointHitsToWeightedXYZ(std::vector<art::Ptr<recob::Hit>> const& hits);
100  const std::vector< art::Ptr< recob::Hit > > SpacePointToHits_Ps(art::Ptr<recob::SpacePoint> const& spt);
101  const std::vector< double > SpacePointToXYZ( art::Ptr< recob::SpacePoint > const& spt);
102 
103 
104 
105 
106 
107  private:
108  //FHICL parameters.
109  //The BackTracker service has no parameters.
110 
111  //Configure services
112 // cheat::BackTracker fBackTracker;
113 
114  const art::Event* fEvt=nullptr;
115 
116  //Prep functions go here.
117  void priv_PrepEvent ( const art::Event& evt );
118  void priv_PrepSimChannels (const art::Event& evt);
119 // void priv_PrepAllHitList ();
120  void priv_PrepFailed ();
121 
122  bool priv_CanRun (const art::Event& evt);
123 
125 // bool priv_AllHitListReady() { return BackTracker::AllHitListReady();}
126 
127 
128 
129 
130  }; //class BackTrackerService
131 
132 } //end namespace cheat
134 
135 
136 
137 #endif //CHEAT_BACKTRACKERSERVICESERVICE_H
const std::vector< std::vector< art::Ptr< recob::Hit > > > TrackIdsToHits_Ps(std::vector< int > const &tkIds, std::vector< art::Ptr< recob::Hit > > const &hitsIn)
const std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides)
const double HitChargeCollectionEfficiency(std::set< int > 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< double > HitToXYZ(const recob::Hit &hit)
const std::vector< sim::TrackIDE > HitToTrackIDEs(recob::Hit const &hit)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
fhicl::Table< BackTracker::fhiclConfig > BackTrackerTable
#define DECLARE_ART_SERVICE(svc, scope)
Definition: ServiceMacros.h:91
const std::set< int > GetSetOfEveIds()
const art::Ptr< sim::SimChannel > FindSimChannel(raw::ChannelID_t channel)
const std::vector< double > SpacePointToXYZ(art::Ptr< recob::SpacePoint > const &spt)
const std::vector< const sim::IDE * > HitToSimIDEs_Ps(recob::Hit const &hit)
const std::set< int > GetSetOfTrackIds()
const double HitChargeCollectionPurity(std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit > > const &hits)
const std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Access the description of detector geometry.
const std::vector< art::Ptr< recob::Hit > > SpacePointToHits_Ps(art::Ptr< recob::SpacePoint > const &spt)
void hits()
Definition: readHits.C:15
const std::vector< int > HitToTrackIds(recob::Hit const &hit)
void Rebuild(const art::Event &evt)
BackTrackerService(const fhicl::ParameterSet &pSet, art::ActivityRegistry &reg)
bool SimChannelsReady() const
Definition: BackTracker.h:86
void priv_PrepSimChannels(const art::Event &evt)
const provider_type * provider() const
const double HitCollectionEfficiency(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< double > SpacePointHitsToWeightedXYZ(std::vector< art::Ptr< recob::Hit >> const &hits)
Detector simulation of raw signals on wires.
bool priv_CanRun(const art::Event &evt)
void priv_PrepEvent(const art::Event &evt)
code to link reconstructed objects back to the MC truth information
Definition: BackTracker.cc:26
const double HitCollectionPurity(std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit > > const &hits)
const std::vector< sim::TrackIDE > HitToEveTrackIDEs(recob::Hit const &hit)
const std::vector< art::Ptr< recob::Hit > > TrackIdToHits_Ps(const int &tkId, std::vector< art::Ptr< recob::Hit > > const &hitsIn)
Header for the ParticleInvenotry Service Provider.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
const std::vector< art::Ptr< sim::SimChannel > > & SimChannels()
const std::vector< sim::TrackIDE > ChannelToTrackIDEs(raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time)
const std::vector< sim::IDE > HitToAvgSimIDEs(recob::Hit const &hit)
art framework interface to geometry description
BackTracker(const fhiclConfig &config, const cheat::ParticleInventory *partInv, const geo::GeometryCore *geom, const detinfo::DetectorClocks *detClock)
Definition: BackTracker.cc:29