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

Produces plots. Aaah! More...

Classes

struct  AlgorithmConfiguration
 Data structure with all the configuration. More...
 
struct  FHiCLconfig
 

Public Types

using Parameters = fhicl::Table< FHiCLconfig >
 

Public Member Functions

 PlotDetectorActivityRates (Parameters const &config)
 Constructor: reads the configuration from the specified parameters set. More...
 
void setup (TDirectory *pDestDir, detinfo::DetectorClocksData &&clocksData, detinfo::DetectorPropertiesData &&propsData)
 Sets the algorithm up. More...
 
void prepare ()
 Performs the initialization of the algorithm. More...
 
void setupEvent (detinfo::DetectorClocksData &&clocksData, detinfo::DetectorPropertiesData &&propsData)
 Set up for a specific event. More...
 
template<typename Event >
void plotEvent (Event const &event)
 Processes a single event. More...
 
void finish ()
 Completes and saves the plots. More...
 
template<typename Stream >
void printConfig (Stream &&out) const
 Prints the current configuration to the specified output stream. More...
 
template<typename Stream >
void printTimingSummary (Stream &&out) const
 Prints some information about configured timing. More...
 

Static Public Member Functions

static void printConfigurationHelp (std::ostream &out)
 Prints on out screen a configuration summary. More...
 

Static Public Attributes

static std::string const ConfigurationKey { "plot" }
 Name of the recommended configuration table for this algorithm. More...
 

Private Types

using nanoseconds = util::quantities::intervals::nanoseconds
 
using simulation_time_scale = detinfo::timescales::timescale_traits< detinfo::timescales::SimulationTimeCategory >
 Time scale used for plotting of generation and particle level simulation. More...
 
using simulation_time = simulation_time_scale::time_point_t
 
using trigger_time = detinfo::timescales::simulation_time
 
using electronics_tick = detinfo::timescales::electronics_tick
 
using EDepUnit_t = util::quantities::megaelectronvolt
 Unit the energy depositions are stored in (LArSoft convention). More...
 

Private Member Functions

AlgorithmConfiguration parseAlgorithmConfiguration (fhicl::ParameterSet const &pset)
 
AlgorithmConfiguration parseValidatedAlgorithmConfiguration (FHiCLconfig const &config)
 
AlgorithmConfiguration parseValidatedAlgorithmConfiguration (fhicl::ParameterSet const &pset)
 
void initializePlots ()
 Performs the initialization of the plots filled by the algorithm. More...
 
void initializeEnergyDepositPlots ()
 Performs the initialization of plots pertaining energy deposits. More...
 
void initializeTPCionizationPlots ()
 Performs the initialization of plots pertaining collected TPC charge. More...
 
void initializePhotonPlots ()
 Performs the initialization of plots pertaining collected photoelectrons. More...
 
void savePlots ()
 Writes all plots into the current ROOT directory (and then deletes them). More...
 
void printStats () const
 Prints on screen some collected statistics. More...
 
void plotEnergyDeposits (std::vector< sim::SimEnergyDeposit > const &energyDeps)
 Plots data from energy deposits in liquid argon. More...
 
void plotTPCionization (std::vector< sim::SimChannel > const &TPCchannels)
 Plots data from photoelectron collection. More...
 
void plotPhotons (std::vector< sim::SimPhotons > const &photonChannels)
 Plots data from photoelectron collection. More...
 

Static Private Member Functions

template<typename ConfigOut >
static void parseBinning (ConfigOut &binConfig, fhicl::ParameterSet const &pset)
 
template<typename ConfigOut , typename ConfigIn >
static void parseAndValidateBinning (ConfigOut &binConfig, ConfigIn const &config)
 
template<typename T , typename BinConfig >
static util::Binner< T > makeBinning (BinConfig const &config)
 
template<typename T >
static void readParam (fhicl::ParameterSet const &pset, std::string const &key, T &var)
 
template<typename Plot >
static void Serialize (std::unique_ptr< Plot > &plot)
 Writes plot into the current ROOT directory, then deletes it. More...
 

Private Attributes

AlgorithmConfiguration const fConfig
 Complete configuration of the algorithm. More...
 
util::Binner< simulation_timefSimBinner
 
util::Binner< electronics_tickfTPCBinner
 
util::Binner< trigger_timefOpDetBinner
 
TDirectory * fDestDir = nullptr
 ROOT directory where to write the plots. More...
 
std::optional
< detinfo::DetectorTimings
fDetTimings
 
std::optional
< detinfo::DetectorPropertiesData
fDetPropsData
 
