Skip to content

Commit 7fe5bab

Browse files
committed
inherit efficiency, tpc constants from their initial fcls; add units to some fcl comments
- also remove unused functions
1 parent 193666b commit 7fe5bab

4 files changed

Lines changed: 76 additions & 50 deletions

File tree

sbndcode/Calorimetry/LightCaloProducer_module.cc

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,7 @@ class sbnd::LightCaloProducer : public art::EDProducer {
119119
std::vector<double> ref_visibility,
120120
std::vector<double> &total_gamma_v);
121121

122-
// Returns the median of the light vector
123-
double CalcMedian(std::vector<double> total_light);
124-
125-
// Returns the mean of the light vector
126-
double CalcMean(std::vector<double> total_light);
122+
// Returns the weighted mean of the light vector
127123
double CalcMean(std::vector<double> total_light, std::vector<double> total_err);
128124

129125
// fcl parameters
@@ -150,6 +146,19 @@ class sbnd::LightCaloProducer : public art::EDProducer {
150146
std::vector<float> fupper_thresh;
151147

152148
std::vector<float> fcal_area_const;
149+
150+
double fpmtcoated_vuveff_tpc0;
151+
double fpmtcoated_viseff_tpc0;
152+
double fpmtuncoated_eff_tpc0;
153+
154+
double fpmtcoated_vuveff_tpc1;
155+
double fpmtcoated_viseff_tpc1;
156+
double fpmtuncoated_eff_tpc1;
157+
158+
double fxarapucavuv_vuveff;
159+
double fxarapucavuv_viseff;
160+
double fxarapucavis_eff;
161+
153162
std::vector<float> fopdet_vuv_eff;
154163
std::vector<float> fopdet_vis_eff;
155164
std::vector<int> fopdet_mask;
@@ -214,10 +223,48 @@ sbnd::LightCaloProducer::LightCaloProducer(fhicl::ParameterSet const& p)
214223
fupper_thresh = p.get<std::vector<float>>("OpDetMaxPEThreshold");
215224

216225
fcal_area_const = p.get<std::vector<float>>("CalAreaConstants");
217-
fopdet_vuv_eff = p.get<std::vector<float>>("OpDetVUVEfficiencies");
218-
fopdet_vis_eff = p.get<std::vector<float>>("OpDetVISEfficiencies");
219226
fopdet_mask = p.get<std::vector<int>>("OpDetMask");
220227

228+
fpmtcoated_viseff_tpc0 = p.get<double>("PMTCoatedVISEff_tpc0");
229+
fpmtcoated_vuveff_tpc0 = p.get<double>("PMTCoatedVUVEff_tpc0");
230+
fpmtuncoated_eff_tpc0 = p.get<double>("PMTUncoatedEff_tpc0");
231+
fpmtcoated_viseff_tpc1 = p.get<double>("PMTCoatedVISEff_tpc1");
232+
fpmtcoated_vuveff_tpc1 = p.get<double>("PMTCoatedVUVEff_tpc1");
233+
fpmtuncoated_eff_tpc1 = p.get<double>("PMTUncoatedEff_tpc1");
234+
235+
fxarapucavuv_vuveff = p.get<double>("XArapucaVUVVUVEff");
236+
fxarapucavuv_viseff = p.get<double>("XArapucaVUVVISEff");
237+
fxarapucavis_eff = p.get<double>("XArapucaVISEff");
238+
239+
// fill efficiency vectors
240+
fopdet_vuv_eff.resize(nchan,0.);
241+
fopdet_vis_eff.resize(nchan,0.);
242+
for (unsigned int ch = 0; ch < nchan; ++ch) {
243+
std::string pd_type = opdetmap.pdType(ch);
244+
if (pd_type == "pmt_coated") {
245+
if (ch%2==0){
246+
fopdet_vuv_eff[ch] = fpmtcoated_vuveff_tpc0;
247+
fopdet_vis_eff[ch] = fpmtcoated_viseff_tpc0;
248+
}
249+
else{
250+
fopdet_vuv_eff[ch] = fpmtcoated_vuveff_tpc1;
251+
fopdet_vis_eff[ch] = fpmtcoated_viseff_tpc1;
252+
}
253+
} else if (pd_type == "pmt_uncoated") {
254+
if (ch%2==0)
255+
fopdet_vis_eff[ch] = fpmtuncoated_eff_tpc0;
256+
else
257+
fopdet_vis_eff[ch] = fpmtuncoated_eff_tpc1;
258+
}
259+
else if (pd_type == "xarapuca_vuv") {
260+
fopdet_vuv_eff[ch] = fxarapucavuv_vuveff;
261+
fopdet_vis_eff[ch] = fxarapucavuv_viseff;
262+
}
263+
else if (pd_type == "xarapuca_vis") {
264+
fopdet_vis_eff[ch] = fxarapucavis_eff;
265+
}
266+
}
267+
221268
geom = lar::providerFrom<geo::Geometry>();
222269

223270
art::ServiceHandle<art::TFileService> fs;
@@ -701,21 +748,6 @@ void sbnd::LightCaloProducer::CalcLight(std::vector<double> flash_pe_v,
701748
}
702749
}
703750

