1 #ifndef PHOTONLIBRARY_H 5 #define PHOTONLIBRARY_H 30 TTree* ProduceTTree()
const;
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;
49 const std::vector<float>* GetTimingPars(
size_t Voxel)
const;
50 TF1* GetTimingTF1s(
size_t Voxel)
const;
52 virtual float const* GetReflCounts(
size_t Voxel)
const override;
53 virtual float const* GetReflT0s(
size_t Voxel)
const override;
59 virtual bool hasReflected()
const override {
return fHasReflected; }
64 void StoreLibraryToFile(std::string LibraryFile,
65 bool storeReflected =
false,
66 bool storeReflT0 =
false,
67 size_t storeTiming = 0)
const;
68 void LoadLibraryFromFile(std::string LibraryFile,
70 bool storeReflected =
false,
71 bool storeReflT0 =
false,
72 size_t storeTiming = 0,
74 void CreateEmptyLibrary(
size_t NVoxels,
76 bool storeReflected =
false,
77 bool storeReflT0 =
false,
78 size_t storeTiming = 0);
104 virtual int NVoxels()
const override {
return fNVoxels; }
106 virtual bool isVoxelValid(
size_t Voxel)
const override {
return isVoxelValidImpl(Voxel); }
108 bool fHasReflected =
false;
109 bool fHasReflectedT0 =
132 art::TFileDirectory* fDir =
nullptr;
139 return Voxel * fNOpChannels + OpChannel;
145 return fLookupTable[uncheckedIndex(Voxel, OpChannel)];
151 return fLookupTable[uncheckedIndex(Voxel, OpChannel)];
157 return fReflLookupTable[uncheckedIndex(Voxel, OpChannel)];
163 return fReflLookupTable[uncheckedIndex(Voxel, OpChannel)];
169 return fReflTLookupTable[uncheckedIndex(Voxel, OpChannel)];
175 return fReflTLookupTable[uncheckedIndex(Voxel, OpChannel)];
181 return fTimingParLookupTable[uncheckedIndex(Voxel, OpChannel)][parnum];
187 return fTimingParLookupTable[uncheckedIndex(Voxel, OpChannel)][parnum];
193 return fTimingParTF1LookupTable[uncheckedIndex(Voxel, OpChannel)];
200 return *(fTimingParTF1LookupTable.
data_address(uncheckedIndex(Voxel, OpChannel)));
204 void LoadMetadata(TDirectory& srcDir);
207 void StoreMetadata()
const;
213 static size_t ExtractNOpChannels(TTree* tree);
218 constexpr
size_t int_max_as_size_t{std::numeric_limits<int>::max()};
219 return val <= int_max_as_size_t ? static_cast<int>(val) : -1;
Definitions of voxel data structures.
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.
float & uncheckedAccess(size_t Voxel, size_t OpChannel)
Unchecked access to a visibility datum.
util::LazyVector< float > fReflLookupTable
sim::PhotonVoxelDef const & GetVoxelDef() const
bool hasVoxelDef() const
Returns whether voxel metadata is available.
virtual int NOpChannels() const override
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.
float uncheckedAccessReflT(size_t Voxel, size_t OpChannel) const
Unchecked access to a reflected T0 visibility datum.
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
virtual bool hasReflectedT0() const override
Returns whether the current library deals with reflected light timing.
void SetVoxelDef(sim::PhotonVoxelDef const &voxelDef)
bool isVoxelValidImpl(size_t Voxel) const
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.
float & uncheckedAccessTimingPar(size_t Voxel, size_t OpChannel, size_t parnum)
Unchecked access to a parameter of the time distribution.
Contiguous data container with lazy resizing on access.
util::LazyVector< TF1 > fTimingParTF1LookupTable
virtual bool isVoxelValid(size_t Voxel) const override
General LArSoft Utilities.
float uncheckedAccessRefl(size_t Voxel, size_t OpChannel) const
Unchecked access to a reflected visibility datum.
float & uncheckedAccessRefl(size_t Voxel, size_t OpChannel)
Unchecked access to a reflected visibility datum.
virtual bool hasReflected() const override
Returns whether the current library deals with reflected light count.
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.
virtual int NVoxels() const override
bool hasTiming() const
Returns whether the current library deals with time propagation distributions.
float uncheckedAccessTimingPar(size_t Voxel, size_t OpChannel, size_t parnum) const
Unchecked access to a parameter the time distribution.