All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SignalShapingICARUSService_service.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////
2 ///
3 /// \file SignalShapingICARUSService.h
4 ///
5 /// \brief Service to provide ICARUS-specific signal shaping for
6 /// simulation (convolution) and reconstruction (deconvolution)./Users/Lsrea/newSim/SignalShapingICARUSService.h
7 ///
8 /// \author H. Greenlee, major mods by L. Rochester
9 ///
10 /// This service inherits from SignalShaping and supplies
11 /// ICARUS-specific configuration. It is intended that SimWire and
12 /// CalWire modules will access this service.
13 ///
14 /// FCL parameters:
15 ///
16 /// FieldBins - Number of bins of field response (generated from the histogram).
17 /// Col3DCorrection - 3D path length correction for collection plane. (not invoked)
18 /// Ind3DCorrection - 3D path length correction for induction plane. (not invoked)
19 /// FieldRespAmpVec - vector of response amplitudes, one for each view
20 /// ShapeTimeConst - Time constants for exponential shaping.
21 /// FilterVec - vector of filter function parameters, one for each view
22 /// FilterParamsVec - Vector of filter function parameters.
23 ///
24 /// \update notes: Leon Rochester (lsrea@slac.stanford.edu, Jan 12, 2015
25 /// many changes, need to be documented better
26 /// 1. the three (or n) views are now represented by a vector of views
27 /// 2. There are separate SignalShaping objects for convolution and
28 /// deconvolution
29 ///
30 /// Yun-Tse Tsai (yuntse@slac.stanford.edu), July 17th, 2014
31 /// 1. Read in field responses from input histograms
32 /// 2. Allow different sampling rates in the input
33 /// field response
34 /// NOTE: The InputFieldRespSamplingRate parameter has
35 /// NOT implemented for the field response input
36 /// as a function (UseFunctionFieldShape)
37 /// 3. Allow different electron drift velocities from
38 /// which the input field responses are obtained
39 /// 4. Convolute the field and electronic responses,
40 /// and then sample the convoluted function with
41 /// the nominal sampling rate (detinfo::DetectorPropertiesService).
42 /// NOTE: Currently this doesn't include the filter
43 /// function and the deconvolution kernel.
44 /// We may want to include them later?
45 /// 5. Disable fColSignalShaping.SetPeakResponseTime(0.),
46 /// so that the peak time in the input field response
47 /// is preserved.
48 /// 6. Somebody needs to unify the units of time (microsec
49 /// or nanosec); I'm fainting!
50 ///
51 /// New function: void SetResponseSampling();
52 ///
53 /// Modified functions: void init();
54 /// void SetFieldResponse();
55 ///
56 /// New FCL parameters:
57 /// DefaultDriftVelocity - The electron drift velocity used to obtain
58 /// the input field response waveforms
59 /// InputFieldRespSamplingRate - The sampling rate in the input field response
60 /// UseHistogramFieldShape - Use the field response from an input histogram,
61 /// if both UseFunctionFieldShape and
62 /// UseHistogramFieldShape are false, we will
63 /// use the toy field responses (a bipolar square
64 /// function for induction planes, a ramp function
65 /// for collection planes.)
66 /// FieldResponseFname - Name of the file containing the input field
67 /// response histograms
68 /// FieldResponseHistoName - Name of the field response histograms,
69 /// the format in the code will be
70 /// FieldResponseHistoName_U(V,Y)
71 ///update notes: Jyoti Joshi (jjoshi@bnl.gov), Jan 13, 2015
72 // 1. Modification to GetShapingTime function to read in different
73 // shaping time for different planes
74 // 2. Modification to GetASICGain fucntion to read in different gain
75 // settings for different planes
76 ////////////////////////////////////////////////////////////////////////
77 
78 #ifndef SignalShapingICARUSService_H
79 #define SignalShapingICARUSService_H
80 
81 #include <vector>
82 #include <map>
83 #include "fhiclcpp/ParameterSet.h"
84 #include "art/Framework/Services/Registry/ActivityRegistry.h"
85 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
86 #include "art/Framework/Services/Registry/ServiceHandle.h"
87 
89 #include "TH1D.h"
90 
91 using DoubleVec = std::vector<double>;
92 using DoubleVec2 = std::vector<DoubleVec>;
93 
94 namespace icarusutil {
95 
96 class SignalShapingICARUSService //: private lar::EnsureOnlyOneSchedule
97 {
98 public:
99 
100  // Constructor, destructor.
101  SignalShapingICARUSService(const fhicl::ParameterSet& pset,
102  art::ActivityRegistry& reg);
103 
104  // Update configuration parameters.
105  void reconfigure(const fhicl::ParameterSet& pset);
106 
107  // Accessors.
109 
110  double GetASICGain(unsigned int const channel) const;
111  double GetShapingTime(unsigned int const planeIdx) const;
112 
113  double GetRawNoise(unsigned int const channel) const;
114  double GetDeconNoise(unsigned int const channel) const;
115 
116  const icarus_tool::IResponse& GetResponse(size_t channel) const;
117 
118  int ResponseTOffset(unsigned int const channel) const;
119 
120  void SetDecon(double samplingRate, size_t fftsize, size_t channel);
121  double GetDeconNorm() {return fDeconNorm;};
122 
123 
124 private:
125 
126  // Private configuration methods.
127  using IResponsePtr = std::unique_ptr<icarus_tool::IResponse>;
128  using ResponseVec = std::vector<IResponsePtr>;
129  using PlaneToResponseMap = std::map<size_t, ResponseVec>;
130 
131  // Post-constructor initialization.
132  void init() const{const_cast<SignalShapingICARUSService*>(this)->init();}
133  void init();
134 
135  // Attributes.
136  bool fInit; ///< Initialization flag
137 
138  // Fcl parameters.
139  size_t fPlaneForNormalization; ///< Normalize responses to this plane
140  double fDeconNorm; ///< Final normalization to apply
141  DoubleVec2 fNoiseFactVec; ///< RMS noise in ADCs for lowest gain setting
142  size_t fInitialFFTSize; ///< Size we initially initalize the responses
145 
146  // Field response tools
148 };
149 
150 } // end of namespace
151 
152 DECLARE_ART_SERVICE(icarusutil::SignalShapingICARUSService, SHARED)
153 #endif
std::vector< double > DoubleVec
double GetASICGain(unsigned int const channel) const
double GetRawNoise(unsigned int const channel) const
SignalShapingICARUSService(const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
double GetShapingTime(unsigned int const planeIdx) const
This is the interface class for a tool to handle the field response It is assumed that the field resp...
DoubleVec2 fNoiseFactVec
RMS noise in ADCs for lowest gain setting.
size_t fPlaneForNormalization
Normalize responses to this plane.
std::vector< DoubleVec > DoubleVec2
size_t fInitialFFTSize
Size we initially initalize the responses.
double GetDeconNoise(unsigned int const channel) const
void reconfigure(const fhicl::ParameterSet &pset)
const icarus_tool::IResponse & GetResponse(size_t channel) const
int ResponseTOffset(unsigned int const channel) const
void SetDecon(double samplingRate, size_t fftsize, size_t channel)
std::unique_ptr< icarus_tool::IResponse > IResponsePtr