1 #ifndef PHOTONLIBHYPOTHESIS_CXX
2 #define PHOTONLIBHYPOTHESIS_CXX
10 #define USING_LARSOFT 1
13 using namespace std::chrono;
14 namespace flashmatch {
18 PhotonLibHypothesis::PhotonLibHypothesis(
const std::string
name)
20 , _vis(art::ServiceHandle<phot::PhotonVisibilityService
const>().
get())
25 #if USING_LARSOFT == 0
34 _qe_v = pset.get<std::vector<double> >(
"CCVCorrection",
_qe_v);
55 #if USING_LARSOFT == 1
60 for (
auto& v : flash.
pe_v ) v = 0;
73 for (
size_t ipt = 0; ipt < trk.size(); ++ipt) {
76 auto const& pt = trk[ipt];
79 double n_original_photons = pt.q;
83 std::vector<double> direct_visibilities;
84 _semi_model->detectedDirectVisibilities(direct_visibilities, xyz);
86 std::vector<double> reflected_visibilities;
87 _semi_model->detectedReflectedVisibilities(reflected_visibilities, xyz);
92 for (
size_t op_det=0; op_det<direct_visibilities.size(); ++op_det) {
94 const double visibility = direct_visibilities[op_det];
106 flash.
pe_v[op_det] +=
q;
108 flash.
pe_v[op_det] = 0;
115 for (
size_t op_det=0; op_det<reflected_visibilities.size(); ++op_det) {
117 const double visibility = reflected_visibilities[op_det];
122 flash.
pe_v[op_det] +=
q;
124 flash.
pe_v[op_det] = 0;
137 static double xyz[3] = {0.};
141 for (
size_t ipmt = 0; ipmt < n_pmt; ++ipmt) {
147 bool is_uncoated =
false;
152 for (
size_t ipt = 0; ipt < trk.size(); ++ipt) {
153 auto const& pt = trk[ipt];
161 double q_direct = 0, q_refl = 0;
174 flash.
pe_v[ipmt] += q_direct;
175 flash.
pe_v[ipmt] += q_refl;
190 static double xyz[3] = {0.};
194 for (
auto& v : flash.
pe_v ) v = 0;
198 if(flash.
pe_v.empty()) flash.
pe_v.resize(n_pmt);
201 assert(flash.
pe_v.size() == n_pmt);
202 assert(flash.
pe_err_v.size() == n_pmt);
204 for (
auto& v : flash.
pe_v ) v = 0;
205 for (
auto& v : flash.
pe_err_v ) v = 0;
214 size_t thread_id = omp_get_thread_num();
215 size_t num_threads = omp_get_num_threads();
216 size_t num_pts = trk.size() / num_threads;
217 size_t start_pt = num_pts * thread_id;
218 if(thread_id+1 == num_threads) num_pts += (trk.size() % num_threads);
227 std::vector<double> local_pe_v(n_pmt,0);
229 for(
size_t ipt = start_pt; ipt < start_pt + num_pts; ++ipt) {
230 auto const& pt = trk[ipt];
231 vox_id = vox_def.GetVoxelID(pt.x,pt.y,pt.z);
232 if (vox_id < 0)
continue;
233 auto const& vis_pmt = lib_data[vox_id];
234 for (
size_t ipmt = 0; ipmt < n_pmt; ++ipmt) {
235 local_pe_v[ipmt] += pt.q * vis_pmt[ipmt];
239 for(
size_t ipmt = 0; ipmt < n_pmt; ++ipmt) {
double _global_qe
Global QE for direct light.
void FillEstimateLibrary(const QCluster_t &, Flash_t &) const
Fills the estimate using the photon library (ICARUS, SBND)
Class def header for a class PhotonLibHypothesis.
double _global_qe_refl
Global QE for reflected light.
size_t NOpDets() const
of PMTs
const std::vector< std::vector< float > > & GetPhotonLibraryData() const
Photon Library data access FIXME.
static PhotonLibHypothesisFactory __global_PhotonLibHypothesisFactory__
fhicl::ParameterSet Config_t
Configuration object.
static DetectorSpecs & GetME(std::string filename="detector_specs.cfg")
Struct to represent an optical flash.
std::vector< double > pe_v
PE distribution over photo-detectors.
#define FLASH_CRITICAL()
Compiler macro for CRITICAL message.
Collection of charge deposition 3D point (cluster)
void FillEstimateSemiAnalytical(const QCluster_t &, Flash_t &) const
Fills the estimate using the semi analytical approach (SBND)
std::vector< int > _uncoated_pmt_list
A list of opdet sensitive to visible (reflected) light.
void FillEstimate(const QCluster_t &, Flash_t &) const
Method to simply fill provided reference of flashmatch::Flash_t.
bool _use_semi_analytical
If the semi-analytical approach should be used.
std::vector< double > _qe_v
PMT-wise relative QE.
size_t NOpDets(int cryostat)
void _Configure_(const Config_t &pset)
phot::PhotonVisibilityService const *const _vis
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
std::vector< double > pe_err_v
PE value error.
float GetVisibility(Point const &p, unsigned int OpChannel, bool wantReflected=false) const
std::unique_ptr< SemiAnalyticalModel > _semi_model
std::vector< int > _channel_mask
The list of channels to use.