20 #include "art_root_io/TFileService.h" 21 #include "art_root_io/TFileDirectory.h" 27 #include "lbne-raw-data/Overlays/TpcMilliSliceFragment.hh" 28 #include "artdaq-core/Data/Fragment.hh" 56 #include "TVirtualFFT.h" 107 gStyle->SetOptStat(0);
110 RawFFT_100KHz = tfs->make<TH2F>(
"RawFFT_100KHz" ,
"Raw FFT for all channels less than 100 KHz; Channel Number; Frequency (KHz)" , 2048, 0, 2048, 100, 0, 100 );
111 FixFFT_100KHz = tfs->make<TH2F>(
"FixFFT_100KHz" ,
"FFT for all channels less than 100 KHz after filtering; Channel Number; Frequency (KHz)" , 2048, 0, 2048, 100, 0, 100 );
112 RawFFT_1000KHz = tfs->make<TH2F>(
"RawFFT_1000KHz",
"Raw FFT for all channels less than 1000 KHz; Channel Number; Frequency (KHz)" , 2048, 0, 2048, 1000, 0, 1000);
113 FixFFT_1000KHz = tfs->make<TH2F>(
"FixFFT_1000KHz",
"FFT for all channels less than 1000 KHz after filtering; Channel Number; Frequency (KHz)", 2048, 0, 2048, 1000, 0, 1000);
116 for (
int HistoChan=0; HistoChan<2048; HistoChan++) {
119 std::stringstream oss1, oss2;
120 oss1 <<
"RawDigit_"<<HistoChan;
121 oss2 <<
"Raw Digit for Channel "<<HistoChan<<
"; Time (us); ADC";
125 else RawDigitHistos[HistoChan] =
new TH1F(Name1.c_str(), Title1.c_str(), NumBins, 0, NumBins/2);
128 std::stringstream oss3, oss3a, oss4;
129 oss3 <<
"FFT_"<<HistoChan;
130 oss3a <<
"FFT_"<<HistoChan<<
"_correct";
131 oss4 <<
"FFT of Raw Digit for Channel "<<HistoChan<<
" in frequency domain";
135 RawDigitFFT[HistoChan] =
new TH1F(Name2.c_str(), Title2.c_str(), NumBins, 0, NumBins);
136 RawDigitFFTCorrect[HistoChan] =
new TH1F(Name2a.c_str(),Title2.c_str(), NumBins, 0, NumBins);
139 std::stringstream oss5, oss5a, oss6;
140 oss5 <<
"ChanFFT_"<<HistoChan;
141 oss6 <<
"FFT of Raw Digit for Channel "<<HistoChan<<
"; Frequency (KHz); Number";
144 RawDigitFFTChannel[HistoChan] =
new TH1F(Name3.c_str(), Title3.c_str(), NumBins, 0, 2000);
147 std::stringstream oss9, oss10;
148 oss9 <<
"ChanFFT_"<<HistoChan<<
"_Filter";
149 oss10 <<
"FFT of Raw Digit for Channel "<<HistoChan<<
" after filter is applied; Frequency (KHz); Number";
155 std::stringstream oss7, oss8;
156 oss5 <<
"InvFFT_"<<HistoChan;
157 oss6 <<
"Inverse FFT of the FFT Channel "<<HistoChan<<
" histogram; Time (us); ADC";
160 RawDigitInvFFT[HistoChan] =
new TH1F(Name4.c_str(), Title4.c_str(), NumBins, 0, NumBins/2);
170 std::vector<double> colFiltParams = pset.
get<std::vector<double> >(
"ColFilterParams");
172 for(
unsigned int i=0; i<colFiltParams.size(); ++i)
173 fColFilterFunc->SetParameter(i, colFiltParams[i]);
176 std::vector<double> indUFiltParams = pset.
get<std::vector<double> >(
"IndUFilterParams");
178 for(
unsigned int i=0; i<indUFiltParams.size(); ++i)
179 fIndUFilterFunc->SetParameter(i, indUFiltParams[i]);
182 std::vector<double> indVFiltParams = pset.
get<std::vector<double> >(
"IndVFilterParams");
184 for(
unsigned int i=0; i<indVFiltParams.size(); ++i)
185 fIndVFilterFunc->SetParameter(i, indVFiltParams[i]);
194 std::vector<raw::RawDigit>
const& rawDigitVector(*rawDigitHandle);
196 std::vector< std::pair<int,int> > ZeroFreq;
203 for (
size_t DigLoop=0; DigLoop < rawDigitVector.size(); ++DigLoop) {
205 int Channel = rawDigitVector[DigLoop].Channel();
206 size_t NADC = rawDigitVector[DigLoop].NADC();
207 double Pedestal = rawDigitVector[DigLoop].GetPedestal();
215 for (
size_t ADCs=0; ADCs < NADC; ++ADCs) {
218 for (
int ww=NADC; ww<16384; ++ww)
226 if (freq < 1000 && BinVal < 1e5) {
237 std::unique_ptr<double[]> Re(
new double[NADC]);
238 std::unique_ptr<double[]> Im(
new double[NADC]);
239 TVirtualFFT *fft = TVirtualFFT::GetCurrentTransform();
240 fft->GetPointsComplex(Re.get(),Im.get());
243 for (
size_t aa=0; aa<ZeroFreq.size(); ++aa) {
244 for (
int bb=ZeroFreq[aa].first; bb<ZeroFreq[aa].second; ++bb) {
248 for (
int cc=0; cc<Range; ++cc) {
249 ReMeanVal += Re[ZeroFreq[aa].first-cc] + Re[ZeroFreq[aa].second+cc];
250 ImMeanVal += Im[ZeroFreq[aa].first-cc] + Im[ZeroFreq[aa].second+cc];
252 ReMeanVal = ReMeanVal / Range;
253 Re[bb] = Re[1500-bb] = ReMeanVal;
254 ImMeanVal = ImMeanVal / Range;
255 Im[bb] = Im[1500-bb] = ImMeanVal;
256 double MagVal =
pow ( Re[bb]*Re[bb] + Im[bb]*Im[bb], 0.5);
268 double freq = 2000. *
bin / NBins;
280 if (TMath::IsNaN(MagVal)) MagVal = 0;
293 TVirtualFFT *fft_back = TVirtualFFT::FFT(1, &NBins,
"C2R");
294 fft_back->SetPointsComplex(Re.get(),Im.get());
295 fft_back->Transform();
297 hb = TH1::TransformHisto(fft_back, hb,
"Re");
298 for (
int BinNum=0; BinNum<NBins; ++BinNum) {
void analyze(art::Event const &evt) override
FilterAnalyzer & operator=(FilterAnalyzer const &)=delete
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
TH1F * RawDigitFFTChannelFilter[2048]
Definition of basic raw digits.
Planes which measure Z direction.
EDAnalyzer(fhicl::ParameterSet const &pset)
TF1 * fColFilterFunc
Parameterized collection filter function.
TF1 * fIndVFilterFunc
Parameterized induction filter function.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
FilterAnalyzer(fhicl::ParameterSet const &pset)
Collect all the RawData header files together.
T get(std::string const &key) const
TH1F * RawDigitHistos[2048]
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
TF1 * fIndUFilterFunc
Parameterized induction filter function.
std::string fDigitModuleInstance
std::string fDigitModuleLabel
TH1F * RawDigitFFTCorrect[2048]
void reconfigure(const fhicl::ParameterSet &pset)
TH1F * RawDigitFFTChannel[2048]
ChannelMappingService::Channel Channel
QTextStream & bin(QTextStream &s)
Interface for experiment-specific channel quality info provider.
Interface for experiment-specific service for channel quality info.
Namespace collecting geometry-related classes utilities.
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
TH1F * RawDigitInvFFT[2048]