14 #ifndef DataProviderAlg_h 15 #define DataProviderAlg_h 18 #include "cetlib_except/exception.h" 32 #include "CLHEP/Random/JamesRandom.h" 41 class DetectorClocksData;
42 class DetectorPropertiesData;
71 Name(
"CalorimetryAlg"),
72 Comment(
"Used to eliminate amplitude variation due to electron lifetime.")};
80 Comment(
"Calibrate ADC values with CalAmpConstants")};
83 Comment(
"Calibrate ADC values with the electron lifetime")};
86 Comment(
"Downsampling window (in drift ticks).")};
91 Name(
"DownscaleFullView"),
92 Comment(
"Downsample full view (faster / lower location precision)")};
111 const std::vector<recob::Wire>&
117 std::vector<float>
const&
wireData(
size_t widx)
const {
return fAlgView.fWireDriftData[widx]; }
122 std::vector<std::vector<float>>
getPatch(
size_t wire,
125 size_t patchSizeD)
const 128 std::vector<std::vector<float>> patch;
129 if (fDownscaleFullView) {
130 ok = patchFromDownsampledView(wire, drift, patchSizeW, patchSizeD, patch);
133 ok = patchFromOriginalView(wire, drift, patchSizeW, patchSizeD, patch);
136 if (ok)
return patch;
137 throw cet::exception(
"img::DataProviderAlg") <<
"Patch filling failed." << std::endl;
144 size_t didx = getDriftIndex(drift), widx = (size_t)wire;
146 if ((widx < fAlgView.fWireDriftData.size()) && (didx < fAlgView.fNCachedDrifts)) {
147 return fAlgView.fWireDriftData[widx][didx];
156 float poolMax(
int wire,
int drift,
size_t r = 0)
const;
161 unsigned int Cryo()
const {
return fCryo; }
162 unsigned int TPC()
const {
return fTPC; }
163 unsigned int Plane()
const {
return fPlane; }
165 unsigned int NWires()
const {
return fAlgView.fNWires; }
177 return fCalorimetryAlg.LifetimeCorrection(clock_data, det_prop, tick);
189 std::vector<float> downscaleMax(std::size_t dst_size,
190 std::vector<float>
const& adc,
192 std::vector<float> downscaleMaxMean(std::size_t dst_size,
193 std::vector<float>
const& adc,
195 std::vector<float> downscaleMean(std::size_t dst_size,
196 std::vector<float>
const& adc,
199 std::vector<float>
const& adc,
202 switch (fDownscaleMode) {
207 throw cet::exception(
"img::DataProviderAlg") <<
"Downscale mode not supported." << std::endl;
212 if (fDownscaleFullView)
213 return (
size_t)(drift * fDriftWindowInv);
215 return (
size_t)drift;
218 std::optional<std::vector<float>> setWireData(std::vector<float>
const& adc,
219 size_t wireIdx)
const;
221 bool patchFromDownsampledView(
size_t wire,
226 bool patchFromOriginalView(
size_t wire,
244 float scaleAdcSample(
float val)
const;
245 void scaleAdcSamples(std::vector<float>&
values)
const;
248 unsigned int fCryo = 9999, fTPC = 9999, fPlane = 9999;
249 float fAdcMax, fAdcMin, fAdcScale, fAdcOffset,
fAdcZero;
258 void addWhiteNoise();
261 void addCoherentNoise();
geo::GeometryCore const * fGeometry
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
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.
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.
Description of geometry of one entire detector.
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
Namespace collecting geometry-related classes utilities.
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