38 fUseCryoBoundary(false),
39 fLibraryBuildJob(false),
40 fDoNotLoadLibrary(false),
41 fParameterization(false),
43 fStoreReflected(false),
45 fIncludePropTime(false),
66 throw cet::exception(
"PhotonVisibilityServiceS2") <<
"Unable to find photon library in " << sp.
to_string() <<
"\n";
71 mf::LogInfo(
"PhotonVisibilityServiceS2") <<
"PhotonVisibilityServiceS2 Loading photon library from file " 72 << LibraryFileWithPath
77 <<
" optical detectors." 96 size_t NOpDets = geom->
NOpDets();
98 mf::LogInfo(
"PhotonVisibilityServiceS2") <<
" Vis service running library build job. Please ensure " 99 <<
" job contains LightSource, LArG4, SimPhotonCounter"<<
std::endl;
119 std::cout<<
"This is would be building a Hybrid Library. Not defined. "<<
std::endl;
121 mf::LogInfo(
"PhotonVisibilityServiceS2") <<
" Vis service " 122 <<
" Storing Library entries to file..." <<
std::endl;
138 fHybrid = p.
get<
bool >(
"HybridLibrary",
false);
159 double CryoBounds[6];
161 fXmin = CryoBounds[0];
162 fXmax = CryoBounds[1];
163 fYmin = CryoBounds[2];
164 fYmax = CryoBounds[3];
165 fZmin = CryoBounds[4];
166 fZmax = CryoBounds[5];
178 fNx = p.
get<
int >(
"NX" );
179 fNy = p.
get<
int >(
"NY" );
180 fNz = p.
get<
int >(
"NZ" );
187 std::cout<<
"Getting direct light parameters from .fcl file"<<
std::endl;
188 std::vector<std::string> direct_functions = p.
get<std::vector<std::string> >(
"Direct_functions");
195 std::vector<double> direct_landauNormpars = p.
get<std::vector<double> >(
"Direct_landauNormpars");
196 fparslogNorm =
new TF1(
"fparslogNorm", direct_functions[0].c_str(), 0., fD_break);
197 for(
unsigned int i=0; i<direct_landauNormpars.size(); ++i)
198 fparslogNorm->SetParameter(i, direct_landauNormpars[i]);
200 std::vector<double> direct_landauMPVpars = p.
get<std::vector<double> >(
"Direct_landauMPVpars");
201 fparsMPV =
new TF1(
"fparsMPV", direct_functions[1].c_str(), 0., fD_break);
202 for(
unsigned int i=0; i<direct_landauMPVpars.size(); ++i)
203 fparsMPV->SetParameter(i, direct_landauMPVpars[i]);
205 std::vector<double> direct_landauWidthpars = p.
get<std::vector<double> >(
"Direct_landauWidthpars");
206 fparsWidth =
new TF1(
"fparsWidth", direct_functions[2].c_str(), 0., fD_break);
207 for(
unsigned int i=0; i<direct_landauWidthpars.size(); ++i)
208 fparsWidth->SetParameter(i, direct_landauWidthpars[i]);
210 std::vector<double> direct_expoCtepars = p.
get<std::vector<double> >(
"Direct_expoCtepars");
211 fparsCte =
new TF1(
"fparsCte", direct_functions[3].c_str(), 0., fD_break);
212 for(
unsigned int i=0; i<direct_expoCtepars.size(); ++i)
213 fparsCte->SetParameter(i, direct_expoCtepars[i]);
215 std::vector<double> direct_expoSlopepars = p.
get<std::vector<double> >(
"Direct_expoSlopepars");
216 fparsSlope =
new TF1(
"fparsSlope", direct_functions[4].c_str(), 0., fD_break);
217 for(
unsigned int i=0; i<direct_expoSlopepars.size(); ++i)
218 fparsSlope->SetParameter(i, direct_expoSlopepars[i]);
220 std::vector<double> direct_landauNormpars_far = p.
get<std::vector<double> >(
"Direct_landauNormpars_far");
221 fparslogNorm_far =
new TF1(
"fparslogNorm_far", direct_functions[5].c_str(), fD_break, fD_max);
222 for(
unsigned int i=0; i<direct_landauNormpars_far.size(); ++i)
223 fparslogNorm_far->SetParameter(i, direct_landauNormpars_far[i]);
225 std::vector<double> direct_landauMPVpars_far = p.
get<std::vector<double> >(
"Direct_landauMPVpars_far");
226 fparsMPV_far =
new TF1(
"fparsMPV_far", direct_functions[6].c_str(), fD_break, fD_max);
227 for(
unsigned int i=0; i<direct_landauMPVpars_far.size(); ++i)
228 fparsMPV_far->SetParameter(i, direct_landauMPVpars_far[i]);
230 std::vector<double> direct_expoCtepars_far = p.
get<std::vector<double> >(
"Direct_expoCtepars_far");
231 fparsCte_far =
new TF1(
"fparsCte_far", direct_functions[7].c_str(), fD_break - 50., fD_max);
232 for(
unsigned int i=0; i<direct_expoCtepars_far.size(); ++i)
233 fparsCte_far->SetParameter(i, direct_expoCtepars_far[i]);
235 std::vector<std::string> reflected_functions = p.
get<std::vector<std::string> >(
"Reflected_functions");
240 std::vector<double> reflected_landauNormpars = p.
get<std::vector<double> >(
"Reflected_landauNormpars");
241 fparslogNorm_refl =
new TF1(
"fparslogNorm_refl", reflected_functions[0].c_str(), 0., fT0_max);
242 for(
unsigned int i=0; i<reflected_landauNormpars.size(); ++i)
243 fparslogNorm_refl->SetParameter(i, reflected_landauNormpars[i]);
245 std::vector<double> reflected_landauMPVpars = p.
get<std::vector<double> >(
"Reflected_landauMPVpars");
246 fparsMPV_refl =
new TF1(
"fparsMPV_refl", reflected_functions[1].c_str(), 0., fT0_max);
247 for(
unsigned int i=0; i<reflected_landauMPVpars.size(); ++i)
248 fparsMPV_refl->SetParameter(i, reflected_landauMPVpars[i]);
250 std::vector<double> reflected_landauWidthpars = p.
get<std::vector<double> >(
"Reflected_landauWidthpars");
251 fparsWidth_refl =
new TF1(
"fparsWidth_refl", reflected_functions[2].c_str(), 0., fT0_max);
252 for(
unsigned int i=0; i<reflected_landauWidthpars.size(); ++i)
253 fparsWidth_refl->SetParameter(i, reflected_landauWidthpars[i]);
255 std::vector<double> reflected_expoCtepars = p.
get<std::vector<double> >(
"Reflected_expoCtepars");
256 fparsCte_refl =
new TF1(
"fparsCte_refl", reflected_functions[3].c_str(), 0., fT0_max);
257 for(
unsigned int i=0; i<reflected_expoCtepars.size(); ++i)
258 fparsCte_refl->SetParameter(i, reflected_expoCtepars[i]);
260 std::vector<double> reflected_expoSlopepars = p.
get<std::vector<double> >(
"Reflected_expoSlopepars");
261 fparsSlope_refl =
new TF1(
"fparsSlope_refl", reflected_functions[4].c_str(), 0., fT0_max);
262 for(
unsigned int i=0; i<reflected_expoSlopepars.size(); ++i)
263 fparsSlope_refl->SetParameter(i, reflected_expoSlopepars[i]);
294 static std::vector<float> ret;
337 if (!neis)
return 0.0;
342 if (
n.id < 0)
continue;
355 mf::LogInfo(
"PhotonVisibilityServiceS2") <<
" PVS notes production of " << N <<
" photons at Vox " << VoxID<<
std::endl;
384 mf::LogDebug(
"PhotonVisibilityServiceS2") <<
" PVS logging " << VoxID <<
" " << OpChannel<<
std::endl;
444 mf::LogDebug(
"PhotonVisibilityServiceS2") <<
" PVS logging " << VoxID <<
" " << OpChannel<<
std::endl;
507 mf::LogDebug(
"PhotonVisibilityServiceS2") <<
" PVS logging " << VoxID <<
" " << OpChannel<<
std::endl;
520 mf::LogDebug(
"PhotonVisibilityServiceS2") <<
" PVS logging " << VoxID <<
" " << OpChannel<<
std::endl;
Definitions of voxel data structures.
static double DistanceToOpDet(double const *xyz, unsigned int OpDet)
const std::vector< float > * GetTimingPar(double const *xyz) const
Index OpChannel(Index detNum, Index channel)
float const * 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.
Encapsulate the construction of a single cyostat.
void LoadLibraryFromFile(std::string LibraryFile, size_t NVoxels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0, int maxrange=200)
static double SolidAngleFactor(double const *xyz, unsigned int OpDet)
void CreateEmptyLibrary(size_t NVoxels, size_t NChannels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
TF1 *const GetTimingTF1(double const *xyz)
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const =0
float const * GetLibraryEntries(int VoxID, bool wantReflected=false) const
Representation of a region of space diced into voxels.
float GetLibraryTimingParEntry(int VoxID, int Channel, size_t npar) const
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
double fTF1_sampling_factor
void StoreLibraryToFile(std::string LibraryFile, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) const
std::string fParPropTime_formula
void SetCount(size_t Voxel, size_t OpChannel, float Count)
int GetVoxelID(Point const &p) const
Returns the ID of the voxel containing p, or -1 if none.
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 SetLibraryTimingTF1Entry(int VoxID, int OpChannel, TF1 func)
TF1 *const GetLibraryTimingTF1Entries(int VoxID)
void SetLibraryEntry(int VoxID, int OpChannel, float N, bool wantReflected=false)
const sim::PhotonVoxelDef & GetVoxelDef() const
float GetVisibility(double const *xyz, unsigned int OpChannel, bool wantReflected=false) const
sim::PhotonVoxelDef fVoxelDef
void SetReflT0(size_t Voxel, size_t OpChannel, float reflT0)
float GetLibraryReflT0Entry(int VoxID, int Channel) const
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 RetrieveLightProd(int &VoxID, double &N) const
void reconfigure(fhicl::ParameterSet const &p)
void SetDirectLightPropFunctions(TF1 const *functions[8], double &d_break, double &d_max, double &tf1_sampling_factor) const
TF1 * GetTimingTF1s(size_t Voxel) const
const std::vector< float > * GetTimingPars(size_t Voxel) const
void SetLibraryTimingParEntry(int VoxID, int OpChannel, float value, size_t parnum)
void SetReflectedCOLightPropFunctions(TF1 const *functions[5], double &t0_max, double &t0_break_point) const
unsigned int NOpDets() const
Number of OpDets in the whole detector.
virtual int NOpChannels() const =0
float const * GetReflT0s(double const *xyz) const
Encapsulate the geometry of an optical detector.
void SetTimingPar(size_t Voxel, size_t OpChannel, float Count, size_t parnum)
#define DEFINE_ART_SERVICE(svc)
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
General LArSoft Utilities.
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
const std::vector< float > * GetLibraryTimingParEntries(int VoxID) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
size_t NOpChannels() const
void StoreLightProd(int VoxID, double N)
float GetTimingPar(size_t Voxel, size_t OpChannel, size_t parnum) const
std::string find_file(std::string const &filename) const
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
PhotonVisibilityServiceS2(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
IPhotonLibrary * fTheLibrary
double GetQuenchingFactor(double dQdx) const
void SetReflCount(size_t Voxel, size_t OpChannel, float Count)
float GetLibraryEntry(int VoxID, int OpChannel, bool wantReflected=false) const
float const * GetAllVisibilities(double const *xyz, bool wantReflected=false) const
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)