All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sim::DumpSimEnergyDeposits Class Reference

Prints the content of all the deposited energies on screen. More...

Inheritance diagram for sim::DumpSimEnergyDeposits:

Classes

struct  Config
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 DumpSimEnergyDeposits (Parameters const &config)
 Constructor: reads the configuration. More...
 
void analyze (art::Event const &evt)
 Does the printing. More...
 

Private Member Functions

template<typename Stream >
void dumpEnergyDeposit (Stream &out, sim::SimEnergyDeposit const &dep) const
 

Private Attributes

art::InputTag fEnergyDepositTag
 Tag for input data product. More...
 
std::string fOutputCategory
 Category for LogInfo output. More...
 
bool bShowLocation = true
 Print the center of the deposition. More...
 
bool bShowStep = true
 Print the step ends. More...
 
bool bShowEmission = true
 Print the photons and electrons emitted. More...
 
bool bSplitPhotons = true
 Print photons by emission speed. More...
 

Detailed Description

Prints the content of all the deposited energies on screen.

This analyzer prints the content of all the hits into the LogInfo/LogVerbatim stream.

Configuration parameters

Definition at line 52 of file DumpSimEnergyDeposits_module.cc.

Member Typedef Documentation

using sim::DumpSimEnergyDeposits::Parameters = art::EDAnalyzer::Table<Config>

Definition at line 99 of file DumpSimEnergyDeposits_module.cc.

Constructor & Destructor Documentation

sim::DumpSimEnergyDeposits::DumpSimEnergyDeposits ( Parameters const &  config)
explicit

Constructor: reads the configuration.

Definition at line 127 of file DumpSimEnergyDeposits_module.cc.

128  : EDAnalyzer (config)
129  , fEnergyDepositTag(config().EnergyDepositTag())
130  , fOutputCategory (config().OutputCategory())
131  , bShowLocation(config().ShowLocation())
132  , bShowStep (config().ShowStep())
133  , bShowEmission(config().ShowEmission())
134  , bSplitPhotons(config().SplitPhotons())
135  {}
bool bSplitPhotons
Print photons by emission speed.
art::InputTag fEnergyDepositTag
Tag for input data product.
bool bShowEmission
Print the photons and electrons emitted.
bool bShowLocation
Print the center of the deposition.
std::string fOutputCategory
Category for LogInfo output.

Member Function Documentation

void sim::DumpSimEnergyDeposits::analyze ( art::Event const &  evt)

Does the printing.

Definition at line 139 of file DumpSimEnergyDeposits_module.cc.

139  {
140 
141  using namespace util::quantities::energy_literals;
142  using namespace util::quantities::space_literals;
145 
146  // fetch the data to be dumped on screen
147  auto const& Deps = *(
148  event.getValidHandle<std::vector<sim::SimEnergyDeposit>>(fEnergyDepositTag)
149  );
150 
151  mf::LogVerbatim(fOutputCategory)
152  << "Event " << event.id() << " contains " << Deps.size() << " '"
153  << fEnergyDepositTag.encode() << "' energy deposits";
154 
155  megaelectronvolt TotalE = 0_MeV;
156  centimeter TotalLength { 0.0 };
157  unsigned int TotalElectrons = 0U, TotalPhotons = 0U,
158  TotalPhotonsFast = 0U, TotalPhotonsSlow = 0U;
159 
160  for (auto const& [ iDep, dep ]: util::enumerate(Deps)) {
161 
162  // print a header for the cluster
163  mf::LogVerbatim log(fOutputCategory);
164  log << "[#" << iDep << "] ";
165  dumpEnergyDeposit(log, dep);
166 
167  // collect statistics
168  TotalE += megaelectronvolt{ dep.Energy() };
169  TotalLength += centimeter{ dep.StepLength() };
170  TotalElectrons += dep.NumElectrons();
171  TotalPhotons += dep.NumPhotons();
172  TotalPhotonsSlow += dep.NumSPhotons();
173  TotalPhotonsFast += dep.NumFPhotons();
174 
175  } // for depositions
176 
177  mf::LogVerbatim(fOutputCategory)
178  << "Event " << event.id() << " energy deposits '"
179  << fEnergyDepositTag.encode() << "' include "
180  << TotalE << " worth of energy, " << TotalElectrons
181  << " electrons and " << TotalPhotons << " photons ("
182  << TotalPhotonsFast << " fast and " << TotalPhotonsSlow
183  << " slow); tracked particles crossed " << TotalLength << " of space."
184  ;
185 
186 } // sim::DumpSimEnergyDeposits::analyze()
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
art::InputTag fEnergyDepositTag
Tag for input data product.
megaelectronvolt_as<> megaelectronvolt
Type of energy stored in megaelectronvolt, in double precision.
Definition: energy.h:119
void dumpEnergyDeposit(Stream &out, sim::SimEnergyDeposit const &dep) const
centimeter_as<> centimeter
Type of space stored in centimeters, in double precision.
Definition: spacetime.h:434
std::string fOutputCategory
Category for LogInfo output.
template<typename Stream >
void sim::DumpSimEnergyDeposits::dumpEnergyDeposit ( Stream out,
sim::SimEnergyDeposit const &  dep 
) const
private

