16 bool fatal(
const std::string& msg)
18 std::cerr <<
"FATAL: PhotonLibraryHybrid: " << msg << std::endl;
29 TFile
f(fname.c_str());
30 !
f.IsZombie() || fatal(
"Could not open PhotonLibrary " + fname);
32 for (
int opdetIdx = 0;
true; ++opdetIdx) {
33 const std::string dirname = TString::Format(
"opdet_%d", opdetIdx).Data();
34 TDirectory*
dir = (TDirectory*)
f.Get(dirname.c_str());
39 TVectorD* fit = (TVectorD*)dir->Get(
"fit");
40 fit || fatal(
"Didn't find " + dirname +
"/fit in " + fname);
43 TTree* tr = (TTree*)dir->Get(
"tr");
44 tr || fatal(
"Didn't find " + dirname +
"/tr in " + fname);
47 tr->SetBranchAddress(
"vox", &vox);
48 tr->SetBranchAddress(
"vis", &vis);
51 for (
int i = 0; i < tr->GetEntries(); ++i) {
53 vox <
NVoxels() || fatal(
"Voxel out of range");
64 !
fRecords.empty() || fatal(
"No opdet_*/ directories in " + fname);
67 geom->
NOpDets() ==
fRecords.size() || fatal(
"Number of opdets mismatch");
97 int(vox) <
NVoxels() || fatal(
"GetCount(): Voxel out of range");
98 int(opchan) <
NOpChannels() || fatal(
"GetCount(): OpChan out of range");
103 if (it2->vox == vox)
return it2->vis;
Definitions of voxel data structures.
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
virtual const float * GetCounts(size_t Voxel) const override
Returns a pointer to NOpChannels() visibility values, one per channel.
Representation of a region of space diced into voxels.
double Eval(double x) const
PhotonLibraryHybrid(const std::string &fname, const sim::PhotonVoxelDef &voxdef)
virtual ~PhotonLibraryHybrid()
virtual int NVoxels() const override
counts_as<> counts
Number of ADC counts, represented by signed short int.
std::vector< Exception > exceptions
const sim::PhotonVoxelDef & fVoxDef
virtual int NOpChannels() const override
unsigned int NOpDets() 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].
General LArSoft Utilities.
virtual float GetCount(size_t Voxel, size_t OpChannel) const override
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
Point GetCenter() const
Returns the center of the voxel (type Point).
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
std::vector< OpDetRecord > fRecords
art framework interface to geometry description
PhotonVoxel GetPhotonVoxel(int ID) const