Public Member Functions | Private Attributes | List of all members
phot::PhotonLibraryAnalyzer Class Reference
Inheritance diagram for phot::PhotonLibraryAnalyzer:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 PhotonLibraryAnalyzer (fhicl::ParameterSet const &pset)
 
void beginJob ()
 
void analyze (const art::Event &evt)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fAltXAxis
 
int fOpDet
 
bool fEachSlice
 
bool fEachDetector
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 28 of file PhotonLibraryAnalyzer_module.cc.

Constructor & Destructor Documentation

phot::PhotonLibraryAnalyzer::PhotonLibraryAnalyzer ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 53 of file PhotonLibraryAnalyzer_module.cc.

54  : EDAnalyzer(pset)
55  , fAltXAxis{pset.get<std::string>("alt_x_axis")}
56  , fOpDet{pset.get<int>("opdet")}
57  , fEachSlice{pset.get<bool>("each_slice")}
58  , fEachDetector{pset.get<bool>("each_detector")}
59  {
60  std::cout<<"Photon library analyzer constructor "<<std::endl;
61  }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
QTextStream & endl(QTextStream &s)

Member Function Documentation

void phot::PhotonLibraryAnalyzer::analyze ( const art::Event evt)

Definition at line 252 of file PhotonLibraryAnalyzer_module.cc.

253  {
254 
255  }
void phot::PhotonLibraryAnalyzer::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 64 of file PhotonLibraryAnalyzer_module.cc.

66  {
67  mf::LogInfo("PhotonLibraryAnalyzer")<<"Analyzing photon library - begin"<< std::endl;
68 
69 
73 
74  int NOpDet = pvs->NOpChannels();
75 
76  sim::PhotonVoxelDef TheVoxelDef = pvs->GetVoxelDef();
77  auto const& UpperCorner = TheVoxelDef.GetRegionUpperCorner();
78  auto const& LowerCorner = TheVoxelDef.GetRegionLowerCorner();
79 
80  mf::LogInfo("PhotonLibraryAnalyzer") << "UpperCorner: " << lar::dump::vector3D(UpperCorner) << "\n"
81  << "LowerCorner: " << lar::dump::vector3D(LowerCorner);
82 
83  auto const [ XSteps, YSteps, ZSteps ] = TheVoxelDef.GetSteps(); // unsigned int
84 
85  // for c2: FullVolume is unused, just call tfs->make
86  // TH3D *FullVolume = tfs->make<TH3D>("FullVolume","FullVolume",
87  tfs->make<TH3D>("FullVolume","FullVolume",
88  XSteps,LowerCorner.X(),UpperCorner.X(),
89  YSteps,LowerCorner.Y(),UpperCorner.Y(),
90  ZSteps,LowerCorner.Z(),UpperCorner.Z());
91 
92 
93  int reportnum=10000;
94 
95  int newX, newY;
96  if (fAltXAxis == "Z") {
97  newX = 2; // Z
98  newY = 1; // Y
99  }
100  else {
101  newX = 1; // Y
102  newY = 2; // Z
103  }
104 
105 
106 
107  mf::LogInfo("PhotonLibraryAnalyzer")<<"Analyzing photon library - making historams"<< std::endl;
108 
109  TH2D* XProjection;
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);
114 
115  // TH1D * PMTsNoVisibility = tfs->make<TH1D>("PMTsNoVisibility","PMTsNoVisibility", NOpDet,0,NOpDet);
116 
117  TH1D* VisByN = tfs->make<TH1D>("VisByN","VisByN", NOpDet, 0, NOpDet);
118 
119  TH2D* XInvisibles;
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);
124 
125 
126 
127 
128 
129  std::vector<TH2D*> TheXCrossSections;
130  std::vector<TH2D*> TheYCrossSections;
131  std::vector<TH2D*> TheZCrossSections;
132  if (fEachSlice) {
133 
134 
135  for(unsigned int i=0; i!=XSteps; ++i)
136  {
137  std::stringstream ss("");
138  ss.flush();
139  ss<<"projX"<<i;
140  if (fAltXAxis == "Z")
141  TheXCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), ZSteps, 0,ZSteps, YSteps, 0,YSteps));
142  else
143  TheXCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), YSteps, 0,YSteps, ZSteps, 0,ZSteps));
144 
145 
146  }
147 
148  for(unsigned int i=0; i!=YSteps; ++i)
149  {
150  std::stringstream ss("");
151  ss.flush();
152  ss<<"projY"<<i;
153  TheYCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), XSteps, 0,XSteps, ZSteps, 0, ZSteps));
154 
155  }
156 
157  for(unsigned int i=0; i!=ZSteps; ++i)
158  {
159  std::stringstream ss("");
160  ss.flush();
161  ss<<"projZ"<<i;
162  TheZCrossSections.push_back(tfs->make<TH2D>(ss.str().c_str(),ss.str().c_str(), XSteps, 0,XSteps, YSteps, 0,YSteps));
163 
164  }
165  }
166 
167 
168  std::vector<TH2D*> TheXProjections;
169  std::vector<TH2D*> TheYProjections;
170  std::vector<TH2D*> TheZProjections;
171 
172  if (fEachDetector) {
173 
174  mf::LogInfo("PhotonLibraryAnalyzer")<<"Making projections for each of " << NOpDet << " photon detectors" << std::endl;
175 
176  for(int i=0; i<NOpDet; ++i)
177  {
178  char ss[99];
179 
180  sprintf(ss, "ProjXOpDet%d", i);
181  if (fAltXAxis == "Z")
182  TheXProjections.push_back(tfs->make<TH2D>(ss, ss, ZSteps, 0,ZSteps, YSteps, 0,YSteps));
183  else
184  TheXProjections.push_back(tfs->make<TH2D>(ss, ss, YSteps, 0,YSteps, ZSteps, 0,ZSteps));
185 
186  sprintf(ss, "ProjYOpDet%d", i);
187  TheYProjections.push_back(tfs->make<TH2D>(ss, ss, XSteps, 0,XSteps, ZSteps, 0, ZSteps));
188 
189  sprintf(ss, "ProjZOpDet%d", i);
190  TheZProjections.push_back(tfs->make<TH2D>(ss, ss, XSteps, 0,XSteps, YSteps, 0,YSteps));
191  }
192  }
193 
194 
195  mf::LogInfo("PhotonLibraryAnalyzer")<<"Analyzing photon library - running through voxels "<< std::endl;
196 
197 
198  for(unsigned int i=0; i!=TheVoxelDef.GetNVoxels(); ++i)
199  {
200  if(i%reportnum==0) std::cout<<"Photon library analyzer at voxel " << i<<std::endl;
201 
202  auto const Coords = TheVoxelDef.GetVoxelCoords(i);
203 
204  const float* Visibilities = pvs->GetLibraryEntries(i);
205  size_t NOpChannels = pvs->NOpChannels();
206 
207  float TotalVis=0;
208  if (fOpDet < 0) {
209  for(size_t ichan=0; ichan!=NOpChannels; ++ichan)
210  {
211  TotalVis+=Visibilities[ichan];
212  }
213  }
214  else {
215  TotalVis = Visibilities[fOpDet];
216  }
217 
218  VisByN->Fill(NOpChannels);
219 
220  if(TotalVis==0)
221  {
222  XInvisibles->Fill(Coords[newX],Coords[newY]);
223  YInvisibles->Fill(Coords[0],Coords[2]);
224  ZInvisibles->Fill(Coords[0],Coords[1]);
225  }
226 
227  if (fEachSlice) {
228  TheXCrossSections.at(Coords.at(0))->Fill(Coords[newX],Coords[newY],TotalVis);
229  TheYCrossSections.at(Coords.at(1))->Fill(Coords[0],Coords[2],TotalVis);
230  TheZCrossSections.at(Coords.at(2))->Fill(Coords[0],Coords[1],TotalVis);
231  }
232 
233  if (fEachDetector) {
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]);
238  }
239  }
240 
241  // Always make the summed projections
242  XProjection->Fill(Coords[newX], Coords[newY], TotalVis);
243  YProjection->Fill(Coords[0], Coords[2], TotalVis);
244  ZProjection->Fill(Coords[0], Coords[1], TotalVis);
245 
246  }
247 
248  mf::LogInfo("PhotonLibraryAnalyzer")<<"Analyzing photon library - end"<< std::endl;
249  }
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
Definition: DumpUtils.h:301
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Representation of a region of space diced into voxels.
Definition: PhotonVoxels.h:58
std::array< int, 3U > GetVoxelCoords(int ID) const
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
Index NOpChannels(Index)
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.
Eigen::Vector3f Coords
Definition: DCEL.h:46
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string phot::PhotonLibraryAnalyzer::fAltXAxis
private

Definition at line 42 of file PhotonLibraryAnalyzer_module.cc.

bool phot::PhotonLibraryAnalyzer::fEachDetector
private

Definition at line 45 of file PhotonLibraryAnalyzer_module.cc.

bool phot::PhotonLibraryAnalyzer::fEachSlice
private

Definition at line 44 of file PhotonLibraryAnalyzer_module.cc.

int phot::PhotonLibraryAnalyzer::fOpDet
private

Definition at line 43 of file PhotonLibraryAnalyzer_module.cc.


The documentation for this class was generated from the following file: