|
69 | 69 | #include <cmath> |
70 | 70 | #include <functional> |
71 | 71 | #include <map> |
| 72 | +#include <string> |
72 | 73 |
|
73 | 74 | namespace sbnd { |
74 | 75 | class LightCaloProducer; |
@@ -345,13 +346,18 @@ void sbnd::LightCaloProducer::CalculateCalorimetry(art::Event& e, |
345 | 346 | std::vector<art::Ptr<recob::OpFlash>> flash0_v; |
346 | 347 | std::vector<art::Ptr<recob::OpFlash>> flash1_v; |
347 | 348 |
|
348 | | - for (size_t i=0; i<2; i++){ |
| 349 | + for (size_t i=0; i<fopflash_producer_v.size(); i++){ |
349 | 350 | ::art::Handle<std::vector<recob::OpFlash>> flash_h; |
350 | 351 | e.getByLabel(fopflash_producer_v[i], flash_h); |
351 | 352 | if (!flash_h.isValid() || flash_h->empty()) { |
352 | 353 | std::cout << "don't have good PMT flashes from producer " << fopflash_producer_v[i] << std::endl; |
353 | 354 | } |
354 | | - else art::fill_ptr_vector((i==0)? flash0_v : flash1_v, flash_h); |
| 355 | + else{ |
| 356 | + if (fopflash_producer_v[i].find("tpc0") != std::string::npos) |
| 357 | + art::fill_ptr_vector(flash0_v, flash_h); |
| 358 | + else if (fopflash_producer_v[i].find("tpc1") != std::string::npos) |
| 359 | + art::fill_ptr_vector(flash1_v, flash_h); |
| 360 | + } |
355 | 361 | } |
356 | 362 |
|
357 | 363 | art::FindManyP<recob::PFParticle> slice_to_pfp (slice_h, e, fslice_producer); |
@@ -420,13 +426,18 @@ void sbnd::LightCaloProducer::CalculateCalorimetry(art::Event& e, |
420 | 426 | ::art::Handle<std::vector<recob::OpFlash>> flash0_ara_h; |
421 | 427 | ::art::Handle<std::vector<recob::OpFlash>> flash1_ara_h; |
422 | 428 |
|
423 | | - for (size_t i=0; i<2; i++){ |
| 429 | + for (size_t i=0; i<fopflash_ara_producer_v.size(); i++){ |
424 | 430 | ::art::Handle<std::vector<recob::OpFlash>> flash_ara_h; |
425 | 431 | e.getByLabel(fopflash_ara_producer_v[i], flash_ara_h); |
426 | 432 | if (!flash_ara_h.isValid() || flash_ara_h->empty()) { |
427 | 433 | std::cout << "don't have good X-ARAPUCA flashes from producer " << fopflash_ara_producer_v[i] << std::endl; |
428 | 434 | } |
429 | | - else art::fill_ptr_vector((i==0)? flash0_ara_v : flash1_ara_v, flash_ara_h); |
| 435 | + else{ |
| 436 | + if (fopflash_ara_producer_v[i].find("tpc0") != std::string::npos) |
| 437 | + art::fill_ptr_vector(flash0_ara_v, flash_ara_h); |
| 438 | + else if (fopflash_ara_producer_v[i].find("tpc1") != std::string::npos) |
| 439 | + art::fill_ptr_vector(flash1_ara_v, flash_ara_h); |
| 440 | + } |
430 | 441 | } |
431 | 442 | } |
432 | 443 |
|
|
0 commit comments