All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
phot::PhotonLibraryPropagation Class Reference

Fast simulation of propagating the photons created from SimEnergyDeposits. More...

Inheritance diagram for phot::PhotonLibraryPropagation:

Public Member Functions

 PhotonLibraryPropagation (fhicl::ParameterSet const &)
 
 PhotonLibraryPropagation (PhotonLibraryPropagation const &)=delete
 
 PhotonLibraryPropagation (PhotonLibraryPropagation &&)=delete
 
PhotonLibraryPropagationoperator= (PhotonLibraryPropagation const &)=delete
 
PhotonLibraryPropagationoperator= (PhotonLibraryPropagation &&)=delete
 

Private Member Functions

void produce (art::Event &) override
 

Private Attributes

double fRiseTimeFast
 
double fRiseTimeSlow
 
bool fDoSlowComponent
 
vector< art::InputTag > fEDepTags
 
larg4::ISCalcSeparate fISAlg
 
CLHEP::HepRandomEngine & fPhotonEngine
 
CLHEP::HepRandomEngine & fScintTimeEngine
 

Detailed Description

Fast simulation of propagating the photons created from SimEnergyDeposits.

This module does a fast simulation of propagating the photons created from SimEnergyDeposits, which is the Geant4 output after each step, to each of the optical detectors. This simulation is done using the PhotonLibrary, which stores the visibilities of each optical channel with respect to each optical voxel in the TPC volume, to avoid propagating single photons using Geant4. At the end of this module a collection of the propagated photons either as sim::SimPhotonsLite or as sim::SimPhotons is placed into the art event.

Keep in mind that at this stage the LArG4 main module is not capable of running the full optical simulation, because the necessary code has not yet been written.

In the future when the PhotonLibrary has the propagation time included, it could be possible to enhance sim::SimPhotons and sim::SimPhotonsLite to contain the propagation time. At this point the time recorded for the photon is the creation time of the photon.

The steps this module takes are:

the total amount of visible photons produced during the current Geant4 step equals the sum of counts for each time.

and if sim::SimPhotons produced:

This module should only be run for the fast optical simulation even though it can create sim::SimPhotonsLite and sim::SimPhotons as data products. If there is need to create sim::SimPhotons, there are some considerations you must be aware of. Since the amount of sim::SimPhotons produced even at low energies and in small geometries quickly exceeds the memory capacity of the job, right now it is actually impossible to produce sim::SimPhotons for any realistic geometry. A possible way around the problem is to implement a scaling of the produced sim::SimPhotons, to only produce a fraction of them.

Definition at line 145 of file PhotonLibraryPropagation_module.cc.

Constructor & Destructor Documentation

phot::PhotonLibraryPropagation::PhotonLibraryPropagation ( fhicl::ParameterSet const &  p)
explicit

Definition at line 165 of file PhotonLibraryPropagation_module.cc.

166  : art::EDProducer{p}
167  , fRiseTimeFast{p.get<double>("RiseTimeFast", 0.0)}
168  , fRiseTimeSlow{p.get<double>("RiseTimeSlow", 0.0)}
169  , fDoSlowComponent{p.get<bool>("DoSlowComponent")}
170  , fEDepTags{p.get<vector<art::InputTag>>("EDepModuleLabels")}
171  , fPhotonEngine(art::ServiceHandle<rndm::NuRandomService> {}
pdgs p
Definition: selectors.fcl:22
phot::PhotonLibraryPropagation::PhotonLibraryPropagation ( PhotonLibraryPropagation const &  )
delete
phot::PhotonLibraryPropagation::PhotonLibraryPropagation ( PhotonLibraryPropagation &&  )
delete

Member Function Documentation

PhotonLibraryPropagation& phot::PhotonLibraryPropagation::operator= ( PhotonLibraryPropagation const &  )
delete
PhotonLibraryPropagation& phot::PhotonLibraryPropagation::operator= ( PhotonLibraryPropagation &&  )
delete
void phot::PhotonLibraryPropagation::produce ( art::Event &  e)
overrideprivate

Definition at line 185 of file PhotonLibraryPropagation_module.cc.

186  {
187  art::ServiceHandle<PhotonVisibilityService const> pvs;
188  art::ServiceHandle<sim::LArG4Parameters const> lgp;
189  auto const* larp = lar::providerFrom<detinfo::LArPropertiesService>();
190  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e);
191  CLHEP::RandPoissonQ randpoisphot{fPhotonEngine};
192  CLHEP::RandFlat randflatscinttime{fScintTimeEngine};
193  auto const nOpChannels = pvs->NOpChannels();
194  unique_ptr<vector<sim::SimPhotons>> photCol{new vector<sim::SimPhotons>{}};
195  auto& photonCollection{*photCol};
196  photonCollection.resize(nOpChannels);
197  unique_ptr<vector<sim::SimPhotonsLite>> photLiteCol{new vector<sim::SimPhotonsLite>{}};
198  auto& photonLiteCollection{*photLiteCol};
199  photonLiteCollection.resize(nOpChannels);
200  for (unsigned int i = 0; i < nOpChannels; ++i) {
201  photonLiteCollection[i].OpChannel = i;
202  photonCollection[i].SetChannel(i);
203  }
204  vector<vector<sim::SimEnergyDeposit> const*> edep_vecs;
205  for (auto label : fEDepTags) {
206  auto const& edep_handle = e.getValidHandle<vector<sim::SimEnergyDeposit>>(label);
207  edep_vecs.push_back(edep_handle);
208  }
209  for (auto const& edeps : edep_vecs) { //loop over modules
210  for (auto const& edep : *edeps) { //loop over energy deposits: one per step
211  //int count_onePhot =0; // unused
212  auto const& p = edep.MidPoint();
213  auto const& Visibilities = pvs->GetAllVisibilities(p);
214  if (!Visibilities) {
215  throw cet::exception("PhotonLibraryPropagation")
216  << "There is no entry in the PhotonLibrary for this position in space. "
217  "Position: "
218  << edep.MidPoint();
219  }
220  auto const isCalcData = fISAlg.CalcIonAndScint(detProp, edep);
221  //total amount of scintillation photons
222  double nphot = static_cast<int>(isCalcData.numPhotons);
223  //amount of scintillated photons created via the fast scintillation process
224  double nphot_fast = static_cast<int>(GetScintYield(edep, *larp) * nphot);
225  //amount of scintillated photons created via the slow scintillation process
226  double nphot_slow = nphot - nphot_fast;
227  for (unsigned int channel = 0; channel < nOpChannels; ++channel) {
228  auto visibleFraction = Visibilities[channel];
229  if (visibleFraction == 0.0) {
230  // Voxel is not visible at this optical channel, skip doing anything for this channel.
231  continue;
232  }
233  if (lgp->UseLitePhotons()) {
234  if (nphot_fast > 0) {
235  //throwing a random number from a poisson distribution with a mean of the amount of photons visible at this channel
236  auto n = static_cast<int>(randpoisphot.fire(nphot_fast * visibleFraction));
237  for (long i = 0; i < n; ++i) {
238  //calculates the time at which the photon was produced
239  auto time = static_cast<int>(edep.T0() + GetScintTime(fRiseTimeFast,
240  larp->ScintFastTimeConst(),
241  randflatscinttime));
242  ++photonLiteCollection[channel].DetectedPhotons[time];
243  }
244  }
245  if ((nphot_slow > 0) && fDoSlowComponent) {
246  //throwing a random number from a poisson distribution with a mean of the amount of photons visible at this channel
247  auto n = randpoisphot.fire(nphot_slow * visibleFraction);
248  for (long i = 0; i < n; ++i) {
249  //calculates the time at which the photon was produced
250  auto time = static_cast<int>(edep.T0() + GetScintTime(fRiseTimeSlow,
251  larp->ScintSlowTimeConst(),
252  randflatscinttime));
253  ++photonLiteCollection[channel].DetectedPhotons[time];
254  }
255  }
256  }
257  else {
259  photon.SetInSD = false;
260  photon.InitialPosition = edep.End();
261  photon.Energy = 9.7e-6;
262  if (nphot_fast > 0) {
263  //throwing a random number from a poisson distribution with a mean of the amount of photons visible at this channel
264  auto n = randpoisphot.fire(nphot_fast * visibleFraction);
265  if (n > 0) {
266  //calculates the time at which the photon was produced
267  photon.Time =
268  edep.T0() +
269  GetScintTime(fRiseTimeFast, larp->ScintFastTimeConst(), randflatscinttime);
270  // add n copies of sim::OnePhoton photon to the photon collection for a given OpChannel
271  photonCollection[channel].insert(photonCollection[channel].end(), n, photon);
272  }
273  }
274  if ((nphot_slow > 0) && fDoSlowComponent) {
275  //throwing a random number from a poisson distribution with a mean of the amount of photons visible at this channel
276  auto n = randpoisphot.fire(nphot_slow * visibleFraction);
277  if (n > 0) {
278  //calculates the time at which the photon was produced
279  photon.Time =
280  edep.T0() +
281  GetScintTime(fRiseTimeSlow, larp->ScintSlowTimeConst(), randflatscinttime);
282  // add n copies of sim::OnePhoton photon to the photon collection for a given OpChannel
283  photonCollection[channel].insert(photonCollection[channel].end(), n, photon);
284  }
285  }
286  }
287  }
288  }
289  }
290  if (lgp->UseLitePhotons()) {
291  // put the photon collection of LitePhotons into the art event
292  e.put(move(photLiteCol));
293  }
294  else {
295  //put the photon collection of SimPhotons into the art event
296  e.put(move(photCol));
297  }
298  }
process_name can override from command line with o or output photon
Definition: runPID.fcl:28
pdgs p
Definition: selectors.fcl:22
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
ISCalcData CalcIonAndScint(detinfo::DetectorPropertiesData const &detProp, sim::SimEnergyDeposit const &edep) override
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
Definition: SimPhotons.h:67
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
bool SetInSD
Whether the photon reaches the sensitive detector.
Definition: SimPhotons.h:88
do i e
float Energy
Scintillation photon energy [GeV].
Definition: SimPhotons.h:82
auto const detProp

Member Data Documentation

bool phot::PhotonLibraryPropagation::fDoSlowComponent
private

Definition at line 149 of file PhotonLibraryPropagation_module.cc.

vector<art::InputTag> phot::PhotonLibraryPropagation::fEDepTags
private

Definition at line 150 of file PhotonLibraryPropagation_module.cc.

larg4::ISCalcSeparate phot::PhotonLibraryPropagation::fISAlg
private

Definition at line 151 of file PhotonLibraryPropagation_module.cc.

CLHEP::HepRandomEngine& phot::PhotonLibraryPropagation::fPhotonEngine
private

Definition at line 152 of file PhotonLibraryPropagation_module.cc.

double phot::PhotonLibraryPropagation::fRiseTimeFast
private

Definition at line 147 of file PhotonLibraryPropagation_module.cc.

double phot::PhotonLibraryPropagation::fRiseTimeSlow
private

Definition at line 148 of file PhotonLibraryPropagation_module.cc.

CLHEP::HepRandomEngine& phot::PhotonLibraryPropagation::fScintTimeEngine
private

Definition at line 153 of file PhotonLibraryPropagation_module.cc.


The documentation for this class was generated from the following file: