LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PhotonBackTrackerService_service.cc
Go to the documentation of this file.
1 //
3 // \file PhotonBackTrackerServiceService_service.cc
4 // \brief This is the LArSoft facing implimentation of the PhotonBackTracker.
5 // \author jason.stock@mines.sdsmt.edu
6 //
7 //
9 
11 
12 //CPP includes
13 #include <map>
14 
15 // Framework includes
17 
18 // LArSoft includes
21 
22 //#include "lardata/Utilities/AssociationUtil.h"
23 //#include "lardataobj/Simulation/sim.h"
24 
25 namespace cheat{
26 
27  //----------------------------------------------------------------------
30  pSet.get<fhicl::ParameterSet>("PhotonBackTracker"),
32  lar::providerFrom<geo::Geometry>()//,
33 // lar::providerFrom<detinfo::DetectorClocksService>()
34  )
35  {
37  }
38 
39  //----------------------------------------------------------------------
42  config.PhotonBackTrackerTable(),
44  lar::providerFrom<geo::Geometry>()//,
45 // lar::providerFrom<detinfo::DetectorClocksService>()
46  )
47  {
49  }
50 
57 
58 
59  //----------------------------------------------------------------------
61  {
62  this->priv_PrepEvent(evt);
63  }
64 
65  //----------------------------------------------------------------------
67  {
69  if( ! this->priv_CanRun(evt) ){ return; }
70  this->priv_PrepOpDetBTRs(evt);
71  this->priv_PrepOpFlashToOpHits(evt);
72  }
73 
74  //----------------------------------------------------------------------
76  return PhotonBackTracker::CanRun(evt);
77  }
78 
79  //----------------------------------------------------------------------
81  throw cet::exception("PhotonBackTrackerService")
82  <<"The called Prep Fucntion failed. This is most likely due "
83  <<"to a PhotonBackTracker fucntion being used on a file that "
84  <<"is real data.";
85  }
86 
87  //----------------------------------------------------------------------
89  if( !this->priv_CanRun(evt) ) {this->priv_PrepFailed(); }
90  if( this->priv_OpDetBTRsReady()){ return; }
92  //catch(...){ mf::LogWarning("PhotonBackTrackerService")//This needs to go. Catch all should not be used.
93  catch(cet::exception e){//This needs to go. Make it specific if there is a really an exception we would like to catch.
94  mf::LogWarning("PhotonBackTrackerService")
95  <<"Rebuild failed to get the OpDetBTRs. This is expected when "
96  <<"running on a generation or simulation step.";}
97  }
98 
100  if( !this->priv_CanRun(evt) ) {this->priv_PrepFailed();}
101  if( this->priv_OpFlashToOpHitsReady()){ return; }
103  //catch(...){ //This needs to go. Catch all should not be used.
104  catch(cet::exception e){//This needs to go. Make it specific if there is a really an exception we would like to catch.
105  mf::LogWarning("PhotonBackTrackerService")
106  <<"Rebuild failed to get the OpFlashToOpHits. This is expected when "
107  <<"running on a generation or simulation stage.";
108  }
109  }
110 
112  // End of the Event Rebuild Implimentation //
114 
117  // This section contains the implimentation //
118  // of all PhotonBackTrackerService end user //
119  // functionality //
121 
122 
123  //----------------------------------------------------------------------
124  const std::vector< art::Ptr< sim::OpDetBacktrackerRecord >>& PhotonBackTrackerService::OpDetBTRs()
125  {
127  }
128 
129  //----------------------------------------------------------------------
131 
132  //----------------------------------------------------------------------
133  const std::vector< const sim::SDP* > PhotonBackTrackerService::TrackIdToSimSDPs_Ps(int const& id)
134  {
136  }
137 
138  //----------------------------------------------------------------------
139  const std::vector< const sim::SDP* > PhotonBackTrackerService::TrackIdToSimSDPs_Ps(int const& id, geo::View_t const& view )
140  {
142  }
143 
144  //----------------------------------------------------------------------
146  {
147  return PhotonBackTracker::FindOpDetBTR(opDetNum);
148  }
149 
150  //----------------------------------------------------------------------
151  const std::vector < sim::TrackSDP > PhotonBackTrackerService::OpDetToTrackSDPs( int const& OpDetNum,
152  double const& opHit_start_time,
153  double const& opHit_end_time)
154  {
155  return PhotonBackTracker::OpDetToTrackSDPs(OpDetNum, opHit_start_time, opHit_end_time);
156  }
157 
158  //----------------------------------------------------------------------
159  std::vector<sim::TrackSDP> PhotonBackTrackerService::OpHitToTrackSDPs(art::Ptr<recob::OpHit> const& opHit_P )
160  {
161  return PhotonBackTracker::OpHitToTrackSDPs(opHit_P );
162  }
163 
164  //----------------------------------------------------------------------
165  std::vector<sim::TrackSDP> PhotonBackTrackerService::OpHitToTrackSDPs(recob::OpHit const& opHit)
166  {
168  }
169 
170  //----------------------------------------------------------------------
171  const std::vector < int > PhotonBackTrackerService::OpHitToTrackIds(recob::OpHit const& opHit) {
173  }
174 
175  //----------------------------------------------------------------------
176  const std::vector < int > PhotonBackTrackerService::OpHitToTrackIds(art::Ptr<recob::OpHit> const& opHit_P) {
177  return PhotonBackTracker::OpHitToTrackIds(opHit_P);
178  }
179 
180  //----------------------------------------------------------------------
181  //----------------------------------------------------------------------
182  const std::vector < int > PhotonBackTrackerService::OpHitToEveTrackIds(recob::OpHit const& opHit) {
184  }
185 
186  //----------------------------------------------------------------------
187  const std::vector < int > PhotonBackTrackerService::OpHitToEveTrackIds(art::Ptr<recob::OpHit> const& opHit_P) {
189  }
190 
191  //----------------------------------------------------------------------
192  std::vector<sim::TrackSDP> PhotonBackTrackerService::OpHitToEveTrackSDPs(art::Ptr<recob::OpHit> const& opHit_P )
193  {
195  }
196 
197  //----------------------------------------------------------------------
198  std::vector<sim::TrackSDP> PhotonBackTrackerService::OpHitToEveTrackSDPs(recob::OpHit const& opHit)
199  {
201  }
202 
203  //----------------------------------------------------------------------
204  const std::vector<art::Ptr<recob::OpHit>> PhotonBackTrackerService::TrackIdToOpHits_Ps(int const& tkId, std::vector<art::Ptr<recob::OpHit>> const& hitsIn)
205  {
206  return PhotonBackTracker::TrackIdToOpHits_Ps(tkId, hitsIn);
207  }
208 
209  //----------------------------------------------------------------------
210  const std::vector<std::vector<art::Ptr<recob::OpHit>>> PhotonBackTrackerService::TrackIdsToOpHits_Ps(std::vector<int> const& tkIds, std::vector<art::Ptr<recob::OpHit>> const& hitsIn)
211  {
212  return PhotonBackTracker::TrackIdsToOpHits_Ps(tkIds, hitsIn);
213  }
214 
215  //----------------------------------------------------------------------
216  const std::vector< const sim::SDP* > PhotonBackTrackerService::OpHitToSimSDPs_Ps(recob::OpHit const& opHit)
217  {
219  }
220 
221  //----------------------------------------------------------------------
222  const std::vector< const sim::SDP* > PhotonBackTrackerService::OpHitToSimSDPs_Ps(art::Ptr<recob::OpHit> const& opHit_P)
223  {
224  return PhotonBackTracker::OpHitToSimSDPs_Ps(opHit_P);
225  }
226 
227  //----------------------------------------------------------------------
228  /*
229  const std::vector< sim::SDP > PhotonBackTrackerService::OpHitToChannelWeightedSimSDPs(art::Ptr<recob::OpHit> const& opHit_P)
230  {
231  return PhotonBackTracker::OpHitToChannelWeightedSimSDPs(opHit_P);
232  }*/
233 
234  //----------------------------------------------------------------------
235  const std::unordered_set< const sim::SDP* > PhotonBackTrackerService::OpHitToEveSimSDPs_Ps(recob::OpHit const& opHit)
236  {
238  }
239 
240  //----------------------------------------------------------------------
241  const std::unordered_set< const sim::SDP* > PhotonBackTrackerService::OpHitToEveSimSDPs_Ps(art::Ptr<recob::OpHit> & opHit_P)
242  {
244  }
245 
246  //----------------------------------------------------------------------
247  const std::vector< double> PhotonBackTrackerService::SimSDPsToXYZ(std::vector<sim::SDP> const& sdps) const&
248  {
249  return PhotonBackTracker::SimSDPsToXYZ(sdps);
250  }
251 
252  //----------------------------------------------------------------------
253  const std::vector< double> PhotonBackTrackerService::SimSDPsToXYZ(std::vector<const sim::SDP*> const& sdps_Ps )
254  {
255  return PhotonBackTracker::SimSDPsToXYZ(sdps_Ps);
256  }
257 
258  //----------------------------------------------------------------------
259  const std::vector< double> PhotonBackTrackerService::OpHitToXYZ(recob::OpHit const& opHit)
260  {
261  return PhotonBackTracker::OpHitToXYZ(opHit);
262  }
263 
264  //----------------------------------------------------------------------
265  const std::vector< double> PhotonBackTrackerService::OpHitToXYZ(art::Ptr<recob::OpHit> const& opHit_P)
266  {
267  return PhotonBackTracker::OpHitToXYZ(opHit_P);
268  }
269 
270  //----------------------------------------------------------------------
272  {
274  }
275 
276  //----------------------------------------------------------------------
278  {
280  }
281 
282  //----------------------------------------------------------------------
284  {
285  return PhotonBackTracker::GetSetOfEveIds(opHits_Ps);
286  }
287  //----------------------------------------------------------------------
288  const std::set< int> PhotonBackTrackerService::GetSetOfEveIds(std::vector< recob::OpHit > const& opHits)
289  {
290  return PhotonBackTracker::GetSetOfEveIds(opHits);
291  }
292 
293  //----------------------------------------------------------------------
295  {
296  return PhotonBackTracker::GetSetOfTrackIds(opHits_Ps);
297  }
298  //----------------------------------------------------------------------
299  const std::set< int> PhotonBackTrackerService::GetSetOfTrackIds(std::vector< recob::OpHit > const& opHits)
300  {
302  }
303 
304  //----------------------------------------------------------------------
305  const double PhotonBackTrackerService::OpHitCollectionPurity(std::set<int> const& tkIds,
306  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps)
307  {
308  return PhotonBackTracker::OpHitCollectionPurity(tkIds, opHits_Ps);
309  }
310 
311  //----------------------------------------------------------------------
312  const double PhotonBackTrackerService::OpHitLightCollectionPurity(std::set<int> const& tkIds,
313  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps)
314  {
315  return PhotonBackTracker::OpHitLightCollectionPurity(tkIds, opHits_Ps);
316  }
317 
318 
319  //----------------------------------------------------------------------
320  const double PhotonBackTrackerService::OpHitCollectionEfficiency(std::set<int> const& tkIds,
321  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
322  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps,
323  geo::View_t const& view)
324  {
325  throw cet::exception("PhotonBackTrackerService")<<"This function is not supported. OpHits do not have type View.\n";
326  }
327 
328  //----------------------------------------------------------------------
329  const double PhotonBackTrackerService::OpHitCollectionEfficiency(std::set<int> const& tkIds,
330  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
331  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps)
332  {
333  return PhotonBackTracker::OpHitCollectionEfficiency(tkIds, opHits_Ps, opHitsIn_Ps);
334  }
335 
336  //----------------------------------------------------------------------
337  const double PhotonBackTrackerService::OpHitLightCollectionEfficiency(std::set<int> const& tkIds,
338  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
339  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps,
340  geo::View_t const& view)
341  {
342  throw cet::exception("PhotonBackTrackerService")<<"This function is not supported. OpHits do not have type View.\n";
343  }
344 
345  //----------------------------------------------------------------------
346  const double PhotonBackTrackerService::OpHitLightCollectionEfficiency(std::set<int> const& tkIds,
347  std::vector< art::Ptr<recob::OpHit> > const& opHits_Ps,
348  std::vector< art::Ptr<recob::OpHit> > const& opHitsIn_Ps)
349  {
350  return PhotonBackTracker::OpHitLightCollectionEfficiency(tkIds, opHits_Ps, opHitsIn_Ps);
351  }
352 
353  //----------------------------------------------------------------------
355  return PhotonBackTracker::OpFlashToTrackIds( flash_P);
356  }
357 
358  //----------------------------------------------------------------------
359  const std::vector < art::Ptr< recob::OpHit > > PhotonBackTrackerService::OpFlashToOpHits_Ps ( art::Ptr < recob::OpFlash > & flash_P ){
360  return PhotonBackTracker::OpFlashToOpHits_Ps( flash_P);
361  }
362 
363  //----------------------------------------------------------------------
364  const std::vector < double > PhotonBackTrackerService::OpFlashToXYZ ( art::Ptr < recob::OpFlash > & flash_P ){
365  return PhotonBackTracker::OpFlashToXYZ( flash_P );
366  }
367 
368 
370  //-------------------------------------------------------------------
371  } // namespace
372 
const art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBTR(int const &opDetNum) const
art::Ptr< sim::OpDetBacktrackerRecord > FindOpDetBTR(int const &opDetNum)
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P)
const std::unordered_set< const sim::SDP * > OpHitToEveSimSDPs_Ps(recob::OpHit const &opHit)
const std::vector< art::Ptr< recob::OpHit > > TrackIdToOpHits_Ps(int const &tkId, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
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)
const bool CanRun(Evt const &evt)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
T::provider_type const * providerFrom()
Returns a constant pointer to the provider of specified service.
Definition: ServiceUtil.h:77
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
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)
std::vector< double > SimSDPsToXYZ(std::vector< sim::SDP > const &sdps)
void PrepOpFlashToOpHits(Evt const &evt)
const std::vector< int > OpHitToEveTrackIds(recob::OpHit const &opHit)
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps(int const &id)
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIdsToOpHits_Ps(std::vector< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
double OpHitCollectionPurity(std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit > > const &hits)
const double OpHitCollectionPurity(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps)
const std::vector< double > OpHitToXYZ(recob::OpHit const &opHit)
std::vector< double > OpHitToXYZ(art::Ptr< recob::OpHit > const &hit)
const std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P) const
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< sim::OpDetBacktrackerRecord > > & OpDetBTRs()
const std::set< int > OpFlashToTrackIds(art::Ptr< recob::OpFlash > &flash_P) const
const std::set< int > GetSetOfEveIds() const
const std::vector< std::vector< art::Ptr< recob::OpHit > > > TrackIdsToOpHits_Ps(std::vector< int > const &tkIds, std::vector< art::Ptr< recob::OpHit >> const &hitsIn)
void PrepOpDetBTRs(Evt const &evt)
parameter set interface
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)
double OpHitCollectionEfficiency(std::set< int > trackIDs, std::vector< art::Ptr< recob::OpHit > > const &hits, std::vector< art::Ptr< recob::OpHit > > const &allhits)
const std::vector< const sim::SDP * > TrackIdToSimSDPs_Ps(int const &id)
const double OpHitLightCollectionPurity(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits)
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< int > OpHitToEveTrackIds(recob::OpHit const &opHit)
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)
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &hit)
code to link reconstructed objects back to the MC truth information
Definition: BackTracker.cc:26
const std::set< int > GetSetOfTrackIds() const
const std::vector< int > OpHitToTrackIds(recob::OpHit const &opHit) const
LArSoft-specific namespace.
PhotonBackTrackerService(fhicl::ParameterSet const &pSet, art::ActivityRegistry &reg)
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> sPreProcessEvent
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
const std::vector< const sim::SDP * > OpHitToSimSDPs_Ps(recob::OpHit const &opHit) const
const std::vector< int > OpHitToTrackIds(recob::OpHit const &opHit)
std::vector< art::Ptr< sim::OpDetBacktrackerRecord > > const & OpDetBTRs()
TCEvent evt
Definition: DataStructs.cxx:5
const std::set< int > OpFlashToTrackIds(art::Ptr< recob::OpFlash > &flash_P) const
const std::vector< double > OpFlashToXYZ(art::Ptr< recob::OpFlash > &flash_P) const
Float_t e
Definition: plot.C:34
std::vector< sim::TrackSDP > OpHitToEveTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
Namespace collecting geometry-related classes utilities.
const std::vector< sim::TrackSDP > OpDetToTrackSDPs(int const &OpDetNum, double const &opHit_start_time, double const &opHit_end_time) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P) const
void priv_PrepOpFlashToOpHits(art::Event const &evt)