LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
phot::PhotonVisibilityService Class Reference

#include "PhotonVisibilityService.h"

Public Member Functions

 ~PhotonVisibilityService ()
 
 PhotonVisibilityService (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
void reconfigure (fhicl::ParameterSet const &p)
 
double GetQuenchingFactor (double dQdx) const
 
float GetVisibility (double const *xyz, unsigned int OpChannel, bool wantReflected=false) const
 
float const * GetAllVisibilities (double const *xyz, bool wantReflected=false) const
 
void LoadLibrary () const
 
void StoreLibrary ()
 
void StoreLightProd (int VoxID, double N)
 
void RetrieveLightProd (int &VoxID, double &N) const
 
void SetLibraryEntry (int VoxID, int OpChannel, float N, bool wantReflected=false)
 
float GetLibraryEntry (int VoxID, int OpChannel, bool wantReflected=false) const
 
float const * GetLibraryEntries (int VoxID, bool wantReflected=false) const
 
float const * GetReflT0s (double const *xyz) const
 
void SetLibraryReflT0Entry (int VoxID, int OpChannel, float value)
 
float const * GetLibraryReflT0Entries (int VoxID) const
 
float GetLibraryReflT0Entry (int VoxID, int Channel) const
 
const std::vector< float > * GetTimingPar (double const *xyz) const
 
void SetLibraryTimingParEntry (int VoxID, int OpChannel, float value, size_t parnum)
 
const std::vector< float > * GetLibraryTimingParEntries (int VoxID) const
 
float GetLibraryTimingParEntry (int VoxID, int Channel, size_t npar) const
 
TF1 * GetTimingTF1 (double const *xyz) const
 
void SetLibraryTimingTF1Entry (int VoxID, int OpChannel, TF1 func)
 
TF1 * GetLibraryTimingTF1Entries (int VoxID) const
 
void SetDirectLightPropFunctions (TF1 const *functions[8], double &d_break, double &d_max, double &tf1_sampling_factor) const
 
void SetReflectedCOLightPropFunctions (TF1 const *functions[5], double &t0_max, double &t0_break_point) const
 
bool IsBuildJob () const
 
bool UseParameterization () const
 
bool StoreReflected () const
 
bool StoreReflT0 () const
 
bool IncludeParPropTime () const
 
size_t ParPropTimeNpar () const
 
std::string ParPropTimeFormula () const
 
bool IncludePropTime () const
 
const sim::PhotonVoxelDefGetVoxelDef () const
 
size_t NOpChannels () const
 

Static Public Member Functions

static double DistanceToOpDet (double const *xyz, unsigned int OpDet)
 
static double SolidAngleFactor (double const *xyz, unsigned int OpDet)
 

Private Member Functions

const TVector3 LibLocation (const double *xyz) const
 

Private Attributes

int fCurrentVoxel
 
double fCurrentValue
 
float fXmin
 
float fXmax
 
float fYmin
 
float fYmax
 
float fZmin
 
float fZmax
 
int fNx
 
int fNy
 
int fNz
 
bool fUseCryoBoundary
 
bool fLibraryBuildJob
 
bool fDoNotLoadLibrary
 
bool fParameterization
 
bool fHybrid
 
bool fStoreReflected
 
bool fStoreReflT0
 
bool fIncludePropTime
 
bool fParPropTime
 
size_t fParPropTime_npar
 
std::string fParPropTime_formula
 
int fParPropTime_MaxRange
 
bool fInterpolate
 
bool fReflectOverZeroX
 
TF1 * fparslogNorm = nullptr
 
TF1 * fparslogNorm_far = nullptr
 
TF1 * fparsMPV = nullptr
 
TF1 * fparsMPV_far = nullptr
 
TF1 * fparsWidth = nullptr
 
TF1 * fparsCte = nullptr
 
TF1 * fparsCte_far = nullptr
 
TF1 * fparsSlope = nullptr
 
double fD_break
 
double fD_max
 
double fTF1_sampling_factor
 
TF1 * fparslogNorm_refl = nullptr
 
TF1 * fparsMPV_refl = nullptr
 
TF1 * fparsWidth_refl = nullptr
 
TF1 * fparsCte_refl = nullptr
 
TF1 * fparsSlope_refl = nullptr
 
double fT0_max
 
double fT0_break_point
 
std::string fLibraryFile
 
IPhotonLibraryfTheLibrary
 
sim::PhotonVoxelDef fVoxelDef
 

Detailed Description

Definition at line 25 of file PhotonVisibilityService.h.

Constructor & Destructor Documentation

phot::PhotonVisibilityService::~PhotonVisibilityService ( )

Definition at line 44 of file PhotonVisibilityService_service.cc.

References fparsCte, fparsCte_far, fparsCte_refl, fparslogNorm, fparslogNorm_far, fparslogNorm_refl, fparsMPV, fparsMPV_far, fparsMPV_refl, fparsSlope, fparsSlope_refl, fparsWidth, fparsWidth_refl, and fTheLibrary.

45  {
46  delete fparslogNorm;
47  delete fparslogNorm_far;
48  delete fparsMPV;
49  delete fparsMPV_far;
50  delete fparsWidth;
51  delete fparsCte;
52  delete fparsCte_far;
53  delete fparsSlope;
54  delete fparslogNorm_refl;
55  delete fparsMPV_refl;
56  delete fparsWidth_refl;
57  delete fparsCte_refl;
58  delete fparsSlope_refl;
59  delete fTheLibrary;
60  }
phot::PhotonVisibilityService::PhotonVisibilityService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)

Definition at line 63 of file PhotonVisibilityService_service.cc.

References reconfigure().

63  :
64 
65  fCurrentVoxel(0),
66  fCurrentValue(0.),
67  fXmin(0.),
68  fXmax(0.),
69  fYmin(0.),
70  fYmax(0.),
71  fZmin(0.),
72  fZmax(0.),
73  fNx(0),
74  fNy(0),
75  fNz(0),
76  fUseCryoBoundary(false),
77  fLibraryBuildJob(false),
78  fDoNotLoadLibrary(false),
79  fParameterization(false),
80  fHybrid(false),
81  fStoreReflected(false),
82  fStoreReflT0(false),
83  fIncludePropTime(false),
84  fParPropTime(false),
88  fInterpolate(false),
89  fReflectOverZeroX(false),
90  fparslogNorm(nullptr),
91  fparslogNorm_far(nullptr),
92  fparsMPV(nullptr),
93  fparsMPV_far(nullptr),
94  fparsWidth(nullptr),
95  fparsCte(nullptr),
96  fparsCte_far(nullptr),
97  fparsSlope(nullptr),
98  fD_break(0.0),
99  fD_max(0.0),
101  fparslogNorm_refl(nullptr),
102  fparsMPV_refl(nullptr),
103  fparsWidth_refl(nullptr),
104  fparsCte_refl(nullptr),
105  fparsSlope_refl(nullptr),
106  fT0_max(0.0),
107  fT0_break_point(0.0),
108  fLibraryFile(),
109  fTheLibrary(nullptr),
110  fVoxelDef()
111  {
112  this->reconfigure(pset);
113  mf::LogInfo("PhotonVisibilityService")<<"PhotonVisbilityService initializing"<<std::endl;
114  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void reconfigure(fhicl::ParameterSet const &p)

Member Function Documentation

double phot::PhotonVisibilityService::DistanceToOpDet ( double const *  xyz,
unsigned int  OpDet 
)
static

Definition at line 373 of file PhotonVisibilityService_service.cc.

References geo::OpDetGeo::DistanceToPoint(), and geo::GeometryCore::OpDetGeoFromOpDet().

374  {
376  return geom->OpDetGeoFromOpDet(OpDet).DistanceToPoint(xyz);
377 
378  }
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Number of OpDets in the whole detector.
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
Definition: OpDetGeo.cxx:114
float const * phot::PhotonVisibilityService::GetAllVisibilities ( double const *  xyz,
bool  wantReflected = false 
) const

Definition at line 355 of file PhotonVisibilityService_service.cc.

References fInterpolate, fVoxelDef, GetLibraryEntries(), GetVisibility(), sim::PhotonVoxelDef::GetVoxelID(), LibLocation(), and NOpChannels().

Referenced by cosmic::BeamFlashTrackMatchTaggerAlg::AddLightFromSegment(), opdet::FlashHypothesisCreator::CreateFlashHypothesesFromSegment(), larg4::OpFastScintillation::RecordPhotonsProduced(), and opdet::TrackTimeAssoc::ScanMIPHypotheses().

356  {
357  if(fInterpolate){
358  static std::vector<float> ret;
359  if(ret.size() != NOpChannels()) ret.resize(NOpChannels());
360  for(unsigned int i = 0; i < NOpChannels(); ++i) ret[i] = GetVisibility(xyz, i, wantReflected);
361  return &ret.front();
362  }
363  else{
364  size_t VoxID = fVoxelDef.GetVoxelID(LibLocation(xyz));
365  return GetLibraryEntries(VoxID, wantReflected);
366  }
367  }
float const * GetLibraryEntries(int VoxID, bool wantReflected=false) const
int GetVoxelID(const TVector3 &) const
const TVector3 LibLocation(const double *xyz) const
float GetVisibility(double const *xyz, unsigned int OpChannel, bool wantReflected=false) const
float const * phot::PhotonVisibilityService::GetLibraryEntries ( int  VoxID,
bool  wantReflected = false 
) const

Definition at line 459 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::IPhotonLibrary::GetCounts(), phot::IPhotonLibrary::GetReflCounts(), and LoadLibrary().

Referenced by GetAllVisibilities().

460  {
461  if(fTheLibrary == 0)
462  LoadLibrary();
463 
464  if(!wantReflected)
465  return fTheLibrary->GetCounts(VoxID);
466  else
467  return fTheLibrary->GetReflCounts(VoxID);
468  }
virtual const float * GetReflCounts(size_t Voxel) const =0
virtual const float * GetCounts(size_t Voxel) const =0
Returns a pointer to NOpChannels() visibility values, one per channel.
float phot::PhotonVisibilityService::GetLibraryEntry ( int  VoxID,
int  OpChannel,
bool  wantReflected = false 
) const

Definition at line 472 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::IPhotonLibrary::GetCount(), phot::IPhotonLibrary::GetReflCount(), and LoadLibrary().

Referenced by GetVisibility().

473  {
474  if(fTheLibrary == 0)
475  LoadLibrary();
476 
477  if(!wantReflected)
478  return fTheLibrary->GetCount(VoxID, Channel);
479  else
480  return fTheLibrary->GetReflCount(VoxID, Channel);
481  }
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const =0
virtual float GetCount(size_t Voxel, size_t OpChannel) const =0
float const * phot::PhotonVisibilityService::GetLibraryReflT0Entries ( int  VoxID) const

Definition at line 496 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::IPhotonLibrary::GetReflT0s(), and LoadLibrary().

Referenced by GetReflT0s().

497  {
498  if(fTheLibrary == 0)
499  LoadLibrary();
500 
501  return fTheLibrary->GetReflT0s(VoxID);
502  }
virtual const float * GetReflT0s(size_t Voxel) const =0
float phot::PhotonVisibilityService::GetLibraryReflT0Entry ( int  VoxID,
int  Channel 
) const

Definition at line 519 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::IPhotonLibrary::GetReflT0(), and LoadLibrary().

520  {
521  if(fTheLibrary == 0)
522  LoadLibrary();
523 
524  return fTheLibrary->GetReflT0(VoxID, Channel);
525  }
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const =0
const std::vector< float > * phot::PhotonVisibilityService::GetLibraryTimingParEntries ( int  VoxID) const

Definition at line 547 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::PhotonLibrary::GetTimingPars(), and LoadLibrary().

Referenced by GetTimingPar().

548  {
549  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
550  if(fTheLibrary == 0)
551  LoadLibrary();
552 
553  return lib->GetTimingPars(VoxID);
554  }
float phot::PhotonVisibilityService::GetLibraryTimingParEntry ( int  VoxID,
int  Channel,
size_t  npar 
) const

Definition at line 596 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::PhotonLibrary::GetTimingPar(), and LoadLibrary().

597  {
598  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
599  if(fTheLibrary == 0)
600  LoadLibrary();
601 
602  return lib->GetTimingPar(VoxID, Channel,npar);
603  }
TF1 * phot::PhotonVisibilityService::GetLibraryTimingTF1Entries ( int  VoxID) const

Definition at line 558 of file PhotonVisibilityService_service.cc.

References fTheLibrary, phot::PhotonLibrary::GetTimingTF1s(), and LoadLibrary().

Referenced by GetTimingTF1().

559  {
560  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
561  if(fTheLibrary == 0)
562  LoadLibrary();
563 
564  return lib->GetTimingTF1s(VoxID);
565  }
double phot::PhotonVisibilityService::GetQuenchingFactor ( double  dQdx) const

Definition at line 342 of file PhotonVisibilityService_service.cc.

343  {
344  // for now, no quenching
345  return 1.0;
346 
347  }
float const * phot::PhotonVisibilityService::GetReflT0s ( double const *  xyz) const

Definition at line 488 of file PhotonVisibilityService_service.cc.

References fVoxelDef, GetLibraryReflT0Entries(), sim::PhotonVoxelDef::GetVoxelID(), and LibLocation().

Referenced by larg4::OpFastScintillation::RecordPhotonsProduced().

489  {
490  int VoxID = fVoxelDef.GetVoxelID(LibLocation(xyz));
491  return GetLibraryReflT0Entries(VoxID);
492  }
float const * GetLibraryReflT0Entries(int VoxID) const
int GetVoxelID(const TVector3 &) const
const TVector3 LibLocation(const double *xyz) const
const std::vector< float > * phot::PhotonVisibilityService::GetTimingPar ( double const *  xyz) const

Definition at line 532 of file PhotonVisibilityService_service.cc.

References fVoxelDef, GetLibraryTimingParEntries(), sim::PhotonVoxelDef::GetVoxelID(), and LibLocation().

533  {
534  int VoxID = fVoxelDef.GetVoxelID(LibLocation(xyz));
535  return GetLibraryTimingParEntries(VoxID);
536  }
const std::vector< float > * GetLibraryTimingParEntries(int VoxID) const
int GetVoxelID(const TVector3 &) const
const TVector3 LibLocation(const double *xyz) const
TF1 * phot::PhotonVisibilityService::GetTimingTF1 ( double const *  xyz) const

Definition at line 538 of file PhotonVisibilityService_service.cc.

References fVoxelDef, GetLibraryTimingTF1Entries(), sim::PhotonVoxelDef::GetVoxelID(), and LibLocation().

Referenced by larg4::OpFastScintillation::RecordPhotonsProduced().

539  {
540  int VoxID = fVoxelDef.GetVoxelID(LibLocation(xyz));
541  return GetLibraryTimingTF1Entries(VoxID);
542  }
int GetVoxelID(const TVector3 &) const
const TVector3 LibLocation(const double *xyz) const
float phot::PhotonVisibilityService::GetVisibility ( double const *  xyz,
unsigned int  OpChannel,
bool  wantReflected = false 
) const

Definition at line 393 of file PhotonVisibilityService_service.cc.

References fInterpolate, fVoxelDef, GetLibraryEntry(), sim::PhotonVoxelDef::GetNeighboringVoxelIDs(), sim::PhotonVoxelDef::GetVoxelID(), LibLocation(), and n.

Referenced by phot::CreateHybridLibrary::CreateHybridLibrary(), and GetAllVisibilities().

394  {
395  // Static to avoid reallocating this buffer between calls
396  // (GetNeighbouringVoxelIDs makes sure to clear it).
397  static std::vector<sim::PhotonVoxelDef::NeiInfo> neis;
398 
399  if(fInterpolate){
400  // In case we're outside the bounding box we'll get an empty vector here
401  // and return visibility 0, which seems OK.
403  }
404  else{
405  // For no interpolation, use a single entry with weight 1
406  neis.clear();
407  neis.emplace_back(fVoxelDef.GetVoxelID(LibLocation(xyz)), 1);
408  }
409 
410  // Sum up all the weighted neighbours to get interpolation behaviour
411  float vis = 0;
412  for(const sim::PhotonVoxelDef::NeiInfo& n: neis){
413  vis += n.weight * GetLibraryEntry(n.id, OpChannel, wantReflected);
414  }
415  return vis;
416  }
void GetNeighboringVoxelIDs(const TVector3 &v, std::vector< NeiInfo > &ret) const
int GetVoxelID(const TVector3 &) const
Char_t n[5]
const TVector3 LibLocation(const double *xyz) const
float GetLibraryEntry(int VoxID, int OpChannel, bool wantReflected=false) const
const sim::PhotonVoxelDef& phot::PhotonVisibilityService::GetVoxelDef ( ) const
inline
bool phot::PhotonVisibilityService::IncludeParPropTime ( ) const
inline
bool phot::PhotonVisibilityService::IncludePropTime ( ) const
inline
bool phot::PhotonVisibilityService::IsBuildJob ( ) const
inline
const TVector3 phot::PhotonVisibilityService::LibLocation ( const double *  xyz) const
private

Definition at line 651 of file PhotonVisibilityService_service.cc.

References DEFINE_ART_SERVICE, and fReflectOverZeroX.

Referenced by GetAllVisibilities(), GetReflT0s(), GetTimingPar(), GetTimingTF1(), GetVisibility(), and GetVoxelDef().

652  {
653  TVector3 location(xyz);
654 
655  // Always use postive X coordinate if set
656  if (fReflectOverZeroX && location.x() < 0) {
657  location.SetX( fabs(location.x() ) );
658  }
659  return location;
660  }
void phot::PhotonVisibilityService::LoadLibrary ( ) const

Definition at line 117 of file PhotonVisibilityService_service.cc.

References phot::PhotonLibrary::CreateEmptyLibrary(), fDoNotLoadLibrary, fHybrid, fLibraryBuildJob, fLibraryFile, fParameterization, fParPropTime_MaxRange, fParPropTime_npar, fStoreReflected, fStoreReflT0, fTheLibrary, sim::PhotonVoxelDef::GetNVoxels(), GetVoxelDef(), phot::PhotonLibrary::LoadLibraryFromFile(), and geo::GeometryCore::NOpDets().

Referenced by GetLibraryEntries(), GetLibraryEntry(), GetLibraryReflT0Entries(), GetLibraryReflT0Entry(), GetLibraryTimingParEntries(), GetLibraryTimingParEntry(), GetLibraryTimingTF1Entries(), NOpChannels(), SetLibraryEntry(), SetLibraryReflT0Entry(), SetLibraryTimingParEntry(), SetLibraryTimingTF1Entry(), and StoreLibrary().

118  {
119  // Don't do anything if the library has already been loaded.
120 
121  if(fTheLibrary == 0) {
122 
124  std::string LibraryFileWithPath;
125  cet::search_path sp("FW_SEARCH_PATH");
126 
127  if( !sp.find_file(fLibraryFile, LibraryFileWithPath) )
128  throw cet::exception("PhotonVisibilityService") << "Unable to find photon library in " << sp.to_string() << "\n";
129 
130  if(!fParameterization) {
132 
133  mf::LogInfo("PhotonVisibilityService") << "PhotonVisibilityService Loading photon library from file "
134  << LibraryFileWithPath
135  << " for "
136  << GetVoxelDef().GetNVoxels()
137  << " voxels and "
138  << geom->NOpDets()
139  << " optical detectors."
140  << std::endl;
141 
142  if(fHybrid){
143  fTheLibrary = new PhotonLibraryHybrid(LibraryFileWithPath,
144  GetVoxelDef());
145  }
146  else{
147  PhotonLibrary* lib = new PhotonLibrary;
148  fTheLibrary = lib;
149 
150  size_t NVoxels = GetVoxelDef().GetNVoxels();
151  lib->LoadLibraryFromFile(LibraryFileWithPath, NVoxels, fStoreReflected, fStoreReflT0, fParPropTime_npar, fParPropTime_MaxRange);
152  }
153  }
154  }
155  else {
157 
158  size_t NOpDets = geom->NOpDets();
159  size_t NVoxels = GetVoxelDef().GetNVoxels();
160  mf::LogInfo("PhotonVisibilityService") << " Vis service running library build job. Please ensure "
161  << " job contains LightSource, LArG4, SimPhotonCounter"<<std::endl;
162  PhotonLibrary* lib = new PhotonLibrary;
163  fTheLibrary = lib;
164 
165  lib->CreateEmptyLibrary(NVoxels, NOpDets, fStoreReflected, fStoreReflT0, fParPropTime_npar);
166  }
167 
168  }
169  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int GetNVoxels() const
unsigned int NOpDets() const
Number of OpDets in the whole detector.
const sim::PhotonVoxelDef & GetVoxelDef() const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::string phot::PhotonVisibilityService::ParPropTimeFormula ( ) const
inline

Definition at line 75 of file PhotonVisibilityService.h.

References fParPropTime_formula.

size_t phot::PhotonVisibilityService::ParPropTimeNpar ( ) const
inline

Definition at line 74 of file PhotonVisibilityService.h.

References fParPropTime_npar.

void phot::PhotonVisibilityService::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 192 of file PhotonVisibilityService_service.cc.

References geo::GeometryCore::CryostatBoundaries(), fD_break, fD_max, fDoNotLoadLibrary, fHybrid, fIncludePropTime, fInterpolate, fLibraryBuildJob, fLibraryFile, fNx, fNy, fNz, fParameterization, fParPropTime, fParPropTime_formula, fParPropTime_MaxRange, fParPropTime_npar, fparsCte, fparsCte_far, fparsCte_refl, fparslogNorm, fparslogNorm_far, fparslogNorm_refl, fparsMPV, fparsMPV_far, fparsMPV_refl, fparsSlope, fparsSlope_refl, fparsWidth, fparsWidth_refl, fReflectOverZeroX, fStoreReflected, fStoreReflT0, fT0_break_point, fT0_max, fTF1_sampling_factor, fUseCryoBoundary, fVoxelDef, fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, and fhicl::ParameterSet::get().

Referenced by PhotonVisibilityService().

193  {
194 
196 
197  // Library details
198  fLibraryBuildJob = p.get< bool >("LibraryBuildJob" );
199  fParameterization = p.get< bool >("DUNE10ktParameterization", false);
200  fHybrid = p.get< bool >("HybridLibrary", false);
201  fLibraryFile = p.get< std::string >("LibraryFile" );
202  fDoNotLoadLibrary = p.get< bool >("DoNotLoadLibrary" );
203  fStoreReflected = p.get< bool >("StoreReflected", false);
204  fStoreReflT0 = p.get< bool >("StoreReflT0", false);
205  fIncludePropTime = p.get< bool >("IncludePropTime", false);
206  // Voxel parameters
207  fUseCryoBoundary = p.get< bool >("UseCryoBoundary" );
208  fInterpolate = p.get< bool >("Interpolate", false);
209  fReflectOverZeroX = p.get< bool >("ReflectOverZeroX", false);
210 
211  fParPropTime = p.get< bool >("ParametrisedTimePropagation", false);
212  fParPropTime_npar = p.get< size_t >("ParametrisedTimePropagationNParameters", 0);
213  fParPropTime_formula = p.get< std::string >("ParametrisedTimePropagationFittedFormula","");
214  fParPropTime_MaxRange = p.get< int >("ParametrisedTimePropagationMaxRange", 200);
215 
216  if (!fParPropTime)
217  {
218  fParPropTime_npar=0;
219  }
220 
221  if(fUseCryoBoundary)
222  {
223  double CryoBounds[6];
224  geom->CryostatBoundaries(CryoBounds);
225  fXmin = CryoBounds[0];
226  fXmax = CryoBounds[1];
227  fYmin = CryoBounds[2];
228  fYmax = CryoBounds[3];
229  fZmin = CryoBounds[4];
230  fZmax = CryoBounds[5];
231  }
232  else
233  {
234  fXmin = p.get< double >("XMin" );
235  fXmax = p.get< double >("XMax" );
236  fYmin = p.get< double >("YMin" );
237  fYmax = p.get< double >("YMax" );
238  fZmin = p.get< double >("ZMin" );
239  fZmax = p.get< double >("ZMax" );
240  }
241 
242  fNx = p.get< int >("NX" );
243  fNy = p.get< int >("NY" );
244  fNz = p.get< int >("NZ" );
245 
247 
248  if(fIncludePropTime)
249  {
250  // Construct parameterized model parameter functions.
251  std::cout<< "Getting direct light parameters from .fcl file"<<std::endl;
252  std::vector<std::string> direct_functions = p.get<std::vector<std::string> >("Direct_functions");
253  //range of distances where the parametrization is valid
254  fD_break = p.get<double>("D_break");
255  fD_max = p.get<double>("D_max");
256 
257  fTF1_sampling_factor = p.get<double>("TF1_sampling_factor");
258 
259  std::vector<double> direct_landauNormpars = p.get<std::vector<double> >("Direct_landauNormpars");
260  fparslogNorm = new TF1("fparslogNorm", direct_functions[0].c_str(), 0., fD_break);
261  for(unsigned int i=0; i<direct_landauNormpars.size(); ++i)
262  fparslogNorm->SetParameter(i, direct_landauNormpars[i]);
263 
264  std::vector<double> direct_landauMPVpars = p.get<std::vector<double> >("Direct_landauMPVpars");
265  fparsMPV = new TF1("fparsMPV", direct_functions[1].c_str(), 0., fD_break);
266  for(unsigned int i=0; i<direct_landauMPVpars.size(); ++i)
267  fparsMPV->SetParameter(i, direct_landauMPVpars[i]);
268 
269  std::vector<double> direct_landauWidthpars = p.get<std::vector<double> >("Direct_landauWidthpars");
270  fparsWidth = new TF1("fparsWidth", direct_functions[2].c_str(), 0., fD_break);
271  for(unsigned int i=0; i<direct_landauWidthpars.size(); ++i)
272  fparsWidth->SetParameter(i, direct_landauWidthpars[i]);
273 
274  std::vector<double> direct_expoCtepars = p.get<std::vector<double> >("Direct_expoCtepars");
275  fparsCte = new TF1("fparsCte", direct_functions[3].c_str(), 0., fD_break);
276  for(unsigned int i=0; i<direct_expoCtepars.size(); ++i)
277  fparsCte->SetParameter(i, direct_expoCtepars[i]);
278 
279  std::vector<double> direct_expoSlopepars = p.get<std::vector<double> >("Direct_expoSlopepars");
280  fparsSlope = new TF1("fparsSlope", direct_functions[4].c_str(), 0., fD_break);
281  for(unsigned int i=0; i<direct_expoSlopepars.size(); ++i)
282  fparsSlope->SetParameter(i, direct_expoSlopepars[i]);
283 
284  std::vector<double> direct_landauNormpars_far = p.get<std::vector<double> >("Direct_landauNormpars_far");
285  fparslogNorm_far = new TF1("fparslogNorm_far", direct_functions[5].c_str(), fD_break, fD_max);
286  for(unsigned int i=0; i<direct_landauNormpars_far.size(); ++i)
287  fparslogNorm_far->SetParameter(i, direct_landauNormpars_far[i]);
288 
289  std::vector<double> direct_landauMPVpars_far = p.get<std::vector<double> >("Direct_landauMPVpars_far");
290  fparsMPV_far = new TF1("fparsMPV_far", direct_functions[6].c_str(), fD_break, fD_max);
291  for(unsigned int i=0; i<direct_landauMPVpars_far.size(); ++i)
292  fparsMPV_far->SetParameter(i, direct_landauMPVpars_far[i]);
293 
294  std::vector<double> direct_expoCtepars_far = p.get<std::vector<double> >("Direct_expoCtepars_far");
295  fparsCte_far = new TF1("fparsCte_far", direct_functions[7].c_str(), fD_break - 50., fD_max);
296  for(unsigned int i=0; i<direct_expoCtepars_far.size(); ++i)
297  fparsCte_far->SetParameter(i, direct_expoCtepars_far[i]);
298 
299  std::vector<std::string> reflected_functions = p.get<std::vector<std::string> >("Reflected_functions");
300  //times where the parametrizations are valid or change
301  fT0_max = p.get<double>("T0_max");
302  fT0_break_point = p.get<double>("T0_break_point");
303 
304  std::vector<double> reflected_landauNormpars = p.get<std::vector<double> >("Reflected_landauNormpars");
305  fparslogNorm_refl = new TF1("fparslogNorm_refl", reflected_functions[0].c_str(), 0., fT0_max);
306  for(unsigned int i=0; i<reflected_landauNormpars.size(); ++i)
307  fparslogNorm_refl->SetParameter(i, reflected_landauNormpars[i]);
308 
309  std::vector<double> reflected_landauMPVpars = p.get<std::vector<double> >("Reflected_landauMPVpars");
310  fparsMPV_refl = new TF1("fparsMPV_refl", reflected_functions[1].c_str(), 0., fT0_max);
311  for(unsigned int i=0; i<reflected_landauMPVpars.size(); ++i)
312  fparsMPV_refl->SetParameter(i, reflected_landauMPVpars[i]);
313 
314  std::vector<double> reflected_landauWidthpars = p.get<std::vector<double> >("Reflected_landauWidthpars");
315  fparsWidth_refl = new TF1("fparsWidth_refl", reflected_functions[2].c_str(), 0., fT0_max);
316  for(unsigned int i=0; i<reflected_landauWidthpars.size(); ++i)
317  fparsWidth_refl->SetParameter(i, reflected_landauWidthpars[i]);
318 
319  std::vector<double> reflected_expoCtepars = p.get<std::vector<double> >("Reflected_expoCtepars");
320  fparsCte_refl = new TF1("fparsCte_refl", reflected_functions[3].c_str(), 0., fT0_max);
321  for(unsigned int i=0; i<reflected_expoCtepars.size(); ++i)
322  fparsCte_refl->SetParameter(i, reflected_expoCtepars[i]);
323 
324  std::vector<double> reflected_expoSlopepars = p.get<std::vector<double> >("Reflected_expoSlopepars");
325  fparsSlope_refl = new TF1("fparsSlope_refl", reflected_functions[4].c_str(), 0., fT0_max);
326  for(unsigned int i=0; i<reflected_expoSlopepars.size(); ++i)
327  fparsSlope_refl->SetParameter(i, reflected_expoSlopepars[i]);
328 
329 
330  }
331 
332 
333  return;
334 
335  }
void CryostatBoundaries(double *boundaries, geo::CryostatID const &cid) const
Returns the boundaries of the specified cryostat.
void phot::PhotonVisibilityService::RetrieveLightProd ( int &  VoxID,
double &  N 
) const
void phot::PhotonVisibilityService::SetDirectLightPropFunctions ( TF1 const *  functions[8],
double &  d_break,
double &  d_max,
double &  tf1_sampling_factor 
) const

Definition at line 616 of file PhotonVisibilityService_service.cc.

References fD_break, fD_max, fparsCte, fparsCte_far, fparslogNorm, fparslogNorm_far, fparsMPV, fparsMPV_far, fparsSlope, fparsWidth, and fTF1_sampling_factor.

Referenced by larg4::OpFastScintillation::OpFastScintillation().

617  {
618  functions[0] = fparslogNorm;
619  functions[1] = fparsMPV;
620  functions[2] = fparsWidth;
621  functions[3] = fparsCte;
622  functions[4] = fparsSlope;
623  functions[5] = fparslogNorm_far;
624  functions[6] = fparsMPV_far;
625  functions[7] = fparsCte_far;
626 
627  d_break = fD_break;
628  d_max = fD_max;
629  tf1_sampling_factor = fTF1_sampling_factor;
630  }
void phot::PhotonVisibilityService::SetLibraryEntry ( int  VoxID,
int  OpChannel,
float  N,
bool  wantReflected = false 
)

Definition at line 440 of file PhotonVisibilityService_service.cc.

References fTheLibrary, LoadLibrary(), LOG_DEBUG, phot::PhotonLibrary::SetCount(), and phot::PhotonLibrary::SetReflCount().

Referenced by opdet::SimPhotonCounter::analyze().

441  {
442  if(fTheLibrary == 0)
443  LoadLibrary();
444 
445  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
446 
447  if(!wantReflected)
448  lib->SetCount(VoxID,OpChannel, N);
449 
450  else
451  lib->SetReflCount(VoxID,OpChannel, N);
452 
453  //std::cout<< " PVS logging " << VoxID << " " << OpChannel<<std::endl;
454  LOG_DEBUG("PhotonVisibilityService") << " PVS logging " << VoxID << " " << OpChannel<<std::endl;
455  }
#define LOG_DEBUG(id)
void phot::PhotonVisibilityService::SetLibraryReflT0Entry ( int  VoxID,
int  OpChannel,
float  value 
)

Definition at line 506 of file PhotonVisibilityService_service.cc.

References fTheLibrary, LoadLibrary(), LOG_DEBUG, and phot::PhotonLibrary::SetReflT0().

Referenced by opdet::SimPhotonCounter::analyze().

507  {
508  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
509  if(fTheLibrary == 0)
510  LoadLibrary();
511 
512  lib->SetReflT0(VoxID,OpChannel,T0);
513 
514  LOG_DEBUG("PhotonVisibilityService") << " PVS logging " << VoxID << " " << OpChannel<<std::endl;
515  }
#define LOG_DEBUG(id)
void phot::PhotonVisibilityService::SetLibraryTimingParEntry ( int  VoxID,
int  OpChannel,
float  value,
size_t  parnum 
)

Definition at line 569 of file PhotonVisibilityService_service.cc.

References fTheLibrary, LoadLibrary(), LOG_DEBUG, and phot::PhotonLibrary::SetTimingPar().

570  {
571  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
572  if(fTheLibrary == 0)
573  LoadLibrary();
574 
575  lib->SetTimingPar(VoxID,OpChannel,par, parnum);
576 
577  LOG_DEBUG("PhotonVisibilityService") << " PVS logging " << VoxID << " " << OpChannel<<std::endl;
578  }
#define LOG_DEBUG(id)
void phot::PhotonVisibilityService::SetLibraryTimingTF1Entry ( int  VoxID,
int  OpChannel,
TF1  func 
)

Definition at line 582 of file PhotonVisibilityService_service.cc.

References fTheLibrary, LoadLibrary(), LOG_DEBUG, and phot::PhotonLibrary::SetTimingTF1().

583  {
584  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
585  if(fTheLibrary == 0)
586  LoadLibrary();
587 
588  lib->SetTimingTF1(VoxID,OpChannel,func);
589 
590  LOG_DEBUG("PhotonVisibilityService") << " PVS logging " << VoxID << " " << OpChannel<<std::endl;
591  }
#define LOG_DEBUG(id)
void phot::PhotonVisibilityService::SetReflectedCOLightPropFunctions ( TF1 const *  functions[5],
double &  t0_max,
double &  t0_break_point 
) const
double phot::PhotonVisibilityService::SolidAngleFactor ( double const *  xyz,
unsigned int  OpDet 
)
static

Definition at line 385 of file PhotonVisibilityService_service.cc.

References geo::OpDetGeo::CosThetaFromNormal(), and geo::GeometryCore::OpDetGeoFromOpDet().

386  {
388  return geom->OpDetGeoFromOpDet(OpDet).CosThetaFromNormal(xyz);
389  }
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Number of OpDets in the whole detector.
double CosThetaFromNormal(geo::Point_t const &point) const
Get cos(angle) to normal of this detector - used for solid angle calcs.
Definition: OpDetGeo.cxx:121
void phot::PhotonVisibilityService::StoreLibrary ( )

Definition at line 172 of file PhotonVisibilityService_service.cc.

References fHybrid, fLibraryBuildJob, fLibraryFile, fParPropTime_npar, fStoreReflected, fStoreReflT0, fTheLibrary, LoadLibrary(), and phot::PhotonLibrary::StoreLibraryToFile().

Referenced by opdet::SimPhotonCounter::endJob().

173  {
174  if(fTheLibrary == 0)
175  LoadLibrary();
176 
177  if(fLibraryBuildJob )
178  {
179 
180  if(fHybrid){
181  std::cout<< "This is would be building a Hybrid Library. Not defined. "<<std::endl;
182  }
183  mf::LogInfo("PhotonVisibilityService") << " Vis service "
184  << " Storing Library entries to file..." <<std::endl;
185  PhotonLibrary* lib = dynamic_cast<PhotonLibrary*>(fTheLibrary);
186  lib->StoreLibraryToFile(fLibraryFile, fStoreReflected, fStoreReflT0, fParPropTime_npar);
187  }
188  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void phot::PhotonVisibilityService::StoreLightProd ( int  VoxID,
double  N 
)

Definition at line 421 of file PhotonVisibilityService_service.cc.

References fCurrentValue, and fCurrentVoxel.

Referenced by evgen::LightSource::produce().

422  {
423  fCurrentVoxel = VoxID;
424  fCurrentValue = N;
425  mf::LogInfo("PhotonVisibilityService") << " PVS notes production of " << N << " photons at Vox " << VoxID<<std::endl;
426  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
bool phot::PhotonVisibilityService::StoreReflected ( ) const
inline
bool phot::PhotonVisibilityService::StoreReflT0 ( ) const
inline
bool phot::PhotonVisibilityService::UseParameterization ( ) const
inline

Definition at line 70 of file PhotonVisibilityService.h.

References fParameterization.

Member Data Documentation

double phot::PhotonVisibilityService::fCurrentValue
private

Definition at line 87 of file PhotonVisibilityService.h.

Referenced by RetrieveLightProd(), and StoreLightProd().

int phot::PhotonVisibilityService::fCurrentVoxel
private

Definition at line 86 of file PhotonVisibilityService.h.

Referenced by RetrieveLightProd(), and StoreLightProd().

double phot::PhotonVisibilityService::fD_break
private

Definition at line 121 of file PhotonVisibilityService.h.

Referenced by reconfigure(), and SetDirectLightPropFunctions().

double phot::PhotonVisibilityService::fD_max
private

Definition at line 121 of file PhotonVisibilityService.h.

Referenced by reconfigure(), and SetDirectLightPropFunctions().

bool phot::PhotonVisibilityService::fDoNotLoadLibrary
private

Definition at line 99 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), and reconfigure().

bool phot::PhotonVisibilityService::fHybrid
private

Definition at line 101 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), reconfigure(), and StoreLibrary().

bool phot::PhotonVisibilityService::fIncludePropTime
private

Definition at line 104 of file PhotonVisibilityService.h.

Referenced by IncludePropTime(), and reconfigure().

bool phot::PhotonVisibilityService::fInterpolate
private

Definition at line 110 of file PhotonVisibilityService.h.

Referenced by GetAllVisibilities(), GetVisibility(), and reconfigure().

bool phot::PhotonVisibilityService::fLibraryBuildJob
private

Definition at line 98 of file PhotonVisibilityService.h.

Referenced by IsBuildJob(), LoadLibrary(), reconfigure(), and StoreLibrary().

std::string phot::PhotonVisibilityService::fLibraryFile
private

Definition at line 129 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), reconfigure(), and StoreLibrary().

