13 #include "art_root_io/TFileService.h" 56 ,
fOpDet{pset.get<
int>(
"opdet")}
60 std::cout<<
"Photon library analyzer constructor "<<
std::endl;
74 int NOpDet = pvs->NOpChannels();
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);
211 TotalVis+=Visibilities[ichan];
215 TotalVis = Visibilities[
fOpDet];
218 VisByN->Fill(NOpChannels);
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);
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
Representation of a region of space diced into voxels.
EDAnalyzer(fhicl::ParameterSet const &pset)
PhotonLibraryAnalyzer(fhicl::ParameterSet const &pset)
art framework interface to geometry description
std::array< int, 3U > GetVoxelCoords(int ID) const
#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.
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.
QTextStream & endl(QTextStream &s)