37 struct EnergyAccumulator {
42 GeV totalEnergy { 0.0 }, inSpillEnergy { 0.0 }, inPreSpillEnergy { 0.0 };
43 GeV activeEnergy { 0.0 }, inSpillActiveEnergy { 0.0 },
44 inPreSpillActiveEnergy { 0.0 };
47 TimeSpan_t inSpillTimes,
48 TimeSpan_t inPreSpillTimes,
52 , fInSpillTimes(inSpillTimes)
53 , fInPreSpillTimes(inPreSpillTimes)
63 = (time >= fInSpillTimes.first) && (time <= fInSpillTimes.second);
64 bool const inPreSpill =
65 (time >= fInPreSpillTimes.first) && (time <= fInPreSpillTimes.second);
67 totalEnergy += energy;
68 if (inSpill) inSpillEnergy += energy;
69 if (inPreSpill) inPreSpillEnergy += energy;
71 if (pointInActiveTPC(location)) {
72 activeEnergy += energy;
73 if (inSpill) inSpillActiveEnergy += energy;
74 if (inPreSpill) inPreSpillActiveEnergy += energy;
82 TimeSpan_t
const fInSpillTimes;
85 TimeSpan_t
const fInPreSpillTimes;
89 { return ::pointInActiveTPC(
fGeom, point); }
98 std::vector<art::InputTag> truthTags,
105 std::string logCategory
107 : fGeneratorTags(
std::move(truthTags))
108 , fEnergyDepositTags(
std::move(edepTags))
111 , fDetProps(detProps)
112 , fDetTimings(detTimings)
113 , fInSpillTimes(
std::move(inSpillTimes))
114 , fInPreSpillTimes(
std::move(inPreSpillTimes))
124 if (truth.NeutrinoSet()) fillGeneratorNeutrinoInfo(info, truth);
133 if (!truth.NeutrinoSet())
return;
138 setMainGeneratorNeutrinoInfo(info, truth);
140 addGeneratorNeutrinoInfo(info, truth);
163 simb::MCParticle
const&
nu = truth.GetNeutrino().Nu();
172 switch (nu.PdgCode()) {
183 switch (truth.GetNeutrino().CCNC()) {
188 <<
"Unexpected NC/CC flag (" << truth.GetNeutrino().CCNC() <<
")";
215 simb::MCParticle
const&
nu = truth.GetNeutrino().Nu();
229 (
EventInfo_t& info, std::vector<sim::SimEnergyDeposit>
const& energyDeposits)
234 auto Eacc = EnergyAccumulator(fInSpillTimes, fInPreSpillTimes,
fGeom);
265 (
EventInfo_t& info, std::vector<sim::SimChannel>
const& channels)
const
272 auto Eacc = EnergyAccumulator(fInSpillTimes, fInPreSpillTimes,
fGeom);
274 double const driftVel = fDetProps->DriftVelocity();
279 std::vector<geo::WireID>
const& wires
280 =
fGeom.ChannelToWire(channel.Channel());
281 if (
empty(wires))
continue;
282 if (wires.front().Plane != 0)
continue;
286 for (
auto const& [ tdc, IDEs ]: channel.TDCIDEMap()) {
291 = fDetTimings->toSimulationTime(
tick);
294 MeV const energy { IDE.energy };
302 Eacc.add(energy, time - driftTime, location);
330 return fGeom.PositionToTPCptr(point);
339 return ::pointInActiveTPC(
fGeom, point);
347 assert(truth.NeutrinoSet());
348 simb::MCParticle
const&
nu = truth.GetNeutrino().Nu();
357 std::vector<art::InputTag> truthTags,
362 std::string logCategory
364 : fGeneratorTags(
std::move(truthTags))
365 , fEnergyDepositTags(
std::move(edepTags))
368 , fDetProps(detProps)
369 , fDetTimings(detTimings)
379 fGeneratorTags, fEnergyDepositTags,
380 inSpillTimes, inPreSpillTimes,
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
void SetNu_mu(bool numu)
Marks the flavor of the neutrino in the first interaction.
timescale_traits< ElectronicsTimeCategory >::tick_t electronics_tick
A point on the electronics time scale expressed in its ticks.
Energy deposited on a readout channel by simulated tracks.
Geometry information for a single TPC.
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
geo::TPCGeo const * PositionToTPCptr(geo::Point_t const &point) const
Returns the TPC at specified location.
void InsertVertex(geo::Point_t const &vertex, std::size_t beforeIndex)
void SetDepositedEnergyInSpill(GeV e)
Sets the energy of the event deposited during beam gate [GeV].
void SetInteractionTime(simulation_time time)
Sets the time of the first interaction.
void SetDepositedEnergyInPreSpillInActiveVolume(GeV e)
void SetDepositedEnergyInPreSpill(GeV e)
Sets the energy of the event deposited during pre-spill window [GeV].
Access the description of detector geometry.
Charged-current interactions.
GeV DepositedEnergyInPreSpill() const
void AddVertex(geo::Point_t const &vertex)
Adds a point to the list of interaction vertices in the event.
void AddWeakNeutralCurrentInteractions(unsigned int n=1U)
Marks this event as including n more weak neutral current interactions.
void SetLeptonEnergy(GeV eL)
Sets the lepton energy.
timescale_traits< SimulationTimeCategory >::time_point_t simulation_time
A point in time on the simulation time scale.
Ionization at a point of the TPC sensitive volume.
A value measured in the specified unit.
megaelectronvolt_as<> megaelectronvolt
Type of energy stored in megaelectronvolt, in double precision.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
void SetInActiveVolume(bool active=true)
Set whether the event has relevant activity in the active volume.
void SetNeutrinoEnergy(GeV eNu)
Sets the neutrino energy.
Description of geometry of one entire detector.
GeV DepositedEnergyInSpill() const
Returns the total energy deposited in the detector during beam [GeV].
An interval (duration, length, distance) between two quantity points.
gigaelectronvolt_as<> gigaelectronvolt
Type of energy stored in gigaelectronvolt, in double precision.
Functions dealing with icarus::trigger::details::EventInfo_t.
simulation_time InteractionTime() const
Returns the time of the first interaction, in simulation time scale [ns].
GeV DepositedEnergyInSpillInActiveVolume() const
Returns the energy deposited in the active volume during the beam [GeV].
GeV DepositedEnergyInPreSpillInActiveVolume() const
void SetNeutrinoPDG(int NU)
Marks the neutrino type of the first interaction in the event.
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
unsigned int nVertices() const
Returns the number of known interaction vertices.
Dimensioned variables representing space or time quantities.
A class exposing an upgraded interface of detinfo::DetectorClocksData.
void SetDepositedEnergy(GeV e)
Sets the total deposited energy of the event [GeV].
Energy deposition in the active material.
GeV DepositedEnergy() const
Returns the total energy deposited in the detector during the event [GeV].
Neutral-current interactions.
GeV DepositedEnergyInActiveVolume() const
Returns the energy deposited in the active volume during the event [GeV].
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.
bool empty(FixedBins< T, C > const &) noexcept
void SetInteractionType(int type)
Sets the interaction type.
void AddWeakChargedCurrentInteractions(unsigned int n=1U)
Marks this event as including n more weak charged current interactions.
void SetDepositedEnergyInActiveVolume(GeV e)
Sets the total deposited energy of the event in active volume [GeV].
bool ContainsPosition(geo::Point_t const &point, double wiggle=1.0) const
Returns whether this volume contains the specified point.
Encapsulate the construction of a single detector plane.