12 #include "cetlib_except/exception.h" 88 fExpEndBins = pset.get<
int > (
"ExponentialEndBins");
94 produces< std::vector<recob::Wire> >();
95 produces<art::Assns<raw::RawDigit, recob::Wire>>();
103 MF_LOG_DEBUG(
"CalWireT962") <<
"CalWireT962_module: Opening Electronics Response File: " 111 TH2D *respRe =
dynamic_cast<TH2D*
>(
f.Get(
"real/RespRe") );
112 TH2D *respIm =
dynamic_cast<TH2D*
>(
f.Get(
"real/RespIm") );
113 TH1D *decayHist =
dynamic_cast<TH1D*
>(
f.Get(
"real/decayHist"));
114 unsigned int wires = decayHist->GetNbinsX();
115 unsigned int bins = respRe->GetYaxis()->GetNbins();
116 unsigned int bin = 0;
117 unsigned int wire = 0;
120 fKernelR.resize(respRe->GetXaxis()->GetNbins());
121 const TArrayD *edges = respRe->GetXaxis()->GetXbins();
122 for(
int i = 0; i < respRe->GetXaxis()->GetNbins(); ++i) {
124 for(bin = 0; bin < bins; ++
bin) {
126 const TComplex
a(respRe->GetBinContent(i+1,bin+1),
127 respIm->GetBinContent(i+1,bin+1));
130 for(; wire < (*edges)[i+1]; ++wire) {
135 respRe =
dynamic_cast<TH2D*
>(
f.Get(
"sim/RespRe") );
136 respIm =
dynamic_cast<TH2D*
>(
f.Get(
"sim/RespIm") );
137 decayHist =
dynamic_cast<TH1D*
>(
f.Get(
"sim/decayHist"));
138 wires = decayHist->GetNbinsX();
139 bins = respRe->GetYaxis()->GetNbins();
142 fKernelS.resize(respRe->GetXaxis()->GetNbins());
143 const TArrayD *edges1 = respRe->GetXaxis()->GetXbins();
145 for(
int i = 0; i < respRe->GetXaxis()->GetNbins(); ++i) {
147 for(bin = 0; bin < bins; ++
bin) {
148 const TComplex
b(respRe->GetBinContent(i+1,bin+1),
149 respIm->GetBinContent(i+1,bin+1));
152 for(; wire < (*edges1)[i+1]; ++wire) {
169 std::vector<double> decayConsts;
170 std::vector<int> kernMap;
171 std::vector<std::vector<TComplex> > kernel;
188 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
190 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
197 if (!digitVecHandle->size())
return;
198 mf::LogInfo(
"CalWireT962") <<
"CalWireT962:: digitVecHandle size is " << digitVecHandle->size();
203 unsigned int dataSize = digitVec0->
Samples();
205 int transformSize = fFFT->
FFTSize();
212 double decayConst = 0.;
213 double fitAmplitude = 0.;
214 std::vector<float> holder;
215 std::vector<TComplex> freqHolder(transformSize+1);
218 for(
unsigned int rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
227 if(!channelStatus.
IsBad(channel)) {
228 holder.resize(transformSize);
230 for(bin = 0; bin < dataSize; ++
bin)
235 TH1D expTailData(
"expTailData",
"Tail data for fit",
237 TF1 expFit(
"expFit",
"[0]*exp([1]*x)");
241 decayConst = decayConsts[
channel];
243 expFit.FixParameter(1,decayConst);
244 expFit.SetParameter(0,fitAmplitude);
245 expTailData.Fit(&expFit,
"QWN",
"",dataSize-
fExpEndBins,dataSize);
246 expFit.SetRange(dataSize,transformSize);
247 for(bin = 0; bin < dataSize; ++
bin)
248 holder[dataSize+bin]= expFit.Eval(bin+dataSize);
256 fFFT->
Convolute(holder,kernel[kernMap[channel]]);
259 holder.resize(dataSize,1
e-5);
265 for(bin = 0; bin < holder.size(); ++
bin) holder[bin]-=average;
275 <<
"Can't associate wire #" << (wirecol->size() - 1)
276 <<
" with raw digit #" << digitVec.
key();
280 if(wirecol->size() == 0)
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
float GetPedestal() const
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int fPostsample
number of postsample bins
Helper functions to create a wire.
EDProducer(fhicl::ParameterSet const &pset)
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Class managing the creation of a new recob::Wire object.
creation of calibrated signals on wires
std::vector< std::vector< TComplex > > fKernelR
std::vector< double > fDecayConstsS
art framework interface to geometry description
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
#define DEFINE_ART_MODULE(klass)
std::string fDigitModuleLabel
module that made digits
key_type key() const noexcept
std::vector< int > fKernMapS
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void Convolute(std::vector< T > &input, std::vector< T > &respFunc)
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
Class providing information about the quality of channels.
std::string fResponseFile
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< double > fDecayConstsR
QTextStream & bin(QTextStream &s)
Interface for experiment-specific channel quality info provider.
Declaration of basic channel signal object.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Interface for experiment-specific service for channel quality info.
void produce(art::Event &evt)
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
CalWireT962(fhicl::ParameterSet const &pset)
std::vector< std::vector< TComplex > > fKernelS
std::vector< int > fKernMapR
int fExpEndBins
number of end bins to consider for tail fit