All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventInfo_t.cxx
Go to the documentation of this file.
1 /**
2  * @file icaruscode/PMT/Trigger/Algorithms/details/EventInfo_t.cxx
3  * @brief Class hosting selected information about the event (implementation).
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date May 15, 2020
6  * @see icaruscode/PMT/Trigger/Algorithms/details/EventInfo_t.h
7  */
8 
9 
10 // library header
12 
13 // LArSoft libraries
14 #include "lardataalg/MCDumpers/MCDumperUtils.h" // sim::TruthInteractionTypeName
15 
16 // C/C++ standard libraries
17 #include <ostream>
18 
19 
20 //------------------------------------------------------------------------------
21 void icarus::trigger::details::EventInfo_t::dump(std::ostream& out) const {
22  if (hasGenerated()) {
23  out << "Event contains:";
24  if (isNeutrino()) {
26  out << " " << nWeakChargedCurrentInteractions() << " CC";
28  out << " " << nWeakNeutralCurrentInteractions() << " NC";
29  if (isNu_mu()) out << " nu_mu";
30  if (isNu_e()) out << " nu_e";
31  out << "\nThe first neutrino has E=" << NeutrinoEnergy()
32  << " and becomes a lepton with E=" << LeptonEnergy()
34  << " interaction at " << InteractionTime()
35  ;
36  }
37  else {
38  out << " no neutrino interaction";
39  }
40  }
41  else {
42  out << "No generation information is available.";
43  }
44  if (hasDepEnergy()) {
45  out << "\nTotal deposited energy: " << DepositedEnergy()
46  << ", of which in spill/pre-spill " << DepositedEnergyInSpill()
47  << " / " << DepositedEnergyInPreSpill()
48  << ", in active volume " << DepositedEnergyInActiveVolume()
49  << ", in active volume and in spill/pre-spill "
52  }
53  else {
54  out << "\nNo energy deposition information is available.";
55  }
56  if (hasGenerated()) {
57  if (fVertices.empty()) {
58  out << "\nNo interaction vertex found.";
59  }
60  else {
61  auto iVertex = fVertices.begin();
62  auto const vend = fVertices.end();
63  out
64  << "\n" << fVertices.size() << " interaction vertices: " << *iVertex;
65  while (++iVertex != vend) out << "; " << *iVertex;
66  out << ".";
67  }
68  out << "\nThe event is" << (isInActiveVolume()? "": " NOT")
69  << " marked as in the active volume of the detector.";
70  }
71  out << "\n";
72  out.flush();
73 } // icarus::trigger::details::EventInfo_t::dump()
74 
75 
76 //------------------------------------------------------------------------------
bool isInActiveVolume() const
Returns whether there is an interaction within the active volume.
Definition: EventInfo_t.h:124
std::vector< geo::Point_t > fVertices
Position of all vertices.
Definition: EventInfo_t.h:273
std::string TruthInteractionTypeName(int type)
GeV NeutrinoEnergy() const
Returns the neutrino energy [GeV].
Definition: EventInfo_t.h:103
GeV LeptonEnergy() const
Returns the lepton energy [GeV].
Definition: EventInfo_t.h:106
bool hasDepEnergy() const
Returns whether generator information is available.
Definition: EventInfo_t.h:140
unsigned int nWeakChargedCurrentInteractions() const
Returns the number of weak charged current interactions in the event.
Definition: EventInfo_t.h:69
void dump(std::ostream &out) const
Prints the content of the object into a stream.
Definition: EventInfo_t.cxx:21
bool isNu_mu() const
Returns which neutrino flavor is present in an event.
Definition: EventInfo_t.h:96
GeV DepositedEnergyInSpill() const
Returns the total energy deposited in the detector during beam [GeV].
Definition: EventInfo_t.h:146
simulation_time InteractionTime() const
Returns the time of the first interaction, in simulation time scale [ns].
Definition: EventInfo_t.h:112
GeV DepositedEnergyInSpillInActiveVolume() const
Returns the energy deposited in the active volume during the beam [GeV].
Definition: EventInfo_t.h:156
bool hasGenerated() const
Returns whether generator information is available.
Definition: EventInfo_t.h:66
GeV DepositedEnergyInPreSpillInActiveVolume() const
Definition: EventInfo_t.h:161
Class hosting selected information about the event.
bool isNeutrino() const
Returns whether the event is generated as a neutrino interaction.
Definition: EventInfo_t.h:92
Utility functions to print MC truth information.
GeV DepositedEnergy() const
Returns the total energy deposited in the detector during the event [GeV].
Definition: EventInfo_t.h:143
GeV DepositedEnergyInActiveVolume() const
Returns the energy deposited in the active volume during the event [GeV].
Definition: EventInfo_t.h:153
unsigned int nWeakNeutralCurrentInteractions() const
Returns the number of weak neutral current interactions in the event.
Definition: EventInfo_t.h:73
int InteractionType() const
Returns the interaction type.
Definition: EventInfo_t.h:109