9 #ifndef ICARUSCODE_PMT_TRIGGER_ALGORITHM_DETAILS_EVENTINFOUTILS_H
10 #define ICARUSCODE_PMT_TRIGGER_ALGORITHM_DETAILS_EVENTINFOUTILS_H
25 #include "nusimdata/SimulationBase/MCTruth.h"
28 #include "canvas/Utilities/InputTag.h"
29 #include "messagefacility/MessageLogger/MessageLogger.h"
47 namespace icarus::trigger::details {
48 class EventInfoExtractor;
49 class EventInfoExtractorMaker;
104 using TimeSpan_t = std::pair<simulation_time, simulation_time>;
115 template <InputType Category>
123 art::InputTag
const&
tag()
const {
return fTag; }
124 explicit operator art::InputTag
const& ()
const {
return tag(); }
146 std::vector<art::InputTag>,
181 std::vector<art::InputTag> truthTags,
188 std::string logCategory =
"EventInfoExtractor"
212 template <
typename ConsumesColl>
214 std::vector<art::InputTag> truthTags,
215 std::vector<art::InputTag> edepTags,
221 std::string logCategory,
236 template <
typename Event>
239 template <
typename Event>
334 EventInfo_t&
info, std::vector<sim::SimEnergyDeposit>
const& energyDeposits
339 (
EventInfo_t&
info, std::vector<sim::SimChannel>
const& channels)
const;
355 template <
typename ConsumesColl>
358 std::vector<art::InputTag>
const& truthTags,
376 std::vector<art::InputTag> truthTags,
381 std::string logCategory
386 template <
typename ConsumesColl>
388 std::vector<art::InputTag> truthTags,
393 std::string logCategory,
405 {
return make(inSpillTimes, inPreSpillTimes); }
435 {
return std::holds_alternative<SimEnergyDepositSummaryInputTag>(edepTag); }
442 auto const* edeplist = std::get_if<std::vector<art::InputTag>>(&edepTag);
443 return edeplist && !edeplist->empty();
457 template <
typename ConsumesColl>
459 std::vector<art::InputTag> truthTags,
460 std::vector<art::InputTag> edepTags,
466 std::string logCategory,
470 std::move(truthTags), std::move(edepTags),
471 inSpillTimes, inPreSpillTimes,
480 template <
typename Event>
490 for (art::InputTag
const& inputTag: fGeneratorTags) {
492 auto const& truthRecords
493 =
event.template getProduct<std::vector<simb::MCTruth>>(inputTag);
495 for (simb::MCTruth
const& truth: truthRecords) {
497 fillGeneratorInfo(info, truth);
507 = std::get_if<SimEnergyDepositSummaryInputTag>(&fEnergyDepositTags)
512 auto const& energyDeposits =
event
513 .template getProduct<icarus::SimEnergyDepositSummary>(summaryTag->tag());
524 (
auto* channelsTag = std::get_if<SimChannelsInputTag>(&fEnergyDepositTags))
528 =
event.template getProduct<std::vector<sim::SimChannel>>
532 <<
"Event " <<
event.id() <<
" has " << channels.size()
533 <<
" energy deposits recorded in '" << channelsTag->tag().encode() <<
"'";
535 addEnergyDepositionInfo(info, channels);
540 = std::get_if<std::vector<art::InputTag>>(&fEnergyDepositTags)
543 for (art::InputTag
const& edepTag: *edepListTag) {
545 auto const& energyDeposits
546 =
event.template getProduct<std::vector<sim::SimEnergyDeposit>>(edepTag);
548 <<
"Event " <<
event.id() <<
" has " << energyDeposits.size()
549 <<
" energy deposits recorded in '" << edepTag.encode() <<
"'";
551 addEnergyDepositionInfo(info, energyDeposits);
557 throw std::logic_error(
558 "icarus::trigger::details::EventInfoExtractor::EventInfoExtractor(): "
559 "unexpected type from EDepTags_t"
570 template <
typename ConsumesColl>
573 std::vector<art::InputTag>
const& truthTags,
577 for (art::InputTag
const& inputTag: truthTags)
578 consumesCollector.template consumes<std::vector<simb::MCTruth>>(inputTag);
581 auto* summaryTag = std::get_if<SimEnergyDepositSummaryInputTag>(&edepTags);
585 consumesCollector.template consumes<icarus::SimEnergyDepositSummary>
586 (
static_cast<art::InputTag
const&
>(*summaryTag));
590 auto* edepListTag = std::get_if<std::vector<art::InputTag>>(&edepTags);
594 for (art::InputTag
const& inputTag: *edepListTag) {
595 consumesCollector.template consumes<std::vector<sim::SimEnergyDeposit>>
606 template <
typename ConsumesColl>
608 std::vector<art::InputTag> truthTags,
613 std::string logCategory,
617 std::move(truthTags),
std::move(edepTags),
618 geom, detProps, detTimings,
std::move(logCategory)
629 #endif // ICARUSCODE_PMT_TRIGGER_ALGORITHM_DETAILS_EVENTINFOUTILS_H
util::quantities::gigaelectronvolt GeV
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Object storing a summary of energy depositions in the detector.
Geometry information for a single TPC.
void SetDepositedEnergyInSpill(GeV e)
Sets the energy of the event deposited during beam gate [GeV].
Interface to detinfo::DetectorClocks.
void SetDepositedEnergyInPreSpillInActiveVolume(GeV e)
void SetDepositedEnergyInPreSpill(GeV e)
Sets the energy of the event deposited during pre-spill window [GeV].
Definitions of geometry vector data types.
timescale_traits< SimulationTimeCategory >::time_point_t simulation_time
A point in time on the simulation time scale.
A value measured in the specified unit.
Description of geometry of one entire detector.
gigaelectronvolt_as<> gigaelectronvolt
Type of energy stored in gigaelectronvolt, in double precision.
Dimensioned variables representing energy.
Class hosting selected information about the event.
contains information for a single step in the detector simulation
A class exposing an upgraded interface of detinfo::DetectorClocksData.
void SetDepositedEnergy(GeV e)
Sets the total deposited energy of the event [GeV].
Data types for detinfo::DetectorTimings.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
void SetDepositedEnergyInSpillInActiveVolume(GeV e)
Selected information about the event.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
void SetDepositedEnergyInActiveVolume(GeV e)
Sets the total deposited energy of the event in active volume [GeV].