17 caloAlg(p.get<
fhicl::ParameterSet>(
"CalorimetryAlg"))
28 std::vector<recob::Hit>
const& hitVector,
29 std::vector< std::vector<size_t> >
const& hit_indices_per_track,
30 std::vector<anab::Calorimetry>& caloVector,
31 std::vector<size_t>& assnTrackCaloVector,
39 for(
size_t i_track=0; i_track<trackVector.size(); i_track++){
45 std::vector< std::vector<size_t> > hit_indices_per_plane(geom.Nplanes());
46 for(
auto const& i_hit : hit_indices_per_track[i_track])
47 hit_indices_per_plane[hitVector[i_hit].WireID().Plane].push_back(i_hit);
50 for(
size_t i_plane=0; i_plane<geom.Nplanes(); i_plane++){
59 float tick = detprop.ConvertXToTicks(x_pos,(
int)i_plane,0,0);
60 traj_points_in_plane[i_trjpt] = std::make_pair(geom.NearestWireID(track.
LocationAtPoint(i_trjpt),i_plane),
66 for(
auto const& i_hit : hit_indices_per_plane[i_plane])
70 path_length_fraction_vec,
71 HitPropertiesMultiset,
77 MakeCalorimetryObject(HitPropertiesMultiset, track, i_track, caloVector, assnTrackCaloVector, planeID);
90 bool operator() (std::pair<geo::WireID,float> i, std::pair<geo::WireID,float> j)
92 float dw_i = ((int)(i.first.Wire) - (int)(
hit.WireID().Wire))*geom.WirePitch(i.first.Plane);
93 float dw_j = ((int)(j.first.Wire) - (int)(
hit.WireID().Wire))*geom.WirePitch(j.first.Plane);
94 float dt_i = i.second -
hit.PeakTime();
95 float dt_j = j.second -
hit.PeakTime();
97 return (std::sqrt(dw_i*dw_i + dt_i*dt_i) < std::sqrt(dw_j*dw_j + dt_j*dt_j));
109 float cumulative_path_length=0;
110 const float total_path_length = track.
Length();
113 trk_path_length_frac_vec[i_trj]=cumulative_path_length/total_path_length;
116 return trk_path_length_frac_vec;
121 std::vector< std::pair<geo::WireID,float> >
const& traj_points_in_plane,
122 std::vector<float>
const& path_length_fraction_vec,
126 size_t traj_iter = std::distance(traj_points_in_plane.begin(),
127 std::min_element(traj_points_in_plane.begin(),
128 traj_points_in_plane.end(),
132 HitPropertiesMultiset.emplace(hit.
Integral(),
137 path_length_fraction_vec[traj_iter]);
144 float charge_start=0,charge_end=0;
145 unsigned int counter=0;
150 charge_start += (*it_hpm).charge;
156 for(HitPropertiesMultiset_t::reverse_iterator it_hpm=hpm.rbegin();
160 charge_end += (*it_hpm).charge;
165 return (charge_start > charge_end);
170 size_t const& i_track,
171 std::vector<anab::Calorimetry>& caloVector,
172 std::vector<size_t>& assnTrackCaloVector,
174 size_t n_hits = hpm.size();
175 std::vector<float> dEdxVector,dQdxVector,resRangeVector,deadWireVector,pitchVector;
176 std::vector<TVector3> XYZVector;
178 dEdxVector.reserve(n_hits);
179 dQdxVector.reserve(n_hits);
180 resRangeVector.reserve(n_hits);
181 deadWireVector.reserve(n_hits);
182 pitchVector.reserve(n_hits);
183 XYZVector.reserve(n_hits);
185 float kinetic_energy=0,track_length=track.
Length();
192 dEdxVector.push_back((*it_hpm).dEdx);
193 dQdxVector.push_back((*it_hpm).dQdx);
194 resRangeVector.push_back((*it_hpm).path_fraction*track_length);
195 pitchVector.push_back((*it_hpm).pitch);
196 XYZVector.push_back((*it_hpm).xyz);
197 kinetic_energy += dEdxVector.back()*pitchVector.back();
203 for(HitPropertiesMultiset_t::reverse_iterator it_hpm=hpm.rbegin();
207 dEdxVector.push_back((*it_hpm).dEdx);
208 dQdxVector.push_back((*it_hpm).dQdx);
209 resRangeVector.push_back((1-(*it_hpm).path_fraction)*track_length);
210 pitchVector.push_back((*it_hpm).pitch);
211 XYZVector.push_back((*it_hpm).xyz);
212 kinetic_energy += dEdxVector.back()*pitchVector.back();
217 caloVector.emplace_back(kinetic_energy,
226 assnTrackCaloVector.emplace_back(i_track);
231 for(
auto const&
hit : hpm)
geo::GeometryCore const & geom
double dEdx_AREA(art::Ptr< recob::Hit > hit, double pitch, double T0=0) const
geo::WireID WireID() const
Initial tdc tick for hit.
bool IsInvertedTrack(HitPropertiesMultiset_t const &)
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)
The data type to uniquely identify a Plane.
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
void reconfigure(const Config &config)
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.
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)
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
void ReserveInternalVectors(size_t s)
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.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Detector simulation of raw signals on wires.
TrackCalorimetryAlg(fhicl::ParameterSet const &p)
void ClearInternalVectors()
Container for a list of pointers to providers.
unsigned int fNHitsToDetermineStart
std::multiset< HitProperties, HitPropertySorter > HitPropertiesMultiset_t
void reconfigure(fhicl::ParameterSet const &p)
2D representation of charge deposited in the TDC/wire plane
double TrackPitchInView(recob::Track const &track, geo::View_t view, size_t trajectory_point=0)
Provides projected wire pitch for the view.
void ExtractCalorimetry(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)
Utility functions to extract information from recob::Track.
void AnalyzeHit(recob::Hit const &, recob::Track const &, std::vector< std::pair< geo::WireID, float > > const &, std::vector< float > const &, HitPropertiesMultiset_t &, geo::GeometryCore const &)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: