23 : caloAlg(p.
get<
fhicl::ParameterSet>(
"CalorimetryAlg"))
31 std::vector<recob::Track>
const& trackVector,
32 std::vector<recob::Hit>
const& hitVector,
33 std::vector<std::vector<size_t>>
const& hit_indices_per_track,
34 std::vector<anab::Calorimetry>& caloVector,
35 std::vector<size_t>& assnTrackCaloVector,
41 for (
size_t i_track = 0; i_track < trackVector.size(); i_track++) {
47 std::vector<std::vector<size_t>> hit_indices_per_plane(geom.Nplanes());
48 for (
auto const& i_hit : hit_indices_per_track[i_track])
49 hit_indices_per_plane[hitVector[i_hit].WireID().Plane].push_back(i_hit);
52 for (
unsigned int i_plane = 0; i_plane < geom.Nplanes(); ++i_plane) {
56 std::vector<std::pair<geo::WireID, float>> traj_points_in_plane(
61 traj_points_in_plane[i_trjpt] =
62 std::make_pair(geom.NearestWireID(track.
LocationAtPoint(i_trjpt), planeID), tick);
67 for (
auto const& i_hit : hit_indices_per_plane[i_plane])
73 path_length_fraction_vec,
74 HitPropertiesMultiset,
79 HitPropertiesMultiset, track, i_track, caloVector, assnTrackCaloVector, planeID);
90 bool operator()(std::pair<geo::WireID, float>
const& i, std::pair<geo::WireID, float>
const& j)
93 ((int)(i.first.Wire) - (int)(
hit.WireID().Wire)) * geom.WirePitch(i.first.asPlaneID());
95 ((int)(j.first.Wire) - (int)(
hit.WireID().Wire)) * geom.WirePitch(j.first.asPlaneID());
96 float dt_i = i.second -
hit.PeakTime();
97 float dt_j = j.second -
hit.PeakTime();
98 return std::hypot(dw_i, dt_i) < std::hypot(dw_j, dt_j);
112 float cumulative_path_length = 0;
113 const float total_path_length = track.
Length();
116 trk_path_length_frac_vec[i_trj] = cumulative_path_length / total_path_length;
119 return trk_path_length_frac_vec;
127 std::vector<std::pair<geo::WireID, float>>
const& traj_points_in_plane,
128 std::vector<float>
const& path_length_fraction_vec,
133 size_t traj_iter = std::distance(traj_points_in_plane.begin(),
134 std::min_element(traj_points_in_plane.begin(),
135 traj_points_in_plane.end(),
139 HitPropertiesMultiset.emplace(hit.
Integral(),
144 path_length_fraction_vec[traj_iter]);
152 float charge_start = 0, charge_end = 0;
155 charge_start += (*it_hpm).charge;
161 for (HitPropertiesMultiset_t::reverse_iterator it_hpm = hpm.rbegin(); it_hpm != hpm.rend();
163 charge_end += (*it_hpm).charge;
168 return (charge_start > charge_end);
173 size_t const& i_track,
174 std::vector<anab::Calorimetry>& caloVector,
175 std::vector<size_t>& assnTrackCaloVector,
178 size_t n_hits = hpm.size();
179 std::vector<float> dEdxVector, dQdxVector, resRangeVector, deadWireVector, pitchVector;
180 std::vector<TVector3> XYZVector;
182 dEdxVector.reserve(n_hits);
183 dQdxVector.reserve(n_hits);
184 resRangeVector.reserve(n_hits);
185 deadWireVector.reserve(n_hits);
186 pitchVector.reserve(n_hits);
187 XYZVector.reserve(n_hits);
189 float kinetic_energy = 0, track_length = track.
Length();
193 dEdxVector.push_back((*it_hpm).dEdx);
194 dQdxVector.push_back((*it_hpm).dQdx);
195 resRangeVector.push_back((*it_hpm).path_fraction * track_length);
196 pitchVector.push_back((*it_hpm).pitch);
197 XYZVector.push_back((*it_hpm).xyz);
198 kinetic_energy += dEdxVector.back() * pitchVector.back();
203 for (HitPropertiesMultiset_t::reverse_iterator it_hpm = hpm.rbegin(); it_hpm != hpm.rend();
205 dEdxVector.push_back((*it_hpm).dEdx);
206 dQdxVector.push_back((*it_hpm).dQdx);
207 resRangeVector.push_back((1 - (*it_hpm).path_fraction) * track_length);
208 pitchVector.push_back((*it_hpm).pitch);
209 XYZVector.push_back((*it_hpm).xyz);
210 kinetic_energy += dEdxVector.back() * pitchVector.back();
214 caloVector.emplace_back(kinetic_energy,
223 assnTrackCaloVector.emplace_back(i_track);
229 for (
auto const&
hit : hpm)
geo::GeometryCore const & geom
bool IsInvertedTrack(HitPropertiesMultiset_t const &)
Declaration of signal hit object.
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
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.
bool operator()(std::pair< geo::WireID, float > const &i, std::pair< geo::WireID, float > const &j)
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.
geo::WireID const & WireID() const
Initial tdc tick for hit.
std::multiset< HitProperties, HitPropertySorter > HitPropertiesMultiset_t
dist_projected(recob::Hit const &h, geo::GeometryCore const &g)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< float > CreatePathLengthFractionVector(recob::Track const &track)
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
double Length(size_t p=0) const
Access to various track properties.
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
Provides recob::Track data product.
std::vector< Point_t > convertCollToPoint(std::vector< Point > const &coll)
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
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 &)
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
TrackCalorimetryAlg(fhicl::ParameterSet const &p)
Contains all timing reference information for the detector.
Container for a list of pointers to providers.
View_t View(PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
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].
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
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: