14 #ifndef DataProviderAlg_h 15 #define DataProviderAlg_h 18 #include "cetlib_except/exception.h" 30 #include "CLHEP/Random/JamesRandom.h" 39 class DetectorClocksData;
40 class DetectorPropertiesData;
69 Name(
"CalorimetryAlg"),
70 Comment(
"Used to eliminate amplitude variation due to electron lifetime.")};
78 Comment(
"Calibrate ADC values with CalAmpConstants")};
81 Comment(
"Calibrate ADC values with the electron lifetime")};
84 Comment(
"Downsampling window (in drift ticks).")};
89 Name(
"DownscaleFullView"),
90 Comment(
"Downsample full view (faster / lower location precision)")};
109 const std::vector<recob::Wire>&
115 std::vector<float>
const&
wireData(
size_t widx)
const {
return fAlgView.fWireDriftData[widx]; }
120 std::vector<std::vector<float>>
getPatch(
size_t wire,
123 size_t patchSizeD)
const 126 std::vector<std::vector<float>> patch;
127 if (fDownscaleFullView) {
128 ok = patchFromDownsampledView(wire, drift, patchSizeW, patchSizeD, patch);
131 ok = patchFromOriginalView(wire, drift, patchSizeW, patchSizeD, patch);
134 if (ok)
return patch;
135 throw cet::exception(
"img::DataProviderAlg") <<
"Patch filling failed." << std::endl;
142 size_t didx = getDriftIndex(drift), widx = (size_t)wire;
144 if ((widx < fAlgView.fWireDriftData.size()) && (didx < fAlgView.fNCachedDrifts)) {
145 return fAlgView.fWireDriftData[widx][didx];
154 float poolMax(
int wire,
int drift,
size_t r = 0)
const;
159 unsigned int Cryo()
const {
return fCryo; }
160 unsigned int TPC()
const {
return fTPC; }
161 unsigned int Plane()
const {
return fPlane; }
163 unsigned int NWires()
const {
return fAlgView.fNWires; }
175 return fCalorimetryAlg.LifetimeCorrection(clock_data, det_prop, tick);
187 std::vector<float> downscaleMax(std::size_t dst_size,
188 std::vector<float>
const& adc,
190 std::vector<float> downscaleMaxMean(std::size_t dst_size,
191 std::vector<float>
const& adc,
193 std::vector<float> downscaleMean(std::size_t dst_size,
194 std::vector<float>
const& adc,
197 std::vector<float>
const& adc,
200 switch (fDownscaleMode) {
205 throw cet::exception(
"img::DataProviderAlg") <<
"Downscale mode not supported." << std::endl;
210 if (fDownscaleFullView)
211 return (
size_t)(drift * fDriftWindowInv);
213 return (
size_t)drift;
216 std::optional<std::vector<float>> setWireData(std::vector<float>
const& adc,
217 size_t wireIdx)
const;
219 bool patchFromDownsampledView(
size_t wire,
224 bool patchFromOriginalView(
size_t wire,
243 float scaleAdcSample(
float val)
const;
244 void scaleAdcSamples(std::vector<float>&
values)
const;
247 unsigned int fCryo = 9999, fTPC = 9999, fPlane = 9999;
248 float fAdcMax, fAdcMin, fAdcScale, fAdcOffset,
fAdcZero;
257 void addWhiteNoise();
260 void addCoherentNoise();
unsigned int fNCachedDrifts
unsigned int NCachedDrifts() const
std::vector< std::vector< float > > fWireDriftData
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double tick) const
geo::Geometry const * fGeometry
unsigned int DriftWindow() const
std::vector< float > downscale(std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
DataProviderAlg(const fhicl::ParameterSet &pset)
unsigned int Plane() const
std::vector< float > fBlurKernel
unsigned int NWires() const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
geo::WireReadoutGeom const * fWireReadoutGeom
Interface for a class providing readout channel mapping to geometry.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
unsigned int fNScaledDrifts
std::vector< raw::ChannelID_t > fWireChannels
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
General LArSoft Utilities.
The geometry of one entire detector, as served by art.
DataProviderAlgView fAlgView
calo::CalorimetryAlg fCalorimetryAlg
Contains all timing reference information for the detector.
std::vector< float > fLifetimeCorrFactors
unsigned int Cryo() const
Pool sum of pixels in a patch around the wire/drift pixel.
float getPixelOrZero(int wire, int drift) const
std::vector< float > fAmplCalibConst
unsigned int NScaledDrifts() const
Declaration of basic channel signal object.
std::vector< std::vector< float > > getPatch(size_t wire, float drift, size_t patchSizeW, size_t patchSizeD) const
float ZeroLevel() const
Level of zero ADC after scaling.
EDownscaleMode fDownscaleMode
CLHEP::HepJamesRandom fRndEngine
size_t getAdcArea() const
size_t getDriftIndex(float drift) const
cet::coded_exception< error, detail::translate > exception
std::vector< float > const & wireData(size_t widx) const
map< int, array< map< int, double >, 2 >> Table