6 #include "CLHEP/Random/RandFlat.h" 7 #include "CLHEP/Random/RandPoissonQ.h" 14 #include "cetlib_except/exception.h" 25 #include "nurandom/RandomUtils/NuRandomService.h" 35 single_exp(
double t,
double tau2)
37 return exp((-1.0 * t) / tau2) / tau2;
41 bi_exp(
double t,
double tau1,
double tau2)
43 return (((exp((-1.0 * t) / tau2) * (1.0 - exp((-1.0 * t) / tau1))) / tau2) / tau2) *
52 GetScintTime(
double tau1,
double tau2, CLHEP::RandFlat& randflatscinttime)
56 if ((tau1 == 0.0) || (tau1 == -1.0)) {
return -tau2 * log(randflatscinttime()); }
58 auto ran1 = randflatscinttime();
59 auto ran2 = randflatscinttime();
60 auto d = (tau1 + tau2) / tau2;
61 auto t = -tau2 * log(1 - ran1);
62 auto g =
d * single_exp(t, tau2);
63 if (ran2 <= bi_exp(t, tau1, tau2) /
g) {
return t; }
168 ,
fEDepTags{
p.get<vector<art::InputTag>>(
"EDepModuleLabels")}
170 ->createEngine(*
this,
"HepJamesRandom",
"photon",
p,
"SeedPhoton"))
172 ->createEngine(*
this,
"HepJamesRandom",
"scinttime",
p,
"SeedScintTime"))
175 produces<vector<sim::SimPhotonsLite>>();
178 produces<vector<sim::SimPhotons>>();
187 auto const* larp = lar::providerFrom<detinfo::LArPropertiesService>();
191 auto const nOpChannels = pvs->NOpChannels();
192 unique_ptr<vector<sim::SimPhotons>> photCol{
new vector<sim::SimPhotons>{}};
193 auto& photonCollection{*photCol};
194 photonCollection.resize(nOpChannels);
195 unique_ptr<vector<sim::SimPhotonsLite>> photLiteCol{
new vector<sim::SimPhotonsLite>{}};
196 auto& photonLiteCollection{*photLiteCol};
197 photonLiteCollection.resize(nOpChannels);
198 for (
unsigned int i = 0; i < nOpChannels; ++i) {
199 photonLiteCollection[i].OpChannel = i;
200 photonCollection[i].SetChannel(i);
202 vector<vector<sim::SimEnergyDeposit>
const*> edep_vecs;
205 edep_vecs.push_back(edep_handle);
207 for (
auto const& edeps : edep_vecs) {
208 for (
auto const& edep : *edeps) {
211 auto const& Visibilities = pvs->GetAllVisibilities(
p);
214 <<
"There is no entry in the PhotonLibrary for this position in space. " 220 double nphot =
static_cast<int>(isCalcData.numPhotons);
222 double nphot_fast =
static_cast<int>(GetScintYield(edep, *larp) * nphot);
224 double nphot_slow = nphot - nphot_fast;
226 auto visibleFraction = Visibilities[
channel];
227 if (visibleFraction == 0.0) {
232 if (nphot_fast > 0) {
234 auto n =
static_cast<int>(randpoisphot.fire(nphot_fast * visibleFraction));
235 for (
long i = 0; i <
n; ++i) {
240 ++photonLiteCollection[
channel].DetectedPhotons[
time];
245 auto n = randpoisphot.fire(nphot_slow * visibleFraction);
246 for (
long i = 0; i <
n; ++i) {
251 ++photonLiteCollection[
channel].DetectedPhotons[
time];
260 if (nphot_fast > 0) {
262 auto n = randpoisphot.fire(nphot_fast * visibleFraction);
274 auto n = randpoisphot.fire(nphot_slow * visibleFraction);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
virtual double ElectronScintYieldRatio() const =0
Store parameters for running LArG4.
virtual double ScintYieldRatio() const =0
static constexpr double g
virtual double AlphaScintYieldRatio() const =0
void produce(art::Event &) override
virtual double ScintSlowTimeConst() const =0
All information of a photon entering the sensitive optical detector volume.
virtual double ScintFastTimeConst() const =0
CLHEP::HepRandomEngine & fScintTimeEngine
ISCalcData CalcIonAndScint(detinfo::DetectorPropertiesData const &detProp, sim::SimEnergyDeposit const &edep) override
virtual double ProtonScintYieldRatio() const =0
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
virtual double PionScintYieldRatio() const =0
Simulation objects for optical detectors.
#define DEFINE_ART_MODULE(klass)
Fast simulation of propagating the photons created from SimEnergyDeposits.
larg4::ISCalcSeparate fISAlg
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
geo::Point_t MidPoint() const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
vector< art::InputTag > fEDepTags
CLHEP::HepRandomEngine & fPhotonEngine
General LArSoft Utilities.
bool SetInSD
Whether the photon reaches the sensitive detector.
contains information for a single step in the detector simulation
Energy deposition in the active material.
virtual double MuonScintYieldRatio() const =0
float Energy
Scintillation photon energy [GeV].
virtual double KaonScintYieldRatio() const =0
virtual bool ScintByParticleType() const =0
cet::coded_exception< error, detail::translate > exception
bool UseLitePhotons() const