271 mf::LogTrace(
"PDFastSimPAR") <<
"PDFastSimPAR Module Producer" 272 <<
"EventID: " <<
event.event();
274 auto phot = std::make_unique<std::vector<sim::SimPhotons>>();
275 auto phlit = std::make_unique<std::vector<sim::SimPhotonsLite>>();
276 auto opbtr = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
278 auto phot_ref = std::make_unique<std::vector<sim::SimPhotons>>();
279 auto phlit_ref = std::make_unique<std::vector<sim::SimPhotonsLite>>();
280 auto opbtr_ref = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
282 auto& dir_photcol(*
phot);
283 auto& ref_photcol(*phot_ref);
284 auto& dir_phlitcol(*phlit);
285 auto& ref_phlitcol(*phlit_ref);
290 for (
unsigned int i = 0; i <
nOpDets; i ++)
292 dir_photcol[i].fOpChannel = i;
293 ref_photcol[i].fOpChannel = i;
294 dir_phlitcol[i].OpChannel = i;
295 ref_phlitcol[i].OpChannel = i;
304 auto const& edeps = edepHandle;
312 for (
auto const& edepi : *edeps) {
315 int trackID = edepi.TrackID();
316 double nphot = edepi.NumPhotons();
317 double edeposit = edepi.Energy() / nphot;
318 double pos[3] = {edepi.MidPointX(), edepi.MidPointY(), edepi.MidPointZ()};
319 geo::Point_t const ScintPoint = {pos[0], pos[1], pos[2]};
323 double nphot_fast = edepi.NumFPhotons();
324 double nphot_slow = edepi.NumSPhotons();
326 num_fastph += nphot_fast;
327 num_slowph += nphot_slow;
330 std::map<size_t, int> DetectedNumFast;
331 std::map<size_t, int> DetectedNumSlow;
335 std::map<size_t, double> OpDetVisibilities;
336 fVisibilityModel->detectedDirectVisibilities(OpDetVisibilities, ScintPoint);
341 std::map<size_t, int> AnodeDetectedNumFast;
342 std::map<size_t, int> AnodeDetectedNumSlow;
344 std::map<size_t, double> OpDetVisibilitiesAnode;
345 fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesAnode, ScintPoint,
true);
350 for (
auto const&
x : AnodeDetectedNumFast) DetectedNumFast[
x.first] +=
x.second;
351 for (
auto const&
x : AnodeDetectedNumSlow) DetectedNumSlow[
x.first] +=
x.second;
356 std::map<size_t, int> ReflDetectedNumFast;
357 std::map<size_t, int> ReflDetectedNumSlow;
360 std::map<size_t, double> OpDetVisibilitiesRefl;
361 fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesRefl, ScintPoint,
false);
367 std::vector<double> transport_time;
370 for (
size_t Reflected = 0; Reflected <= 1; ++Reflected) {
379 int ndetected_fast = DetectedNumFast[
channel];
380 int ndetected_slow = DetectedNumSlow[
channel];
382 ndetected_fast = ReflDetectedNumFast[
channel];
383 ndetected_slow = ReflDetectedNumSlow[
channel];
388 transport_time.resize(ndetected_fast + ndetected_slow);
389 fPropTimeModel->propagationTime(transport_time, ScintPoint, channel, Reflected);
398 int n = ndetected_fast;
400 for (
long i = 0; i <
n; ++i) {
405 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
406 if (Reflected) ++ref_phlitcol[
channel].DetectedPhotons[time];
407 else ++dir_phlitcol[
channel].DetectedPhotons[time];
408 tmpbtr.AddScintillationPhotons(trackID, time, 1, pos, edeposit);
413 int n = ndetected_slow;
415 for (
long i = 0; i <
n; ++i) {
418 if (
fIncludePropTime) time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime() + transport_time[ndetected_fast + i]);
419 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
420 if (Reflected) ++ref_phlitcol[
channel].DetectedPhotons[time];
421 else ++dir_phlitcol[
channel].DetectedPhotons[time];
422 tmpbtr.AddScintillationPhotons(trackID, time, 1, pos, edeposit);
439 int n = ndetected_fast;
441 for (
long i = 0; i <
n; ++i) {
446 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
448 if(Reflected) ref_photcol[
channel].insert(ref_photcol[channel].
end(), 1, photon);
449 else dir_photcol[
channel].insert(dir_photcol[channel].
end(), 1, photon);
454 int n = ndetected_slow;
456 for (
long i = 0; i <
n; ++i) {
459 if (
fIncludePropTime) time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime() + transport_time[ndetected_fast + i]);
460 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
462 if(Reflected) ref_photcol[
channel].insert(ref_photcol[channel].
end(), 1, photon);
463 else dir_photcol[
channel].insert(dir_photcol[channel].
end(), 1, photon);
471 mf::LogTrace(
"PDFastSimPAR") <<
"Total points: " << num_points
472 <<
", total fast photons: " << num_fastph
473 <<
", total slow photons: " << num_slowph
474 <<
"\ndetected fast photons: " << num_fastdp
475 <<
", detected slow photons: " << num_slowdp;
481 event.put(
move(phlit));
482 event.put(
move(opbtr));
484 event.put(
move(phlit_ref),
"Reflected");
485 event.put(
move(opbtr_ref),
"Reflected");
491 event.put(
move(phot_ref),
"Reflected");
std::map< size_t, int > PDChannelToSOCMapDirect
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< geo::Point_t > fOpDetCenter
bool isOpDetInSameTPC(geo::Point_t const &ScintPoint, geo::Point_t const &OpDetPoint) const
void detectedNumPhotons(std::map< size_t, int > &DetectedNumPhotons, const std::map< size_t, double > &OpDetVisibilities, const double NumPhotons)
std::unique_ptr< PropagationTimeModel > fPropTimeModel
All information of a photon entering the sensitive optical detector volume.
std::unique_ptr< ScintTime > fScintTime
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Energy deposited on a readout Optical Detector by simulated tracks.
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
CLHEP::HepRandomEngine & fScintTimeEngine
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::map< size_t, int > PDChannelToSOCMapReflect
static constexpr double eV
std::unique_ptr< SemiAnalyticalModel > fVisibilityModel
bool fIncludeAnodeReflections
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
General LArSoft Utilities.
bool SetInSD
Whether the photon reaches the sensitive detector.
MaybeLogger_< ELseverityLevel::ELsev_success, true > LogTrace
float Energy
Scintillation photon energy [GeV].
bool isScintInActiveVolume(geo::Point_t const &ScintPoint)
void AddOpDetBTR(std::vector< sim::OpDetBacktrackerRecord > &opbtr, std::map< size_t, int > &ChannelMap, sim::OpDetBacktrackerRecord btr)