int phot::PhotonVisibilityService::fNx
private

Definition at line 94 of file PhotonVisibilityService.h.

Referenced by reconfigure().

int phot::PhotonVisibilityService::fNy
private

Definition at line 94 of file PhotonVisibilityService.h.

Referenced by reconfigure().

int phot::PhotonVisibilityService::fNz
private

Definition at line 94 of file PhotonVisibilityService.h.

Referenced by reconfigure().

bool phot::PhotonVisibilityService::fParameterization
private

Definition at line 100 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), reconfigure(), and UseParameterization().

bool phot::PhotonVisibilityService::fParPropTime
private

Definition at line 106 of file PhotonVisibilityService.h.

Referenced by IncludeParPropTime(), and reconfigure().

std::string phot::PhotonVisibilityService::fParPropTime_formula
private

Definition at line 108 of file PhotonVisibilityService.h.

Referenced by ParPropTimeFormula(), and reconfigure().

int phot::PhotonVisibilityService::fParPropTime_MaxRange
private

Definition at line 109 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), and reconfigure().

size_t phot::PhotonVisibilityService::fParPropTime_npar
private

Definition at line 107 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), ParPropTimeNpar(), reconfigure(), and StoreLibrary().

TF1* phot::PhotonVisibilityService::fparsCte = nullptr
private
TF1* phot::PhotonVisibilityService::fparsCte_far = nullptr
private
TF1* phot::PhotonVisibilityService::fparsCte_refl = nullptr
private
TF1* phot::PhotonVisibilityService::fparslogNorm = nullptr
private
TF1* phot::PhotonVisibilityService::fparslogNorm_far = nullptr
private
TF1* phot::PhotonVisibilityService::fparslogNorm_refl = nullptr
private
TF1* phot::PhotonVisibilityService::fparsMPV = nullptr
private
TF1* phot::PhotonVisibilityService::fparsMPV_far = nullptr
private
TF1* phot::PhotonVisibilityService::fparsMPV_refl = nullptr
private
TF1* phot::PhotonVisibilityService::fparsSlope = nullptr
private
TF1* phot::PhotonVisibilityService::fparsSlope_refl = nullptr
private
TF1* phot::PhotonVisibilityService::fparsWidth = nullptr
private
TF1* phot::PhotonVisibilityService::fparsWidth_refl = nullptr
private
bool phot::PhotonVisibilityService::fReflectOverZeroX
private

