14 #include "art/Framework/Core/EDAnalyzer.h"
15 #include "art/Framework/Core/ModuleMacros.h"
16 #include "art/Framework/Principal/Event.h"
17 #include "art/Framework/Principal/Handle.h"
18 #include "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "art_root_io/TFileService.h"
20 #include "fhiclcpp/ParameterSet.h"
79 , fLArG4ModuleLabel{pset.get<std::string>(
"LArGeantModuleLabel")}
103 art::ServiceHandle<art::TFileService const>
tfs;
105 art::ServiceHandle<geo::Geometry const> geom;
108 double width = 2 * geom->TPC(0).HalfWidth();
109 double halfHeight = geom->TPC(0).HalfHeight();
110 double length = geom->TPC(0).Length();
114 tfs->make<TH1D>(
"hChargeXpos",
"X charge depositions;X (cm);Events", 101, 0.0, width);
116 "hChargeYpos",
"Y charge depositions;Y (cm);Events", 101, -halfHeight, halfHeight);
118 tfs->make<TH1D>(
"hChargeZpos",
"Z charge depositions;Z (cm);Events", 101, 0.0, length);
119 fTDC = tfs->make<TH1D>(
"hTDC",
"Active TDC;TDCs;Events;", nTimeSamples, 0, nTimeSamples);
121 "hTDCsPerChannel",
"TDCs per channel entry;# TDCs;Events", 128, 0, nTimeSamples);
123 tfs->make<TH1D>(
"hIDEsPerChannel",
"IDE per channel entry;# IDEs;Events", 100, 0, 20000);
125 tfs->make<TH1D>(
"hElectrons",
"Electrons per channel;Electrons;Events", 100, 0, 2e7);
126 fEnergy = tfs->make<TH1D>(
"hEnergy",
"Energy per channel;energy;Events", 100, 0, 2500);
128 tfs->make<TH1D>(
"hElectronsPerIDE",
"Electrons per IDE;Electrons;Events", 100, 0, 10000);
129 fEnergyPerIDE = tfs->make<TH1D>(
"hEnergyPerIDE",
"Energy per IDE;energy;Events", 100, 0, 50);
131 tfs->make<TH1D>(
"hElectronsPerTDC",
"Electrons per TDC;Electrons;Events", 100, 0, 10000);
132 fEnergyPerTDC = tfs->make<TH1D>(
"hEnergyPerTDC",
"Energy per YDC;energy;Events", 100, 0, 50);
139 if (evt.isRealData()) {
140 throw cet::exception(
"LArSimChannelAna") <<
"Not for use on Data yet...\n";
144 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt);
147 art::ServiceHandle<geo::Geometry const> geom;
149 auto const& scVec = *evt.getValidHandle<std::vector<sim::SimChannel>>(
fLArG4ModuleLabel);
154 unsigned int totalIDEs = 0;
155 double totalElectrons = 0;
156 double totalEnergy = 0;
157 for (
const auto& sc : scVec) {
158 const auto& tdcidemap = sc.TDCIDEMap();
161 for (
auto const& [tdc, ideVec] : tdcidemap) {
162 totalIDEs += ideVec.size();
163 double tdcElectrons = 0;
164 double tdcEnergy = 0;
168 for (
const auto& ide : ideVec) {
169 totalElectrons += ide.numElectrons;
170 totalEnergy += ide.energy;
171 tdcElectrons += ide.numElectrons;
172 tdcEnergy += ide.energy;
TH1D * fTDCsPerChannel
Number of TDCs with activity.
std::string fLArG4ModuleLabel
TH1D * fElectrons
Electrons in the whole channel entry.
TH1D * fChargeXpos
position of the MC Truth charge deposition
void ensureHists(unsigned int const nTimeSamples)
LArSimChannelAna(fhicl::ParameterSet const &pset)
void analyze(const art::Event &evt) override
TH1D * fChargeYpos
position of the MC Truth charge deposition
Base class for creation of raw signals on wires.
TH1D * fEnergy
Energy in the whole channel entry.
TH1D * fChargeZpos
position of the MC Truth charge deposition
object containing MC truth information necessary for making RawDigits and doing back tracking ...
art::ServiceHandle< art::TFileService > tfs
TH1D * fTDC
Which TDCs have activity.
art framework interface to geometry description
Encapsulate the construction of a single detector plane.