4 #ifndef PHOTONLIBRARY_H
5 #define PHOTONLIBRARY_H
32 virtual float GetCount(
size_t Voxel,
size_t OpChannel)
const override;
33 void SetCount(
size_t Voxel,
size_t OpChannel,
float Count);
35 float GetTimingPar(
size_t Voxel,
size_t OpChannel,
size_t parnum)
const;
36 void SetTimingPar(
size_t Voxel,
size_t OpChannel,
float Count,
size_t parnum);
39 void SetTimingTF1(
size_t Voxel,
size_t OpChannel, TF1 func);
41 virtual float GetReflCount(
size_t Voxel,
size_t OpChannel)
const override;
42 void SetReflCount(
size_t Voxel,
size_t OpChannel,
float Count);
44 virtual float GetReflT0(
size_t Voxel,
size_t OpChannel)
const override;
45 void SetReflT0(
size_t Voxel,
size_t OpChannel,
float reflT0);
48 virtual float const*
GetCounts(
size_t Voxel)
const override;
52 virtual float const*
GetReflCounts(
size_t Voxel)
const override;
53 virtual float const*
GetReflT0s(
size_t Voxel)
const override;
77 bool storeReflected =
false,
78 bool storeReflT0 =
false,
79 size_t storeTiming = 0)
const;
82 bool storeReflected =
false,
83 bool storeReflT0 =
false,
84 size_t storeTiming = 0,
88 bool storeReflected =
false,
89 bool storeReflT0 =
false,
90 size_t storeTiming = 0);
165 art::TFileDirectory*
fDir =
nullptr;
267 constexpr
size_t int_max_as_size_t{std::numeric_limits<int>::max()};
268 return val <= int_max_as_size_t ? static_cast<int>(val) : -1;
const_pointer data_address(size_type pos) const
Returns a constant pointer to the specified element.
size_t fTimingParNParameters
static int size_t2int(size_t val)
Converts size_t into integer.
std::optional< sim::PhotonVoxelDef > fVoxelDef
Voxel definition loaded from library metadata.
TTree * ProduceTTree() const
float & uncheckedAccess(size_t Voxel, size_t OpChannel)
Unchecked access to a visibility datum.
size_t fHasTiming
Whether the current library deals with time propagation distribution.
void LoadLibraryFromFile(std::string LibraryFile, size_t NVoxels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0, int maxrange=200)
util::LazyVector< float > fReflLookupTable
bool fHasReflectedT0
Whether the current library deals with reflected light timing.
void CreateEmptyLibrary(size_t NVoxels, size_t NChannels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0)
sim::PhotonVoxelDef const & GetVoxelDef() const
bool hasVoxelDef() const
Returns whether voxel metadata is available.
Representation of a region of space diced into voxels.
static std::string const OpChannelBranchName
Name of the optical channel number in the input tree.
float uncheckedAccess(size_t Voxel, size_t OpChannel) const
Unchecked access to a visibility datum.
void StoreLibraryToFile(std::string LibraryFile, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) const
float uncheckedAccessReflT(size_t Voxel, size_t OpChannel) const
Unchecked access to a reflected T0 visibility datum.
void SetCount(size_t Voxel, size_t OpChannel, float Count)
void SetTimingTF1(size_t Voxel, size_t OpChannel, TF1 func)
std::string fTimingParFormula
size_t uncheckedIndex(size_t Voxel, size_t OpChannel) const
Returns the index of visibility of specified voxel and cell.
util::LazyVector< float > fLookupTable
void SetVoxelDef(sim::PhotonVoxelDef const &voxelDef)
static size_t ExtractNOpChannels(TTree *tree)
Returns the number of optical channels in the specified tree.
Definitions of voxel data structures.
virtual bool hasReflected() const override
Returns whether the current library deals with reflected light count.
bool isVoxelValidImpl(size_t Voxel) const
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.
bool fHasReflected
Whether the current library deals with reflected light counts.
const TF1 & uncheckedAccessTimingTF1(size_t Voxel, size_t OpChannel) const
Unchecked access to a parameter of the time distribution.
TF1 & uncheckedAccessTimingTF1(size_t Voxel, size_t OpChannel)
Unchecked access to a parameter of the time distribution.
virtual float const * GetReflCounts(size_t Voxel) const override
void StoreMetadata() const
Writes the current metadata (if any) into the ROOT output file.
float & uncheckedAccessTimingPar(size_t Voxel, size_t OpChannel, size_t parnum)
Unchecked access to a parameter of the time distribution.
TF1 * GetTimingTF1s(size_t Voxel) const
const std::vector< float > * GetTimingPars(size_t Voxel) const
Contiguous data container with lazy resizing on access.
virtual float GetCount(size_t Voxel, size_t OpChannel) const override
util::LazyVector< TF1 > fTimingParTF1LookupTable
virtual bool isVoxelValid(size_t Voxel) const override
virtual float GetReflCount(size_t Voxel, size_t OpChannel) const override
virtual float const * GetReflT0s(size_t Voxel) const override
void SetTimingPar(size_t Voxel, size_t OpChannel, float Count, size_t parnum)
float uncheckedAccessRefl(size_t Voxel, size_t OpChannel) const
Unchecked access to a reflected visibility datum.
virtual int NOpChannels() const override
float & uncheckedAccessRefl(size_t Voxel, size_t OpChannel)
Unchecked access to a reflected visibility datum.
float GetTimingPar(size_t Voxel, size_t OpChannel, size_t parnum) const
virtual float GetReflT0(size_t Voxel, size_t OpChannel) const override
Interface shared by all PhotonLibrary-like classes.
util::LazyVector< std::vector< float > > fTimingParLookupTable
util::LazyVector< float > fReflTLookupTable
float & uncheckedAccessReflT(size_t Voxel, size_t OpChannel)
Unchecked access to a reflected T0 visibility datum.
art::TFileDirectory * fDir
ROOT directory where to write data.
virtual int NVoxels() const override
void SetReflCount(size_t Voxel, size_t OpChannel, float Count)
bool hasTiming() const
Returns whether the current library deals with time propagation distributions.
void LoadMetadata(TDirectory &srcDir)
Reads the metadata from specified ROOT directory and sets it as current.
float uncheckedAccessTimingPar(size_t Voxel, size_t OpChannel, size_t parnum) const
Unchecked access to a parameter the time distribution.
virtual bool hasReflectedT0() const override
Returns whether the current library deals with reflected light timing.