30 #include "art_root_io/TFileService.h" 31 #include "art_root_io/TFileDirectory.h" 34 #include "canvas/Persistency/Common/FindManyP.h" 56 void calculateFFT(TH1D* hist_waveform, TH1D* graph_frequency);
84 std::map<size_t,TH1D*>
fft_;
115 fHEventNumber = tFileService->make<TH1I>(
"EventNumber",
"SSP: EventNumber;Event Number", 100, 0, 10000);
116 adc_values_ = tFileService->make<TH1D>(
"ssp_adc_values",
"SSP: ADC_Values;ADC Value",4096,-0.5,4095.5);
117 peaks_ = tFileService->make<TH1D>(
"peaks",
"Peak Amplitudes;Peak Amplitude",100,-30,50);
118 areas_ = tFileService->make<TH1D>(
"areas",
"Hit Areas;Hit Area",100,-10000,15000);
121 hit_times_->GetYaxis()->SetTitle(
"Number of hits");
122 hit_times_->GetXaxis()->SetTitle(
"Time [s]");
146 for(
unsigned int i = 0; i < OpHitHandle->size(); ++i)
174 for(
size_t iwaveform = 0; iwaveform < OpDetWaveformHandle->size(); ++iwaveform)
178 size_t nADC = odp->size();
180 TH1D *
hist =
new TH1D(
"hist",
"hist",nADC,0,nADC);
185 pwave->SetTitle(Form(
"Persistent waveform - Channel %d",
channel));
186 pwave->GetYaxis()->SetTitle(
"ADC value");
187 pwave->GetXaxis()->SetTitle(
"Time sample");
192 TH1D *fftp = tFileService->make<TH1D>(Form(
"fft_channel_%d",
channel),Form(
"fft_channel_%d",
channel), 100,0,4);
193 fftp->SetTitle(Form(
"FFT - Channel %d",
channel));
194 fftp->GetXaxis()->SetTitle(
"Frequency [MHz]");
199 for (
size_t iadc=0; iadc < nADC; ++iadc)
201 auto adcval = odp->at(iadc);
205 pwavep->Fill(iadc,adcval,1);
206 hist->SetBinContent(iadc+1,adcval);
215 sprintf(histname,
"evt%i_channel%d",evt.
event(),
channel);
216 TH1D *htf = tFileService->make<TH1D>(histname,histname,nADC,0,nADC);
232 int n_bins = hist_waveform->GetNbinsX();
233 TH1* hist_transform = 0;
236 hist_transform = hist_waveform->FFT(hist_transform,
"MAG");
237 hist_transform ->
Scale (1.0 /
float(n_bins));
238 int nFFT=hist_transform->GetNbinsX();
244 for (
int k = 2;
k <= nFFT/40; ++
k){
246 frequency = (
k-1)/(n_bins/150.);
247 amplitude = hist_transform->GetBinContent(
k);
249 hist_frequency->Fill(frequency, amplitude);
252 hist_transform->Delete();
SSPMonitor(const fhicl::ParameterSet &)
EventNumber_t event() const
std::string fOpDetWaveformModuleLabel
Handle< PROD > getHandle(SelectorBase const &) const
void analyze(const art::Event &)
void calculateFFT(TH1D *hist_waveform, TH1D *graph_frequency)
std::set< size_t > has_waveform
std::map< size_t, TH1D * > fft_
Scale(size_t pos, T factor) -> Scale< T >
EDAnalyzer(fhicl::ParameterSet const &pset)
std::map< size_t, TH2D * > persistent_waveform_
std::map< size_t, TH1D * > chan_areas_
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
std::string fOpHitModuleLabel
double PeakTimeAbs() const
std::map< size_t, TH1D * > chan_peaks_