@@ -204,27 +204,22 @@ public void translate(List<DetectorDataDgtz> detectorData){
204204 }
205205 }
206206
207- private void fitPulses (DetectorDataDgtz data , IndexedTable config ) {
208- final DetectorDescriptor desc = data .getDescriptor ();
209- final DetectorType type = desc .getType ();
210- final long hash = IndexedTable .DEFAULT_GENERATOR .hashCode (
211- desc .getCrate (), desc .getSlot (), desc .getChannel ());
212- final int nsa = config .getIntValueByHash ("nsa" , hash );
213- final int nsb = config .getIntValueByHash ("nsb" , hash );
214- final int tet = config .getIntValueByHash ("tet" , hash );
215- int ped = 0 ;
216- if (type == DetectorType .RF ) {
217- ped = config .getIntValueByHash ("pedestal" , hash );
218- }
207+ private void fitPulses (DetectorDataDgtz data , IndexedTable cfg ) {
208+ final DetectorDescriptor dd = data .getDescriptor ();
209+ final long hash = IndexedTable .DEFAULT_GENERATOR .hashCode (dd .getCrate (), dd .getSlot (), dd .getChannel ());
210+ final int nsa = cfg .getIntValueByHash ("nsa" , hash );
211+ final int nsb = cfg .getIntValueByHash ("nsb" , hash );
212+ final int tet = cfg .getIntValueByHash ("tet" , hash );
213+ final int ped = dd .getType () == DetectorType .RF ? cfg .getIntValueByHash ("pedestal" , hash ) : 0 ;
219214 final int nadc = data .getADCSize ();
220215 for (int i = 0 ; i < nadc ; i ++) {
221216 ADCData adc = data .getADCData (i );
222217 if (adc .getPulseSize ()>0 ){
223218 try {
224219 extendedFitter .fit (nsa , nsb , tet , ped , adc .getPulseArray ());
225220 } catch (Exception e ) {
226- System .err .println (">>>> error : fitting pulse " +desc .getCrate ()+
227- " / " +desc .getSlot ()+" / " +desc .getChannel ());
221+ System .err .println (">>>> error : fitting pulse " +dd .getCrate ()+
222+ " / " +dd .getSlot ()+" / " +dd .getChannel ());
228223 }
229224 adc .setIntegral (extendedFitter .adc + extendedFitter .ped *(nsa +nsb ));
230225 adc .setHeight ((short ) this .extendedFitter .pulsePeakValue );
@@ -235,18 +230,18 @@ private void fitPulses(DetectorDataDgtz data, IndexedTable config) {
235230 }
236231 }
237232
238- private void fitMicromegaPulses (DetectorDataDgtz data , IndexedTable config ) {
233+ private void fitMicromegaPulses (DetectorDataDgtz data , IndexedTable cfg ) {
239234 final long hash0 = IndexedTable .DEFAULT_GENERATOR .hashCode (0 ,0 ,0 );
240- final short adcOffset = (short ) config .getDoubleValueByHash ("adc_offset" , hash0 );
241- final double fineTimeStampResolution = (byte ) config .getDoubleValueByHash ("dream_clock" , hash0 );
242- final double samplingTime = (byte ) config .getDoubleValueByHash ("sampling_time" , hash0 );
243- final int sparseSample = config .getIntValueByHash ("sparse" , hash0 );
235+ final short adcOffset = (short ) cfg .getDoubleValueByHash ("adc_offset" , hash0 );
236+ final double fineTimeStampResolution = (byte ) cfg .getDoubleValueByHash ("dream_clock" , hash0 );
237+ final double samplingTime = (byte ) cfg .getDoubleValueByHash ("sampling_time" , hash0 );
238+ final int sparseSample = cfg .getIntValueByHash ("sparse" , hash0 );
244239 ADCData adc = data .getADCData (0 );
245- mvtFitter .fit (adcOffset , fineTimeStampResolution , samplingTime , adc .getPulseArray (), adc .getTimeStamp (), sparseSample );
246- adc .setHeight ((short ) (mvtFitter .adcMax ));
247- adc .setTime ((int ) (mvtFitter .timeMax ));
248- adc .setIntegral ((int ) (mvtFitter .integral ));
249- adc .setTimeStamp (mvtFitter .timestamp );
240+ mvtFitter .fit (adcOffset , fineTimeStampResolution , samplingTime , adc .getPulseArray (), adc .getTimeStamp (), sparseSample );
241+ adc .setHeight ((short ) (mvtFitter .adcMax ));
242+ adc .setTime ((int ) (mvtFitter .timeMax ));
243+ adc .setIntegral ((int ) (mvtFitter .integral ));
244+ adc .setTimeStamp (mvtFitter .timestamp );
250245 }
251246
252247 public void fitPulses (List <DetectorDataDgtz > detectorData ){
0 commit comments