@@ -69,12 +69,6 @@ class sbnd::trigger::PMTMCMetricProducer : public art::EDProducer {
6969 std::vector <int > fChannelsToIgnore ;
7070 std::vector<uint32_t > sumWvfms (const std::vector<uint32_t >& v1, const std::vector<int16_t >& v2);
7171 float estimateBaseline (std::vector<uint32_t > wvfm);
72-
73- TTree* tree;
74- int _run, _subrun, _event;
75- float _flash_peakpe;
76- float _flash_peaktime;
77- int _npmts;
7872};
7973
8074
@@ -87,15 +81,6 @@ sbnd::trigger::PMTMCMetricProducer::PMTMCMetricProducer(fhicl::ParameterSet cons
8781 fStartTime = p.get <float >(" StartTime" ,-1 );
8882 fChannelsToIgnore = p.get <std::vector<int >>(" ChannelsToIgnore" ,{});
8983
90- art::ServiceHandle<art::TFileService> fs;
91- tree = fs->make <TTree>(" tree" ," metrictree" );
92- tree->Branch (" run" ,&_run," run/I" );
93- tree->Branch (" subrun" ,&_subrun," subrun/I" );
94- tree->Branch (" event" ,&_event," event/I" );
95- tree->Branch (" flash_peakpe" ,&_flash_peakpe," flash_peakpe/F" );
96- tree->Branch (" flash_peaktime" ,&_flash_peaktime," flash_peaktime/F" );
97- tree->Branch (" npmts" ,&_npmts, " npmts/I" );
98-
9984 // Call appropriate produces<>() functions here.
10085 produces< std::vector<sbnd::trigger::pmtSoftwareTrigger>>();
10186 // Call appropriate consumes<>() for any products to be retrieved by this module.
@@ -115,7 +100,7 @@ void sbnd::trigger::PMTMCMetricProducer::produce(art::Event& e)
115100 return ;
116101 }
117102
118- // hardcoded to match match data version
103+ // hardcoded to match match data!
119104 size_t flash_len=5000 ;
120105 std::vector<uint32_t > flash (flash_len, 0 );
121106
@@ -142,23 +127,20 @@ void sbnd::trigger::PMTMCMetricProducer::produce(art::Event& e)
142127 }
143128
144129 auto flash_baseline = estimateBaseline (flash);
145- auto flash_peak_it = std::min_element (flash.begin (),flash.end ());
146- _flash_peakpe = (flash_baseline-(*flash_peak_it))/12.5 ;
147- _flash_peaktime = ((flash_peak_it-flash.begin ()))*ticks_to_us + readout_start;
148- _npmts = counter;
130+ auto flash_peak_it = std::min_element (flash.begin (),flash.end ());
131+ auto flash_peakpe = (flash_baseline-(*flash_peak_it))/12.5 ;
132+ auto flash_peaktime = ((flash_peak_it-flash.begin ()))*ticks_to_us + readout_start;
149133
150134 trig_metrics.foundBeamTrigger = true ;
151- trig_metrics.nAboveThreshold = _npmts ;
135+ trig_metrics.nAboveThreshold = counter ;
152136 trig_metrics.promptPE = 0 ;
153137 trig_metrics.prelimPE = 0 ;
154- trig_metrics.peakPE = _flash_peakpe ;
155- trig_metrics.peaktime = _flash_peaktime ;
138+ trig_metrics.peakPE = flash_peakpe ;
139+ trig_metrics.peaktime = flash_peaktime ;
156140 trig_metrics.trig_ts = 0 ;
157141 trig_metrics_v->push_back (trig_metrics);
158142
159143 e.put (std::move (trig_metrics_v));
160-
161- tree->Fill ();
162144}
163145
164146
@@ -168,8 +150,8 @@ std::vector<uint32_t> sbnd::trigger::PMTMCMetricProducer::sumWvfms(const std::ve
168150 size_t result_len = (v1.size () > v2.size ()) ? v1.size () : v2.size ();
169151 std::vector<uint32_t > result (result_len,0 );
170152 for (size_t i = 0 ; i < result_len; i++){
171- auto value1 = (i < v1.size ()) ? v1[i] : 1e5 ;
172- auto value2 = (i < v2.size ()) ? v2[i] : 1e5 ;
153+ auto value1 = (i < v1.size ()) ? v1[i] : 2e4 ;
154+ auto value2 = (i < v2.size ()) ? v2[i] : 2e4 ;
173155 result.at (i) = value1 + uint32_t (value2);
174156 }
175157 return result;
0 commit comments