28 #include "nurandom/RandomUtils/NuRandomService.h"
31 #include "art/Framework/Services/Optional/RandomNumberGenerator.h"
32 #include "art/Framework/Core/EDProducer.h"
33 #include "art/Framework/Services/Registry/ServiceHandle.h"
34 #include "art_root_io/TFileService.h"
35 #include "art/Framework/Core/ModuleMacros.h"
36 #include "canvas/Utilities/InputTag.h"
39 #include "messagefacility/MessageLogger/MessageLogger.h"
40 #include "fhiclcpp/ParameterSet.h"
45 #include "CLHEP/Random/RandLandau.h"
62 virtual void configure(fhicl::ParameterSet
const & pset);
63 virtual void produce(art::Event &
e)
override;
65 virtual void endJob()
override;
94 : EDProducer{pset}, fGeometry(lar::providerFrom<geo::Geometry>())
95 , fPhotonEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(*
this,
"HepJamesRandom",
"icarusphoton", pset,
"SeedPhoton"))
100 produces<std::vector<sim::SimPhotons>>();
103 mf::LogDebug(
"PhotonPropogationICARUS") <<
"PhotonPropogationICARUS configured";
155 auto simPhotonVec = std::make_unique<std::vector<sim::SimPhotons>>();
158 auto const& srcSimPhotons
161 if (srcSimPhotons.empty()) {
162 mf::LogWarning(
"PhotonPropagationICARUS") <<
"No photons! Nice event you have here.";
163 event.put(std::move(simPhotonVec));
172 for(
const auto& simPhoton : srcSimPhotons)
174 auto const channel = simPhoton.OpChannel();
175 if (simPhoton.empty())
continue;
188 unsigned int photonNo = 0;
189 for (
auto& onePhoton: localPhoton)
196 mf::LogError(
"LightPropagationICARUS")
197 <<
"Too many photons to handle! only " << (photonNo - 1) <<
" saved.";
202 double const dis = (position - PMTcenter).R();
204 double mean = 0.18*dis;
205 double sigma = 0.75*dis;
211 const double minPropTime = dis / 21.74;
215 time_plus = mean + landauGen.fire() * sigma;
217 }
while (time_plus < minPropTime);
220 MF_LOG_TRACE(
"LightPropagationICARUS");
228 onePhoton.Time += time_plus;
233 simPhotonVec->push_back(std::move(localPhoton));
237 event.put(std::move(simPhotonVec));
245 mf::LogInfo(
"PhotonPropogationICARUS") <<
"Looked at " <<
fNumEvent <<
" events" << std::endl;
virtual void produce(art::Event &e) override
Utilities related to art service access.
static constexpr unsigned int MaxPhotons
We don't keep more than this number of photons per sim::SimPhoton.
virtual void endJob() override
End job method.
geo::GeometryCore const * fGeometry
Pointer to Geometry service.
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
void GetCenter(double *xyz, double localz=0.0) const
PhotonPropogationICARUS(fhicl::ParameterSet const &pset)
Simulation objects for optical detectors.
unsigned int fNumEvent
Number of events seen.
CLHEP::HepRandomEngine & fPhotonEngine
art::InputTag fSimPhotonModuleLabel
The full collection of SimPhotons.
Utilities to extend the interface of geometry vectors.
Description of geometry of one entire detector.
Encapsulate the geometry of an optical detector.
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Collection of photons which recorded on one channel.
virtual void configure(fhicl::ParameterSet const &pset)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
art framework interface to geometry description
virtual void beginJob() override
Begin job method.