23 : caloAlg(p.
get<
fhicl::ParameterSet>(
"CalorimetryAlg"))
32 std::vector<recob::Track>
const& trackVector,
33 std::vector<recob::Hit>
const& hitVector,
34 std::vector<std::vector<size_t>>
const& hit_indices_per_track,
35 std::vector<anab::Calorimetry>& caloVector,
36 std::vector<size_t>& assnTrackCaloVector,
42 for (
size_t i_track = 0; i_track < trackVector.size(); i_track++) {
48 std::vector<std::vector<size_t>> hit_indices_per_plane(geom.Nplanes());
49 for (
auto const& i_hit : hit_indices_per_track[i_track])
50 hit_indices_per_plane[hitVector[i_hit].WireID().Plane].push_back(i_hit);
53 for (
size_t i_plane = 0; i_plane < geom.Nplanes(); i_plane++) {
59 std::vector<std::pair<geo::WireID, float>> traj_points_in_plane(
64 traj_points_in_plane[i_trjpt] =
65 std::make_pair(geom.NearestWireID(track.
LocationAtPoint(i_trjpt), i_plane), tick);
70 for (
auto const& i_hit : hit_indices_per_plane[i_plane])
76 path_length_fraction_vec,
77 HitPropertiesMultiset,
83 HitPropertiesMultiset, track, i_track, caloVector, assnTrackCaloVector, planeID);
95 operator()(std::pair<geo::WireID, float> i, std::pair<geo::WireID, float> j)
97 float dw_i = ((
int)(i.first.Wire) - (
int)(
hit.WireID().Wire)) * geom.WirePitch(i.first.Plane);
98 float dw_j = ((
int)(j.first.Wire) - (
int)(
hit.WireID().Wire)) * geom.WirePitch(j.first.Plane);
99 float dt_i = i.second -
hit.PeakTime();
100 float dt_j = j.second -
hit.PeakTime();
115 float cumulative_path_length = 0;
116 const float total_path_length = track.
Length();
119 trk_path_length_frac_vec[i_trj] = cumulative_path_length / total_path_length;
122 return trk_path_length_frac_vec;
131 std::vector<std::pair<geo::WireID, float>>
const& traj_points_in_plane,
132 std::vector<float>
const& path_length_fraction_vec,
137 size_t traj_iter =
std::distance(traj_points_in_plane.begin(),
138 std::min_element(traj_points_in_plane.begin(),
139 traj_points_in_plane.end(),
143 HitPropertiesMultiset.emplace(hit.
Integral(),
148 path_length_fraction_vec[traj_iter]);
157 float charge_start = 0, charge_end = 0;
160 charge_start += (*it_hpm).charge;
166 for (HitPropertiesMultiset_t::reverse_iterator it_hpm = hpm.rbegin(); it_hpm != hpm.rend();
168 charge_end += (*it_hpm).charge;
173 return (charge_start > charge_end);
179 size_t const& i_track,
180 std::vector<anab::Calorimetry>& caloVector,
181 std::vector<size_t>& assnTrackCaloVector,
184 size_t n_hits = hpm.size();
185 std::vector<float> dEdxVector, dQdxVector, resRangeVector, deadWireVector, pitchVector;
186 std::vector<TVector3> XYZVector;
188 dEdxVector.reserve(n_hits);
189 dQdxVector.reserve(n_hits);
190 resRangeVector.reserve(n_hits);
191 deadWireVector.reserve(n_hits);
192 pitchVector.reserve(n_hits);
193 XYZVector.reserve(n_hits);
195 float kinetic_energy = 0, track_length = track.
Length();
199 dEdxVector.push_back((*it_hpm).dEdx);
200 dQdxVector.push_back((*it_hpm).dQdx);
201 resRangeVector.push_back((*it_hpm).path_fraction * track_length);
202 pitchVector.push_back((*it_hpm).pitch);
203 XYZVector.push_back((*it_hpm).xyz);
204 kinetic_energy += dEdxVector.back() * pitchVector.back();
209 for (HitPropertiesMultiset_t::reverse_iterator it_hpm = hpm.rbegin(); it_hpm != hpm.rend();
211 dEdxVector.push_back((*it_hpm).dEdx);
212 dQdxVector.push_back((*it_hpm).dQdx);
213 resRangeVector.push_back((1 - (*it_hpm).path_fraction) * track_length);
214 pitchVector.push_back((*it_hpm).pitch);
215 XYZVector.push_back((*it_hpm).xyz);
216 kinetic_energy += dEdxVector.back() * pitchVector.back();
220 caloVector.emplace_back(kinetic_energy,
229 assnTrackCaloVector.emplace_back(i_track);
236 for (
auto const&
hit : hpm)
geo::GeometryCore const & geom
static constexpr double g
geo::WireID WireID() const
bool IsInvertedTrack(HitPropertiesMultiset_t const &)
Point_t const & LocationAtPoint(size_t i) const
void MakeCalorimetryObject(HitPropertiesMultiset_t const &hpm, recob::Track const &track, size_t const &i_track, std::vector< anab::Calorimetry > &caloVector, std::vector< size_t > &assnTrackCaloVector, geo::PlaneID const &planeID)
void ExtractCalorimetry(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, std::vector< recob::Track > const &, std::vector< recob::Hit > const &, std::vector< std::vector< size_t >> const &, std::vector< anab::Calorimetry > &, std::vector< size_t > &, Providers_t providers)
The data type to uniquely identify a Plane.
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Provider const * get() const
Returns the provider with the specified type.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
std::multiset< HitProperties, HitPropertySorter > HitPropertiesMultiset_t
dist_projected(recob::Hit const &h, geo::GeometryCore const &g)
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< float > CreatePathLengthFractionVector(recob::Track const &track)
double Length(size_t p=0) const
Access to various track properties.
bool operator()(std::pair< geo::WireID, float > i, std::pair< geo::WireID, float > j)
void PrintHitPropertiesMultiset(HitPropertiesMultiset_t const &hpm)
T get(std::string const &key) const
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
double ConvertXToTicks(double X, int p, int t, int c) const
void ReserveInternalVectors(size_t s)
std::vector< Point_t > convertCollToPoint(std::vector< Point > const &coll)
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
void AnalyzeHit(detinfo::DetectorClocksData const &, detinfo::DetectorPropertiesData const &, recob::Hit const &, recob::Track const &, std::vector< std::pair< geo::WireID, float >> const &, std::vector< float > const &, HitPropertiesMultiset_t &, geo::GeometryCore const &)
Declaration of signal hit object.
TrackCalorimetryAlg(fhicl::ParameterSet const &p)
Contains all timing reference information for the detector.
void ClearInternalVectors()
Container for a list of pointers to providers.
unsigned int fNHitsToDetermineStart
double TrackPitchInView(recob::Track const &track, geo::View_t view, size_t trajectory_point=0U)
Returns the projected length of track on a wire pitch step [cm].
Provides recob::Track data product.
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
2D representation of charge deposited in the TDC/wire plane
auto const & get(AssnsNode< L, R, D > const &r)
Utility functions to extract information from recob::Track
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
QTextStream & endl(QTextStream &s)