38 #include "art_root_io/TFileService.h" 121 if (pset.
has_key(
"ReflectOverZeroX")) {
124 <<
"`PhotonVisbilityService` configuration specifies both `Mapping` and " 125 "`ReflectOverZeroX`." 126 " Please remove the latter (and use `PhotonMappingXMirrorTransformations` tool).";
130 <<
"Please update the configuration of `PhotonVisbilityService` service" 131 " replacing `ReflectOverZeroX` with tool configuration:" 132 "\n Mapping: { tool_type: \"PhotonMappingXMirrorTransformations\" }";
136 mapDefaultSet.
put(
"tool_type",
138 "PhotonMappingIdentityTransformations");
139 fMapping = art::make_tool<phot::IPhotonMappingTransformations>(
159 <<
"Unable to find photon library in " << sp.
to_string() <<
"\n";
165 <<
"PhotonVisibilityService Loading photon library from file " << LibraryFileWithPath
196 <<
"Photon library reports the geometry:\n" 197 << lib->
GetVoxelDef() <<
"while PhotonVisbilityService is configured with:\n" 206 size_t NOpDets = geom->
NOpDets();
210 <<
" Vis service running library build job. Please ensure " 211 <<
" job contains LightSource, LArG4, SimPhotonCounter";
214 art::TFileDirectory* pDir =
nullptr;
222 <<
"PhotonVisibilityService: " 223 "service `TFileService` is required when building a photon library.\n";
245 std::cout <<
"This is would be building a Hybrid Library. Not defined. " <<
std::endl;
247 mf::LogInfo(
"PhotonVisibilityService") <<
" Vis service " 248 <<
" Storing Library entries to file..." <<
std::endl;
264 fHybrid = p.
get<
bool>(
"HybridLibrary",
false);
285 if (!fParPropTime) { fParPropTime_npar = 0; }
287 if (!fUseNhitsModel) {
289 if (fUseCryoBoundary) {
290 double CryoBounds[6];
292 fXmin = CryoBounds[0];
293 fXmax = CryoBounds[1];
294 fYmin = CryoBounds[2];
295 fYmax = CryoBounds[3];
296 fZmin = CryoBounds[4];
297 fZmax = CryoBounds[5];
315 if (fIncludePropTime) {
318 std::cout <<
"Loading the VUV time parametrization" <<
std::endl;
321 fMpv = p.
get<std::vector<std::vector<double>>>(
"Mpv");
322 fWidth = p.
get<std::vector<std::vector<double>>>(
"Width");
324 fSlope = p.
get<std::vector<std::vector<double>>>(
"Slope");
334 if (fStoreReflected) {
337 std::cout <<
"Loading the VIS time paramterisation" <<
std::endl;
340 fCut_off = p.
get<std::vector<std::vector<std::vector<double>>>>(
"Cut_off");
341 fTau = p.
get<std::vector<std::vector<std::vector<double>>>>(
"Tau");
347 if (fUseNhitsModel) {
348 std::cout <<
"Loading semi-analytic mode models" <<
std::endl;
364 if (fStoreReflected) {
369 fvispars_flat = p.
get<std::vector<std::vector<std::vector<double>>>>(
"VIS_correction_flat");
374 fvispars_dome = p.
get<std::vector<std::vector<std::vector<double>>>>(
"VIS_correction_dome");
410 static std::vector<float> ret;
411 ret.resize(
fMapping->libraryMappingSize(
p));
412 for (std::size_t libIndex = 0; libIndex < ret.size(); ++libIndex) {
449 bool wantReflected )
const 455 if (!neis)
return 0.0;
460 if (
n.id < 0)
continue;
470 bool wantReflected )
const 480 bool wantReflected)
const 495 <<
" PVS notes production of " << N <<
" photons at Vox " << VoxID <<
std::endl;
524 <<
" PVS logging " << VoxID <<
" " << OpChannel <<
std::endl;
555 bool wantReflected)
const 576 return fMapping->applyOpDetMapping(
p, data);
600 <<
" PVS logging " << VoxID <<
" " << OpChannel <<
std::endl;
622 return fMapping->applyOpDetMapping(
p, params);
630 return fMapping->applyOpDetMapping(
p, functions);
669 <<
" PVS logging " << VoxID <<
" " << OpChannel <<
std::endl;
683 <<
" PVS logging " << VoxID <<
" " << OpChannel <<
std::endl;
706 return fMapping->opDetMappingSize();
714 double& tf1_sampling_factor)
const 734 double& t0_break_point)
const 752 double& vuv_vgroup_mean,
753 double& vuv_vgroup_max,
754 double& inflexion_point_distance,
755 double& angle_bin_timing_vuv)
const 776 std::vector<double>& radial_distances,
780 double& angle_bin_timing_vis)
const 793 double &delta_angulo_vuv,
794 double &radius)
const 802 std::vector<double> &border_corr_angulo_flat,
803 std::vector<std::vector<double>> &border_corr_flat)
const 811 std::vector<double> &border_corr_angulo_dome,
812 std::vector<std::vector<double>> &border_corr_dome)
const 820 double &radius)
const 826 std::vector<double> &vis_distances_r_flat,
835 std::vector<double> &vis_distances_r_dome,
852 return fMapping->detectorToLibrary(p);
Definitions of voxel data structures.
std::vector< std::vector< std::vector< double > > > fTau
MappedParams_t doGetTimingPar(geo::Point_t const &p) const
void LoadTimingsForVISPar(std::vector< double > &distances, std::vector< double > &radial_distances, std::vector< std::vector< std::vector< double >>> &cut_off, std::vector< std::vector< std::vector< double >>> &tau, double &vis_vmean, double &angle_bin_timing_vis) const
Index OpChannel(Index detNum, Index channel)
phot::IPhotonLibrary::Counts_t GetLibraryReflT0Entries(int VoxID) const
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const =0
std::string to_string() const
double CosThetaFromNormal(geo::Point_t const &point) const
Get cos(angle) to normal of this detector - used for solid angle calcs.
MappedCounts_t doGetAllVisibilities(geo::Point_t const &p, bool wantReflected=false) const
phot::IPhotonLibrary::Counts_t GetLibraryEntries(int VoxID, bool wantReflected=false) const
~PhotonVisibilityService()
std::unique_ptr< phot::IPhotonMappingTransformations > fMapping
Mapping of detector space into library space.
void RetrieveLightProd(int &VoxID, double &N) const
void SetDirectLightPropFunctions(TF1 const *functions[8], double &d_break, double &d_max, double &tf1_sampling_factor) const
void LoadLibraryFromFile(std::string LibraryFile, size_t NVoxels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0, int maxrange=200)
std::vector< std::vector< double > > fborder_corr_flat
std::vector< double > fvis_distances_r_flat
void LoadTimingsForVUVPar(std::vector< std::vector< double >>(&v)[7], double &step_size, double &max_d, double &min_d, double &vuv_vgroup_mean, double &vuv_vgroup_max, double &inflexion_point_distance, double &angle_bin_timing_vuv) const
std::vector< double > fvis_distances_x_dome
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void SetLibraryTimingParEntry(int VoxID, int OpChannel, float value, size_t parnum)
sim::PhotonVoxelDef const & GetVoxelDef() const
bool hasVoxelDef() const
Returns whether voxel metadata is available.
std::vector< std::vector< double > > fWidth
std::vector< double > fvis_distances_r_dome
sim::PhotonVoxelDef fVoxelDef
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const =0
phot::IPhotonMappingTransformations::LibraryIndex_t LibraryIndex_t
Type of optical library index.
double fangle_bin_timing_vis
Representation of a region of space diced into voxels.
double fTF1_sampling_factor
std::vector< double > fDistances_exp
float GetLibraryTimingParEntry(int VoxID, OpDetID_t libOpChannel, size_t npar) const
std::vector< double > fDistances_refl
bool HasLibraryEntries(int VoxID, bool wantReflected=false) const
void LoadVisParsFlat(std::vector< double > &vis_distances_x_flat, std::vector< double > &vis_distances_r_flat, std::vector< std::vector< std::vector< double >>> &vispars_flat) const
float doGetVisibilityOfOpLib(geo::Point_t const &p, LibraryIndex_t libIndex, bool wantReflected=false) const
bool doHasVisibility(geo::Point_t const &p, bool wantReflected=false) const
std::string fVISBorderCorrectionType
std::vector< double > fvis_distances_x_flat
void StoreLibraryToFile(std::string LibraryFile, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) const
std::vector< std::vector< std::vector< double > > > fCut_off
float GetLibraryEntry(int VoxID, OpDetID_t libOpChannel, bool wantReflected=false) const
void LoadGHDome(std::vector< std::vector< double >> &GHvuvpars_dome, std::vector< double > &border_corr_angulo_dome, std::vector< std::vector< double >> &border_corr_dome) const
int VoxelAt(geo::Point_t const &p) const
void SetCount(size_t Voxel, size_t OpChannel, float Count)
std::vector< double > fDistances_landau
int fParPropTime_MaxRange
void CryostatBoundaries(double *boundaries, geo::CryostatID const &cid) const
Returns the boundaries of the specified cryostat.
art framework interface to geometry description
void SetTimingTF1(size_t Voxel, size_t OpChannel, TF1 func)
void LoadVUVSemiAnalyticProperties(bool &isFlatPDCorr, bool &isDomePDCorr, double &delta_angulo_vuv, double &radius) const
double GetQuenchingFactor(double dQdx) const
float GetLibraryReflT0Entry(int VoxID, OpDetID_t libOpChannel) const
void SetReflectedCOLightPropFunctions(TF1 const *functions[5], double &t0_max, double &t0_break_point) const
std::string fParPropTime_formula
void StoreLightProd(int VoxID, double N)
void SetVoxelDef(sim::PhotonVoxelDef const &voxelDef)
PhotonVisibilityService(fhicl::ParameterSet const &pset)
void LoadGHFlat(std::vector< std::vector< double >> &GHvuvpars_flat, std::vector< double > &border_corr_angulo_flat, std::vector< std::vector< double >> &border_corr_flat) const
MappedFunctions_t doGetTimingTF1(geo::Point_t const &p) const
geo::Point_t LibLocation(geo::Point_t const &p) const
void SetReflT0(size_t Voxel, size_t OpChannel, float reflT0)
void LoadVisParsDome(std::vector< double > &vis_distances_x_dome, std::vector< double > &vis_distances_r_dome, std::vector< std::vector< std::vector< double >>> &vispars_dome) const
std::vector< double > fDistances_radial_refl
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
virtual Counts_t GetReflCounts(size_t Voxel) const =0
T get(std::string const &key) const
virtual float GetCount(size_t Voxel, size_t OpChannel) const =0
virtual Counts_t GetCounts(size_t Voxel) const =0
Returns a pointer to NOpChannels() visibility values, one per channel.
void reconfigure(fhicl::ParameterSet const &p)
TF1 * GetTimingTF1s(size_t Voxel) const
const std::vector< float > * GetTimingPars(size_t Voxel) const
std::vector< std::vector< double > > fGHvuvpars_flat
phot::IPhotonMappingTransformations::OpDetID_t OpDetID_t
Type of (global) optical detector ID.
std::vector< float > const * Params_t
bool has_key(std::string const &key) const
unsigned int NOpDets() const
Number of OpDets in the whole detector.
virtual bool isVoxelValid(size_t Voxel) const
double fangle_bin_timing_vuv
bool fApplyVISBorderCorrection
std::vector< std::vector< double > > fGHvuvpars_dome
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Encapsulate the geometry of an optical detector.
void SetTimingPar(size_t Voxel, size_t OpChannel, float Count, size_t parnum)
std::vector< std::vector< double > > fExpo_over_Landau_norm
const sim::PhotonVoxelDef & GetVoxelDef() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
#define DEFINE_ART_SERVICE(svc)
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
void LoadVisSemiAnalyticProperties(double &delta_angulo_vis, double &radius) const
General LArSoft Utilities.
std::vector< std::vector< double > > fMpv
std::optional< std::array< NeiInfo, 8U > > GetNeighboringVoxelIDs(Point const &v) const
Returns IDs of the eight neighboring voxels around v.
virtual T0s_t GetReflT0s(size_t Voxel) const =0
void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected=false)
A container for photon visibility mapping data.
IPhotonLibrary * fTheLibrary
double finflexion_point_distance
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< std::vector< double > > fborder_corr_dome
float GetTimingPar(size_t Voxel, size_t OpChannel, size_t parnum) const
float doGetVisibility(geo::Point_t const &p, unsigned int OpChannel, bool wantReflected=false) const
std::vector< double > fborder_corr_angulo_flat
std::string find_file(std::string const &filename) const
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
void SetLibraryTimingTF1Entry(int VoxID, int OpChannel, TF1 const &func)
std::vector< std::vector< std::vector< double > > > fvispars_dome
std::vector< std::vector< double > > fNorm_over_entries
const float * Counts_t
Type for visibility count per optical channel.
static double DistanceToOpDetImpl(geo::Point_t const &p, unsigned int OpDet)
MappedT0s_t doGetReflT0s(geo::Point_t const &p) const
static double SolidAngleFactorImpl(geo::Point_t const &p, unsigned int OpDet)
size_t NOpChannels() const
void SetReflCount(size_t Voxel, size_t OpChannel, float Count)
std::vector< std::vector< double > > fSlope
phot::IPhotonLibrary::Functions_t GetLibraryTimingTF1Entries(int VoxID) const
std::vector< double > fborder_corr_angulo_dome
phot::IPhotonLibrary::Params_t GetLibraryTimingParEntries(int VoxID) const
std::vector< std::vector< std::vector< double > > > fvispars_flat
void put(std::string const &key)
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)