std::unique_ptr< TProfile > fEDepDistrib
 Average amount of deposited energy per time [GeV]. More...
 
std::unique_ptr< TProfile > fTPCchargeDistrib
 Average amount of ionization collected per time. More...
 
std::unique_ptr< TProfile > fPhotonDistrib
 Average number of photon per time. More...
 
lar::util::StatCollector< double > fEDepStats
 Statistics of the total energy per event. More...
 
lar::util::StatCollector< double > fTPCchargeStats
 Statistics of the total charge (electron count) per event. More...
 
lar::util::StatCollector
< unsigned int > 
fPhotonStats
 Statistics of the total light (photoelectron count) per event. More...
 

Detailed Description

Produces plots. Aaah!

Algorithm workflow:

  1. construction
  2. setup()
  3. prepare()
  4. for each event:
    1. setupEvent()
    2. plotEvent()
  5. finish()

Definition at line 143 of file DetectorActivityRatePlots.cpp.

Member Typedef Documentation

Unit the energy depositions are stored in (LArSoft convention).

Definition at line 156 of file DetectorActivityRatePlots.cpp.

Definition at line 153 of file DetectorActivityRatePlots.cpp.

Definition at line 145 of file DetectorActivityRatePlots.cpp.

Definition at line 291 of file DetectorActivityRatePlots.cpp.

using PlotDetectorActivityRates::simulation_time = simulation_time_scale::time_point_t
private

Definition at line 151 of file DetectorActivityRatePlots.cpp.

Time scale used for plotting of generation and particle level simulation.

Definition at line 149 of file DetectorActivityRatePlots.cpp.

Definition at line 152 of file DetectorActivityRatePlots.cpp.

Constructor & Destructor Documentation

PlotDetectorActivityRates::PlotDetectorActivityRates ( Parameters const &  config)

Constructor: reads the configuration from the specified parameters set.

Definition at line 427 of file DetectorActivityRatePlots.cpp.

429  , fSimBinner{ makeBinning<simulation_time>(fConfig.simBinning) }
430  , fTPCBinner{ makeBinning<electronics_tick>(fConfig.TPCBinning) }
431  , fOpDetBinner{ makeBinning<trigger_time>(fConfig.opDetBinning) }
432  {}
AlgorithmConfiguration parseValidatedAlgorithmConfiguration(FHiCLconfig const &config)
AlgorithmConfiguration const fConfig
Complete configuration of the algorithm.
util::Binner< simulation_time > fSimBinner
util::Binner< electronics_tick > fTPCBinner
util::Binner< trigger_time > fOpDetBinner

Member Function Documentation

void PlotDetectorActivityRates::finish ( )

Completes and saves the plots.

Definition at line 633 of file DetectorActivityRatePlots.cpp.

633  {
634 
635  savePlots();
636 
637  printStats();
638 
639 } // PlotDetectorActivityRates::finish()
void savePlots()
Writes all plots into the current ROOT directory (and then deletes them).
void printStats() const
Prints on screen some collected statistics.
void PlotDetectorActivityRates::initializeEnergyDepositPlots ( )
private

Performs the initialization of plots pertaining energy deposits.

Definition at line 531 of file DetectorActivityRatePlots.cpp.

531  {
532 
533  fEDepDistrib = std::make_unique<TProfile>(
534  "EnergyDepositsInTime",
535  (
536  "Energy deposited in active volume vs. time"
537  ";deposition time (simulation time scale) [ "
539  ";" + EDepUnit_t::unit_t::symbol() +" / event [ /"
540  + to_string(fSimBinner.step()) + " ]"
541  ).c_str(),
542  fSimBinner.nBins(), fSimBinner.lower().value(), fSimBinner.upper().value()
543  );
544 
545 } // PlotDetectorActivityRates::initializeEnergyDepositPlots()
util::Binner< simulation_time > fSimBinner
std::unique_ptr< TProfile > fEDepDistrib
Average amount of deposited energy per time [GeV].
std::string to_string(WindowPattern const &pattern)
Data_t upper() const
Returns the upper limit of the range.
Definition: Binner.h:104
Step_t step() const
Returns the step size.
Definition: Binner.h:107
Data_t lower() const
Definition: Binner.h:101
unsigned int nBins() const
Returns the number of bins in the range.
Definition: Binner.h:110
void PlotDetectorActivityRates::initializePhotonPlots ( )
private

Performs the initialization of plots pertaining collected photoelectrons.

Definition at line 571 of file DetectorActivityRatePlots.cpp.

