diff --git a/Waveform/WaveEventCnv/WaveByteStream/python/WaveByteStreamConfig.py b/Waveform/WaveEventCnv/WaveByteStream/python/WaveByteStreamConfig.py index cc13137d8e59eef7801d0ffa8fa60230721b372f..840a4d0f091a7e195f4e40f818c2b0b99c0b346b 100644 --- a/Waveform/WaveEventCnv/WaveByteStream/python/WaveByteStreamConfig.py +++ b/Waveform/WaveEventCnv/WaveByteStream/python/WaveByteStreamConfig.py @@ -37,6 +37,17 @@ def WaveByteStreamCfg(configFlags, **kwargs): waveform_tool.PreshowerChannels = [12, 13] acc.addPublicTool(waveform_tool) + elif configFlags.GeoModel.FaserVersion == "FASER-02": + print(" - setting up TI12 with IFT detector") + + # Need to fix this! + waveform_tool = CompFactory.RawWaveformDecoderTool("RawWaveformDecoderTool") + waveform_tool.CaloChannels = [1, 0, 3, 2] + waveform_tool.VetoChannels = [4, 5, 6, 7] + waveform_tool.TriggerChannels = [9, 8, 11, 10] + waveform_tool.PreshowerChannels = [12, 13] + acc.addPublicTool(waveform_tool) + else: print(" - unknown version: user must set up Waveform channel mapping by hand!") diff --git a/Waveform/WaveRecTools/src/ClockReconstructionTool.cxx b/Waveform/WaveRecTools/src/ClockReconstructionTool.cxx index aaae0861b6fab59b7144afedb72797ad9da91f86..c45ea51007362eecd0ab7827f50123c05ddebab7 100644 --- a/Waveform/WaveRecTools/src/ClockReconstructionTool.cxx +++ b/Waveform/WaveRecTools/src/ClockReconstructionTool.cxx @@ -79,8 +79,8 @@ ClockReconstructionTool::reconstruct(const RawWaveform& raw_wave, // Get the coefficients std::vector<double> re_full(N); std::vector<double> im_full(N); - std::vector<double> magnitude(N/2); - fftr2c->GetPointsComplex(&re_full[0],&im_full[0]); + std::vector<double> magnitude(N/2+1); // From fftw manual, output array is N/2+1 long + fftr2c->GetPointsComplex(&re_full[0], &im_full[0]); // Normalize the magnitude (just using the positive complex frequencies) unsigned int i=0; @@ -106,7 +106,7 @@ ClockReconstructionTool::reconstruct(const RawWaveform& raw_wave, clockdata->set_dc_offset(magnitude[0]); clockdata->set_frequency(imax * freqmult); clockdata->set_amplitude(magnitude[imax]); - clockdata->set_phase(atan2(im_full[imax], re_full[imax])); + clockdata->set_phase(atan2(im_full[imax], re_full[imax])); // Not a bug, atan2(y,x)! ATH_MSG_DEBUG("Before correcting for finite resolution:"); ATH_MSG_DEBUG(*clockdata); @@ -125,10 +125,11 @@ ClockReconstructionTool::reconstruct(const RawWaveform& raw_wave, // Improved values + // Not a bug, atan2(y,x)! double phase = atan2(im_full[imax], re_full[imax]) - dm * M_PI; - // Fix any overflows - if (phase < M_PI) phase += (2*M_PI); - if (phase > M_PI) phase -= (2*M_PI); + // Fix any overflows caused by adding dm + if (phase < -M_PI) phase += (2*M_PI); + if (phase > +M_PI) phase -= (2*M_PI); clockdata->set_frequency( (imax+dm) * freqmult ); clockdata->set_phase (phase);