9 #ifndef RecoWireICARUSRaw_H
10 #define RecoWireICARUSRaw_H
20 #include "fhiclcpp/ParameterSet.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 #include "cetlib_except/exception.h"
23 #include "cetlib/search_path.h"
24 #include "canvas/Persistency/Common/Ptr.h"
25 #include "canvas/Persistency/Common/Assns.h"
26 #include "art/Framework/Principal/Event.h"
27 #include "art/Framework/Principal/Handle.h"
28 #include "art/Framework/Services/Registry/ServiceHandle.h"
29 #include "art/Framework/Core/EDProducer.h"
30 #include "art/Framework/Core/ModuleMacros.h"
31 #include "art_root_io/TFileService.h"
86 produces< std::vector<recob::Wire> >();
87 produces<art::Assns<raw::RawDigit, recob::Wire>>();
108 art::ServiceHandle<art::TFileService>
tfs;
110 fWireRMS = tfs->make<TH1F>(
"fWireRMS",
"RMS(ADC#)", 1000, 0, 10);
122 art::ServiceHandle<geo::Geometry> geom;
125 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
127 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn(
new art::Assns<raw::RawDigit,recob::Wire>);
129 mf::LogDebug(
"RecoWireICARUSRaw") <<
" before wirecol size " << wirecol->size() << std::endl;
132 art::Handle< std::vector<raw::RawDigit> > digitVecHandle;
135 if (digitVecHandle.isValid() && digitVecHandle->size() > 0)
137 mf::LogInfo(
"RecoWireICARUSRaw") <<
"RecoWireICARUSRaw:: digitVecHandle size is " << digitVecHandle->size();
140 art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
142 unsigned int dataSize = digitVec0->Samples();
148 std::vector<float> holder;
149 std::vector<short> rawadc(dataSize);
151 wirecol->reserve(digitVecHandle->size());
154 for(
unsigned int rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) {
157 art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
158 channel = digitVec->Channel();
163 std::vector<geo::WireID> wids = geom->ChannelToWire(channel);
165 if (wids.empty())
continue;
169 holder.resize(dataSize);
174 for(bin = 0; bin < dataSize; ++
bin)
175 holder[bin]=(rawadc[bin]-digitVec->GetPedestal());
186 for(
int js=0;js<4096;js++)
187 media+=(holder[js]/4096.);
188 for(
int js=0;js<4096;js++)
189 rms2+=(holder[js]-media)*(holder[js]-media)/4096.;
190 float rms=sqrt(rms2);
198 throw art::Exception(art::errors::ProductRegistrationFailure)
199 <<
"Can't associate wire #" << (wirecol->size() - 1)
200 <<
" with raw digit #" << digitVec.key();
211 if(wirecol->size() == 0)
212 mf::LogWarning(
"RecoWireICARUSRaw") <<
"No wires made for this event.";
214 evt.put(std::move(wirecol));
215 evt.put(std::move(WireDigitAssn));
225 double integral[4096];
229 for(
int j=0;j<4096;j++)
234 integral[0]=signal[0];
235 for(
int j=1;j<4096;j++)
236 integral[j]=integral[j-1]*
exp(-0.4/tau0)+signal[j];
252 for(
int j=1;j<4096;j++) {
253 sum_tot+=integral[j];
254 outl[j]=outl[j-1]*
exp(-0.4/tl)+integral[j];
258 outb[4095]=integral[4095];
260 for(
int j=4094;j>=0;j--) {
261 outb[j]=outb[j+1]*
exp(-0.4/tl)+integral[j];
266 for(
int j=1;j<4096;j++) {
267 sum_tot+=integral[j];
269 outs[j]=outs[j-1]*
exp(-0.4/ts)+integral[j];
274 double nl=(1-
exp(-0.4/tl));
275 double ns=(1-
exp(-0.4/ts));
281 for(
int j=0;j<4096;j++)
283 for(
int j=0;j<4096;j++)
285 for(
int j=0;j<4096;j++)
287 for(
int j=0;j<4096;j++)
291 for(
int j=0;j<4096;j++) {
292 double media=0.5*(outl[j]+outb[j]);
293 data[j]=round(outs[j]*(ns*1.)-media*(nl*1.));
294 data[j]=round(integral[j]);
308 for(
int js=0;js<4096;js++)
325 std::vector<int> vout;
326 for(
int jj=il;jj<=fr;jj++) {
334 for(
int jj=fl;jj<ir;jj++)
347 for(
int j=0;j<3996;j++)
349 for(
int j=3996;j<4096;j++)
360 DEFINE_ART_MODULE(RecoWireICARUSRaw)
365 #endif // RecoWireICARUSRawH
Utilities related to art service access.
void DoubleRebinning(std::vector< float > &)
Helper functions to create a wire.
void produce(art::Event &evt)
Definition of basic raw digits.
Class managing the creation of a new recob::Wire object.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::string fDigitModuleLabel
module that made digits
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Collect all the RawData header files together.
process_name tightIsolTest check
Class providing information about the quality of channels.
PlaneID_t Plane
Index of the plane within its TPC.
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
virtual ~RecoWireICARUSRaw()
Encapsulate the construction of a single detector plane.
const lariov::ChannelStatusProvider * fChannelFilter
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
Interface for experiment-specific channel quality info provider.
Declaration of basic channel signal object.
art::ServiceHandle< art::TFileService > tfs
void reconfigure(fhicl::ParameterSet const &p)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Interface for experiment-specific service for channel quality info.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
void OfflineIntegration(std::vector< float > &)
RecoWireICARUSRaw(fhicl::ParameterSet const &pset)
art framework interface to geometry description