243 mf::LogTrace(
"PDFastSimPAR") <<
"PDFastSimPAR Module Producer"
244 <<
"EventID: " <<
event.event();
246 std::vector<int> PDChannelToSOCMapDirect(
fNOpChannels, -1);
247 std::vector<int> PDChannelToSOCMapReflect(
fNOpChannels, -1);
250 auto phlit = std::make_unique<std::vector<sim::SimPhotonsLite>>();
251 auto opbtr = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
252 auto phlit_ref = std::make_unique<std::vector<sim::SimPhotonsLite>>();
253 auto opbtr_ref = std::make_unique<std::vector<sim::OpDetBacktrackerRecord>>();
254 auto& dir_phlitcol(*phlit);
255 auto& ref_phlitcol(*phlit_ref);
257 auto phot = std::make_unique<std::vector<sim::SimPhotons>>();
258 auto phot_ref = std::make_unique<std::vector<sim::SimPhotons>>();
259 auto& dir_photcol(*phot);
260 auto& ref_photcol(*phot_ref);
265 dir_phlitcol[i].OpChannel = i;
266 ref_phlitcol[i].OpChannel = i;
273 dir_photcol[i].fOpChannel = i;
274 ref_photcol[i].fOpChannel = i;
278 art::Handle<std::vector<sim::SimEnergyDeposit>> edepHandle;
279 if (!event.getByLabel(
simTag, edepHandle)) {
280 mf::LogError(
"PDFastSimPAR") <<
"PDFastSimPAR Module Cannot getByLabel: " <<
simTag;
284 auto const& edeps = edepHandle;
292 for (
auto const& edepi : *edeps) {
295 int nphot_fast = edepi.NumFPhotons();
296 int nphot_slow = edepi.NumSPhotons();
298 num_fastph += nphot_fast;
299 num_slowph += nphot_slow;
304 int trackID = edepi.TrackID();
305 int nphot = edepi.NumPhotons();
306 double edeposit = edepi.Energy() / nphot;
307 double pos[3] = {edepi.MidPointX(), edepi.MidPointY(), edepi.MidPointZ()};
308 geo::Point_t const ScintPoint = {pos[0], pos[1], pos[2]};
316 std::vector<double> OpDetVisibilities;
317 fVisibilityModel->detectedDirectVisibilities(OpDetVisibilities, ScintPoint);
325 std::vector<double> OpDetVisibilitiesAnode;
326 fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesAnode, ScintPoint,
true);
331 for (
size_t i=0; i<AnodeDetectedNumFast.size(); ++i) {DetectedNumFast[i] += AnodeDetectedNumFast[i];}
332 for (
size_t i=0; i<AnodeDetectedNumSlow.size(); ++i) {DetectedNumSlow[i] += AnodeDetectedNumSlow[i];}
339 std::vector<double> OpDetVisibilitiesRefl;
340 fVisibilityModel->detectedReflectedVisibilities(OpDetVisibilitiesRefl, ScintPoint,
false);
347 for (
size_t Reflected = 0; Reflected <= DoReflected; ++Reflected) {
348 for (
size_t channel = 0; channel <
fNOpChannels; channel++) {
352 int ndetected_fast = DetectedNumFast[channel];
353 int ndetected_slow = DetectedNumSlow[channel];
355 ndetected_fast = ReflDetectedNumFast[channel];
356 ndetected_slow = ReflDetectedNumSlow[channel];
362 std::vector<double> transport_time;
364 transport_time.resize(ndetected_fast + ndetected_slow);
365 fPropTimeModel->propagationTime(transport_time, ScintPoint, channel, Reflected);
372 int n = ndetected_fast;
374 for (
int i = 0; i <
n; ++i) {
379 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
380 if (Reflected) ++ref_phlitcol[channel].DetectedPhotons[time];
381 else ++dir_phlitcol[channel].DetectedPhotons[time];
382 tmpbtr.AddScintillationPhotons(trackID, time, 1, pos, edeposit);
386 int n = ndetected_slow;
388 for (
int i = 0; i <
n; ++i) {
391 if (
fIncludePropTime) time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime() + transport_time[ndetected_fast + i]);
392 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
393 if (Reflected) ++ref_phlitcol[channel].DetectedPhotons[time];
394 else ++dir_phlitcol[channel].DetectedPhotons[time];
395 tmpbtr.AddScintillationPhotons(trackID, time, 1, pos, edeposit);
398 if (Reflected)
AddOpDetBTR(*opbtr_ref, PDChannelToSOCMapReflect, tmpbtr);
399 else AddOpDetBTR(*opbtr, PDChannelToSOCMapDirect, tmpbtr);
406 if (Reflected) photon.
Energy = 2.9 * CLHEP::eV;
407 else photon.
Energy = 9.7 * CLHEP::eV;
409 int n = ndetected_fast;
411 for (
int i = 0; i <
n; ++i) {
416 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
418 if(Reflected) ref_photcol[channel].insert(ref_photcol[channel].
end(), 1, photon);
419 else dir_photcol[channel].insert(dir_photcol[channel].
end(), 1, photon);
423 int n = ndetected_slow;
425 for (
int i = 0; i <
n; ++i) {
428 if (
fIncludePropTime) time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime() + transport_time[ndetected_fast + i]);
429 else time =
static_cast<int>(edepi.StartT() +
fScintTime->GetScintTime());
431 if(Reflected) ref_photcol[channel].insert(ref_photcol[channel].
end(), 1, photon);
432 else dir_photcol[channel].insert(dir_photcol[channel].
end(), 1, photon);
440 mf::LogTrace(
"PDFastSimPAR") <<
"Total points: " << num_points
441 <<
", total fast photons: " << num_fastph
442 <<
", total slow photons: " << num_slowph
443 <<
"\ndetected fast photons: " << num_fastdp
444 <<
", detected slow photons: " << num_slowdp;
447 event.put(move(phlit));
448 event.put(move(opbtr));
450 event.put(move(phlit_ref),
"Reflected");
451 event.put(move(opbtr_ref),
"Reflected");
455 event.put(move(phot));
457 event.put(move(phot_ref),
"Reflected");
std::vector< geo::Point_t > fOpDetCenter
bool isOpDetInSameTPC(geo::Point_t const &ScintPoint, geo::Point_t const &OpDetPoint) const
process_name can override from command line with o or output photon
void AddOpDetBTR(std::vector< sim::OpDetBacktrackerRecord > &opbtr, std::vector< int > &ChannelMap, const sim::OpDetBacktrackerRecord &btr) const
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
const bool fIncludePropTime
const bool fOpaqueCathode
Energy deposited on a readout Optical Detector by simulated tracks.
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
const bool fDoReflectedLight
CLHEP::HepRandomEngine & fScintTimeEngine
const bool fDoFastComponent
std::unique_ptr< SemiAnalyticalModel > fVisibilityModel
auto end(FixedBins< T, C > const &) noexcept
const bool fDoSlowComponent
bool SetInSD
Whether the photon reaches the sensitive detector.
const art::InputTag simTag
void detectedNumPhotons(std::vector< int > &DetectedNumPhotons, const std::vector< double > &OpDetVisibilities, const int NumPhotons) const
float Energy
Scintillation photon energy [GeV].
bool isScintInActiveVolume(geo::Point_t const &ScintPoint)
const bool fIncludeAnodeReflections
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.