10 #include "art/Framework/Core/EDProducer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
46 void produce(art::Event&
e)
override;
61 , fGeometry(*lar::providerFrom<geo::Geometry>())
63 fSedLabel =
p.get<art::InputTag>(
"SimEnergyDepositLabel",
"largeant:TPCActive");
66 fVoxelSizeX =
p.get<
double>(
"VoxelSizeX", 0.3);
67 fVoxelSizeY =
p.get<
double>(
"VoxelSizeY", 0.3);
68 fVoxelSizeZ =
p.get<
double>(
"VoxelSizeZ", 0.3);
69 if (fVoxelSizeX <= 0. || fVoxelSizeY <= 0. || fVoxelSizeZ <= 0.) {
70 std::cerr <<
"Voxel size must be strictly greater than zero." << std::endl;
71 throw std::exception();
74 double min_x = std::numeric_limits<double>::max();
75 double min_y = std::numeric_limits<double>::max();
76 double min_z = std::numeric_limits<double>::max();
77 for(
geo::TPCGeo const& tpc: fGeometry.IterateTPCs()) {
78 auto const& tpcabox = tpc.ActiveBoundingBox();
79 min_x = std::min(min_x, tpcabox.MinX());
80 min_y = std::min(min_y, tpcabox.MinY());
81 min_z = std::min(min_z, tpcabox.MinZ());
83 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
86 fMinX = min_x + clockData.TriggerOffsetTPC() * 1.6 / 10;
93 produces<std::vector<sim::SimEnergyDepositLite>>();
96 consumes<std::vector<sim::SimEnergyDeposit>>(fSedLabel);
104 auto handle = e.getValidHandle<std::vector<sim::SimEnergyDeposit>>(
fSedLabel);
105 if (!handle.isValid()) {
107 std::cerr <<
"SimEnergyDeposit not found" << std::endl;
108 throw std::exception();
113 if (lhs.
X() < rhs.
X())
return true;
114 if (lhs.
X() > rhs.
X())
return false;
115 if (lhs.
Y() < rhs.
Y())
return true;
116 if (lhs.
Y() > rhs.
Y())
return false;
117 if (lhs.
Z() < rhs.
Z())
return true;
118 if (lhs.
Z() > rhs.
Z())
return false;
122 std::set<sim::SimEnergyDepositLite, comp> sedlite_v2;
124 auto const& sed_v = *handle;
132 for (
size_t idx = 0; idx < sed_v.size(); ++idx) {
133 auto const& sed = sed_v[idx];
141 auto it = sedlite_v2.find(sed_lite);
142 if (it!=sedlite_v2.end()) {
143 double new_energy = sed_lite.E() + it->E();
144 double new_time = std::min(sed_lite.T(), it->T());
145 sedlite_v2.erase(it);
147 sedlite_v2.insert(new_sed_lite);
150 sedlite_v2.insert(std::move(sed_lite));
165 std::unique_ptr<std::vector<sim::SimEnergyDepositLite>> sedlite_v(
new std::vector<sim::SimEnergyDepositLite>(sedlite_v2.begin(), sedlite_v2.end()));
168 e.put(std::move(sedlite_v));
process_name opflash particleana ie ie ie z
Utilities related to art service access.
process_name opflash particleana ie x
BEGIN_PROLOG could also be cerr
art::InputTag fSedLabel
module making the SimEnergyDeposit
void produce(art::Event &e) override
Geometry information for a single TPC.
const geo::GeometryCore & fGeometry
double fMinZ
bottom left coordinate of union of all TPC active volumes
G4InfoReducer & operator=(G4InfoReducer const &)=delete
Access the description of detector geometry.
double fVoxelSizeZ
size of a voxel (cm)
process_name opflash particleana ie ie y
contains information for a single step in the detector simulation (pared down in size to the essentia...
Description of geometry of one entire detector.
Energy deposition in the active material (lite version).
contains information for a single step in the detector simulation
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
art framework interface to geometry description
G4InfoReducer(fhicl::ParameterSet const &p)