12 #include "art/Framework/Core/EDAnalyzer.h"
13 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Principal/Event.h"
15 #include "fhiclcpp/ParameterSet.h"
16 #include "art/Framework/Principal/Handle.h"
17 #include "canvas/Persistency/Common/Ptr.h"
18 #include "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "art_root_io/TFileService.h"
36 void analyze (
const art::Event&);
71 art::ServiceHandle<OpDigiProperties> odp;
72 fSPEAmp = odp->GetSPECumulativeAmplitude();
94 art::Handle< std::vector< raw::OpDetPulse > > WaveformHandle;
105 art::ServiceHandle<art::TFileService const>
tfs;
108 std::vector<std::string> histnames;
111 for(
unsigned int i = 0; i < WaveformHandle->size(); ++i)
114 art::Ptr< raw::OpDetPulse > ThePulsePtr(WaveformHandle, i);
124 unsigned int pulsenum = 0;
126 sprintf(HistName,
"Event_%d_OpDet_%i_Pulse_%i", evt.id().event(), ThePulse.
OpChannel(), pulsenum);
127 auto p = std::find(histnames.begin(), histnames.end(), HistName);
128 if ( p != histnames.end() ) {
134 histnames.push_back(HistName);
141 TH1D* PulseHist =
nullptr;
144 PulseHist= tfs->make<TH1D>(HistName,
";t (ns);",
150 sprintf(HistName,
"Event_%d_uni_OpDet_%i_Pulse_%i", evt.id().event(), ThePulse.
OpChannel(), pulsenum);
151 TH1D* UnipolarHist =
nullptr;
154 UnipolarHist= tfs->make<TH1D>(HistName,
";t (ns);",
160 for(
unsigned int binNum = 0; binNum < ThePulse.
Waveform().size(); ++binNum)
165 (
double) ThePulse.
Waveform()[binNum] );
168 double BinContent = (double) ThePulse.
Waveform()[binNum] +
169 (double) UnipolarHist->GetBinContent(binNum-1);
171 UnipolarHist->SetBinContent(binNum,BinContent);
173 UnipolarHist->SetBinContent(binNum,0);
187 DEFINE_ART_MODULE(OpDigiAna)
unsigned short OpChannel() const
const std::vector< short > & Waveform() const
std::string fInstanceName
OpDigiAna(const fhicl::ParameterSet &)
void analyze(const art::Event &)
art::ServiceHandle< art::TFileService > tfs