@@ -98,7 +98,6 @@ namespace filt{
9898 npeak = 0 ;
9999 delta_tmaxmin = 0 ;
100100
101-
102101 // get the timestamps
103102 art::Handle<std::vector<raw::RDTimeStamp>> timestamp_handle;
104103 evt.getByLabel (" daq" , timestamp_handle);
@@ -110,16 +109,14 @@ namespace filt{
110109 }
111110 art::fill_ptr_vector (raw_timestamps_handle, timestamp_handle);
112111
113-
114- // analyze timestamp distributions
115- // collect timestamps
112+ // collect TS
116113 unsigned timeindex = 0 ;
117114 for (auto const & timestamps: raw_timestamps_handle) {
118115 long this_ts = timestamps->GetTimeStamp ();
119116 ts_vec.push_back (this_ts);
120117 timeindex++;
121118 }
122- // make binned hist
119+ // find min, max TS values
123120 long ts_min = ts_vec[0 ];
124121 long ts_max = ts_vec[0 ];
125122 for (long ts : ts_vec) {
@@ -132,39 +129,42 @@ namespace filt{
132129 }
133130 delta_tmaxmin = std::abs (ts_max - ts_min);
134131
135- float nbin = 100 .;
136- float bin_width = (ts_max - ts_min)/nbin;
137- for (int i = 0 ; i < 100 ; ++i) {
138- float bin_low = ts_min + i*bin_width;
139- float bin_high = ts_min + (i+1 )*bin_width;
140- int bin_count = 0 ;
141- for (long ts : ts_vec) {
142- if ((bin_low < ts) & (ts <= bin_high)) {
143- bin_count += 1 ;
144- }
145- }
146- ts_hist_vec.push_back (bin_count);
147- }
148- // find peak bins
149- for (int bc : ts_hist_vec) {
150- // TODO: make threshold fcl parameter
151- if (bc > 1000 ) {
152- npeak += 1 ;
153- }
154- }
155-
156- // If the energy deposit within the beam time is greater than some limit then trigger the event
157- if (npeak > 1 ){
158- std::cout << " Event " << event << " has " << npeak << " peaks" << std::endl;
159- }
160- if (delta_tmaxmin > 100000 ){
161- std::cout << " Event " << event << " has a delta_tmaxmin of " << delta_tmaxmin << std::endl;
162- }
163- // return npeak < 2;
132+ // if (delta_tmaxmin > 100000){
133+ // std::cout << "Event " << event << " has a delta_tmaxmin of " << delta_tmaxmin << std::endl;
134+ // }
164135 return delta_tmaxmin < 100000 ;
165136
166- }
167137
138+ // // Identify choppy events by looking at the # of peaks in the TS distribution
139+ // make binned hist
140+ // float nbin = 100.;
141+ // float bin_width = (ts_max - ts_min)/nbin;
142+ // for (int i = 0; i < 100; ++i) {
143+ // float bin_low = ts_min + i*bin_width;
144+ // float bin_high = ts_min + (i+1)*bin_width;
145+ // int bin_count = 0;
146+ // for (long ts : ts_vec) {
147+ // if ((bin_low < ts) & (ts <= bin_high)) {
148+ // bin_count += 1;
149+ // }
150+ // }
151+ // ts_hist_vec.push_back(bin_count);
152+ // }
153+ // // find peak bins
154+ // for (int bc : ts_hist_vec) {
155+ // //TODO: make threshold fcl parameter
156+ // if (bc > 1000) {
157+ // npeak += 1;
158+ // }
159+ // }
160+
161+ // // If the energy deposit within the beam time is greater than some limit then trigger the event
162+ // if (npeak > 1){
163+ // std::cout << "Event " << event << " has " << npeak << " peaks" << std::endl;
164+ // }
165+ // return npeak < 2;
166+
167+ }
168168
169169 void FilterChoppy::beginJob () {
170170 }
0 commit comments