1 #ifndef PHOTLIBANALYZER_H 2 #define PHOTLIBANALYZER_H 69 std::cout<<
"Photon library analyzer constructor "<<std::endl;
90 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - begin"<< std::endl;
97 int NOpDet = pvs->NOpChannels();
100 TVector3 Steps = TheVoxelDef.
GetSteps();
104 mf::LogInfo(
"PhotonLibraryAnalyzer") <<
"UpperCorner: " << UpperCorner[0] <<
" " << UpperCorner[1] <<
" " << UpperCorner[2] <<
"\n" 105 <<
"LowerCorner: " << LowerCorner[0] <<
" " << LowerCorner[1] <<
" " << LowerCorner[2];
107 int XSteps = int(Steps[0]);
108 int YSteps = int(Steps[1]);
109 int ZSteps = int(Steps[2]);
113 tfs->
make<TH3D>(
"FullVolume",
"FullVolume",
114 XSteps,LowerCorner[0],UpperCorner[0],
115 YSteps,LowerCorner[1],UpperCorner[1],
116 ZSteps,LowerCorner[2],UpperCorner[2]);
133 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - making historams"<< std::endl;
136 if (
fAltXAxis ==
"Z") XProjection = tfs->
make<TH2D>(
"XProjection",
"XProjection",ZSteps,0,ZSteps,YSteps,0,YSteps);
137 else XProjection = tfs->
make<TH2D>(
"XProjection",
"XProjection",YSteps,0,YSteps,ZSteps,0,ZSteps);
138 TH2D* YProjection = tfs->
make<TH2D>(
"YProjection",
"YProjection",XSteps,0,XSteps,ZSteps,0,ZSteps);
139 TH2D* ZProjection = tfs->
make<TH2D>(
"ZProjection",
"ZProjection",XSteps,0,XSteps,YSteps,0,YSteps);
143 TH1D* VisByN = tfs->
make<TH1D>(
"VisByN",
"VisByN", NOpDet, 0, NOpDet);
146 if (
fAltXAxis ==
"Z") XInvisibles = tfs->
make<TH2D>(
"XInvisibles",
"XInvisibles",ZSteps,0,ZSteps,YSteps,0,YSteps);
147 else XInvisibles = tfs->
make<TH2D>(
"XInvisibles",
"XInvisibles",YSteps,0,YSteps,ZSteps,0,ZSteps);
148 TH2D* YInvisibles = tfs->
make<TH2D>(
"YInvisibles",
"YInvisibles",XSteps,0,XSteps,ZSteps,0,ZSteps);
149 TH2D* ZInvisibles = tfs->
make<TH2D>(
"ZInvisibles",
"ZInvisibles",XSteps,0,XSteps,YSteps,0,YSteps);
155 std::vector<TH2D*> TheXCrossSections;
156 std::vector<TH2D*> TheYCrossSections;
157 std::vector<TH2D*> TheZCrossSections;
161 for(
int i=0; i!=XSteps; ++i)
163 std::stringstream
ss(
"");
167 TheXCrossSections.push_back(tfs->
make<TH2D>(ss.str().c_str(),ss.str().c_str(), ZSteps, 0,ZSteps, YSteps, 0,YSteps));
169 TheXCrossSections.push_back(tfs->
make<TH2D>(ss.str().c_str(),ss.str().c_str(), YSteps, 0,YSteps, ZSteps, 0,ZSteps));
174 for(
int i=0; i!=YSteps; ++i)
176 std::stringstream
ss(
"");
179 TheYCrossSections.push_back(tfs->
make<TH2D>(ss.str().c_str(),ss.str().c_str(), XSteps, 0,XSteps, ZSteps, 0, ZSteps));
183 for(
int i=0; i!=ZSteps; ++i)
185 std::stringstream
ss(
"");
188 TheZCrossSections.push_back(tfs->
make<TH2D>(ss.str().c_str(),ss.str().c_str(), XSteps, 0,XSteps, YSteps, 0,YSteps));
194 std::vector<TH2D*> TheXProjections;
195 std::vector<TH2D*> TheYProjections;
196 std::vector<TH2D*> TheZProjections;
200 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Making projections for each of " << NOpDet <<
" photon detectors" << std::endl;
202 for(
int i=0; i<NOpDet; ++i)
206 sprintf(ss,
"ProjXOpDet%d", i);
208 TheXProjections.push_back(tfs->
make<TH2D>(ss, ss, ZSteps, 0,ZSteps, YSteps, 0,YSteps));
210 TheXProjections.push_back(tfs->
make<TH2D>(ss, ss, YSteps, 0,YSteps, ZSteps, 0,ZSteps));
212 sprintf(ss,
"ProjYOpDet%d", i);
213 TheYProjections.push_back(tfs->
make<TH2D>(ss, ss, XSteps, 0,XSteps, ZSteps, 0, ZSteps));
215 sprintf(ss,
"ProjZOpDet%d", i);
216 TheZProjections.push_back(tfs->
make<TH2D>(ss, ss, XSteps, 0,XSteps, YSteps, 0,YSteps));
221 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - running through voxels "<< std::endl;
224 for(
int i=0; i!=TheVoxelDef.
GetNVoxels(); ++i)
226 if(i%reportnum==0) std::cout<<
"Photon library analyzer at voxel " << i<<std::endl;
230 const float* Visibilities = pvs->GetLibraryEntries(i);
231 size_t NOpChannels = pvs->NOpChannels();
235 for(
size_t ichan=0; ichan!=NOpChannels; ++ichan)
237 TotalVis+=Visibilities[ichan];
241 TotalVis = Visibilities[
fOpDet];
244 VisByN->Fill(NOpChannels);
248 XInvisibles->Fill(Coords[newX],Coords[newY]);
249 YInvisibles->Fill(Coords[0],Coords[2]);
250 ZInvisibles->Fill(Coords[0],Coords[1]);
254 TheXCrossSections.at(Coords.at(0))->
Fill(Coords[newX],Coords[newY],TotalVis);
255 TheYCrossSections.at(Coords.at(1))->
Fill(Coords[0],Coords[2],TotalVis);
256 TheZCrossSections.at(Coords.at(2))->
Fill(Coords[0],Coords[1],TotalVis);
260 for(
size_t ichan=0; ichan!=NOpChannels; ++ichan) {
261 TheXProjections.at(ichan)->Fill(Coords[newX],Coords[newY],Visibilities[ichan]);
262 TheYProjections.at(ichan)->Fill(Coords[0],Coords[2],Visibilities[ichan]);
263 TheZProjections.at(ichan)->Fill(Coords[0],Coords[1],Visibilities[ichan]);
268 XProjection->Fill(Coords[newX], Coords[newY], TotalVis);
269 YProjection->Fill(Coords[0], Coords[2], TotalVis);
270 ZProjection->Fill(Coords[0], Coords[1], TotalVis);
274 mf::LogInfo(
"PhotonLibraryAnalyzer")<<
"Analyzing photon library - end"<< std::endl;
virtual ~PhotonLibraryAnalyzer()
void analyze(const art::Event &evt)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
TNtupleSim Fill(f1, f2, f3, f4)
TVector3 GetSteps() const
TVector3 GetRegionLowerCorner() const
PhotonLibraryAnalyzer(fhicl::ParameterSet const &pset)
TVector3 GetRegionUpperCorner() const
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
EDAnalyzer(Table< Config > const &config)
std::vector< int > GetVoxelCoords(int ID) const
General LArSoft Utilities.
T * make(ARGS...args) const
Utility object to perform functions of association.
void reconfigure(fhicl::ParameterSet const &pset)
art framework interface to geometry description