571  {
572 
573  fPhotonDistrib = std::make_unique<TProfile>(
574  "PhotoelectronsInTime",
575  (
576  "Photoelectrons detected vs. time"
577  ";PMT conversion time (simulation time scale) [ "
579  ";photons / event [ /" + to_string(fOpDetBinner.step()) + " ]"
580  ).c_str(),
582  fOpDetBinner.lower().value(), fOpDetBinner.upper().value()
583  );
584 
585 } // PlotDetectorActivityRates::initializePhotonPlots()
std::unique_ptr< TProfile > fPhotonDistrib
Average number of photon per time.
std::string to_string(WindowPattern const &pattern)
Data_t upper() const
Returns the upper limit of the range.
Definition: Binner.h:104
Step_t step() const
Returns the step size.
Definition: Binner.h:107
Data_t lower() const
Definition: Binner.h:101
unsigned int nBins() const
Returns the number of bins in the range.
Definition: Binner.h:110
util::Binner< trigger_time > fOpDetBinner
void PlotDetectorActivityRates::initializePlots ( )
private

Performs the initialization of the plots filled by the algorithm.

Definition at line 522 of file DetectorActivityRatePlots.cpp.

522  {
523 
527 
528 } // PlotDetectorActivityRates::initializePlots()
void initializeTPCionizationPlots()
Performs the initialization of plots pertaining collected TPC charge.
void initializePhotonPlots()
Performs the initialization of plots pertaining collected photoelectrons.
void initializeEnergyDepositPlots()
Performs the initialization of plots pertaining energy deposits.
void PlotDetectorActivityRates::initializeTPCionizationPlots ( )
private

Performs the initialization of plots pertaining collected TPC charge.

Definition at line 548 of file DetectorActivityRatePlots.cpp.

548  {
549  assert(fDetTimings); // setup() should have taken care of these already
550  assert(fDetPropsData);
551 
552  detinfo::timescales::TPCelectronics_tick const TPCstart { 0 },
553  TPCstop { fDetPropsData->ReadOutWindowSize() };
554 
555  fTPCchargeDistrib = std::make_unique<TProfile>(
556  "TPCchargeInTime",
557  (
558  "Electrons sensed by TPC channels vs. time (readout window: "
559  + to_string(fDetTimings->toTick<electronics_tick>(TPCstart)) + " -- "
560  + to_string(fDetTimings->toTick<electronics_tick>(TPCstop)) + ")"
561  ";observation time (electronics time scale) [ TPC ticks, "
562  + to_string(fDetTimings->ClockPeriodFor<electronics_tick>()) + " ]"
563  ";ionization electrons / event [ /" + to_string(fTPCBinner.step()) + " ]"
564  ).c_str(),
565  fTPCBinner.nBins(), fTPCBinner.lower().value(), fTPCBinner.upper().value()
566  );
567 
568 } // PlotDetectorActivityRates::initializeTPCionizationPlots()
std::optional< detinfo::DetectorPropertiesData > fDetPropsData
std::optional< detinfo::DetectorTimings > fDetTimings
detinfo::timescales::electronics_tick electronics_tick
std::unique_ptr< TProfile > fTPCchargeDistrib
Average amount of ionization collected per time.
std::string to_string(WindowPattern const &pattern)
Data_t upper() const
Returns the upper limit of the range.
Definition: Binner.h:104
Step_t step() const
Returns the step size.
Definition: Binner.h:107
Data_t lower() const
Definition: Binner.h:101
util::Binner< electronics_tick > fTPCBinner
timescale_traits< TPCelectronicsTimeCategory >::tick_t TPCelectronics_tick
A point on the TPC electronics time scale expressed in its ticks.
unsigned int nBins() const
Returns the number of bins in the range.
Definition: Binner.h:110
template<typename T , typename BinConfig >
static util::Binner<T> PlotDetectorActivityRates::makeBinning ( BinConfig const &  config)
inlinestaticprivate

Definition at line 366 of file DetectorActivityRatePlots.cpp.

367  { return { config.start, config.stop, config.step }; }
auto PlotDetectorActivityRates::parseAlgorithmConfiguration ( fhicl::ParameterSet const &  pset)
private

Definition at line 436 of file DetectorActivityRatePlots.cpp.

437 {
438  AlgorithmConfiguration algConfig;
439  algConfig.edepTag = pset.get<art::InputTag>("Deposits", "largeant");
440  algConfig.chanTag = pset.get<art::InputTag>("TPCchannels", "largeant");
441  algConfig.photTag = pset.get<art::InputTag>("OpDetChannels", "largeant");
442 
444  (algConfig.simBinning, pset.get<fhicl::ParameterSet>("SimBinning"));
446  (algConfig.TPCBinning, pset.get<fhicl::ParameterSet>("TPCBinning"));
448  (algConfig.opDetBinning, pset.get<fhicl::ParameterSet>("OpDetBinning"));
449 
450  return algConfig;
451 } // PlotDetectorActivityRates::parseAlgorithmConfiguration()
static void parseBinning(ConfigOut &binConfig, fhicl::ParameterSet const &pset)
template<typename ConfigOut , typename ConfigIn >
void PlotDetectorActivityRates::parseAndValidateBinning ( ConfigOut &  binConfig,
ConfigIn const &  config 
)
staticprivate

Definition at line 482 of file DetectorActivityRatePlots.cpp.

483 {
484  binConfig.start = config.Start();
485  binConfig.stop = config.Stop();
486  binConfig.step = config.Step();
487 } // PlotDetectorActivityRates::parseAndValidateBinning()
template<typename ConfigOut >
void PlotDetectorActivityRates::parseBinning ( ConfigOut &  binConfig,
fhicl::ParameterSet const &  pset 
)
staticprivate

Definition at line 472 of file DetectorActivityRatePlots.cpp.

473 {
474  readParam(pset, "Start", binConfig.start);
475  readParam(pset, "Stop", binConfig.stop);
476  readParam(pset, "Step", binConfig.step);
477 } // PlotDetectorActivityRates::parseBinning()
static void readParam(fhicl::ParameterSet const &pset, std::string const &key, T &var)
auto PlotDetectorActivityRates::parseValidatedAlgorithmConfiguration ( FHiCLconfig const &  config)
private

Definition at line 455 of file DetectorActivityRatePlots.cpp.

456 {
457  AlgorithmConfiguration algConfig;
458  algConfig.edepTag = config.Deposits();
459  algConfig.chanTag = config.TPCchannels();
460  algConfig.photTag = config.OpDetChannels();
461  parseAndValidateBinning(algConfig.simBinning, config.SimBinning());
462  parseAndValidateBinning(algConfig.TPCBinning, config.TPCBinning());
463  parseAndValidateBinning(algConfig.opDetBinning, config.OpDetBinning());
464  return algConfig;
465 } // PlotDetectorActivityRates::parseValidatedAlgorithmConfiguration()
static void parseAndValidateBinning(ConfigOut &binConfig, ConfigIn const &config)
AlgorithmConfiguration PlotDetectorActivityRates::parseValidatedAlgorithmConfiguration ( fhicl::ParameterSet const &  pset)
inlineprivate

Definition at line 354 of file DetectorActivityRatePlots.cpp.

AlgorithmConfiguration parseValidatedAlgorithmConfiguration(FHiCLconfig const &config)
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
void PlotDetectorActivityRates::plotEnergyDeposits ( std::vector< sim::SimEnergyDeposit > const &  energyDeps)
private

Plots data from energy deposits in liquid argon.

Definition at line 681 of file DetectorActivityRatePlots.cpp.

682 {
683  // funny fact: this method modifies the plot content but does not modify the
684  // plot object pointer, so we can declare it const.
685 
686  // shifted by 1 ([0] is underflow, ROOT standard)
687  std::vector<EDepUnit_t> counters(fSimBinner.nBins() + 2U, EDepUnit_t{ 0.0 });
688 
689  // all channels are aggregated together
690  for (sim::SimEnergyDeposit const& edep: energyDeps) {
691 
692  simulation_time const time { edep.Time() };
693 
694  int const timeBin = fSimBinner.cappedBinWithOverflows(time);
695  assert(timeBin + 1 < counters.size());
696 
697  EDepUnit_t const energy { edep.Energy() }; // explicit with the unit
698 
699  counters[timeBin + 1] += energy;
700 
701  } // for channels
702 
703  for (auto const [ iCount, count ]: util::enumerate(counters))
704  fEDepDistrib->Fill(fSimBinner.binCenter(iCount - 1).value(), count.value());
705 
706 
707  EDepUnit_t const totalE
708  = std::accumulate(counters.cbegin(), counters.cend(), EDepUnit_t{ 0.0 });
709  fEDepStats.add(totalE.value());
710 
711  mf::LogVerbatim("PlotDetectorActivityRates")
712  << "Collected " << totalE << " in " << energyDeps.size() << " deposits.";
713 
714 } // PlotDetectorActivityRates::plotEnergyDeposits()
util::quantities::megaelectronvolt EDepUnit_t
Unit the energy depositions are stored in (LArSoft convention).
simulation_time_scale::time_point_t simulation_time
lar::util::StatCollector< double > fEDepStats
Statistics of the total energy per event.
int cappedBinWithOverflows(Data_t value) const
Returns a valid bin index or -1 for underflow or nBins() for overflow.
Definition: Binner.h:166
Data_t binCenter(int iBin) const
Returns the center of the bin with the specified index iBin.
Definition: Binner.h:189
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
util::Binner< simulation_time > fSimBinner
std::unique_ptr< TProfile > fEDepDistrib
Average amount of deposited energy per time [GeV].
Energy deposition in the active material.
std::size_t count(Cont const &cont)
unsigned int nBins() const
Returns the number of bins in the range.
Definition: Binner.h:110
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.
template<typename Event >
void PlotDetectorActivityRates::plotEvent ( Event const &  event)

Processes a single event.

Definition at line 600 of file DetectorActivityRatePlots.cpp.

600  {
601  assert(fDetTimings); // setupEvent() should have taken care of this
602 
603  //
604  // energy depositions
605  //
606  auto const& energyDeps
607  = *(event.template getValidHandle<std::vector<sim::SimEnergyDeposit>>
608  (fConfig.edepTag));
609 
610  plotEnergyDeposits(energyDeps);
611 
612  //
613  // TPC charge
614  //
615  auto const& TPCchannels
616  = *(event.template getValidHandle<std::vector<sim::SimChannel>>
617  (fConfig.chanTag));
618 
619  plotTPCionization(TPCchannels);
620 
621  //
622  // photons
623  //
624  auto const& photonChannels
625  = *(event.template getValidHandle<std::vector<sim::SimPhotons>>
626  (fConfig.photTag));
627 
628  plotPhotons(photonChannels);
629 
630 } // PlotDetectorActivityRates::plotEvent()
std::optional< detinfo::DetectorTimings > fDetTimings
void plotEnergyDeposits(std::vector< sim::SimEnergyDeposit > const &energyDeps)
Plots data from energy deposits in liquid argon.
void plotPhotons(std::vector< sim::SimPhotons > const &photonChannels)
Plots data from photoelectron collection.
void plotTPCionization(std::vector< sim::SimChannel > const &TPCchannels)
Plots data from photoelectron collection.
AlgorithmConfiguration const fConfig
Complete configuration of the algorithm.
void PlotDetectorActivityRates::plotPhotons ( std::vector< sim::SimPhotons > const &  photonChannels)
private

Plots data from photoelectron collection.

Definition at line 759 of file DetectorActivityRatePlots.cpp.

760 {
761  // funny fact: this method modifies the plot content but does not modify the
762  // plot object pointer, so we can declare it const.
763 
764  // shifted by 1 ([0] is underflow, ROOT standard)
765  std::vector<unsigned int> counters(fOpDetBinner.nBins() + 2U, 0U);
766 
767  // all channels are aggregated together
768  for (sim::SimPhotons const& photons: photonChannels) {
769 
770  for (sim::OnePhoton const& photon: photons) {
771 
772  simulation_time const time { photon.Time };
773 
774  int const timeBin
775  = fOpDetBinner.cappedBinWithOverflows(fDetTimings->toTriggerTime(time));
776  assert(timeBin + 1 < counters.size());
777 
778  ++counters[timeBin + 1];
779 
780  } // for photons in channel
781 
782  } // for channels
783 
784  for (auto const [ iCount, count ]: util::enumerate(counters))
785  fPhotonDistrib->Fill(fOpDetBinner.binCenter(iCount - 1).value(), count);
786 
787  unsigned int const totalPhotons
788  = std::accumulate(counters.cbegin(), counters.cend(), 0U);
789  fPhotonStats.add(totalPhotons);
790 
791  mf::LogVerbatim("PlotDetectorActivityRates")
792  << "Collected " << totalPhotons
793  << " photoelectrons in " << photonChannels.size() << " channels."
794  ;
795 
796 } // PlotDetectorActivityRates::plotPhotons()
process_name can override from command line with o or output photon
Definition: runPID.fcl:28
std::optional< detinfo::DetectorTimings > fDetTimings
simulation_time_scale::time_point_t simulation_time
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
int cappedBinWithOverflows(Data_t value) const
Returns a valid bin index or -1 for underflow or nBins() for overflow.
Definition: Binner.h:166
Data_t binCenter(int iBin) const
Returns the center of the bin with the specified index iBin.
Definition: Binner.h:189
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
lar::util::StatCollector< unsigned int > fPhotonStats
Statistics of the total light (photoelectron count) per event.
std::unique_ptr< TProfile > fPhotonDistrib
Average number of photon per time.
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
std::size_t count(Cont const &cont)
unsigned int nBins() const
Returns the number of bins in the range.
Definition: Binner.h:110
util::Binner< trigger_time > fOpDetBinner
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.
void PlotDetectorActivityRates::plotTPCionization ( std::vector< sim::SimChannel > const &  TPCchannels)
private

Plots data from photoelectron collection.

Definition at line 718 of file DetectorActivityRatePlots.cpp.

719 {
720  // funny fact: this method modifies the plot content but does not modify the
721  // plot object pointer, so we can declare it const.
722 
723  // shifted by 1 ([0] is underflow, ROOT standard)
724  std::vector<double> counters(fTPCBinner.nBins() + 2U, 0U);
725 
726  // all channels are aggregated together
727  for (sim::SimChannel const& channel: TPCchannels) {
728 
729  for (auto const& [ TDC, IDEs ]: channel.TDCIDEMap()) {
730 
731  // the TDC is filled by `LArVoxelReadout` with
732  // clockData.TPCClock().Ticks(clockData.G4ToElecTime(time))
733  electronics_tick const tick { TDC };
734 
735  int const tickBin = fTPCBinner.cappedBinWithOverflows(tick);
736  assert(tickBin + 1 < counters.size());
737 
738  counters[tickBin + 1] += channel.Charge(TDC);
739 
740  } // for all TDC
741 
742  } // for channels
743 
744  for (auto const [ iCount, count ]: util::enumerate(counters))
745  fTPCchargeDistrib->Fill(fTPCBinner.binCenter(iCount - 1).value(), count);
746 
747  double const totalElectrons
748  = std::accumulate(counters.cbegin(), counters.cend(), 0.0);
749  fTPCchargeStats.add(totalElectrons);
750  mf::LogVerbatim("PlotDetectorActivityRates")
751  << "Detected " << totalElectrons
752  << " electrons in " << TPCchannels.size() << " channels (all planes)."
753  ;
754 
755 } // PlotDetectorActivityRates::plotTPCionization()
Energy deposited on a readout channel by simulated tracks.
Definition: SimChannel.h:145
detinfo::timescales::electronics_tick electronics_tick
int cappedBinWithOverflows(Data_t value) const
Returns a valid bin index or -1 for underflow or nBins() for overflow.
Definition: Binner.h:166
Data_t binCenter(int iBin) const
Returns the center of the bin with the specified index iBin.
Definition: Binner.h:189
std::unique_ptr< TProfile > fTPCchargeDistrib
Average amount of ionization collected per time.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
lar::util::StatCollector< double > fTPCchargeStats
Statistics of the total charge (electron count) per event.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
util::Binner< electronics_tick > fTPCBinner
std::size_t count(Cont const &cont)
unsigned int nBins() const
Returns the number of bins in the range.
Definition: Binner.h:110
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.
void PlotDetectorActivityRates::prepare ( )

Performs the initialization of the algorithm.

Definition at line 515 of file DetectorActivityRatePlots.cpp.

515  {
516 
517  initializePlots();
518 
519 } // PlotDetectorActivityRates::prepare()
void initializePlots()
Performs the initialization of the plots filled by the algorithm.
template<typename Stream >
void PlotDetectorActivityRates::printConfig ( Stream &&  out) const

Prints the current configuration to the specified output stream.

Definition at line 643 of file DetectorActivityRatePlots.cpp.

643  {
644 
645  out << "PlotDetectorActivityRates algorithm using:"
646  << "\n * simulated energy deposits: " << fConfig.edepTag.encode()
647  << "\n * simulated electrons: " << fConfig.chanTag.encode()
648  << "\n * simulated photons: " << fConfig.photTag.encode()
649  << "\n * time binning for: "
650  << "\n - simulation: " << fSimBinner
651  << "\n - TPC: " << fTPCBinner
652  << "\n - optical detectors: " << fOpDetBinner
653  << "\n"
654  ;
655 
656 } // PlotDetectorActivityRates::printConfig()
AlgorithmConfiguration const fConfig
Complete configuration of the algorithm.
util::Binner< simulation_time > fSimBinner
util::Binner< electronics_tick > fTPCBinner
util::Binner< trigger_time > fOpDetBinner
void PlotDetectorActivityRates::printConfigurationHelp ( std::ostream &  out)
static

Prints on out screen a configuration summary.

Definition at line 490 of file DetectorActivityRatePlots.cpp.

490  {
491 
492  out << "Configuration for the analysis algorithm:\n";
493  Parameters const table
495  table.print_allowed_configuration(out);
496  out << std::endl;
497 
498 } // PlotDetectorActivityRates::printConfigurationHelp()
static std::string const ConfigurationKey
Name of the recommended configuration table for this algorithm.
BEGIN_PROLOG vertical distance to the surface Name
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
void PlotDetectorActivityRates::printStats ( ) const
private

Prints on screen some collected statistics.

Definition at line 813 of file DetectorActivityRatePlots.cpp.

813  {
814 
815  mf::LogVerbatim("PlotDetectorActivityRates")
816  << "Statistics, on average per event (" << fEDepStats.N() << " events):"
817  << "\n * )" << fEDepStats.Average() << " +/- " << fEDepStats.RMS()
818  << ") " << EDepUnit_t::unitSymbol() << " of deposited energy"
819  << "\n * (" << fTPCchargeStats.Average() << " +/- " << fTPCchargeStats.RMS()
820  << ") ionization electrons (all planes)"
821  << "\n * " << fPhotonStats.Average() << " +/- " << fPhotonStats.RMS()
822  << ") photoelectrons"
823  ;
824 
825 } // PlotDetectorActivityRates::printStats()
lar::util::StatCollector< double > fEDepStats
Statistics of the total energy per event.
Weight_t RMS() const
Returns the root mean square.
static auto unitSymbol()
Returns the symbol of the unit, in a string-like object.
Definition: quantities.h:754
Weight_t Average() const
Returns the value average.
lar::util::StatCollector< unsigned int > fPhotonStats
Statistics of the total light (photoelectron count) per event.
lar::util::StatCollector< double > fTPCchargeStats
Statistics of the total charge (electron count) per event.
int N() const
Returns the number of entries added.
template<typename Stream >
void PlotDetectorActivityRates::printTimingSummary ( Stream &&  out) const

Prints some information about configured timing.

Definition at line 660 of file DetectorActivityRatePlots.cpp.

660  {
661  assert(fDetTimings); // it should have been taken care by setup()
662  assert(fDetPropsData); // it should have been taken care by setup()
663 
664  detinfo::timescales::TPCelectronics_tick const TPCstart { 0 },
665  TPCstop { fDetPropsData->ReadOutWindowSize() };
666 
667  out << "Relevant timing settings:"
668  << "\n * TPC readout window: ";
669  printConvertedTickRange<detinfo::timescales::electronics_tick>
670  (out << "\n - ", TPCstart, TPCstop, *fDetTimings);
671  printConvertedTimeRange<detinfo::timescales::electronics_time>
672  (out << "\n - ", TPCstart, TPCstop, *fDetTimings);
673  printConvertedTimeRange<detinfo::timescales::simulation_time>
674  (out << "\n - ", TPCstart, TPCstop, *fDetTimings);
675  out << "\n";
676 
677 } // PlotDetectorActivityRates::printConfig()
std::optional< detinfo::DetectorPropertiesData > fDetPropsData
std::optional< detinfo::DetectorTimings > fDetTimings
timescale_traits< TPCelectronicsTimeCategory >::tick_t TPCelectronics_tick
A point on the TPC electronics time scale expressed in its ticks.
template<typename T >
static void PlotDetectorActivityRates::readParam ( fhicl::ParameterSet const &  pset,
std::string const &  key,
T &  var 
)
inlinestaticprivate

Definition at line 371 of file DetectorActivityRatePlots.cpp.

372  { var = pset.get<T>(key); }
void PlotDetectorActivityRates::savePlots ( )
private

Writes all plots into the current ROOT directory (and then deletes them).

Definition at line 799 of file DetectorActivityRatePlots.cpp.

799  {
800 
801  if (!fDestDir) return;
802 
804 
808 
809 
810 } // PlotDetectorActivityRates::savePlots()
std::unique_ptr< TProfile > fTPCchargeDistrib
Average amount of ionization collected per time.
TDirectory * fDestDir
ROOT directory where to write the plots.
static void Serialize(std::unique_ptr< Plot > &plot)
Writes plot into the current ROOT directory, then deletes it.
std::unique_ptr< TProfile > fPhotonDistrib
Average number of photon per time.
std::unique_ptr< TProfile > fEDepDistrib
Average amount of deposited energy per time [GeV].
A class restoring the previous TDirectory on destruction.
Definition: ROOTutils.h:54
template<typename Plot >
void PlotDetectorActivityRates::Serialize ( std::unique_ptr< Plot > &  plot)
staticprivate

Writes plot into the current ROOT directory, then deletes it.

Definition at line 829 of file DetectorActivityRatePlots.cpp.

829  {
830  if (!plot) return;
831  plot->Write();
832  plot.reset();
833 } // PlotDetectorActivityRates::Serialize()
void PlotDetectorActivityRates::setup ( TDirectory *  pDestDir,
detinfo::DetectorClocksData &&  clocksData,
detinfo::DetectorPropertiesData &&  propsData 
)

Sets the algorithm up.

Parameters
pDestDirROOT output directory for the plots
clocksDatadetector clocks information (event-independent)
propsDatadetector properties information (event-independent)

Definition at line 501 of file DetectorActivityRatePlots.cpp.

505  {
506 
507  fDestDir = pDestDir;
508 
509  fDetTimings.emplace(std::move(clocksData));
510  fDetPropsData.emplace(std::move(propsData));
511 
512 } // PlotDetectorActivityRates::setup()
std::optional< detinfo::DetectorPropertiesData > fDetPropsData
std::optional< detinfo::DetectorTimings > fDetTimings
TDirectory * fDestDir
ROOT directory where to write the plots.
void PlotDetectorActivityRates::setupEvent ( detinfo::DetectorClocksData &&  clocksData,
detinfo::DetectorPropertiesData &&  propsData 
)

Set up for a specific event.

Definition at line 588 of file DetectorActivityRatePlots.cpp.

591  {
592  // if multithreading were needed, this should be merged with `plotEvent()`
593  // and made constant; ROOT histograms are not thread-safe anyway.
594  fDetTimings.emplace(std::move(clocksData));
595  fDetPropsData.emplace(std::move(propsData));
596 } // PlotDetectorActivityRates::setupEvent()
std::optional< detinfo::DetectorPropertiesData > fDetPropsData
std::optional< detinfo::DetectorTimings > fDetTimings

Member Data Documentation

std::string const PlotDetectorActivityRates::ConfigurationKey { "plot" }
static

Name of the recommended configuration table for this algorithm.

Definition at line 229 of file DetectorActivityRatePlots.cpp.

AlgorithmConfiguration const PlotDetectorActivityRates::fConfig
private

Complete configuration of the algorithm.

Definition at line 186 of file DetectorActivityRatePlots.cpp.

TDirectory* PlotDetectorActivityRates::fDestDir = nullptr
private

ROOT directory where to write the plots.

Definition at line 196 of file DetectorActivityRatePlots.cpp.

std::optional<detinfo::DetectorPropertiesData> PlotDetectorActivityRates::fDetPropsData
private

Definition at line 199 of file DetectorActivityRatePlots.cpp.

std::optional<detinfo::DetectorTimings> PlotDetectorActivityRates::fDetTimings
private

Definition at line 198 of file DetectorActivityRatePlots.cpp.

std::unique_ptr<TProfile> PlotDetectorActivityRates::fEDepDistrib
private

Average amount of deposited energy per time [GeV].

Definition at line 205 of file DetectorActivityRatePlots.cpp.

lar::util::StatCollector<double> PlotDetectorActivityRates::fEDepStats
private

Statistics of the total energy per event.

Definition at line 215 of file DetectorActivityRatePlots.cpp.

util::Binner<trigger_time> PlotDetectorActivityRates::fOpDetBinner
private

Definition at line 190 of file DetectorActivityRatePlots.cpp.

std::unique_ptr<TProfile> PlotDetectorActivityRates::fPhotonDistrib
private

Average number of photon per time.

Definition at line 211 of file DetectorActivityRatePlots.cpp.

lar::util::StatCollector<unsigned int> PlotDetectorActivityRates::fPhotonStats
private

Statistics of the total light (photoelectron count) per event.

Definition at line 221 of file DetectorActivityRatePlots.cpp.

util::Binner<simulation_time> PlotDetectorActivityRates::fSimBinner
private

Definition at line 188 of file DetectorActivityRatePlots.cpp.

util::Binner<electronics_tick> PlotDetectorActivityRates::fTPCBinner
private

Definition at line 189 of file DetectorActivityRatePlots.cpp.

std::unique_ptr<TProfile> PlotDetectorActivityRates::fTPCchargeDistrib
private

Average amount of ionization collected per time.

Definition at line 208 of file DetectorActivityRatePlots.cpp.

lar::util::StatCollector<double> PlotDetectorActivityRates::fTPCchargeStats
private

Statistics of the total charge (electron count) per event.

Definition at line 218 of file DetectorActivityRatePlots.cpp.


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