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" 60 class FilterAnalyzerRunList;
107 gStyle->SetOptStat(0);
125 std::cout <<
"I have made my useful channel vector. It has size " <<
MyUsefulChans.size() <<
". It's elements are as follows." <<
std::endl;
132 RawFFT_Planes = tfs->make<TH2F>(
"RawFFT_Planes",
"Raw FFT for all channels grouped by plane; Channel Number; Frequency (KHz)", 36, 0, 36, 1000, 0, 1000 );
133 FixFFT_Planes = tfs->make<TH2F>(
"FixFFT_Planes",
"Raw FFT for all channels grouped by plane; Channel Number; Frequency (KHz)", 36, 0, 36, 1000, 0, 1000 );
135 RawFFT_APAs = tfs->make<TH2F>(
"RawFFT_APAs",
"Raw FFT for all channels grouped by plane; Channel Number; Frequency (KHz)", 36, 0, 36, 1000, 0, 1000 );
136 FixFFT_APAs = tfs->make<TH2F>(
"FixFFT_APAs",
"Raw FFT for all channels grouped by plane; Channel Number; Frequency (KHz)", 36, 0, 36, 1000, 0, 1000 );
138 for (
int XBin=0; XBin<36; ++XBin) {
139 std::stringstream oss;
142 int WhPla = (XBin/3)%3;
144 RawFFT_Planes->GetXaxis()->SetBinLabel((WhAPA*3)+(WhPla*12)+PlaIn+1, oss.str().c_str());
145 FixFFT_Planes->GetXaxis()->SetBinLabel((WhAPA*3)+(WhPla*12)+PlaIn+1, oss.str().c_str());
147 RawFFT_APAs->GetXaxis()->SetBinLabel(XBin+1, oss.str().c_str());
148 FixFFT_APAs->GetXaxis()->SetBinLabel(XBin+1, oss.str().c_str());
151 for (
size_t HistoChan=0; HistoChan<
MyUsefulChans.size(); HistoChan++) {
152 std::stringstream oss1a, oss1b;
153 oss1a <<
"RawFFT_"<<HistoChan;
154 oss1b <<
"Raw FFT for Channel "<<
MyUsefulChans[HistoChan]<<
"; Run Number; Frequency (KHz)";
155 FFTRaw[HistoChan] = tfs->make<TH2F>(oss1a.str().c_str(), oss1b.str().c_str(),
NumRuns, 0,
NumRuns, 1000, 0, 1000);
157 std::stringstream oss2a, oss2b;
158 oss2a <<
"FixFFT_"<<HistoChan;
159 oss2b <<
"Fix FFT for Channel "<<MyUsefulChans[HistoChan]<<
"; Run Number; Frequency (KHz)";
160 FFTFix[HistoChan] = tfs->make<TH2F>(oss2a.str().c_str(), oss2b.str().c_str(),
NumRuns, 0,
NumRuns, 1000, 0, 1000);
172 std::vector<double> colFiltParams = pset.
get<std::vector<double> >(
"ColFilterParams");
174 for(
unsigned int i=0; i<colFiltParams.size(); ++i)
175 fColFilterFunc->SetParameter(i, colFiltParams[i]);
178 std::vector<double> indUFiltParams = pset.
get<std::vector<double> >(
"IndUFilterParams");
180 for(
unsigned int i=0; i<indUFiltParams.size(); ++i)
181 fIndUFilterFunc->SetParameter(i, indUFiltParams[i]);
184 std::vector<double> indVFiltParams = pset.
get<std::vector<double> >(
"IndVFilterParams");
186 for(
unsigned int i=0; i<indVFiltParams.size(); ++i)
187 fIndVFilterFunc->SetParameter(i, indVFiltParams[i]);
191 if (evt.
event() != 1)
return;
195 for (
size_t HistoChan=0; HistoChan<
MyUsefulChans.size(); HistoChan++) {
196 std::stringstream oss;
197 oss<<
"Run "<<(
int)evt.
run();
206 std::vector<raw::RawDigit>
const& rawDigitVector(*rawDigitHandle);
209 std::vector< std::pair<int,int> > ZeroFreq;
216 for (
size_t DigLoop=0; DigLoop < rawDigitVector.size(); ++DigLoop) {
217 int Channel = rawDigitVector[DigLoop].Channel();
218 size_t NADC = rawDigitVector[DigLoop].NADC();
219 double Pedestal = rawDigitVector[DigLoop].GetPedestal();
222 for (
size_t GotChan=0; GotChan<
MyUsefulChans.size(); ++GotChan) {
225 int WhAPA = GotChan/9;
226 int WhPla = (GotChan/3)%3;
227 int PlaIn = GotChan%3;
236 TH1F* hRawDigit =
new TH1F(
"hRawDigit",
"",NADC,0,NADC/2);
237 TH1F* hRawFFT =
new TH1F(
"hRawFFT" ,
"",NADC,0,NADC);
238 for (
size_t ADCs=0; ADCs < NADC; ++ADCs) {
239 hRawDigit -> SetBinContent( ADCs+1, rawDigitVector[DigLoop].ADC(ADCs)-Pedestal );
241 for (
size_t ww=NADC; ww<NADC; ++ww)
242 hRawFFT -> SetBinContent( ww, 0 );
244 hRawDigit -> FFT( hRawFFT ,
"MAG");
245 for (
size_t bin = 0;
bin < NADC; ++
bin) {
246 double BinVal = hRawFFT->GetBinContent(
bin+1);
247 double freq = 2000. *
bin / (double)NADC;
248 if (freq < 1000 && BinVal < 1e5) {
250 RawFFT_Planes -> Fill( (WhAPA*3)+(WhPla*12)+PlaIn+0.5, freq, BinVal );
257 std::unique_ptr<double[]> Re(
new double[NADC]);
258 std::unique_ptr<double[]> Im(
new double[NADC]);
259 TVirtualFFT *fft = TVirtualFFT::GetCurrentTransform();
260 fft->GetPointsComplex(Re.get(),Im.get());
263 for (
size_t aa=0; aa<ZeroFreq.size(); ++aa) {
264 for (
int bb=ZeroFreq[aa].first; bb<ZeroFreq[aa].second; ++bb) {
268 for (
int cc=0; cc<Range; ++cc) {
269 ReMeanVal += Re[ZeroFreq[aa].first-cc] + Re[ZeroFreq[aa].second+cc];
270 ImMeanVal += Im[ZeroFreq[aa].first-cc] + Im[ZeroFreq[aa].second+cc];
272 ReMeanVal = ReMeanVal / Range;
273 Re[bb] = Re[1500-bb] = ReMeanVal;
274 ImMeanVal = ImMeanVal / Range;
275 Im[bb] = Im[1500-bb] = ImMeanVal;
282 for (
size_t bin = 0;
bin < NADC; ++
bin) {
283 double freq = 2000. *
bin / NADC;
295 if (TMath::IsNaN(MagVal)) MagVal = 0;
298 if (freq < 1000 && MagVal < 1e5) {
300 FixFFT_Planes -> Fill( (WhAPA*3)+(WhPla*12)+PlaIn+0.5, freq, MagVal );
void reconfigure(const fhicl::ParameterSet &pset)
std::string fDigitModuleLabel
EventNumber_t event() const
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< int > MyUsefulChans
Definition of basic raw digits.
Planes which measure Z direction.
EDAnalyzer(fhicl::ParameterSet const &pset)
FilterAnalyzerRunList(fhicl::ParameterSet const &pset)
std::string fDigitModuleInstance
TF1 * fIndUFilterFunc
Parameterized induction filter function.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
Collect all the RawData header files together.
T get(std::string const &key) const
TF1 * fIndVFilterFunc
Parameterized induction filter function.
FilterAnalyzerRunList & operator=(FilterAnalyzerRunList const &)=delete
TF1 * fColFilterFunc
Parameterized collection filter function.
void analyze(art::Event const &evt) override
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
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.
QTextStream & endl(QTextStream &s)