704-
double sbnd::LightCaloProducer::CalcMedian(std::vector<double> total_gamma){
705-
std::vector<double> gamma_nonzero;
706-
for (size_t i=0; i<total_gamma.size(); i++){
707-
if (total_gamma[i] <=0) continue;
708-
gamma_nonzero.push_back(total_gamma[i]);
709-
}
710-
double median_gamma=0;
711-
const auto median_it = gamma_nonzero.begin() + gamma_nonzero.size() / 2;
712-
std::nth_element(gamma_nonzero.begin(), median_it , gamma_nonzero.end());
713-
auto median = *median_it;
714-
median_gamma+=median;
715-
716-
return median_gamma;
717-
}
718-
719751
double sbnd::LightCaloProducer::CalcMean(std::vector<double> total_gamma, std::vector<double> total_err){
720752
// calculates a weighted average, loops over per tpc and then per channel
721753
double total_mean=0;
@@ -734,21 +766,4 @@ double sbnd::LightCaloProducer::CalcMean(std::vector<double> total_gamma, std::v
734766
return total_mean;
735767
}
736768

737-
double sbnd::LightCaloProducer::CalcMean(std::vector<double> total_gamma){
738-
double total_mean=0;
739-
for (int tpc=0; tpc<2; tpc++){
740-
double wgt_num = 0;
741-
double wgt_denom = 0;
742-
743-
for (size_t ich=0; ich<total_gamma.size(); ich++){
744-
if (int(ich%2) != tpc) continue;
745-
if (total_gamma[ich]<=0) continue;
746-
wgt_num += total_gamma[ich];
747-
wgt_denom += 1.;
748-
}
749-
if (wgt_denom!=0) total_mean += wgt_num/wgt_denom;
750-
}
751-
return total_mean;
752-
}
753-
754769
DEFINE_ART_MODULE(sbnd::LightCaloProducer)

sbndcode/Calorimetry/lightcalo_sbnd.fcl

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "opticalsimparameterisations_sbnd.fcl"
22
#include "sbndopticalpath_tool.fcl"
3+
#include "digi_pmt_sbnd.fcl"
4+
#include "digi_arapuca_sbnd.fcl"
5+
#include "calorimetry_sbnd.fcl"
36

47
BEGIN_PROLOG
58
sbnd_lightcalo:
@@ -27,19 +30,27 @@ sbnd_lightcalo:
2730
opt0ScoreCut: 200 # default: accept opt0 match > opt0ScoreCut
2831
opt0FractionalCut: 0.5
2932

30-
OpFlashMin: 0.0 # simulation [0.0], light-triggered data [-0.8]
31-
OpFlashMax: 2.0 # simulation [2.0], light-triggered data [2.0]
33+
OpFlashMin: 0.0 # in us, simulation [0.0], light-triggered data [-0.8]
34+
OpFlashMax: 2.0 # in us, simulation [2.0], light-triggered data [2.0]
3235

3336
# flash parameters
34-
FlashOffset: 0.05 # acceptable offset between the t0 between TPCs or between PMTs/X-ARAPUCAs
35-
FlashNoiseThreshold: [ 600., 1500. ] # {PMT, xARAPUCA}, flash total PE threshold to ignore a flash
36-
OpDetMaxPEThreshold: [4000., 1e9] # PE in a single opdet to ignore (due to saturation effects)
37+
FlashOffset: 0.05 # in us, acceptable offset between the t0 between TPCs or between PMTs/X-ARAPUCAs
38+
FlashNoiseThreshold: [ 600., 1500. ] # in PE, {PMT, xARAPUCA}, flash total PE threshold to ignore a flash
39+
OpDetMaxPEThreshold: [4000., 1e9] # in PE, PE in a single opdet to ignore (due to saturation effects)
40+
OpDetMask: [] # list of opdet channels to ignore (off/non-reconstructable PMTs are already identified via calibration db)
3741

3842
# calibration constants & simulation parameters
39-
CalAreaConstants: [ 0.02052, 0.02044, 0.02019 ] # calibration constants for wire planes, found in sbndcode/LArSoftConfigurations/calorimetry_sbnd.fcl
40-
OpDetVUVEfficiencies: [0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.03920, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752, 0.01752]
41-
OpDetVISEfficiencies: [0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.03570, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.01264, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.02600, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271, 0.00271]
42-
OpDetMask: [] # list of opdet channels to ignore (off/non-reconstructable PMTs are already identified via calibration db)
43+
CalAreaConstants: @local::sbnd_calorimetryalgmc.CalAreaConstants
44+
PMTCoatedVISEff_tpc0: @local::sbnd_digipmt_alg.PMTCoatedVISEff_tpc0
45+
PMTCoatedVUVEff_tpc0: @local::sbnd_digipmt_alg.PMTCoatedVUVEff_tpc0
46+
PMTUncoatedEff_tpc0: @local::sbnd_digipmt_alg.PMTUncoatedEff_tpc0
47+
PMTCoatedVISEff_tpc1: @local::sbnd_digipmt_alg.PMTCoatedVISEff_tpc1
48+
PMTCoatedVUVEff_tpc1: @local::sbnd_digipmt_alg.PMTCoatedVUVEff_tpc1
49+
PMTUncoatedEff_tpc1: @local::sbnd_digipmt_alg.PMTUncoatedEff_tpc1
50+
51+
XArapucaVUVVUVEff: @local::sbnd_digiarapuca_alg.XArapucaVUVEffVUV
52+
XArapucaVUVVISEff: @local::sbnd_digiarapuca_alg.XArapucaVUVEffVis
53+
XArapucaVISEff: @local::sbnd_digiarapuca_alg.XArapucaVISEff
4354
}
4455

4556
sbnd_lightcalo_sce: @local::sbnd_lightcalo

sbndcode/Calorimetry/lightcalo_sbnd_data.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
BEGIN_PROLOG
44
sbnd_lightcalo_data: @local::sbnd_lightcalo
5-
sbnd_lightcalo_data.CalAreaConstants: [ 0.02172 , 0.02150, 0.02103 ] # calibration constants for wire planes, found in sbndcode/LArSoftConfigurations/calorimetry_sbnd.fcl
5+
sbnd_lightcalo_data.CalAreaConstants: @local::sbnd_calorimetryalgdata.CalAreaConstants
66
sbnd_lightcalo_data.OpFlashMin: -0.8 # assumption is light-triggered data
77
sbnd_lightcalo_data.OpFlashMax: 2.0 # assumption is light-triggered data
88

sbndcode/Calorimetry/run_lightcalo.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "simulationservices_sbnd.fcl"
33
#include "messages_sbnd.fcl"
44
#include "sam_sbnd.fcl"
5-
#include "lightcalo.fcl"
5+
#include "lightcalo_sbnd.fcl"
66

77
process_name: LightCaloProducer
88

0 commit comments

Comments
 (0)