All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlashHypothesisCreator.cxx
Go to the documentation of this file.
1 /*!
2  * Title: FlashHypothesis Creator Class
3  * Author: Wes Ketchum (wketchum@lanl.gov)
4  *
5  * Description: Class that produces a flash hypothesis for a trajectory.
6  * Input: Trajectory (std::vector<TVector3> objects)
7  * Output: FlashHypotheses
8 */
9 
10 #include "FlashHypothesisCreator.h"
11 #include "OpDigiProperties.h"
12 
18 
21  std::vector<float> const& dEdxVector,
22  Providers_t providers,
24  opdet::OpDigiProperties const& opdigip,
25  float XOffset)
26 {
27  bool interpolate_dEdx=false;
28  if(track.NumberTrajectoryPoints() == dEdxVector.size())
29  interpolate_dEdx=true;
30  else if(track.NumberTrajectoryPoints() == dEdxVector.size()+1)
31  interpolate_dEdx=false;
32  else
33  throw "ERROR in FlashHypothesisCreator: dEdx vector size not compatible with track size.";
34 
35  auto const* geom = providers.get<geo::GeometryCore>();
36  FlashHypothesisCollection fhc(geom->NOpDets());
37  for(size_t pt=1; pt<track.NumberTrajectoryPoints(); pt++){
38  if(interpolate_dEdx)
39  fhc = fhc + CreateFlashHypothesesFromSegment(track.LocationAtPoint<TVector3>(pt-1),
40  track.LocationAtPoint<TVector3>(pt),
41  0.5*(dEdxVector[pt]+dEdxVector[pt-1]),
42  providers,pvs,opdigip,XOffset);
43  else
44  fhc = fhc + CreateFlashHypothesesFromSegment(track.LocationAtPoint<TVector3>(pt-1),
45  track.LocationAtPoint<TVector3>(pt),
46  dEdxVector[pt-1],
47  providers,pvs,opdigip,XOffset);
48  }
49  return fhc;
50 }
51 
54  std::vector<float> const& dEdxVector,
55  Providers_t providers,
57  opdet::OpDigiProperties const& opdigip,
58  float XOffset)
59 {
60  bool interpolate_dEdx=false;
61  if(mctrack.size() == dEdxVector.size())
62  interpolate_dEdx=true;
63  else if(mctrack.size() == dEdxVector.size()+1)
64  interpolate_dEdx=false;
65  else
66  throw "ERROR in FlashHypothesisCreator: dEdx vector size not compatible with mctrack size.";
67 
68  auto const* geom = providers.get<geo::GeometryCore>();
69  FlashHypothesisCollection fhc(geom->NOpDets());
70  for(size_t pt=1; pt<mctrack.size(); pt++){
71  if(interpolate_dEdx)
72  fhc = fhc + CreateFlashHypothesesFromSegment(mctrack[pt-1].Position().Vect(),
73  mctrack[pt].Position().Vect(),
74  0.5*(dEdxVector[pt]+dEdxVector[pt-1]),
75  providers,pvs,opdigip,XOffset);
76  else
77  fhc = fhc + CreateFlashHypothesesFromSegment(mctrack[pt-1].Position().Vect(),
78  mctrack[pt].Position().Vect(),
79  dEdxVector[pt-1],
80  providers,pvs,opdigip,XOffset);
81  }
82  return fhc;
83 }
84 
86 opdet::FlashHypothesisCreator::GetFlashHypothesisCollection(std::vector<TVector3> const& trajVector,
87  std::vector<float> const& dEdxVector,
88  Providers_t providers,
90  opdet::OpDigiProperties const& opdigip,
91  float XOffset)
92 {
93  bool interpolate_dEdx=false;
94  if(trajVector.size() == dEdxVector.size())
95  interpolate_dEdx=true;
96  else if(trajVector.size() == dEdxVector.size()+1)
97  interpolate_dEdx=false;
98  else
99  throw "ERROR in FlashHypothesisCreator: dEdx vector size not compatible with trajVector size.";
100 
101  auto const* geom = providers.get<geo::GeometryCore>();
102  FlashHypothesisCollection fhc(geom->NOpDets());
103  for(size_t pt=1; pt<trajVector.size(); pt++){
104  if(interpolate_dEdx)
105  fhc = fhc + CreateFlashHypothesesFromSegment(trajVector[pt-1],
106  trajVector[pt],
107  0.5*(dEdxVector[pt]+dEdxVector[pt-1]),
108  providers,pvs,opdigip,XOffset);
109  else
110  fhc = fhc + CreateFlashHypothesesFromSegment(trajVector[pt-1],
111  trajVector[pt],
112  dEdxVector[pt-1],
113  providers,pvs,opdigip,XOffset);
114  }
115  return fhc;
116 }
117 
119 opdet::FlashHypothesisCreator::GetFlashHypothesisCollection(TVector3 const& pt1, TVector3 const& pt2,
120  float const& dEdx,
121  Providers_t providers,
123  opdet::OpDigiProperties const& opdigip,
124  float XOffset)
125 {
126  return CreateFlashHypothesesFromSegment(pt1,pt2,dEdx,providers,pvs,opdigip,XOffset);
127 }
128 
131  float const& dEdx,
132  Providers_t providers,
134  opdet::OpDigiProperties const& opdigip,
135  float XOffset)
136 {
137  auto const* geom = providers.get<geo::GeometryCore>();
138  auto const* larp = providers.get<detinfo::LArProperties>();
139  auto const nOpDets = geom->NOpDets();
140  FlashHypothesisCollection fhc(nOpDets);
141 
142  FlashHypothesis prompt_hyp = FlashHypothesis(nOpDets);
143 
144  std::vector<double> xyz_segment(_calc.SegmentMidpoint(pt1,pt2,XOffset));
145 
146  //get the visibility vector
147  auto const& PointVisibility = pvs.GetAllVisibilities(&xyz_segment[0]);
148 
149  //check visibility pointer, as it may be null if given a y/z outside some range
150  if (!PointVisibility) return fhc;
151 
152  //klugey ... right now, set a qe_vector that gives constant qe across all opdets
153  std::vector<float> qe_vector(nOpDets,opdigip.QE());
154  _calc.FillFlashHypothesis(larp->ScintYield()*larp->ScintYieldRatio(),
155  dEdx,
156  pt1,pt2,
157  qe_vector,
158  PointVisibility,
159  prompt_hyp);
160 
161  fhc.SetPromptHypAndPromptFraction(prompt_hyp,larp->ScintYieldRatio());
162  return fhc;
163 }
FlashHypothesisCollection GetFlashHypothesisCollection(recob::Track const &track, std::vector< float > const &dEdxVector, Providers_t providers, phot::PhotonVisibilityService const &pvs, opdet::OpDigiProperties const &opdigip, float XOffset=0)
Point_t const & LocationAtPoint(size_t i) const
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
double QE() const noexcept
Returns quantum efficiency.
Provider const * get() const
Returns the provider with the specified type.
Definition: ProviderPack.h:193
process_name use argoneut_mc_hitfinder track
Description of geometry of one entire detector.
Class def header for mctrack data container.
MappedCounts_t GetAllVisibilities(Point const &p, bool wantReflected=false) const
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
Provides recob::Track data product.
void SetPromptHypAndPromptFraction(const FlashHypothesis &prompt, float frac)
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
FlashHypothesisCollection CreateFlashHypothesesFromSegment(TVector3 const &pt1, TVector3 const &pt2, float const &dEdx, Providers_t providers, phot::PhotonVisibilityService const &pvs, opdet::OpDigiProperties const &opdigip, float XOffset)
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track: