328 mf::LogTrace(
"PDFastSimPAR") <<
"PDFastSimPAR Module Producer" 329 <<
"EventID: " <<
event.event();
331 std::vector<int> PDChannelToSOCMapDirect(
fNOpChannels, -1);
332 std::vector<int> PDChannelToSOCMapReflect(
fNOpChannels, -1);
335 auto phlit = std::make_unique<std::vector<sim::SimPhotonsLite>>();
336 auto opbtr = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
337 auto phlit_ref = std::make_unique<std::vector<sim::SimPhotonsLite>>();
338 auto opbtr_ref = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
341 std::map<int, sim::OBTRHelper> opbtr_helper, opbtr_helper_ref;
343 auto& dir_phlitcol(*phlit);
344 auto& ref_phlitcol(*phlit_ref);
346 auto phot = std::make_unique<std::vector<sim::SimPhotons>>();
347 auto phot_ref = std::make_unique<std::vector<sim::SimPhotons>>();
348 auto& dir_photcol(*
phot);
349 auto& ref_photcol(*phot_ref);
354 dir_phlitcol[i].OpChannel = i;
355 ref_phlitcol[i].OpChannel = i;
362 dir_photcol[i].fOpChannel = i;
363 ref_photcol[i].fOpChannel = i;
373 auto const& edeps = edepHandle;
381 mf::LogTrace(
"PDFastSimPAR") <<
"Creating SimPhotonsLite/SimPhotons from " << (*edeps).size()
382 <<
" energy deposits\n";
384 for (
auto const& edepi : *edeps) {
386 if (!(num_points % 1000)) {
388 <<
"SimEnergyDeposit: " << num_points <<
" " << edepi.TrackID() <<
" " << edepi.Energy()
389 <<
"\nStart: " << edepi.Start() <<
"\nEnd: " << edepi.End()
390 <<
"\nNF: " << edepi.NumFPhotons() <<
"\nNS: " << edepi.NumSPhotons()
391 <<
"\nSYR: " << edepi.ScintYieldRatio() <<
"\n";
395 int nphot_fast = edepi.NumFPhotons();
396 int nphot_slow = edepi.NumSPhotons();
398 num_fastph += nphot_fast;
399 num_slowph += nphot_slow;
403 int trackID = edepi.TrackID();
404 int nphot = edepi.NumPhotons();
405 double edeposit = edepi.Energy() / nphot;
406 double pos[3] = {edepi.MidPointX(), edepi.MidPointY(), edepi.MidPointZ()};
407 geo::Point_t const ScintPoint = {pos[0], pos[1], pos[2]};
415 std::vector<double> OpDetVisibilities;
416 fVisibilityModel->detectedDirectVisibilities(OpDetVisibilities, ScintPoint);
424 std::vector<double> OpDetVisibilitiesAnode;
425 fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesAnode, ScintPoint,
true);
430 for (
size_t i = 0; i < AnodeDetectedNumFast.size(); ++i) {
431 DetectedNumFast[i] += AnodeDetectedNumFast[i];
433 for (
size_t i = 0; i < AnodeDetectedNumSlow.size(); ++i) {
434 DetectedNumSlow[i] += AnodeDetectedNumSlow[i];
442 std::vector<double> OpDetVisibilitiesRefl;
443 fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesRefl, ScintPoint,
false);
450 for (
size_t Reflected = 0; Reflected <= DoReflected; ++Reflected) {
451 for (
size_t channel = 0; channel <
fNOpChannels; channel++) {
455 int ndetected_fast = DetectedNumFast[channel];
456 int ndetected_slow = DetectedNumSlow[channel];
458 ndetected_fast = ReflDetectedNumFast[channel];
459 ndetected_slow = ReflDetectedNumSlow[channel];
466 std::vector<double> transport_time;
468 transport_time.resize(ndetected_fast + ndetected_slow);
469 fPropTimeModel->propagationTime(transport_time, ScintPoint, channel, Reflected);
475 int n = ndetected_fast;
477 for (
int i = 0; i <
n; ++i) {
479 double dtime = edepi.StartT() +
fScintTime->fastScintTime();
482 int time =
static_cast<int>(std::round(dtime));
484 ++ref_phlitcol[channel].DetectedPhotons[time];
488 PDChannelToSOCMapReflect,
497 ++dir_phlitcol[channel].DetectedPhotons[time];
501 PDChannelToSOCMapDirect,
512 int n = ndetected_slow;
514 for (
int i = 0; i <
n; ++i) {
516 double dtime = edepi.StartT() +
fScintTime->slowScintTime();
518 int time =
static_cast<int>(std::round(dtime));
520 ++ref_phlitcol[channel].DetectedPhotons[time];
524 PDChannelToSOCMapReflect,
533 ++dir_phlitcol[channel].DetectedPhotons[time];
537 PDChannelToSOCMapDirect,
555 photon.
Energy = 2.9 * CLHEP::eV;
557 photon.
Energy = 9.7 * CLHEP::eV;
560 int n = ndetected_fast;
562 for (
int i = 0; i <
n; ++i) {
564 double dtime = edepi.StartT() +
fScintTime->fastScintTime();
566 int time =
static_cast<int>(std::round(dtime));
569 ref_photcol[channel].insert(ref_photcol[channel].
end(), 1, photon);
571 dir_photcol[channel].insert(dir_photcol[channel].
end(), 1, photon);
575 int n = ndetected_slow;
577 for (
int i = 0; i <
n; ++i) {
578 double dtime = edepi.StartT() +
fScintTime->slowScintTime();
580 int time =
static_cast<int>(std::round(dtime));
583 ref_photcol[channel].insert(ref_photcol[channel].
end(), 1, photon);
585 dir_photcol[channel].insert(dir_photcol[channel].
end(), 1, photon);
593 mf::LogTrace(
"PDFastSimPAR") <<
"Total points: " << num_points
594 <<
", total fast photons: " << num_fastph
595 <<
", total slow photons: " << num_slowph
596 <<
"\ndetected fast photons: " << num_fastdp
597 <<
", detected slow photons: " << num_slowdp;
599 mf::LogDebug(
"PDFastSimPAR") <<
"Number of entries in opbtrs";
600 for (
auto& iopbtr : *opbtr) {
602 <<
"OpDet: " << iopbtr.OpDetNum() <<
" " << iopbtr.timePDclockSDPsMap().size();
604 mf::LogDebug(
"PDFastSimPAR") <<
"Number of entries in opbtrs refelected";
605 for (
auto& iopbtr : *opbtr_ref) {
607 <<
"OpDet: " << iopbtr.OpDetNum() <<
" " << iopbtr.timePDclockSDPsMap().size();
612 for (
auto& iopbtr : opbtr_helper) {
613 opbtr->emplace_back(iopbtr.second);
616 event.put(move(phlit));
617 event.put(move(opbtr));
619 for (
auto& iopbtr : opbtr_helper_ref) {
620 opbtr_ref->emplace_back(iopbtr.second);
622 event.put(move(phlit_ref),
"Reflected");
623 event.put(move(opbtr_ref),
"Reflected");
627 event.put(move(
phot));
bool isOpDetInSameTPC(geo::Point_t const &ScintPoint, geo::Point_t const &OpDetPoint) const
const size_t fNOpChannels
const bool fUseLitePhotons
std::unique_ptr< PropagationTimeModel > fPropTimeModel
All information of a photon entering the sensitive optical detector volume.
std::unique_ptr< ScintTime > fScintTime
const bool fOnlyActiveVolume
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
const bool fIncludePropTime
const bool fOpaqueCathode
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
const bool fDoReflectedLight
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
const bool fDoFastComponent
const std::vector< geo::Point_t > fOpDetCenter
std::unique_ptr< SemiAnalyticalModel > fVisibilityModel
void SimpleAddOpDetBTR(std::map< int, sim::OBTRHelper > &opbtr, std::vector< int > &ChannelMap, size_t channel, int trackID, int time, double pos[3], double edeposit, int num_photons=1)
const art::InputTag fSimTag
const bool fDoSlowComponent
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 getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
bool SetInSD
Whether the photon reaches the sensitive detector.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
void detectedNumPhotons(std::vector< int > &DetectedNumPhotons, const std::vector< double > &OpDetVisibilities, const int NumPhotons) const
MaybeLogger_< ELseverityLevel::ELsev_success, true > LogTrace
float Energy
Scintillation photon energy [GeV].
bool isScintInActiveVolume(geo::Point_t const &ScintPoint)
const bool fIncludeAnodeReflections
int MotherTrackID
ID of the GEANT4 track causing the scintillation.