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:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 
- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 DumpSimEnergyDeposits (Parameters const &config)
 Constructor: reads the configuration. More...
 
void analyze (art::Event const &evt)
 Does the printing. More...
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

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...
 

Additional Inherited Members

- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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

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.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
art::InputTag fEnergyDepositTag
Tag for input data product.
static Config * config
Definition: config.cpp:1054
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)
virtual

Does the printing.

Implements art::EDAnalyzer.

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 
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
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 
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()
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
Literal constants for energy quantities.
Definition: energy.h:162
std::string encode() const
Definition: InputTag.cc:97
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
Literal constants for space quantities.
Definition: spacetime.h:543
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: