File indexing completed on 2026-11-07 10:20:32
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <map>
0010 #include <TH1D.h>
0011 #include <TH2D.h>
0012 #include <art/Framework/Core/EDAnalyzer.h>
0013 #include <canvas/Utilities/InputTag.h>
0014 #include <fhiclcpp/types/Atom.h>
0015 #include <fhiclcpp/types/Sequence.h>
0016
0017 namespace sim
0018 {
0019 class SimEnergyDeposit;
0020 class OpDetBacktrackerRecord;
0021 class SimPhotonsLite;
0022 }
0023
0024 namespace celeritas
0025 {
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 class PDSimAna : public art::EDAnalyzer
0036 {
0037 public:
0038 struct Config
0039 {
0040 fhicl::Atom<art::InputTag> SimulationLabel{
0041 fhicl::Name("SimulationLabel"),
0042 fhicl::Comment(R"(Module label containing SimEnergyDeposit)")};
0043
0044 fhicl::Atom<art::InputTag> PDModuleLabel{
0045 fhicl::Name{"PDModuleLabel"},
0046 fhicl::Comment{R"(Module containing SimPhotonsLite/OpDetBTRs)"}};
0047
0048 fhicl::Atom<unsigned int> NumChannels{
0049 fhicl::Name{"NumChannels"},
0050 fhicl::Comment{R"(Number of detector channels)"},
0051 480};
0052
0053 fhicl::Atom<double> MinTime{
0054 fhicl::Name{"MinTime"},
0055 fhicl::Comment{R"(Minimum time for histogram binning [ns])"},
0056 10.0};
0057
0058 fhicl::Atom<double> MaxTime{
0059 fhicl::Name{"MaxTime"},
0060 fhicl::Comment{R"(Maximum time for histogram binning [ns])"},
0061 20e3};
0062 };
0063 using Parameters = art::EDAnalyzer::Table<Config>;
0064
0065 public:
0066
0067 explicit PDSimAna(Parameters const& p);
0068
0069
0070
0071 PDSimAna(PDSimAna const&) = delete;
0072 PDSimAna(PDSimAna&&) = delete;
0073 PDSimAna& operator=(PDSimAna const&) = delete;
0074 PDSimAna& operator=(PDSimAna&&) = delete;
0075
0076
0077
0078 void beginJob() override;
0079
0080
0081 void analyze(art::Event const& event) override;
0082
0083 private:
0084 struct Dims
0085 {
0086 unsigned int num_channels{0};
0087 double min_time{1e100};
0088 double max_time{0};
0089 };
0090
0091 struct Histograms
0092 {
0093 using PDG = int;
0094
0095 TH1D* edep_photons{nullptr};
0096 TH1D* hit_time{nullptr};
0097 std::map<PDG, TH1D*> pdg_edep_step_len;
0098 TH2D* photons_detid_time{nullptr};
0099 };
0100
0101
0102 art::InputTag sim_tag_;
0103 art::InputTag pd_tag_;
0104 Dims inp_;
0105
0106
0107 Histograms hist_;
0108
0109
0110 void fill(sim::SimEnergyDeposit const& edep);
0111 void fill(sim::SimPhotonsLite const& spl,
0112 sim::OpDetBacktrackerRecord const& btr);
0113 };
0114
0115
0116 }