56 fUseCryoBoundary(false),
57 fLibraryBuildJob(false),
58 fDoNotLoadLibrary(false),
59 fParameterization(false),
61 fStoreReflected(false),
63 fIncludePropTime(false),
69 mf::LogInfo(
"PhotonVisibilityService")<<
"PhotonVisbilityService initializing"<<std::endl;
80 std::string LibraryFileWithPath;
81 cet::search_path sp(
"FW_SEARCH_PATH");
84 throw cet::exception(
"PhotonVisibilityService") <<
"Unable to find photon library in " << sp.to_string() <<
"\n";
89 mf::LogInfo(
"PhotonVisibilityService") <<
"PhotonVisibilityService Loading photon library from file " 90 << LibraryFileWithPath
95 <<
" optical detectors." 114 size_t NOpDets = geom->
NOpDets();
116 mf::LogInfo(
"PhotonVisibilityService") <<
" Vis service running library build job. Please ensure " 117 <<
" job contains LightSource, LArG4, SimPhotonCounter"<<std::endl;
137 std::cout<<
"This is would be building a Hybrid Library. Not defined. "<<std::endl;
139 mf::LogInfo(
"PhotonVisibilityService") <<
" Vis service " 140 <<
" Storing Library entries to file..." <<std::endl;
156 fHybrid = p.
get<
bool >(
"HybridLibrary",
false);
177 double CryoBounds[6];
179 fXmin = CryoBounds[0];
180 fXmax = CryoBounds[1];
181 fYmin = CryoBounds[2];
182 fYmax = CryoBounds[3];
183 fZmin = CryoBounds[4];
184 fZmax = CryoBounds[5];
196 fNx = p.
get<
int >(
"NX" );
197 fNy = p.
get<
int >(
"NY" );
198 fNz = p.
get<
int >(
"NZ" );
205 std::cout<<
"Getting direct light parameters from .fcl file"<<std::endl;
206 std::vector<std::string> direct_functions = p.
get<std::vector<std::string> >(
"Direct_functions");
213 std::vector<double> direct_landauNormpars = p.
get<std::vector<double> >(
"Direct_landauNormpars");
214 fparslogNorm =
new TF1(
"fparslogNorm", direct_functions[0].c_str(), 0., fD_break);
215 for(
unsigned int i=0; i<direct_landauNormpars.size(); ++i)
216 fparslogNorm->SetParameter(i, direct_landauNormpars[i]);
218 std::vector<double> direct_landauMPVpars = p.
get<std::vector<double> >(
"Direct_landauMPVpars");
219 fparsMPV =
new TF1(
"fparsMPV", direct_functions[1].c_str(), 0., fD_break);
220 for(
unsigned int i=0; i<direct_landauMPVpars.size(); ++i)
221 fparsMPV->SetParameter(i, direct_landauMPVpars[i]);
223 std::vector<double> direct_landauWidthpars = p.
get<std::vector<double> >(
"Direct_landauWidthpars");
224 fparsWidth =
new TF1(
"fparsWidth", direct_functions[2].c_str(), 0., fD_break);
225 for(
unsigned int i=0; i<direct_landauWidthpars.size(); ++i)
226 fparsWidth->SetParameter(i, direct_landauWidthpars[i]);
228 std::vector<double> direct_expoCtepars = p.
get<std::vector<double> >(
"Direct_expoCtepars");
229 fparsCte =
new TF1(
"fparsCte", direct_functions[3].c_str(), 0., fD_break);
230 for(
unsigned int i=0; i<direct_expoCtepars.size(); ++i)
231 fparsCte->SetParameter(i, direct_expoCtepars[i]);
233 std::vector<double> direct_expoSlopepars = p.
get<std::vector<double> >(
"Direct_expoSlopepars");
234 fparsSlope =
new TF1(
"fparsSlope", direct_functions[4].c_str(), 0., fD_break);
235 for(
unsigned int i=0; i<direct_expoSlopepars.size(); ++i)
236 fparsSlope->SetParameter(i, direct_expoSlopepars[i]);
238 std::vector<double> direct_landauNormpars_far = p.
get<std::vector<double> >(
"Direct_landauNormpars_far");
239 fparslogNorm_far =
new TF1(
"fparslogNorm_far", direct_functions[5].c_str(), fD_break, fD_max);
240 for(
unsigned int i=0; i<direct_landauNormpars_far.size(); ++i)
241 fparslogNorm_far->SetParameter(i, direct_landauNormpars_far[i]);
243 std::vector<double> direct_landauMPVpars_far = p.
get<std::vector<double> >(
"Direct_landauMPVpars_far");
244 fparsMPV_far =
new TF1(
"fparsMPV_far", direct_functions[6].c_str(), fD_break, fD_max);
245 for(
unsigned int i=0; i<direct_landauMPVpars_far.size(); ++i)
246 fparsMPV_far->SetParameter(i, direct_landauMPVpars_far[i]);
248 std::vector<double> direct_expoCtepars_far = p.
get<std::vector<double> >(
"Direct_expoCtepars_far");
249 fparsCte_far =
new TF1(
"fparsCte_far", direct_functions[7].c_str(), fD_break - 50., fD_max);
250 for(
unsigned int i=0; i<direct_expoCtepars_far.size(); ++i)
251 fparsCte_far->SetParameter(i, direct_expoCtepars_far[i]);
253 std::vector<std::string> reflected_functions = p.
get<std::vector<std::string> >(
"Reflected_functions");
258 std::vector<double> reflected_landauNormpars = p.
get<std::vector<double> >(
"Reflected_landauNormpars");
259 fparslogNorm_refl =
new TF1(
"fparslogNorm_refl", reflected_functions[0].c_str(), 0., fT0_max);
260 for(
unsigned int i=0; i<reflected_landauNormpars.size(); ++i)
261 fparslogNorm_refl->SetParameter(i, reflected_landauNormpars[i]);
263 std::vector<double> reflected_landauMPVpars = p.
get<std::vector<double> >(
"Reflected_landauMPVpars");
264 fparsMPV_refl =
new TF1(
"fparsMPV_refl", reflected_functions[1].c_str(), 0., fT0_max);
265 for(
unsigned int i=0; i<reflected_landauMPVpars.size(); ++i)
266 fparsMPV_refl->SetParameter(i, reflected_landauMPVpars[i]);
268 std::vector<double> reflected_landauWidthpars = p.
get<std::vector<double> >(
"Reflected_landauWidthpars");
269 fparsWidth_refl =
new TF1(
"fparsWidth_refl", reflected_functions[2].c_str(), 0., fT0_max);
270 for(
unsigned int i=0; i<reflected_landauWidthpars.size(); ++i)
271 fparsWidth_refl->SetParameter(i, reflected_landauWidthpars[i]);
273 std::vector<double> reflected_expoCtepars = p.
get<std::vector<double> >(
"Reflected_expoCtepars");
274 fparsCte_refl =
new TF1(
"fparsCte_refl", reflected_functions[3].c_str(), 0., fT0_max);
275 for(
unsigned int i=0; i<reflected_expoCtepars.size(); ++i)
276 fparsCte_refl->SetParameter(i, reflected_expoCtepars[i]);
278 std::vector<double> reflected_expoSlopepars = p.
get<std::vector<double> >(
"Reflected_expoSlopepars");
279 fparsSlope_refl =
new TF1(
"fparsSlope_refl", reflected_functions[4].c_str(), 0., fT0_max);
280 for(
unsigned int i=0; i<reflected_expoSlopepars.size(); ++i)
281 fparsSlope_refl->SetParameter(i, reflected_expoSlopepars[i]);
312 static std::vector<float> ret;
351 static std::vector<sim::PhotonVoxelDef::NeiInfo> neis;
379 mf::LogInfo(
"PhotonVisibilityService") <<
" PVS notes production of " << N <<
" photons at Vox " << VoxID<<std::endl;
408 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
468 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
531 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
544 LOG_DEBUG(
"PhotonVisibilityService") <<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
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.
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
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 ®)
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
void LoadLibraryFromFile(std::string LibraryFile, size_t NVoxels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0)
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
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)