LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "PhotonLibrary.h"
Public Types | |
using | Counts_t = const float * |
Type for visibility count per optical channel. More... | |
using | T0s_t = const float * |
Type for time of arrival per optical channel. More... | |
using | Params_t = std::vector< float > const * |
using | Functions_t = TF1 * |
Public Member Functions | |
PhotonLibrary (art::TFileDirectory *pDir=nullptr) | |
If no valid pDir is provided, storage features will not be supported. More... | |
TTree * | ProduceTTree () const |
virtual float | GetCount (size_t Voxel, size_t OpChannel) const override |
void | SetCount (size_t Voxel, size_t OpChannel, float Count) |
float | GetTimingPar (size_t Voxel, size_t OpChannel, size_t parnum) const |
void | SetTimingPar (size_t Voxel, size_t OpChannel, float Count, size_t parnum) |
void | SetTimingTF1 (size_t Voxel, size_t OpChannel, TF1 func) |
virtual float | GetReflCount (size_t Voxel, size_t OpChannel) const override |
void | SetReflCount (size_t Voxel, size_t OpChannel, float Count) |
virtual float | GetReflT0 (size_t Voxel, size_t OpChannel) const override |
void | SetReflT0 (size_t Voxel, size_t OpChannel, float reflT0) |
virtual float const * | GetCounts (size_t Voxel) const override |
Returns a pointer to NOpChannels() visibility values, one per channel. More... | |
const std::vector< float > * | GetTimingPars (size_t Voxel) const |
TF1 * | GetTimingTF1s (size_t Voxel) const |
virtual float const * | GetReflCounts (size_t Voxel) const override |
virtual float const * | GetReflT0s (size_t Voxel) const override |
bool | hasTiming () const |
Returns whether the current library deals with time propagation distributions. More... | |
virtual bool | hasReflected () const override |
Returns whether the current library deals with reflected light count. More... | |
virtual bool | hasReflectedT0 () const override |
Returns whether the current library deals with reflected light timing. More... | |
void | StoreLibraryToFile (std::string LibraryFile, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) const |
void | LoadLibraryFromFile (std::string LibraryFile, size_t NVoxels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0, int maxrange=200) |
void | CreateEmptyLibrary (size_t NVoxels, size_t NChannels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) |
size_t | LibrarySize () const |
Returns the number of elements in the library. More... | |
Metadata: voxel information | |
bool | hasVoxelDef () const |
Returns whether voxel metadata is available. More... | |
sim::PhotonVoxelDef const & | GetVoxelDef () const |
void | SetVoxelDef (sim::PhotonVoxelDef const &voxelDef) |
Private Member Functions | |
virtual int | NOpChannels () const override |
virtual int | NVoxels () const override |
virtual bool | isVoxelValid (size_t Voxel) const override |
bool | isVoxelValidImpl (size_t Voxel) const |
size_t | uncheckedIndex (size_t Voxel, size_t OpChannel) const |
Returns the index of visibility of specified voxel and cell. More... | |
float | uncheckedAccess (size_t Voxel, size_t OpChannel) const |
Unchecked access to a visibility datum. More... | |
float & | uncheckedAccess (size_t Voxel, size_t OpChannel) |
Unchecked access to a visibility datum. More... | |
float | uncheckedAccessRefl (size_t Voxel, size_t OpChannel) const |
Unchecked access to a reflected visibility datum. More... | |
float & | uncheckedAccessRefl (size_t Voxel, size_t OpChannel) |
Unchecked access to a reflected visibility datum. More... | |
float | uncheckedAccessReflT (size_t Voxel, size_t OpChannel) const |
Unchecked access to a reflected T0 visibility datum. More... | |
float & | uncheckedAccessReflT (size_t Voxel, size_t OpChannel) |
Unchecked access to a reflected T0 visibility datum. More... | |
float | uncheckedAccessTimingPar (size_t Voxel, size_t OpChannel, size_t parnum) const |
Unchecked access to a parameter the time distribution. More... | |
float & | uncheckedAccessTimingPar (size_t Voxel, size_t OpChannel, size_t parnum) |
Unchecked access to a parameter of the time distribution. More... | |
TF1 & | uncheckedAccessTimingTF1 (size_t Voxel, size_t OpChannel) |
Unchecked access to a parameter of the time distribution. More... | |
const TF1 & | uncheckedAccessTimingTF1 (size_t Voxel, size_t OpChannel) const |
Unchecked access to a parameter of the time distribution. More... | |
void | LoadMetadata (TDirectory &srcDir) |
Reads the metadata from specified ROOT directory and sets it as current. More... | |
void | StoreMetadata () const |
Writes the current metadata (if any) into the ROOT output file. More... | |
Static Private Member Functions | |
static size_t | ExtractNOpChannels (TTree *tree) |
Returns the number of optical channels in the specified tree. More... | |
static int | size_t2int (size_t val) |
Converts size_t into integer. More... | |
Private Attributes | |
bool | fHasReflected = false |
Whether the current library deals with reflected light counts. More... | |
bool | fHasReflectedT0 |
Whether the current library deals with reflected light timing. More... | |
size_t | fHasTiming |
Whether the current library deals with time propagation distribution. More... | |
util::LazyVector< float > | fLookupTable |
util::LazyVector< float > | fReflLookupTable |
util::LazyVector< float > | fReflTLookupTable |
util::LazyVector< std::vector< float > > | fTimingParLookupTable |
util::LazyVector< TF1 > | fTimingParTF1LookupTable |
std::string | fTimingParFormula |
size_t | fTimingParNParameters |
size_t | fNOpChannels |
size_t | fNVoxels |
std::optional< sim::PhotonVoxelDef > | fVoxelDef |
Voxel definition loaded from library metadata. More... | |
art::TFileDirectory * | fDir = nullptr |
ROOT directory where to write data. More... | |
Static Private Attributes | |
static std::string const | OpChannelBranchName = "OpChannel" |
Name of the optical channel number in the input tree. More... | |
Definition at line 25 of file PhotonLibrary.h.
|
inherited |
Type for visibility count per optical channel.
Definition at line 17 of file IPhotonLibrary.h.
|
inherited |
Type for parametrization function (which is not part of this interface yet).
Definition at line 28 of file IPhotonLibrary.h.
|
inherited |
Type for function parameters (which is not part of this interface yet).
Definition at line 24 of file IPhotonLibrary.h.
|
inherited |
Type for time of arrival per optical channel.
Definition at line 20 of file IPhotonLibrary.h.
phot::PhotonLibrary::PhotonLibrary | ( | art::TFileDirectory * | pDir = nullptr | ) |
If no valid pDir
is provided, storage features will not be supported.
Definition at line 45 of file PhotonLibrary.cxx.
void phot::PhotonLibrary::CreateEmptyLibrary | ( | size_t | NVoxels, |
size_t | NChannels, | ||
bool | storeReflected = false , |
||
bool | storeReflT0 = false , |
||
size_t | storeTiming = 0 |
||
) |
Definition at line 131 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::clear(), fHasReflected, fHasReflectedT0, fHasTiming, fLookupTable, fNOpChannels, fNVoxels, fReflLookupTable, fReflTLookupTable, fTimingParLookupTable, fTimingParTF1LookupTable, phot::IPhotonLibrary::LibrarySize(), NOpChannels(), NVoxels(), and util::LazyVector< T, A >::resize().
|
staticprivate |
Returns the number of optical channels in the specified tree.
Definition at line 557 of file PhotonLibrary.cxx.
References MF_LOG_DEBUG, art::errors::NotFound, and OpChannelBranchName.
Referenced by LoadLibraryFromFile().
|
overridevirtual |
Implements phot::IPhotonLibrary.
Definition at line 305 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccess().
|
overridevirtual |
Returns a pointer to NOpChannels() visibility values, one per channel.
Implements phot::IPhotonLibrary.
Definition at line 392 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::data_address(), fLookupTable, fNVoxels, and uncheckedIndex().
|
overridevirtual |
Implements phot::IPhotonLibrary.
Definition at line 322 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessRefl().
|
overridevirtual |
Implements phot::IPhotonLibrary.
Definition at line 440 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::data_address(), fNVoxels, fReflLookupTable, and uncheckedIndex().
|
overridevirtual |
Implements phot::IPhotonLibrary.
Definition at line 331 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessReflT().
|
overridevirtual |
Implements phot::IPhotonLibrary.
Definition at line 450 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::data_address(), fNVoxels, fReflTLookupTable, and uncheckedIndex().
float phot::PhotonLibrary::GetTimingPar | ( | size_t | Voxel, |
size_t | OpChannel, | ||
size_t | parnum | ||
) | const |
Definition at line 314 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessTimingPar().
Referenced by phot::PhotonVisibilityService::GetLibraryTimingParEntry().
const std::vector< float > * phot::PhotonLibrary::GetTimingPars | ( | size_t | Voxel | ) | const |
Definition at line 402 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::data_address(), fNVoxels, fTimingParLookupTable, and uncheckedIndex().
Referenced by phot::PhotonVisibilityService::GetLibraryTimingParEntries().
TF1 * phot::PhotonLibrary::GetTimingTF1s | ( | size_t | Voxel | ) | const |
Definition at line 412 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::data_address(), fNVoxels, fTimingParTF1LookupTable, and uncheckedIndex().
Referenced by phot::PhotonVisibilityService::GetLibraryTimingTF1Entries().
|
inline |
Returns the current voxel metadata (undefined behaviour if none).
hasVoxelDef()
Definition at line 89 of file PhotonLibrary.h.
Referenced by phot::PhotonVisibilityService::LoadLibrary(), LoadLibraryFromFile(), and StoreMetadata().
|
inlineoverridevirtual |
Returns whether the current library deals with reflected light count.
Implements phot::IPhotonLibrary.
Definition at line 59 of file PhotonLibrary.h.
Referenced by StoreLibraryToFile().
|
inlineoverridevirtual |
Returns whether the current library deals with reflected light timing.
Implements phot::IPhotonLibrary.
Definition at line 62 of file PhotonLibrary.h.
Referenced by StoreLibraryToFile().
|
inline |
Returns whether the current library deals with time propagation distributions.
Definition at line 56 of file PhotonLibrary.h.
Referenced by StoreLibraryToFile().
|
inline |
Returns whether voxel metadata is available.
Definition at line 85 of file PhotonLibrary.h.
Referenced by phot::PhotonVisibilityService::LoadLibrary(), LoadLibraryFromFile(), and StoreMetadata().
|
inlineoverrideprivatevirtual |
Reimplemented from phot::IPhotonLibrary.
Definition at line 106 of file PhotonLibrary.h.
|
inlineprivate |
Definition at line 134 of file PhotonLibrary.h.
|
inlineinherited |
Returns the number of elements in the library.
Definition at line 53 of file IPhotonLibrary.h.
References phot::IPhotonLibrary::NOpChannels(), and phot::IPhotonLibrary::NVoxels().
Referenced by CreateEmptyLibrary(), and LoadLibraryFromFile().
void phot::PhotonLibrary::LoadLibraryFromFile | ( | std::string | LibraryFile, |
size_t | NVoxels, | ||
bool | storeReflected = false , |
||
bool | storeReflT0 = false , |
||
size_t | storeTiming = 0 , |
||
int | maxrange = 200 |
||
) |
Definition at line 161 of file PhotonLibrary.cxx.
References util::LazyVector< T, A >::clear(), util::LazyVector< T, A >::data_init(), ExtractNOpChannels(), f, fHasReflected, fHasReflectedT0, fHasTiming, fLookupTable, fNOpChannels, fNVoxels, fReflLookupTable, fReflTLookupTable, fTimingParFormula, fTimingParLookupTable, fTimingParNParameters, fTimingParTF1LookupTable, GetVoxelDef(), hasVoxelDef(), phot::IPhotonLibrary::LibrarySize(), LoadMetadata(), n, NVoxels(), util::LazyVector< T, A >::resize(), uncheckedAccess(), uncheckedAccessRefl(), uncheckedAccessReflT(), and uncheckedAccessTimingTF1().
Referenced by phot::PhotonVisibilityService::LoadLibrary().
|
private |
Reads the metadata from specified ROOT directory and sets it as current.
Definition at line 459 of file PhotonLibrary.cxx.
References fVoxelDef.
Referenced by LoadLibraryFromFile().
|
inlineoverrideprivatevirtual |
Implements phot::IPhotonLibrary.
Definition at line 103 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary().
|
inlineoverrideprivatevirtual |
Implements phot::IPhotonLibrary.
Definition at line 104 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), and LoadLibraryFromFile().
TTree* phot::PhotonLibrary::ProduceTTree | ( | ) | const |
void phot::PhotonLibrary::SetCount | ( | size_t | Voxel, |
size_t | OpChannel, | ||
float | Count | ||
) |
Definition at line 341 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccess().
Referenced by phot::PhotonVisibilityService::SetLibraryEntry().
void phot::PhotonLibrary::SetReflCount | ( | size_t | Voxel, |
size_t | OpChannel, | ||
float | Count | ||
) |
Definition at line 371 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessRefl().
Referenced by phot::PhotonVisibilityService::SetLibraryEntry().
void phot::PhotonLibrary::SetReflT0 | ( | size_t | Voxel, |
size_t | OpChannel, | ||
float | reflT0 | ||
) |
Definition at line 381 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessReflT().
Referenced by phot::PhotonVisibilityService::SetLibraryReflT0Entry().
void phot::PhotonLibrary::SetTimingPar | ( | size_t | Voxel, |
size_t | OpChannel, | ||
float | Count, | ||
size_t | parnum | ||
) |
Definition at line 351 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessTimingPar().
Referenced by phot::PhotonVisibilityService::SetLibraryTimingParEntry().
void phot::PhotonLibrary::SetTimingTF1 | ( | size_t | Voxel, |
size_t | OpChannel, | ||
TF1 | func | ||
) |
Definition at line 361 of file PhotonLibrary.cxx.
References fNOpChannels, fNVoxels, and uncheckedAccessTimingTF1().
Referenced by phot::PhotonVisibilityService::SetLibraryTimingTF1Entry().
|
inline |
Copies the specified voxel definition into our own (overwrites the existing metadata if any).
Definition at line 97 of file PhotonLibrary.h.
Referenced by phot::PhotonVisibilityService::LoadLibrary().
|
inlinestaticprivate |
Converts size_t into integer.
Definition at line 216 of file PhotonLibrary.h.
Referenced by StoreLibraryToFile().
void phot::PhotonLibrary::StoreLibraryToFile | ( | std::string | LibraryFile, |
bool | storeReflected = false , |
||
bool | storeReflT0 = false , |
||
size_t | storeTiming = 0 |
||
) | const |
Definition at line 49 of file PhotonLibrary.cxx.
References fDir, fLookupTable, fNOpChannels, fNVoxels, fReflLookupTable, fTimingParLookupTable, hasReflected(), hasReflectedT0(), hasTiming(), OpChannelBranchName, util::LazyVector< T, A >::size(), size_t2int(), StoreMetadata(), uncheckedAccess(), uncheckedAccessRefl(), uncheckedAccessReflT(), and uncheckedAccessTimingPar().
Referenced by phot::PhotonVisibilityService::StoreLibrary().
|
private |
Writes the current metadata (if any) into the ROOT output file.
Definition at line 508 of file PhotonLibrary.cxx.
References fDir, fNOpChannels, fNVoxels, sim::PhotonVoxelDef::GetRegionLowerCorner(), sim::PhotonVoxelDef::GetRegionUpperCorner(), sim::PhotonVoxelDef::GetSteps(), GetVoxelDef(), sim::PhotonVoxelDef::GetVoxelSize(), and hasVoxelDef().
Referenced by StoreLibraryToFile().
|
inlineprivate |
Unchecked access to a visibility datum.
Definition at line 143 of file PhotonLibrary.h.
Referenced by GetCount(), LoadLibraryFromFile(), SetCount(), and StoreLibraryToFile().
|
inlineprivate |
Unchecked access to a visibility datum.
Definition at line 149 of file PhotonLibrary.h.
|
inlineprivate |
Unchecked access to a reflected visibility datum.
Definition at line 155 of file PhotonLibrary.h.
Referenced by GetReflCount(), LoadLibraryFromFile(), SetReflCount(), and StoreLibraryToFile().
|
inlineprivate |
Unchecked access to a reflected visibility datum.
Definition at line 161 of file PhotonLibrary.h.
|
inlineprivate |
Unchecked access to a reflected T0 visibility datum.
Definition at line 167 of file PhotonLibrary.h.
Referenced by GetReflT0(), LoadLibraryFromFile(), SetReflT0(), and StoreLibraryToFile().
|
inlineprivate |
Unchecked access to a reflected T0 visibility datum.
Definition at line 173 of file PhotonLibrary.h.
|
inlineprivate |
Unchecked access to a parameter the time distribution.
Definition at line 179 of file PhotonLibrary.h.
Referenced by GetTimingPar(), SetTimingPar(), and StoreLibraryToFile().
|
inlineprivate |
Unchecked access to a parameter of the time distribution.
Definition at line 185 of file PhotonLibrary.h.
|
inlineprivate |
Unchecked access to a parameter of the time distribution.
Definition at line 191 of file PhotonLibrary.h.
Referenced by LoadLibraryFromFile(), and SetTimingTF1().
|
inlineprivate |
Unchecked access to a parameter of the time distribution.
Definition at line 197 of file PhotonLibrary.h.
References util::LazyVector< T, A >::data_address().
|
inlineprivate |
Returns the index of visibility of specified voxel and cell.
Definition at line 137 of file PhotonLibrary.h.
Referenced by GetCounts(), GetReflCounts(), GetReflT0s(), GetTimingPars(), and GetTimingTF1s().
|
private |
ROOT directory where to write data.
Definition at line 132 of file PhotonLibrary.h.
Referenced by StoreLibraryToFile(), and StoreMetadata().
|
private |
Whether the current library deals with reflected light counts.
Definition at line 108 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), and LoadLibraryFromFile().
|
private |
Whether the current library deals with reflected light timing.
Definition at line 109 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), and LoadLibraryFromFile().
|
private |
Whether the current library deals with time propagation distribution.
Definition at line 112 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), and LoadLibraryFromFile().
|
private |
Definition at line 117 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetCounts(), LoadLibraryFromFile(), and StoreLibraryToFile().
|
private |
Definition at line 125 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetCount(), GetReflCount(), GetReflT0(), GetTimingPar(), LoadLibraryFromFile(), SetCount(), SetReflCount(), SetReflT0(), SetTimingPar(), SetTimingTF1(), StoreLibraryToFile(), and StoreMetadata().
|
private |
Definition at line 126 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetCount(), GetCounts(), GetReflCount(), GetReflCounts(), GetReflT0(), GetReflT0s(), GetTimingPar(), GetTimingPars(), GetTimingTF1s(), LoadLibraryFromFile(), SetCount(), SetReflCount(), SetReflT0(), SetTimingPar(), SetTimingTF1(), StoreLibraryToFile(), and StoreMetadata().
|
private |
Definition at line 118 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetReflCounts(), LoadLibraryFromFile(), and StoreLibraryToFile().
|
private |
Definition at line 119 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetReflT0s(), and LoadLibraryFromFile().
|
private |
Definition at line 122 of file PhotonLibrary.h.
Referenced by LoadLibraryFromFile().
|
private |
Definition at line 120 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetTimingPars(), LoadLibraryFromFile(), and StoreLibraryToFile().
|
private |
Definition at line 123 of file PhotonLibrary.h.
Referenced by LoadLibraryFromFile().
|
private |
Definition at line 121 of file PhotonLibrary.h.
Referenced by CreateEmptyLibrary(), GetTimingTF1s(), and LoadLibraryFromFile().
|
private |
Voxel definition loaded from library metadata.
Definition at line 129 of file PhotonLibrary.h.
Referenced by LoadMetadata().
|
staticprivate |
Name of the optical channel number in the input tree.
Definition at line 210 of file PhotonLibrary.h.
Referenced by ExtractNOpChannels(), and StoreLibraryToFile().