38 using namespace std::chrono;
41 PhotonVisibilityService* PhotonVisibilityService::_me =
nullptr;
70 PhotonVisibilityService::PhotonVisibilityService(std::string library) :
83 fUseCryoBoundary(
true),
84 fLibraryBuildJob(
false),
85 fDoNotLoadLibrary(
false),
86 fParameterization(
false),
87 fLibraryFile(library),
94 std::vector<std::vector<float> >
96 std::vector<std::vector<float> > result(
fNy,std::vector<float>(
fNz,0.));
97 if(x < fXmin || x >
fXmax)
return result;
102 for(
int iy=0; iy<
fNy; ++iy) {
103 for(
int iz=0; iz<
fNz; ++iz) {
104 int vox_id = iy*
fNx + iz * (fNy +
fNx);
107 vis_sum += ((double)(vis_pmt));
108 result[iy][iz] = vis_sum;
114 std::vector<std::vector<float> >
116 std::vector<std::vector<float> > result(
fNz,std::vector<float>(
fNx,0.));
117 if(y < fYmin || y >
fYmax)
return result;
122 for(
int ix=0; ix<
fNx; ++ix) {
123 for(
int iz=0; iz<
fNz; ++iz) {
124 int vox_id = ix + iz * (
fNy +
fNx);
127 vis_sum += ((double)(vis_pmt));
128 result[iz][ix] = vis_sum;
134 std::vector<std::vector<float> >
136 std::vector<std::vector<float> > result(
fNx,std::vector<float>(
fNy,0.));
137 if(z < fZmin || z >
fZmax)
return result;
142 for(
int ix=0; ix<
fNx; ++ix) {
143 for(
int iy=0; iy<
fNy; ++iy) {
144 int vox_id = ix + iy *
fNx;
147 vis_sum += ((double)(vis_pmt));
148 result[ix][iy] = vis_sum;
155 { assert(frac>=0. && frac <=1.);
return fXmin + (
fXmax -
fXmin) * frac; }
157 { assert(frac>=0. && frac <=1.);
return fYmin + (
fYmax -
fYmin) * frac; }
159 { assert(frac>=0. && frac <=1.);
return fZmin + (
fZmax -
fZmin) * frac; }
165 std::cout<<
"Loading library..."<<std::endl;
172 std::string LibraryFileWithPath;
175 LibraryFileWithPath = std::string(getenv(
"FMATCH_DATADIR"));
176 LibraryFileWithPath +=
"/";
184 std::cout <<
"PhotonVisibilityService Loading photon library from file "
185 << LibraryFileWithPath
188 fTheLibrary->LoadLibraryFromFile(LibraryFileWithPath, NVoxels);
196 std::cout <<
" Vis service running library build job. Please ensure "
197 <<
" job contains LightSource, LArG4, SimPhotonCounter"<<std::endl;
212 <<
" Storing Library entries to file..." <<std::endl;
286 std::cout <<
" PVS notes production of " << N <<
" photons at Vox " << VoxID<<std::endl;
307 std::cout<<
" PVS logging " << VoxID <<
" " << OpChannel<<std::endl;
process_name opflash particleana ie ie ie z
std::vector< std::vector< float > > GetVisibilityYZ(double x) const
std::vector< std::vector< float > > GetVisibilityXY(double z) const
phot::IPhotonLibrary::Counts_t GetLibraryEntries(int VoxID, bool wantReflected=false) const
void RetrieveLightProd(int &VoxID, double &N) const
std::vector< std::vector< float > > GetVisibilityZX(double y) const
process_name opflash particleana ie x
sim::PhotonVoxelDef fVoxelDef
Representation of a region of space diced into voxels.
virtual float GetCount(size_t Voxel, size_t OpChannel) const =0
float GetLibraryEntry(int VoxID, OpDetID_t libOpChannel, bool wantReflected=false) const
int GetVoxelID(Point const &p) const
Returns the ID of the voxel containing p, or -1 if none.
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
void StoreLightProd(int VoxID, double N)
process_name opflash particleana ie ie y
float Fraction2AbsoluteZ(float frac) const
MappedCounts_t GetAllVisibilities(Point const &p, bool wantReflected=false) const
const sim::PhotonVoxelDef & GetVoxelDef() const
virtual Counts_t GetCounts(size_t Voxel) const =0
Returns a pointer to NOpChannels() visibility values, one per channel.
void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected=false)
IPhotonLibrary * fTheLibrary
process_name largeant stream1 can override from command line with o or output physics producers generator N
float Fraction2AbsoluteY(float frac) const
float GetVisibility(Point const &p, unsigned int OpChannel, bool wantReflected=false) const
BEGIN_PROLOG don t mess with this pandoraTrackGausCryoW true
BEGIN_PROLOG could also be cout
float Fraction2AbsoluteX(float frac) const