All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PhotonBackTrackerService.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // \file: PhotonBackTrackerServiceService_service.cc
4 //
5 //jason.stock@mines.sdsmt.edu
6 //Based on the BackTracker_service by Brian Rebel
7 //
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef CHEAT_PHOTONBACKTRACKERSERVICESERVICE_H
10 #define CHEAT_PHOTONBACKTRACKERSERVICESERVICE_H
11 
16 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
17 #include "art/Persistency/Provenance/ScheduleContext.h"
18 
19 namespace art {
20  class ActivityRegistry;
21  class Event;
22 }
23 
24 #include "canvas/Persistency/Common/Ptr.h"
25 
26 #include "fhiclcpp/types/Comment.h"
27 #include "fhiclcpp/types/Name.h"
28 #include "fhiclcpp/types/Table.h"
29 
30 namespace fhicl {
31  class ParameterSet;
32 }
33 
34 #include <set>
35 #include <vector>
36 
37 namespace cheat{
39  {
40  public:
41  struct fhiclConfig{
42  fhicl::Table <PhotonBackTracker::fhiclConfig> PhotonBackTrackerTable{
43  fhicl::Name("PhotonBackTracker"),
44  fhicl::Comment("This if the fhicl configuration of the PhotonBackTracker service provider.")
45  };
46  };
47 
49  const provider_type* provider() const
50  {return static_cast<provider_type const*>(this);}
51 
52  PhotonBackTrackerService(fhicl::ParameterSet const& pSet, art::ActivityRegistry& reg);
53  PhotonBackTrackerService(fhiclConfig const& config, art::ActivityRegistry& reg);
54 
55  //Temporarily include a rebuild function until the lazy rebuild works.
56 
57  void Rebuild( art::Event const& evt);
58 
59  ///////////////////////////////////////////////
60  /////BackTracking Functions Implimentation/////
61  // This section contains the implimentation //
62  // of all PhotonBackTrackerService end user //
63  // functionality //
64  ///////////////////////////////////////////////
65 
66 
67  //----------------------------------------------------------------------
68  const std::vector< art::Ptr< sim::OpDetBacktrackerRecord >>& OpDetBTRs() ;
69  const double GetDelay();
70  const std::vector< const sim::SDP* > TrackIdToSimSDPs_Ps(int const& id);
71  const std::vector< const sim::SDP* > TrackIdToSimSDPs_Ps(int const& id, geo::View_t const& view);
72  art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBTR(int const& opDetNum);
73  const std::vector < sim::TrackSDP > OpDetToTrackSDPs( int const& OpDetNum,
74  double const& opHit_start_time, double const& opHit_end_time);
75  std::vector<sim::TrackSDP> OpHitToTrackSDPs(art::Ptr<recob::OpHit> const& opHit_P );
76  std::vector<sim::TrackSDP> OpHitToTrackSDPs(recob::OpHit const& opHit);
77  const std::vector < int > OpHitToTrackIds(recob::OpHit const& opHit);
78  const std::vector < int > OpHitToTrackIds(art::Ptr<recob::OpHit> const& opHit_P);
79  const std::vector < int > OpHitToEveTrackIds(recob::OpHit const& opHit);
80  const std::vector < int > OpHitToEveTrackIds(art::Ptr<recob::OpHit> const& opHit_P);
81  std::vector<sim::TrackSDP> OpHitToEveTrackSDPs(art::Ptr<recob::OpHit> const& opHit_P );
82  std::vector<sim::TrackSDP> OpHitToEveTrackSDPs(recob::OpHit const& opHit);
83  const std::vector<art::Ptr<recob::OpHit>> TrackIdToOpHits_Ps(int const& tkId, std::vector<art::Ptr<recob::OpHit>> const& hitsIn);
84  const std::vector<std::vector<art::Ptr<recob::OpHit>>> TrackIdsToOpHits_Ps(std::vector<int> const& tkIds, std::vector<art::Ptr<recob::OpHit>> const& hitsIn);
85  const std::vector< const sim::SDP* > OpHitToSimSDPs_Ps(recob::OpHit const& opHit) ;
86  const std::vector< const sim::SDP* > OpHitToSimSDPs_Ps(art::Ptr<recob::OpHit> const& opHit_P) ;
87 // const std::vector< sim::SDP > OpHitToChannelWeightedSimSDPs(art::Ptr<recob::OpHit> const& opHit_P);
88  const std::unordered_set< const sim::SDP* > OpHitToEveSimSDPs_Ps(recob::OpHit const& opHit) ;
89  const std::unordered_set< const sim::SDP* > OpHitToEveSimSDPs_Ps(art::Ptr<recob::OpHit>& opHit_P) ;
90  const std::vector< double> SimSDPsToXYZ(std::vector<sim::SDP> const& sdps ) const& ;
91  const std::vector< double> SimSDPsToXYZ(std::vector<const sim::SDP*> const& sdps_Ps);
92  const std::vector< double> OpHitToXYZ(recob::OpHit const& opHit);
93  const std::vector< double> OpHitToXYZ(art::Ptr<recob::OpHit> const& opHit_P);
94  const std::set< int> GetSetOfEveIds();
95  const std::set< int> GetSetOfTrackIds();
96  const std::set< int> GetSetOfEveIds(std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps);
97  const std::set< int> GetSetOfEveIds(const std::vector< recob::OpHit >& opHits);
98  const std::set< int> GetSetOfTrackIds(std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps);
99  const std::set< int> GetSetOfTrackIds(std::vector< recob::OpHit > const& opHits);
100  const double OpHitCollectionPurity(std::set<int> const& tkIds,
101  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps);
102  const double OpHitLightCollectionPurity(std::set<int> const& tkIds,
103  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps);
104  const double OpHitCollectionEfficiency(std::set<int> const& tkIds,
105  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
106  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps,
107  geo::View_t const& view);
108  const double OpHitCollectionEfficiency(std::set<int> const& tkIds,
109  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
110  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps);
111  const double OpHitLightCollectionEfficiency(std::set<int> const& tkIds,
112  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
113  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps,
114  geo::View_t const& view);
115  const double OpHitLightCollectionEfficiency(std::set<int> const& tkIds,
116  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
117  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps);
118  const double OpHitChargeCollectionEfficiency(std::set<int> const& tkIds,
119  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
120  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps) { return PhotonBackTracker::OpHitLightCollectionEfficiency(tkIds, opHits_Ps, opHitsIn_Ps); }//Exists only temporarily. Is deprecated.
121  const std::set<int> OpFlashToTrackIds(art::Ptr<recob::OpFlash>& flash_P) const;
122  const std::vector < art::Ptr< recob::OpHit> > OpFlashToOpHits_Ps ( art::Ptr < recob::OpFlash > & flash_P );
123  const std::vector < double > OpFlashToXYZ ( art::Ptr < recob::OpFlash > & flash_P );
124 
125 
126 
127  private:
128  //The PhotonBackTrackerService has no parameters.
129 
130  void priv_PrepEvent(art::Event const& evt, art::ScheduleContext) ;
131  void priv_PrepFailed();
132  void priv_PrepOpDetBTRs(art::Event const& evt);
133  void priv_PrepOpFlashToOpHits(art::Event const& evt);
134 
135  bool priv_CanRun(art::Event const& evt);
138 
139  }; //Class PhotonBackTrackerService
140 
141 
142 
143  //----------------------------------------------------------------------
144 } // namespace
145 DECLARE_ART_SERVICE(cheat::PhotonBackTrackerService, LEGACY)
146 
147 #endif //CHEAT_PHOTONBACKTRACKERSERVICESERVICE_H
art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBTR(int const &opDetNum)
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P)
const double OpHitLightCollectionPurity(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps)
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps(recob::OpHit const &opHit)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const std::unordered_set< const sim::SDP * > OpHitToEveSimSDPs_Ps(recob::OpHit const &opHit)
const std::vector< double > SimSDPsToXYZ(std::vector< sim::SDP > const &sdps) const &
const std::vector< art::Ptr< recob::OpHit > > TrackIdToOpHits_Ps(int const &tkId, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
const std::vector< int > OpHitToEveTrackIds(recob::OpHit const &opHit)
bool priv_CanRun(art::Event const &evt)
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIdsToOpHits_Ps(std::vector< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
const double OpHitCollectionPurity(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps)
void priv_PrepOpDetBTRs(art::Event const &evt)
const std::vector< double > OpHitToXYZ(recob::OpHit const &opHit)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
const std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > & OpDetBTRs()
const double OpHitChargeCollectionEfficiency(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps, std::vector< art::Ptr< recob::OpHit > > const &opHitsIn_Ps)
void Rebuild(art::Event const &evt)
const double OpHitLightCollectionEfficiency(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits, std::vector< art::Ptr< recob::OpHit > > const &opHitsIn)
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
BEGIN_PROLOG vertical distance to the surface Name
back track the reconstruction to the simulation
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps(int const &id)
Definition of data types for geometry description.
const provider_type * provider() const
fhicl::Table< PhotonBackTracker::fhiclConfig > PhotonBackTrackerTable
const std::vector< sim::TrackSDP > OpDetToTrackSDPs(int const &OpDetNum, double const &opHit_start_time, double const &opHit_end_time)
const double OpHitLightCollectionEfficiency(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps, std::vector< art::Ptr< recob::OpHit > > const &opHitsIn_Ps, geo::View_t const &view)
const std::vector< double > OpFlashToXYZ(art::Ptr< recob::OpFlash > &flash_P)
const double OpHitCollectionEfficiency(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps, std::vector< art::Ptr< recob::OpHit > > const &opHitsIn_Ps, geo::View_t const &view)
PhotonBackTracker(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
PhotonBackTrackerService(fhicl::ParameterSet const &pSet, art::ActivityRegistry &reg)
void priv_PrepEvent(art::Event const &evt, art::ScheduleContext)
const std::vector< int > OpHitToTrackIds(recob::OpHit const &opHit)
TCEvent evt
Definition: DataStructs.cxx:8
const std::set< int > OpFlashToTrackIds(art::Ptr< recob::OpFlash > &flash_P) const
std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
const bool OpFlashToOpHitsReady()
void priv_PrepOpFlashToOpHits(art::Event const &evt)