155 art::Handle< std::vector<sim::SimEnergyDeposit> > sedvh;
157 bool okay =
event.getByLabel(
m_inputTag, sedvh);
159 std::string
msg =
"SimDepoSetSource failed to get sim::SimEnergyDeposit from art tag: " +
m_inputTag.encode();
161 THROW(WireCell::RuntimeError() << WireCell::errmsg{msg});
165 const size_t ndepos = sedvh->size();
167 std::cerr <<
"SimDepoSetSource got " << ndepos
169 <<
"\" returns: " << (okay ?
"okay" :
"fail") << std::endl;
173 <<
" unused, prior depos\n";
178 std::vector<sim::SimEnergyDeposit> assn_sedv;
180 art::Handle< std::vector<sim::SimEnergyDeposit> > assn_sedvh;
181 okay =
event.getByLabel(
m_assnTag, assn_sedvh);
183 std::string msg =
"SimDepoSetSource failed to get sim::SimEnergyDeposit from art tag: " +
m_assnTag.encode();
185 THROW(WireCell::RuntimeError() << WireCell::errmsg{msg});
188 std::cout <<
"Larwirecell::SimDepoSetSource got " << assn_sedvh->size()
189 <<
" associated depos from " <<
m_assnTag << std::endl;
190 assn_sedv.insert(assn_sedv.end(), assn_sedvh->begin(), assn_sedvh->end() );
193 if (ndepos != assn_sedv.size()) {
194 std::string msg =
"Larwirecell::SimDepoSetSource Inconsistent size of SimDepoSetSources";
196 THROW(WireCell::RuntimeError() << WireCell::errmsg{msg});
200 for (
size_t ind=0; ind<ndepos; ++ind) {
201 auto const& sed = sedvh->at(ind);
202 auto pt = sed.MidPoint();
203 const WireCell::Point wpt(pt.x()*units::cm, pt.y()*units::cm, pt.z()*units::cm);
204 double wt = sed.Time()*units::ns;
205 double wq = (*m_adapter)(sed);
206 int wid = sed.TrackID();
207 int pdg = sed.PdgCode();
210 if (assn_sedv.size() == 0) {
211 WireCell::IDepo::pointer depo
212 = std::make_shared<SimpleDepo>(wt, wpt, wq,
nullptr, 0.0, 0.0, wid,
pdg, we);
220 auto const& sed1 = assn_sedv.at(ind);
221 auto pt1 = sed1.MidPoint();
222 const WireCell::Point wpt1(pt1.x()*units::cm, pt1.y()*units::cm, pt1.z()*units::cm);
223 double wt1 = sed1.Time()*units::ns;
224 double wq1 = (*m_adapter)(sed1);
225 int wid1 = sed1.TrackID();
226 int pdg1 = sed1.PdgCode();
229 WireCell::IDepo::pointer assn_depo
230 = std::make_shared<SimpleDepo>(wt1, wpt1, wq1,
nullptr, 0.0, 0.0, wid1, pdg1, we1);
232 WireCell::IDepo::pointer depo
233 = std::make_shared<SimpleDepo>(wt, wpt, wq, assn_depo, 0.0, 0.0, wid,
pdg, we);
245 WireCell::IDepo::pointer depo
246 = std::make_shared<SimpleDepo>(0, wpt, 0,
nullptr, 0.0, 0.0);
251 std::sort(
m_depos.begin(),
m_depos.end(), WireCell::ascending_time);
252 std::cerr <<
"SimDepoSetSource: ready with " <<
m_depos.size() <<
" depos spanning: ["
253 <<
m_depos.front()->time()/units::us <<
", "
254 <<
m_depos.back()->time()/units::us <<
"]us\n";
WireCell::IDepo::vector m_depos
BEGIN_PROLOG could also be cerr
util::quantities::megaelectronvolt MeV
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
BEGIN_PROLOG could also be cout