Definition at line 111 of file PhotonVisibilityService.h.

Referenced by LibLocation(), and reconfigure().

bool phot::PhotonVisibilityService::fStoreReflected
private

Definition at line 102 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), reconfigure(), StoreLibrary(), and StoreReflected().

bool phot::PhotonVisibilityService::fStoreReflT0
private

Definition at line 103 of file PhotonVisibilityService.h.

Referenced by LoadLibrary(), reconfigure(), StoreLibrary(), and StoreReflT0().

double phot::PhotonVisibilityService::fT0_break_point
private

Definition at line 127 of file PhotonVisibilityService.h.

Referenced by reconfigure(), and SetReflectedCOLightPropFunctions().

double phot::PhotonVisibilityService::fT0_max
private

Definition at line 127 of file PhotonVisibilityService.h.

Referenced by reconfigure(), and SetReflectedCOLightPropFunctions().

double phot::PhotonVisibilityService::fTF1_sampling_factor
private

Definition at line 121 of file PhotonVisibilityService.h.

Referenced by reconfigure(), and SetDirectLightPropFunctions().

bool phot::PhotonVisibilityService::fUseCryoBoundary
private

Definition at line 96 of file PhotonVisibilityService.h.

Referenced by reconfigure().

sim::PhotonVoxelDef phot::PhotonVisibilityService::fVoxelDef
private
float phot::PhotonVisibilityService::fXmax
private

Definition at line 91 of file PhotonVisibilityService.h.

Referenced by reconfigure().

float phot::PhotonVisibilityService::fXmin
private

Definition at line 91 of file PhotonVisibilityService.h.

Referenced by reconfigure().

float phot::PhotonVisibilityService::fYmax
private

Definition at line 92 of file PhotonVisibilityService.h.

Referenced by reconfigure().

float phot::PhotonVisibilityService::fYmin
private

Definition at line 92 of file PhotonVisibilityService.h.

Referenced by reconfigure().

float phot::PhotonVisibilityService::fZmax
private

Definition at line 93 of file PhotonVisibilityService.h.

Referenced by reconfigure().

float phot::PhotonVisibilityService::fZmin
private

Definition at line 93 of file PhotonVisibilityService.h.

Referenced by reconfigure().


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