31 #include "art/Framework/Core/EDProducer.h"
32 #include "art/Framework/Core/ModuleMacros.h"
33 #include "art/Framework/Principal/Event.h"
34 #include "fhiclcpp/ParameterSet.h"
35 #include "art/Framework/Principal/Handle.h"
36 #include "canvas/Utilities/Exception.h"
80 std::vector<double>
_wf;
94 DEFINE_ART_MODULE(FullOpHitFinder)
107 fInputModule = pset.get< std::string >(
"InputModule");
108 fInputLabels = pset.get< std::vector< std::string > >(
"InputLabels");
110 for (
auto const& ch : pset.get< std::vector< unsigned int > >
111 (
"ChannelMasks", std::vector< unsigned int >()))
112 fChannelMasks.insert(ch);
115 auto const hit_alg_pset = pset.get< fhicl::ParameterSet >(
"HitAlgoPset");
116 std::string threshAlgName = hit_alg_pset.get< std::string >(
"Name");
117 if (threshAlgName ==
"Threshold")
119 else if (threshAlgName ==
"SiPM")
121 else if (threshAlgName ==
"SlidingWindow")
123 else if (threshAlgName ==
"FixedWindow")
125 else if (threshAlgName ==
"CFD" )
127 else throw art::Exception(art::errors::UnimplementedFeature)
128 <<
"Cannot find implementation for "
129 << threshAlgName <<
" algorithm.\n";
131 auto const ped_alg_pset = pset.get< fhicl::ParameterSet >(
"PedAlgoPset");
132 std::string pedAlgName = ped_alg_pset.get< std::string >(
"Name");
133 if (pedAlgName ==
"Edges")
135 else if (pedAlgName ==
"RollingMean")
137 else if (pedAlgName ==
"UB" )
139 else throw art::Exception(art::errors::UnimplementedFeature)
140 <<
"Cannot find implementation for "
141 << pedAlgName <<
" algorithm.\n";
143 fPulseRecoMgr.AddRecoAlgo(fThreshAlg);
144 fPulseRecoMgr.SetDefaultPedAlgo(fPedAlg);
146 _output_filename = pset.get<std::string>(
"OutputFile",
"out.root");
155 _wftree =
new TTree(
"wftree",
"wftree");
156 _wftree->Branch(
"run",&
_run,
"run/I");
157 _wftree->Branch(
"event",&
_event,
"event/I");
158 _wftree->Branch(
"ch",&
_ch,
"ch/I");
159 _wftree->Branch(
"wf",&
_wf);
162 _wftree->Branch(
"tstart",&
_tstart,
"tstart/D");
164 _hittree =
new TTree(
"hittree",
"hittree");
177 _geotree =
new TTree(
"geotree",
"geotree");
178 std::vector<double> pmtX, pmtY, pmtZ;
179 std::vector<double> minX, minY, minZ;
180 std::vector<double> maxX, maxY, maxZ;
181 auto const geop = lar::providerFrom<geo::Geometry>();
183 for(
size_t opch=0; opch<geop->NOpChannels(); ++opch) {
184 geop->OpDetGeoFromOpChannel(opch).GetCenter(PMTxyz);
185 pmtX.push_back(PMTxyz[0]);
186 pmtY.push_back(PMTxyz[1]);
187 pmtZ.push_back(PMTxyz[2]);
189 for(
auto iter=geop->begin_TPC(); iter!=geop->end_TPC(); ++iter) {
190 auto const& tpc = (*iter);
191 minX.push_back(tpc.BoundingBox().MinX());
192 minY.push_back(tpc.BoundingBox().MinY());
193 minZ.push_back(tpc.BoundingBox().MinZ());
194 maxX.push_back(tpc.BoundingBox().MaxX());
195 maxY.push_back(tpc.BoundingBox().MaxY());
196 maxZ.push_back(tpc.BoundingBox().MaxZ());
233 _event = evt.id().event();
234 _run = evt.id().run();
237 std::unique_ptr< std::vector< recob::OpHit > >
238 HitPtr(
new std::vector< recob::OpHit >);
244 if(fInputLabels.empty()) fInputLabels.push_back(
"");
245 for (
auto label : fInputLabels) {
247 art::Handle< std::vector< raw::OpDetWaveform > > wfHandle;
249 if (!wfHandle.isValid())
continue;
251 for(
auto const& waveform : (*wfHandle)) {
253 _ch =
static_cast< int >(waveform.ChannelNumber());
254 _tstart = waveform.TimeStamp();
257 _wf.resize(waveform.size());
258 for(
size_t idx=0; idx<
_wf.size(); ++idx)
259 _wf[idx] = waveform[idx];
270 size_t npulse = pulses.size();
275 for(
size_t idx=0; idx<npulse; ++idx) {
276 auto const& pulse = pulses[idx];
std::vector< double > _tcross_v
std::vector< double > _ped_mean_v
double Mean(size_t i) const
Getter of the pedestal mean value.
Utilities related to art service access.
std::vector< double > _amp_v
void produce(art::Event &)
std::vector< double > _tend_v
std::vector< double > _area_v
std::vector< double > _tmax_v
std::vector< std::string > fInputLabels
pmtana::PMTPedestalBase * fPedAlg
pmtana::PMTPulseRecoBase * fThreshAlg
std::map< int, int > GetChannelMap()
const pulse_param_array & GetPulses() const
A getter for the whole array of pulse_param struct object.
Class definition file of PedAlgoRollingMean.
double Sigma(size_t i) const
Getter of the pedestal standard deviation.
Class definition file of AlgoCFD.
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
std::vector< double > GetSPEShifts()
Class definition file of PedAlgoUB.
std::vector< double > _tstart_v
std::string _output_filename
Class definition file of AlgoFixedWindow.
std::vector< double > _wf
Class definition file of AlgoSlidingWindow.
Class definition file of AlgoThreshold.
std::set< unsigned int > fChannelMasks
std::vector< double > _ped_sigma_v
Class definition file of PMTPulseRecoBase.
virtual ~FullOpHitFinder()
Class definition file of PedAlgoEdges.
pmtana::PulseRecoManager fPulseRecoMgr
std::vector< double > GetSPEScales()
FullOpHitFinder(const fhicl::ParameterSet &)
art framework interface to geometry description
Class definition file of PulseRecoManager.