144 std::map<std::pair<UniquePosition, unsigned int>,
int> hit_index_m;
150 for(
size_t i=0; i<sedArray.size(); ++i) {
153 auto const& sed = sedArray[i];
163 auto const mp = sed.MidPoint();
164 double const xyz[3] = { mp.X(), mp.Y(), mp.Z() };
168 unsigned int cryostat = 0;
174 <<
"cannot be found in a cryostat\n" 178 unsigned int tpc = 0;
184 <<
"cannot be found in a TPC\n" 207 <<
"nearest wire not in TPC\n" 212 int track_id = sed.TrackID();
214 if(track_id < 0) track_id = track_id * (-1);
215 unsigned int real_track_id = track_id;
217 UniquePosition
pos(xyz[0], xyz[1], xyz[2]);
220 auto key = std::make_pair(
pos, real_track_id);
221 auto hit_index_track_iter = hit_index_m.find(
key);
222 if(hit_index_track_iter == hit_index_m.end()) {
224 hit_index_m[
key]= new_hit_index;
227 hit_index = (*hit_index_track_iter).second;
230 auto const channel_id = pindex[
pid];
231 double charge = sed.NumElectrons();
235 this->
__GetEdepArray__(real_track_id).emplace_back(
pos,
pid, pindex.size(), sed.Energy(), charge, channel_id);
240 edep.deps[channel_id].charge += charge;
241 edep.deps[channel_id].energy += sed.Energy();
247 std::cout<< Form(
" Collected %zu particles' energy depositions...",
_mc_edeps.size()) <<
std::endl;
CryostatGeo const & PositionToCryostat(geo::Point_t const &point) const
Returns the cryostat at specified location.
unsigned int Nplanes() const
Number of planes in this tpc.
Geometry information for a single TPC.
std::map< geo::PlaneID, size_t > createPlaneIndexMap()
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
geo::TPCGeo const & PositionToTPC(geo::Point_t const &point) const
Returns the TPC at specified location.
std::vector< std::vector< sim::MCEdep > > _mc_edeps
std::vector< sim::MCEdep > & __GetEdepArray__(unsigned int track_id)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::map< unsigned int, size_t > _track_index
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
raw::ChannelID_t NearestChannel(geo::Point_t const &worldLoc, geo::PlaneID const &planeid) const
Returns the ID of the channel nearest to the specified position.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)