40 std::cout <<
"Writing photon library to input file: " << LibraryFile.c_str()<<std::endl;
42 TFile
fout(LibraryFile.c_str(),
"RECREATE");
44 TTree *tt =
new TTree(
"PhotonLibraryData",
"PhotonLibraryData");
51 tt->Branch(
"Voxel", &Voxel,
"Voxel/I");
52 tt->Branch(
"OpChannel", &OpChannel,
"OpChannel/I");
53 tt->Branch(
"Visibility", &Visibility,
"Visibility/F");
86 for(
size_t ivox=0; ivox!=
NVoxels; ivox++)
99 std::cout<<
"Reading photon library from input file: " << LibraryFile.c_str()<<std::endl;
106 f = TFile::Open(LibraryFile.c_str());
108 std::cerr<<
"\033[95m<<"<<__FUNCTION__<<
">>\033[00m " <<
"Failed to open a ROOT file: " << LibraryFile.c_str()<<std::endl;
109 std::cerr<<
"If you don't have photon library data file, download from below URL..."<<std::endl;
110 std::cerr<<
"/cvmfs/icarus.opensciencegrid.org/products/icarus/icarus_data/v08_28_00/icarus_data/PhotonLibrary/PhotonLibrary-20180801.root"<<std::endl<<std::endl;
111 throw std::exception();
113 tt = (TTree*)f->Get(
"PhotonLibraryData");
115 TKey *key = f->FindKeyAny(
"PhotonLibraryData");
117 tt = (TTree*)key->ReadObj();
119 std::cerr <<
"PhotonLibraryData not found in file" <<LibraryFile<<std::endl;
125 std::cerr <<
"Error in ttree load, reading photon library: " << LibraryFile.c_str()<<std::endl;
132 tt->SetBranchAddress(
"Voxel", &Voxel);
133 tt->SetBranchAddress(
"OpChannel", &OpChannel);
134 tt->SetBranchAddress(
"Visibility", &Visibility);
146 size_t NEntries = tt->GetEntries();
148 for(
size_t i=0; i!=NEntries; ++i) {
153 fNOpChannels = OpChannel+1;
164 for(
size_t ivox=0; ivox!=
NVoxels; ivox++)
180 std::cerr <<
"Error in closing file : " << LibraryFile.c_str()<<std::endl;
199 std::cerr <<
"Error - attempting to set count in voxel " << Voxel<<
" which is out of range" <<std::endl;
static std::vector< float > * EmptyList()
void LoadLibraryFromFile(std::string LibraryFile, size_t NVoxels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0, int maxrange=200)
BEGIN_PROLOG could also be cerr
void CreateEmptyLibrary(size_t NVoxels, size_t NChannels, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0)
size_type size() const noexcept
Returns the size of the vector.
void clear()
Removes all stored data and sets the nominal size to 0.
std::size_t size(FixedBins< T, C > const &) noexcept
void StoreLibraryToFile(std::string LibraryFile, bool storeReflected=false, bool storeReflT0=false, size_t storeTiming=0) const
void SetCount(size_t Voxel, size_t OpChannel, float Count)
util::LazyVector< float > fLookupTable
static std::vector< float > EmptyChannelsList
virtual float const * GetCounts(size_t Voxel) const override
Returns a pointer to NOpChannels() visibility values, one per channel.
virtual float GetCount(size_t Voxel, size_t OpChannel) const override
value_type at(size_type pos) const
Returns a reference to the specified element, throws an exception if not present. ...
virtual int NOpChannels() const override
void resize(size_type newSize)
Changes the nominal size of the container.
virtual int NVoxels() const override
BEGIN_PROLOG could also be cout