67 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - begin"<< std::endl;
70 art::ServiceHandle<art::TFileService const>
tfs;
71 art::ServiceHandle<PhotonVisibilityService const> pvs;
72 art::ServiceHandle<geo::Geometry const> geom;
74 int NOpDet = pvs->NOpChannels();
80 mf::LogInfo(
"PhotonLibraryAnalyzer") <<
"UpperCorner: " <<
lar::dump::vector3D(UpperCorner) <<
"\n"
83 auto const [ XSteps, YSteps, ZSteps ] = TheVoxelDef.
GetSteps();
87 tfs->make<TH3D>(
"FullVolume",
"FullVolume",
88 XSteps,LowerCorner.X(),UpperCorner.X(),
89 YSteps,LowerCorner.Y(),UpperCorner.Y(),
90 ZSteps,LowerCorner.Z(),UpperCorner.Z());
107 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - making historams"<< std::endl;
110 if (
fAltXAxis ==
"Z") XProjection = tfs->make<TH2D>(
"XProjection",
"XProjection",ZSteps,0,ZSteps,YSteps,0,YSteps);
111 else XProjection = tfs->make<TH2D>(
"XProjection",
"XProjection",YSteps,0,YSteps,ZSteps,0,ZSteps);
112 TH2D* YProjection = tfs->make<TH2D>(
"YProjection",
"YProjection",XSteps,0,XSteps,ZSteps,0,ZSteps);
113 TH2D* ZProjection = tfs->make<TH2D>(
"ZProjection",
"ZProjection",XSteps,0,XSteps,YSteps,0,YSteps);
117 TH1D* VisByN = tfs->make<TH1D>(
"VisByN",
"VisByN", NOpDet, 0, NOpDet);
120 if (
fAltXAxis ==
"Z") XInvisibles = tfs->make<TH2D>(
"XInvisibles",
"XInvisibles",ZSteps,0,ZSteps,YSteps,0,YSteps);
121 else XInvisibles = tfs->make<TH2D>(
"XInvisibles",
"XInvisibles",YSteps,0,YSteps,ZSteps,0,ZSteps);
122 TH2D* YInvisibles = tfs->make<TH2D>(
"YInvisibles",
"YInvisibles",XSteps,0,XSteps,ZSteps,0,ZSteps);
123 TH2D* ZInvisibles = tfs->make<TH2D>(
"ZInvisibles",
"ZInvisibles",XSteps,0,XSteps,YSteps,0,YSteps);
129 std::vector<TH2D*> TheXCrossSections;
130 std::vector<TH2D*> TheYCrossSections;
131 std::vector<TH2D*> TheZCrossSections;
135 for(
unsigned int i=0; i!=XSteps; ++i)
137 std::stringstream ss(
"");
141 TheXCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), ZSteps, 0,ZSteps, YSteps, 0,YSteps));
143 TheXCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), YSteps, 0,YSteps, ZSteps, 0,ZSteps));
148 for(
unsigned int i=0; i!=YSteps; ++i)
150 std::stringstream ss(
"");
153 TheYCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), XSteps, 0,XSteps, ZSteps, 0, ZSteps));
157 for(
unsigned int i=0; i!=ZSteps; ++i)
159 std::stringstream ss(
"");
162 TheZCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), XSteps, 0,XSteps, YSteps, 0,YSteps));
168 std::vector<TH2D*> TheXProjections;
169 std::vector<TH2D*> TheYProjections;
170 std::vector<TH2D*> TheZProjections;
174 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Making projections for each of " << NOpDet <<
" photon detectors" << std::endl;
176 for(
int i=0; i<NOpDet; ++i)
180 sprintf(ss,
"ProjXOpDet%d", i);
182 TheXProjections.push_back(tfs->make<TH2D>(ss, ss, ZSteps, 0,ZSteps, YSteps, 0,YSteps));
184 TheXProjections.push_back(tfs->make<TH2D>(ss, ss, YSteps, 0,YSteps, ZSteps, 0,ZSteps));
186 sprintf(ss,
"ProjYOpDet%d", i);
187 TheYProjections.push_back(tfs->make<TH2D>(ss, ss, XSteps, 0,XSteps, ZSteps, 0, ZSteps));
189 sprintf(ss,
"ProjZOpDet%d", i);
190 TheZProjections.push_back(tfs->make<TH2D>(ss, ss, XSteps, 0,XSteps, YSteps, 0,YSteps));
195 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - running through voxels "<< std::endl;
198 for(
unsigned int i=0; i!=TheVoxelDef.
GetNVoxels(); ++i)
200 if(i%reportnum==0)
std::cout<<
"Photon library analyzer at voxel " << i<<std::endl;
204 const float* Visibilities = pvs->GetLibraryEntries(i);
205 size_t NOpChannels = pvs->NOpChannels();
209 for(
size_t ichan=0; ichan!=NOpChannels; ++ichan)
211 TotalVis+=Visibilities[ichan];
215 TotalVis = Visibilities[
fOpDet];
218 VisByN->Fill(NOpChannels);
234 for(
size_t ichan=0; ichan!=NOpChannels; ++ichan) {
235 TheXProjections.at(ichan)->Fill(
Coords[newX],
Coords[newY],Visibilities[ichan]);
236 TheYProjections.at(ichan)->Fill(
Coords[0],
Coords[2],Visibilities[ichan]);
237 TheZProjections.at(ichan)->Fill(
Coords[0],
Coords[1],Visibilities[ichan]);
242 XProjection->Fill(
Coords[newX],
Coords[newY], TotalVis);
248 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - end"<< std::endl;
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
std::array< unsigned int, 3U > GetSteps() const
Returns the number of voxels along each of the three dimensions.
Representation of a region of space diced into voxels.
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
std::array< int, 3U > GetVoxelCoords(int ID) const
art::ServiceHandle< art::TFileService > tfs
BEGIN_PROLOG could also be cout