113 mf::LogInfo(
"PhotonVisibilityService")<<
"PhotonVisbilityService initializing"<<std::endl;
124 std::string LibraryFileWithPath;
125 cet::search_path sp(
"FW_SEARCH_PATH");
128 throw cet::exception(
"PhotonVisibilityService") <<
"Unable to find photon library in " << sp.to_string() <<
"\n";
133 mf::LogInfo(
"PhotonVisibilityService") <<
"PhotonVisibilityService Loading photon library from file " 134 << LibraryFileWithPath
139 <<
" optical detectors." 158 size_t NOpDets = geom->
NOpDets();
160 mf::LogInfo(
"PhotonVisibilityService") <<
" Vis service running library build job. Please ensure " 161 <<
" job contains LightSource, LArG4, SimPhotonCounter"<<std::endl;
181 std::cout<<
"This is would be building a Hybrid Library. Not defined. "<<std::endl;
183 mf::LogInfo(
"PhotonVisibilityService") <<
" Vis service " 184 <<
" Storing Library entries to file..." <<std::endl;
200 fHybrid = p.
get<
bool >(
"HybridLibrary",
false);
223 double CryoBounds[6];
225 fXmin = CryoBounds[0];
226 fXmax = CryoBounds[1];
227 fYmin = CryoBounds[2];
228 fYmax = CryoBounds[3];
229 fZmin = CryoBounds[4];
230 fZmax = CryoBounds[5];
242 fNx = p.
get<
int >(
"NX" );
243 fNy = p.
get<
int >(
"NY" );
244 fNz = p.
get<
int >(
"NZ" );
251 std::cout<<
"Getting direct light parameters from .fcl file"<<std::endl;
252 std::vector<std::string> direct_functions = p.
get<std::vector<std::string> >(
"Direct_functions");
259 std::vector<double> direct_landauNormpars = p.
get<std::vector<double> >(
"Direct_landauNormpars");
260 fparslogNorm =
new TF1(
"fparslogNorm", direct_functions[0].c_str(), 0., fD_break);
261 for(
unsigned int i=0; i<direct_landauNormpars.size(); ++i)
262 fparslogNorm->SetParameter(i, direct_landauNormpars[i]);
264 std::vector<double> direct_landauMPVpars = p.
get<std::vector<double> >(
"Direct_landauMPVpars");
265 fparsMPV =
new TF1(
"fparsMPV", direct_functions[1].c_str(), 0., fD_break);
266 for(
unsigned int i=0; i<direct_landauMPVpars.size(); ++i)
267 fparsMPV->SetParameter(i, direct_landauMPVpars[i]);
269 std::vector<double> direct_landauWidthpars = p.
get<std::vector<double> >(
"Direct_landauWidthpars");
270 fparsWidth =
new TF1(
"fparsWidth", direct_functions[2].c_str(), 0., fD_break);
271 for(
unsigned int i=0; i<direct_landauWidthpars.size(); ++i)
272 fparsWidth->SetParameter(i, direct_landauWidthpars[i]);
274 std::vector<double> direct_expoCtepars = p.
get<std::vector<double> >(
"Direct_expoCtepars");
275 fparsCte =
new TF1(
"fparsCte", direct_functions[3].c_str(), 0., fD_break);
276 for(
unsigned int i=0; i<direct_expoCtepars.size(); ++i)
277 fparsCte->SetParameter(i, direct_expoCtepars[i]);
279 std::vector<double> direct_expoSlopepars = p.
get<std::vector<double> >(
"Direct_expoSlopepars");
280 fparsSlope =
new TF1(
"fparsSlope", direct_functions[4].c_str(), 0., fD_break);
281 for(
unsigned int i=0; i<direct_expoSlopepars.size(); ++i)
282 fparsSlope->SetParameter(i, direct_expoSlopepars[i]);
284 std::vector<double> direct_landauNormpars_far = p.
get<std::vector<double> >(
"Direct_landauNormpars_far");
285 fparslogNorm_far =
new TF1(
"fparslogNorm_far", direct_functions[5].c_str(), fD_break, fD_max);
286 for(
unsigned int i=0; i<direct_landauNormpars_far.size(); ++i)
287 fparslogNorm_far->SetParameter(i, direct_landauNormpars_far[i]);
289 std::vector<double> direct_landauMPVpars_far = p.
get<std::vector<double> >(
"Direct_landauMPVpars_far");
290 fparsMPV_far =
new TF1(
"fparsMPV_far", direct_functions[6].c_str(), fD_break, fD_max);
291 for(
unsigned int i=0; i<direct_landauMPVpars_far.size(); ++i)
292 fparsMPV_far->SetParameter(i, direct_landauMPVpars_far[i]);
294 std::vector<double> direct_expoCtepars_far = p.
get<std::vector<double> >(
"Direct_expoCtepars_far");
295 fparsCte_far =
new TF1(
"fparsCte_far", direct_functions[7].c_str(), fD_break - 50., fD_max);
296 for(
unsigned int i=0; i<direct_expoCtepars_far.size(); ++i)
297 fparsCte_far->SetParameter(i, direct_expoCtepars_far[i]);
299 std::vector<std::string> reflected_functions = p.
get<std::vector<std::string> >(
"Reflected_functions");
304 std::vector<double> reflected_landauNormpars = p.
get<std::vector<double> >(
"Reflected_landauNormpars");
305 fparslogNorm_refl =
new TF1(
"fparslogNorm_refl", reflected_functions[0].c_str(), 0., fT0_max);
306 for(
unsigned int i=0; i<reflected_landauNormpars.size(); ++i)
307 fparslogNorm_refl->SetParameter(i, reflected_landauNormpars[i]);
309 std::vector<double> reflected_landauMPVpars = p.
get<std::vector<double> >(
"Reflected_landauMPVpars");
310 fparsMPV_refl =
new TF1(
"fparsMPV_refl", reflected_functions[1].c_str(), 0., fT0_max);
311 for(
unsigned int i=0; i<reflected_landauMPVpars.size(); ++i)
312 fparsMPV_refl->SetParameter(i, reflected_landauMPVpars[i]);
314 std::vector<double> reflected_landauWidthpars = p.
get<std::vector<double> >(
"Reflected_landauWidthpars");
315 fparsWidth_refl =
new TF1(
"fparsWidth_refl", reflected_functions[2].c_str(), 0., fT0_max);
316 for(
unsigned int i=0; i<reflected_landauWidthpars.size(); ++i)
317 fparsWidth_refl->SetParameter(i, reflected_landauWidthpars[i]);
319 std::vector<double> reflected_expoCtepars = p.
get<std::vector<double> >(
"Reflected_expoCtepars");
320 fparsCte_refl =
new TF1(
"fparsCte_refl", reflected_functions[3].c_str(), 0., fT0_max);
321 for(
unsigned int i=0; i<reflected_expoCtepars.size(); ++i)
322 fparsCte_refl->SetParameter(i, reflected_expoCtepars[i]);
324 std::vector<double> reflected_expoSlopepars = p.
get<std::vector<double> >(
"Reflected_expoSlopepars");
325 fparsSlope_refl =
new TF1(
"fparsSlope_refl", reflected_functions[4].c_str(), 0., fT0_max);
326 for(
unsigned int i=0; i<reflected_expoSlopepars.size(); ++i)
327 fparsSlope_refl->SetParameter(i, reflected_expoSlopepars[i]);
358 static std::vector<float> ret;
397 static std::vector<sim::PhotonVoxelDef::NeiInfo> neis;
425 mf::LogInfo(
"PhotonVisibilityService") <<
" PVS notes production of " << N <<
" photons at Vox " << VoxID<<std::endl;
454 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
514 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
577 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
590 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
653 TVector3 location(xyz);
657 location.SetX( fabs(location.x() ) );
TF1 * GetLibraryTimingTF1Entries(int VoxID) const
void GetNeighboringVoxelIDs(const TVector3 &v, std::vector< NeiInfo > &ret) const
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Number of OpDets in the whole detector.
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const =0
double CosThetaFromNormal(geo::Point_t const &point) const
Get cos(angle) to normal of this detector - used for solid angle calcs.
~PhotonVisibilityService()
void RetrieveLightProd(int &VoxID, double &N) const
Encapsulate the construction of a single cyostat.
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)
const std::vector< float > * GetLibraryTimingParEntries(int VoxID) const
virtual const float * GetReflCounts(size_t Voxel) const =0
void CreateEmptyLibrary(size_t NVoxels, size_t NChannels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
#define DEFINE_ART_SERVICE(svc)
void SetLibraryTimingParEntry(int VoxID, int OpChannel, float value, size_t parnum)
sim::PhotonVoxelDef fVoxelDef
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const =0
double fTF1_sampling_factor
const std::vector< float > * GetTimingPar(double const *xyz) const
float const * GetLibraryReflT0Entries(int VoxID) const
void StoreLibraryToFile(std::string LibraryFile, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) const
void SetCount(size_t Voxel, size_t OpChannel, float Count)
PhotonVisibilityService(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
int fParPropTime_MaxRange
void SetLibraryTimingTF1Entry(int VoxID, int OpChannel, TF1 func)
void CryostatBoundaries(double *boundaries, geo::CryostatID const &cid) const
Returns the boundaries of the specified cryostat.
void SetTimingTF1(size_t Voxel, size_t OpChannel, TF1 func)
double GetQuenchingFactor(double dQdx) const
float const * GetLibraryEntries(int VoxID, bool wantReflected=false) 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 SetReflT0(size_t Voxel, size_t OpChannel, float reflT0)
float const * GetAllVisibilities(double const *xyz, bool wantReflected=false) const
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
T get(std::string const &key) const
virtual float GetCount(size_t Voxel, size_t OpChannel) const =0
TF1 * GetTimingTF1(double const *xyz) const
void reconfigure(fhicl::ParameterSet const &p)
virtual const float * GetCounts(size_t Voxel) const =0
Returns a pointer to NOpChannels() visibility values, one per channel.
TF1 * GetTimingTF1s(size_t Voxel) const
const std::vector< float > * GetTimingPars(size_t Voxel) const
void SetLibraryEntry(int VoxID, int OpChannel, float N, bool wantReflected=false)
int GetVoxelID(const TVector3 &) const
unsigned int NOpDets() const
Number of OpDets in the whole detector.
virtual int NOpChannels() const =0
Encapsulate the geometry of an optical detector.
void SetTimingPar(size_t Voxel, size_t OpChannel, float Count, size_t parnum)
const sim::PhotonVoxelDef & GetVoxelDef() const
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
General LArSoft Utilities.
virtual const float * GetReflT0s(size_t Voxel) const =0
float GetLibraryTimingParEntry(int VoxID, int Channel, size_t npar) const
IPhotonLibrary * fTheLibrary
static double SolidAngleFactor(double const *xyz, unsigned int OpDet)
float GetTimingPar(size_t Voxel, size_t OpChannel, size_t parnum) const
float GetLibraryReflT0Entry(int VoxID, int Channel) const
const TVector3 LibLocation(const double *xyz) const
size_t NOpChannels() const
void SetReflCount(size_t Voxel, size_t OpChannel, float Count)
art framework interface to geometry description
float GetLibraryEntry(int VoxID, int OpChannel, bool wantReflected=false) const
cet::coded_exception< error, detail::translate > exception
float const * GetReflT0s(double const *xyz) const
float GetVisibility(double const *xyz, unsigned int OpChannel, bool wantReflected=false) const
static double DistanceToOpDet(double const *xyz, unsigned int OpDet)