16 #include "art_root_io/TFileService.h" 54 ,
fOpDet{pset.get<
int>(
"opdet")}
58 std::cout <<
"Photon library analyzer constructor " << std::endl;
65 mf::LogInfo(
"PhotonLibraryAnalyzer") <<
"Analyzing photon library - begin" << std::endl;
71 int NOpDet = pvs->NOpChannels();
81 auto const [XSteps, YSteps, ZSteps] = TheVoxelDef.
GetSteps();
85 tfs->make<TH3D>(
"FullVolume",
97 int reportnum = 10000;
110 <<
"Analyzing photon library - making historams" << std::endl;
115 tfs->make<TH2D>(
"XProjection",
"XProjection", ZSteps, 0, ZSteps, YSteps, 0, YSteps);
118 tfs->make<TH2D>(
"XProjection",
"XProjection", YSteps, 0, YSteps, ZSteps, 0, ZSteps);
120 tfs->make<TH2D>(
"YProjection",
"YProjection", XSteps, 0, XSteps, ZSteps, 0, ZSteps);
122 tfs->make<TH2D>(
"ZProjection",
"ZProjection", XSteps, 0, XSteps, YSteps, 0, YSteps);
126 TH1D* VisByN = tfs->make<TH1D>(
"VisByN",
"VisByN", NOpDet, 0, NOpDet);
131 tfs->make<TH2D>(
"XInvisibles",
"XInvisibles", ZSteps, 0, ZSteps, YSteps, 0, YSteps);
134 tfs->make<TH2D>(
"XInvisibles",
"XInvisibles", YSteps, 0, YSteps, ZSteps, 0, ZSteps);
136 tfs->make<TH2D>(
"YInvisibles",
"YInvisibles", XSteps, 0, XSteps, ZSteps, 0, ZSteps);
138 tfs->make<TH2D>(
"ZInvisibles",
"ZInvisibles", XSteps, 0, XSteps, YSteps, 0, YSteps);
140 std::vector<TH2D*> TheXCrossSections;
141 std::vector<TH2D*> TheYCrossSections;
142 std::vector<TH2D*> TheZCrossSections;
145 for (
unsigned int i = 0; i != XSteps; ++i) {
146 std::stringstream ss(
"");
150 TheXCrossSections.push_back(tfs->make<TH2D>(
151 ss.str().c_str(), ss.str().c_str(), ZSteps, 0, ZSteps, YSteps, 0, YSteps));
153 TheXCrossSections.push_back(tfs->make<TH2D>(
154 ss.str().c_str(), ss.str().c_str(), YSteps, 0, YSteps, ZSteps, 0, ZSteps));
157 for (
unsigned int i = 0; i != YSteps; ++i) {
158 std::stringstream ss(
"");
161 TheYCrossSections.push_back(tfs->make<TH2D>(
162 ss.str().c_str(), ss.str().c_str(), XSteps, 0, XSteps, ZSteps, 0, ZSteps));
165 for (
unsigned int i = 0; i != ZSteps; ++i) {
166 std::stringstream ss(
"");
169 TheZCrossSections.push_back(tfs->make<TH2D>(
170 ss.str().c_str(), ss.str().c_str(), XSteps, 0, XSteps, YSteps, 0, YSteps));
174 std::vector<TH2D*> TheXProjections;
175 std::vector<TH2D*> TheYProjections;
176 std::vector<TH2D*> TheZProjections;
181 <<
"Making projections for each of " << NOpDet <<
" photon detectors" << std::endl;
183 for (
int i = 0; i < NOpDet; ++i) {
186 sprintf(ss,
"ProjXOpDet%d", i);
188 TheXProjections.push_back(tfs->make<TH2D>(ss, ss, ZSteps, 0, ZSteps, YSteps, 0, YSteps));
190 TheXProjections.push_back(tfs->make<TH2D>(ss, ss, YSteps, 0, YSteps, ZSteps, 0, ZSteps));
192 sprintf(ss,
"ProjYOpDet%d", i);
193 TheYProjections.push_back(tfs->make<TH2D>(ss, ss, XSteps, 0, XSteps, ZSteps, 0, ZSteps));
195 sprintf(ss,
"ProjZOpDet%d", i);
196 TheZProjections.push_back(tfs->make<TH2D>(ss, ss, XSteps, 0, XSteps, YSteps, 0, YSteps));
201 <<
"Analyzing photon library - running through voxels " << std::endl;
203 for (
unsigned int i = 0; i != TheVoxelDef.
GetNVoxels(); ++i) {
204 if (i % reportnum == 0) std::cout <<
"Photon library analyzer at voxel " << i << std::endl;
208 const float* Visibilities = pvs->GetLibraryEntries(i);
209 size_t NOpChannels = pvs->NOpChannels();
213 for (
size_t ichan = 0; ichan != NOpChannels; ++ichan) {
214 TotalVis += Visibilities[ichan];
218 TotalVis = Visibilities[
fOpDet];
221 VisByN->Fill(NOpChannels);
236 for (
size_t ichan = 0; ichan != NOpChannels; ++ichan) {
237 TheXProjections.at(ichan)->Fill(
Coords[newX],
Coords[newY], Visibilities[ichan]);
238 TheYProjections.at(ichan)->Fill(
Coords[0],
Coords[2], Visibilities[ichan]);
239 TheZProjections.at(ichan)->Fill(
Coords[0],
Coords[1], Visibilities[ichan]);
244 XProjection->Fill(
Coords[newX],
Coords[newY], TotalVis);
249 mf::LogInfo(
"PhotonLibraryAnalyzer") <<
"Analyzing photon library - end" << std::endl;
Definitions of voxel data structures.
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
void analyze(const art::Event &evt)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
TNtupleSim Fill(f1, f2, f3, f4)
Representation of a region of space diced into voxels.
EDAnalyzer(fhicl::ParameterSet const &pset)
PhotonLibraryAnalyzer(fhicl::ParameterSet const &pset)
std::array< int, 3U > GetVoxelCoords(int ID) const
Utilities to dump objects into a stream.
#define DEFINE_ART_MODULE(klass)
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
T get(std::string const &key) const
General LArSoft Utilities.
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
std::array< unsigned int, 3U > GetSteps() const
Returns the number of voxels along each of the three dimensions.
art framework interface to geometry description
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.