30 std::vector<std::vector<float>> horigs;
32 assert(horigs.size()==48);
33 assert(horigs.at(0).size()==9594);
35 assert(horigs.size()==96);
37 assert(horigs.size()==144);
39 assert(horigs.size()==192);
45 for (
int ich = 0; ich!=48; ich++){
47 for (
int itick =0; itick!=9594;itick++){
48 auto q = horigs.at(ich+48).at(itick);
56 for (
int ich = 0; ich!=48; ich++){
58 for (
int itick =0; itick!=9594;itick++){
59 auto q = horigs.at(ich).at(itick);
66 for (
int ich = 0; ich!=48; ich++){
68 for (
int itick =0; itick!=9594;itick++){
69 auto q = horigs.at(ich+96).at(itick);
76 for (
int ich = 0; ich!=48; ich++){
78 for (
int itick =0; itick!=9594;itick++){
79 auto q = horigs.at(ich+144).at(itick);
94 const int nsamples = 9594;
97 vector<int> uchans(2400), vchans(2400), wchans(3456);
98 const int nchans = uchans.size() + vchans.size() + wchans.size();
99 std::iota(uchans.begin(), uchans.end(), 0);
100 std::iota(vchans.begin(), vchans.end(), vchans.size());
101 std::iota(wchans.begin(), wchans.end(), vchans.size() + uchans.size());
104 const double unombl=2048.0, vnombl=2048.0, wnombl=400.0;
107 vector<int> miscfgchan;
108 const double from_gain_mVfC=4.7, to_gain_mVfC=14.0,
110 for (
int ind=2016; ind<= 2095; ++ind) { miscfgchan.push_back(ind); }
111 for (
int ind=2192; ind<= 2303; ++ind) { miscfgchan.push_back(ind); }
112 for (
int ind=2352; ind< 2400; ++ind) { miscfgchan.push_back(ind); }
115 vector<int> bad_channels;
116 for (
int i=0;i!=wchans.size();i++){
117 if (i>=7136 - 4800 && i <=7263 - 4800){
118 if (i != 7200- 4800 && i!=7215 - 4800)
119 bad_channels.push_back(i+4800);
125 vector<int> rcrcchans(nchans);
126 std::iota(rcrcchans.begin(), rcrcchans.end(), 0);
129 vector<int> harmonicchans(uchans.size() + vchans.size());
130 std::iota(harmonicchans.begin(), harmonicchans.end(), 0);
132 vector<int> special_chans;
133 special_chans.push_back(2240);
139 hharmonic.push_back(h36kHz);
140 hharmonic.push_back(h108kHz);
142 hspecial.push_back(h36kHz);
143 hspecial.push_back(h108kHz);
144 hspecial.push_back(hspkHz);
147 float u_resp_array[120]={0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.364382, 0.387949, 0.411053, 0.433979, 0.456863, 0.479746, 0.502641, 0.52554, 0.548441, 0.57134, 0.591765, 0.609448, 0.626848, 0.644094, 0.661364, 0.678859, 0.695231, 0.710462, 0.726147, 0.742373, 0.761332, 0.783313, 0.806325, 0.830412, 0.857676, 0.888412, 0.920705, 0.954624, 0.990242, 1.02766, 1.06121, 1.09027, 1.12037, 1.15157, 1.18392, 1.21748, 1.25229, 1.28824, 1.32509, 1.36256, 1.40051, 1.43907, 1.47857, 1.51933, 1.56134, 1.60404, 1.72665, 1.94005, 2.16994, 2.42041, 2.69475, 3.07222, 3.67375, 4.60766, 5.91864, 7.30178, 8.3715, 8.94736, 8.93705, 8.40339, 7.2212, 5.76382, 3.8931, 1.07893, -3.52481, -11.4593, -20.4011, -29.1259, -34.9544, -36.9358, -35.3303, -31.2068, -25.8614, -20.3613, -15.3794, -11.2266, -7.96091, -5.50138, -3.71143, -2.44637, -1.57662, -0.99733, -0.62554, -0.393562, -0.249715, -0.15914, -0.100771, -0.062443, -0.037283, -0.0211508, -0.0112448, -0.00552085, -0.00245133, -0.000957821, -0.000316912, -8.51679e-05, -2.21299e-05, -1.37496e-05, -1.49806e-05, -1.36935e-05, -9.66758e-06, -5.20773e-06, -7.4787e-07, 3.71199e-06, 8.17184e-06, 1.26317e-05, 1.70916e-05, 2.15514e-05, 2.60113e-05, 3.04711e-05};
148 float v_resp_array[120]={0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0865303, 0.0925559, 0.0983619, 0.104068, 0.109739, 0.115403, 0.121068, 0.126735, 0.132403, 0.138072, 0.143739, 0.149408, 0.155085, 0.160791, 0.166565, 0.172454, 0.178514, 0.184795, 0.191341, 0.198192, 0.205382, 0.212944, 0.220905, 0.229292, 0.238129, 0.247441, 0.257256, 0.267601, 0.278502, 0.28999, 0.298745, 0.304378, 0.310105, 0.315921, 0.321818, 0.327796, 0.333852, 0.339967, 0.346098, 0.352169, 0.358103, 0.363859, 0.36945, 0.374915, 0.380261, 0.385401, 0.39016, 0.394378, 0.39804, 0.401394, 0.405145, 0.410714, 0.4205, 0.437951, 0.467841, 0.516042, 0.587738, 0.694157, 0.840763, 1.01966, 1.22894, 1.5612, 2.12348, 3.31455, 5.59355, 9.10709, 14.1756, 18.4603, 19.9517, 17.4166, 10.6683, 1.40656, -10.0638, -19.034, -23.654, -24.0558, -21.4418, -17.3229, -12.9485, -9.08912, -6.05941, -3.86946, -2.38669, -1.43678, -0.853335, -0.503951, -0.296551, -0.173029, -0.0990099, -0.0547172, -0.0287882, -0.0142758, -0.00661815, -0.00284757, -0.00115702, -0.000456456, -0.000183439, -8.04214e-05, -4.20533e-05, -2.62903e-05, -1.64098e-05, -6.68039e-06, 3.04903e-06, 1.27784e-05, 2.25079e-05, 3.22373e-05, 4.19667e-05, 5.16961e-05, 6.14255e-05, 7.11549e-05};
151 for (
int i=0;i!=120;i++){
152 u_resp.at(i) = u_resp_array[i];
153 v_resp.at(i) = v_resp_array[i];
159 int uplane_time_shift = 79;
160 int vplane_time_shift = 82;
166 std::vector< std::vector<int> > channel_groups;
167 for (
int i=0;i!=172;i++){
169 std::vector<int> channel_group;
170 for (
int j=0;j!=48;j++){
171 channel_group.push_back(i*48+j);
173 channel_groups.push_back(channel_group);
183 noise->set_nominal_baseline(uchans, unombl);
184 noise->set_nominal_baseline(vchans, vnombl);
185 noise->set_nominal_baseline(wchans, wnombl);
187 noise->set_response(uchans,u_resp_freq);
188 noise->set_response(vchans,v_resp_freq);
190 noise->set_response_offset(uchans,uplane_time_shift);
191 noise->set_response_offset(vchans,vplane_time_shift);
193 noise->set_pad_window_front(uchans,20);
195 noise->set_pad_window_back(uchans,10);
196 noise->set_pad_window_front(vchans,10);
197 noise->set_pad_window_back(vchans,10);
198 noise->set_pad_window_front(wchans,10);
199 noise->set_pad_window_back(wchans,10);
203 noise->set_gains_shapings(miscfgchan, from_gain_mVfC, to_gain_mVfC, from_shaping, to_shaping);
205 noise->set_rcrc_constant(rcrcchans, rcrc);
210 for (
int i=0;i!=uchans.size();i++){
211 if (uchans.at(i)<100){
212 noise->set_min_rms_cut_one(uchans.at(i),1);
213 noise->set_max_rms_cut_one(uchans.at(i),5);
214 }
else if (uchans.at(i)<2000){
215 noise->set_min_rms_cut_one(uchans.at(i),1.9);
216 noise->set_max_rms_cut_one(uchans.at(i),11);
218 noise->set_min_rms_cut_one(uchans.at(i),0.9);
219 noise->set_max_rms_cut_one(uchans.at(i),5);
222 for (
int i=0;i!=vchans.size();i++){
223 if (vchans.at(i)<290+uchans.size()){
224 noise->set_min_rms_cut_one(vchans.at(i),1);
225 noise->set_max_rms_cut_one(vchans.at(i),5);
226 }
else if (vchans.at(i)<2200+uchans.size()){
227 noise->set_min_rms_cut_one(vchans.at(i),1.9);
228 noise->set_max_rms_cut_one(vchans.at(i),11);
230 noise->set_min_rms_cut_one(vchans.at(i),1);
231 noise->set_max_rms_cut_one(vchans.at(i),5);
234 noise->set_min_rms_cut(wchans,1.3);
235 noise->set_max_rms_cut(wchans,8.0);
244 noise->set_bad_channels(bad_channels);
246 noise->set_filter(harmonicchans,hharmonic);
247 noise->set_filter(special_chans,hspecial);
248 noise->set_channel_groups(channel_groups);
250 shared_ptr<WireCell::IChannelNoiseDatabase> noise_sp(noise);
254 shared_ptr<WireCell::IChannelFilter> one_sp(one);
258 shared_ptr<WireCell::IChannelFilter> many_sp(many);
272 std::vector<std::vector<float>> hfilts;
275 assert(hfilts.size()==48);
276 assert(hfilts.at(0).size()==9594);
278 assert(hfilts.size()==96);
280 assert(hfilts.size()==144);
282 assert(hfilts.size()==192);
284 auto traces1 = quiet->traces();
287 for (
auto trace : *traces1.get()) {
288 int tbin =
trace->tbin();
289 int ch =
trace->channel();
290 auto charges =
trace->charge();
292 for (
int i=0;i!=9594;i++){
293 const double diff = fabs(charges.at(i) - hfilts.at(counter).at(i));
295 std::cerr <<
"Warning: normally would assert: " 296 <<
"counter: " << counter <<
" ch:" << i
298 <<
" charge:" << charges.at(i)
299 <<
" hfilts:" << hfilts.at(counter).at(i)
std::vector< mask_t > multimask_t
void set_channel_filters(std::vector< WireCell::IChannelFilter::pointer > filters)
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
void set_channel_noisedb(WireCell::IChannelNoiseDatabase::pointer ndb)
millisecond_as<> millisecond
Type of time stored in milliseconds, in double precision.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
void set_channel_noisedb(WireCell::IChannelNoiseDatabase::pointer ndb)
void set_grouped_filters(std::vector< WireCell::IChannelFilter::pointer > filters)
const GenericPointer< typename T::ValueType > & pointer
std::vector< float > ChargeSequence
Sequential collection of charge.
QTextStream & endl(QTextStream &s)
void set_sampling(double tick=0.5 *units::us, int nsamples=9600)
std::tuple< double, int, int > mask_t