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 "CLHEP/Random/RandFlat.h"
17 #include "CLHEP/Random/RandFlat.h"
18 #include "CLHEP/Random/RandExponential.h"
20 #include "nurandom/RandomUtils/NuRandomService.h"
21 #include "canvas/Utilities/InputTag.h"
22 #include "fhiclcpp/ParameterSet.h"
23 #include "messagefacility/MessageLogger/MessageLogger.h"
48 void produce(art::Event&
e)
override;
49 void beginRun(art::Run& run)
override;
64 std::vector<unsigned int>
_ch_v;
74 , fFlatEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(*
this,
"HepJamesRandom",
"Gen",
p,
"Seed"))
77 _verbose =
p.get<
bool>(
"Verbose",
false);
78 auto min_pe =
p.get<
int>(
"MinPE",1);
79 auto max_pe =
p.get<
int>(
"MaxPE",1);
80 assert(min_pe <= max_pe && min_pe>0 && max_pe>0);
84 _ch_v =
p.get<std::vector<unsigned int> >(
"Channels",_ch_v);
85 _frequency =
p.get<
double>(
"Frequency");
86 _duration =
p.get<
double>(
"Duration");
87 _tstart =
p.get<
double>(
"G4TStart");
88 produces<std::vector<sim::SimPhotons> >();
89 produces< sumdata::RunData, art::InRun >();
91 _simulate_time =
p.get<
bool>(
"SimulateTime",
false);
92 _fast_frac =
p.get<
double>(
"PromptLightFraction",0.23);
93 _fast_tau =
p.get<
double>(
"FastTimeConstant",0.006);
94 _slow_tau =
p.get<
double>(
"SlowTimeConstant",1.5);
96 fFlatRandom =
new CLHEP::RandFlat(fFlatEngine,_min_pe,_max_pe);
97 fExpoRandom =
new CLHEP::RandExponential(fFlatEngine);
103 art::ServiceHandle<geo::Geometry> geo;
105 std::unique_ptr<sumdata::RunData> runData(
new sumdata::RunData(geo->DetectorName()));
107 run.put(std::move(runData));
115 std::vector<double> res(numphotons);
116 for(
int i=0; i<((int)numphotons); ++i) {
127 auto simph_v = std::unique_ptr<std::vector<sim::SimPhotons> >(
new std::vector<sim::SimPhotons>());
130 auto const geop = lar::providerFrom<geo::Geometry>();
131 _ch_v.reserve(geop->NOpChannels());
132 for(
size_t opch=0; opch<geop->NOpChannels(); ++opch)
133 _ch_v.push_back(opch);
135 simph_v->reserve(
_ch_v.size());
136 for(
auto const& opch :
_ch_v) {
145 std::vector<double> time_array(npe,0.);
147 for(
size_t ctr=0;ctr<npe;++ctr) {
149 phot.
Time =
_tstart + clock * 1.e3 + time_array[ctr];
150 sphot.emplace_back(std::move(phot));
155 simph_v->emplace_back(std::move(sphot));
158 e.put(std::move(simph_v));
CLHEP::RandFlat * fFlatRandom
double _fast_tau
scintillation emission time constant for fast component
Utilities related to art service access.
double _slow_tau
scintillation emission time constant for slow component
FakePhotoS(fhicl::ParameterSet const &p)
All information of a photon entering the sensitive optical detector volume.
FakePhotoS & operator=(FakePhotoS const &)=delete
std::vector< double > GenerateTime(size_t numphotons)
Simulation objects for optical detectors.
std::vector< unsigned int > _ch_v
void beginRun(art::Run &run) override
Collection of photons which recorded on one channel.
bool _simulate_time
whether or not to simulate scintillation fall time
art framework interface to geometry description
BEGIN_PROLOG could also be cout
void produce(art::Event &e) override
CLHEP::HepRandomEngine & fFlatEngine
CLHEP::RandExponential * fExpoRandom
double _fast_frac
fraction of prompt light