Definition at line 192 of file DumpSimEnergyDeposits_module.cc.

193 {
197 
198  auto const time { nanosecond(dep.Time()) };
199  auto const energy { megaelectronvolt(dep.Energy()) };
200  auto const length { centimeter(dep.StepLength()) };
201 
202  out << "TrkID=" << dep.TrackID()
203  << " (" << sim::ParticleName(dep.PdgCode()) << "): "
204  << energy << " on " << time;
205  if (bShowLocation) out << " at " << dep.MidPoint();
206  if (bShowStep) out << " from " << dep.Start() << " to " << dep.End();
207  out << " (step: " << length << ")";
208  if (bShowEmission) {
209  out << "; electrons: " << dep.NumElectrons();
210  if (bSplitPhotons) {
211  out << "; photons: " << dep.NumFPhotons() << " (fast), "
212  << dep.NumSPhotons() << " (slow)";
213  }
214  else out << "; photons: " << dep.NumPhotons();
215  }
216 
217 } // sim::DumpSimEnergyDeposits::dumpEnergyDeposit()
bool bSplitPhotons
Print photons by emission speed.
megaelectronvolt_as<> megaelectronvolt
Type of energy stored in megaelectronvolt, in double precision.
Definition: energy.h:119
std::string ParticleName(int pigid)
Returns a string with the name of particle the specified with PDG ID.
gigaelectronvolt_as<> gigaelectronvolt
Type of energy stored in gigaelectronvolt, in double precision.
Definition: energy.h:129
bool bShowEmission
Print the photons and electrons emitted.
nanosecond_as<> nanosecond
Type of time stored in nanoseconds, in double precision.
Definition: spacetime.h:136
centimeter_as<> centimeter
Type of space stored in centimeters, in double precision.
Definition: spacetime.h:434
bool bShowLocation
Print the center of the deposition.

Member Data Documentation

bool sim::DumpSimEnergyDeposits::bShowEmission = true
private

Print the photons and electrons emitted.

Definition at line 115 of file DumpSimEnergyDeposits_module.cc.

bool sim::DumpSimEnergyDeposits::bShowLocation = true
private

Print the center of the deposition.

Definition at line 113 of file DumpSimEnergyDeposits_module.cc.

bool sim::DumpSimEnergyDeposits::bShowStep = true
private

Print the step ends.

Definition at line 114 of file DumpSimEnergyDeposits_module.cc.

bool sim::DumpSimEnergyDeposits::bSplitPhotons = true
private

Print photons by emission speed.

Definition at line 116 of file DumpSimEnergyDeposits_module.cc.

art::InputTag sim::DumpSimEnergyDeposits::fEnergyDepositTag
private

Tag for input data product.

Definition at line 110 of file DumpSimEnergyDeposits_module.cc.

std::string sim::DumpSimEnergyDeposits::fOutputCategory
private

Category for LogInfo output.

Definition at line 111 of file DumpSimEnergyDeposits_module.cc.


The documentation for this class was generated from the following file: