172 art::Handle< std::vector< simb::MCTruth > > mctruth_h;
173 std::map<double, int> mctruth_db;
176 for (
size_t mctruth_index = 0; mctruth_index < mctruth_h->size(); ++mctruth_index) {
177 auto const& mctruth = (*mctruth_h)[mctruth_index];
178 for (
int part_idx = 0; part_idx < mctruth.NParticles(); ++part_idx) {
179 const simb::MCParticle & particle = mctruth.GetParticle(part_idx);
188 art::Handle< std::vector< recob::OpFlash > > mcflash_h;
191 if(!mcflash_h.isValid()) {
193 throw std::exception();
199 std::map<double,int> mcflash_db;
203 for(
size_t mcflash_index=0; mcflash_index < mcflash_h->size(); ++mcflash_index) {
204 auto const&
mcflash = (*mcflash_h)[mcflash_index];
209 for(
size_t label_idx=0; label_idx<
_flash_label_v.size(); ++label_idx) {
213 art::Handle< std::vector< recob::OpFlash > > flash_h;
214 e.getByLabel(label,flash_h);
215 if(!flash_h.isValid()){
216 std::cerr <<
"Invalid producer for recob::OpFlash: " << label << std::endl;
217 throw std::exception();
221 std::vector<bool> mcflash_used;
222 if(!
_mcflash_label.empty()) { mcflash_used.resize(mcflash_h->size(),
false); }
224 for(
auto const& flash : (*flash_h)) {
226 _time = flash.Time();
232 auto low_mct = mctruth_db.lower_bound(
_time);
233 if (low_mct != mctruth_db.begin()) {
235 auto const& mctruth = (*mctruth_h).at(0);
236 auto const& particle = mctruth.GetParticle((*low_mct).second);
237 if ( (particle.T() - (*low_mct).first) <
_match_dt) {
245 auto low = mcflash_db.lower_bound(
_time);
248 _time_true = std::numeric_limits<double>::max();
250 if(
low != mcflash_db.begin()) {
253 auto const&
mcflash = (*mcflash_h).at((*low).second);
260 mcflash_used[(*low).second] =
true;
261 std::cout <<
mcflash.TotalPE() <<
" " << std::accumulate(_pe_true_v.begin(), _pe_true_v.end(), 0.) << std::endl;
271 for(
size_t mcflash_idx=0; mcflash_idx < mcflash_used.size(); ++mcflash_idx) {
272 if(mcflash_used[mcflash_idx])
continue;
273 auto const&
mcflash = (*mcflash_h)[mcflash_idx];
279 _time = std::numeric_limits<double>::max();
281 _pe_v.resize(_pe_true_v.size(),0.);
BEGIN_PROLOG could also be cerr
std::string _mctruth_label
std::vector< TTree * > _flashtree_v
standard_dbscan3dalg useful for diagnostics hits not in a line will not be clustered on on only for track like only for track like on on the smaller the less shower like tracks low
std::vector< double > _pe_true_v
std::vector< double > _pe_v
std::vector< std::string > _flash_label_v
std::string _mcflash_label
BEGIN_PROLOG could also be cout