LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
caldata::CalWire Class Reference
Inheritance diagram for caldata::CalWire:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 CalWire (fhicl::ParameterSet const &pset)
 
void produce (art::Event &evt)
 
void beginJob ()
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Attributes

std::string fResponseFile
 
int fExpEndBins
 number of end bins to consider for tail fit More...
 
int fPostsample
 number of postsample bins More...
 
std::string fDigitModuleLabel
 module that made digits More...
 
std::vector< std::vector< TComplex > > fKernelR
 
std::vector< std::vector< TComplex > > fKernelS
 
std::vector< double > fDecayConstsR
 
std::vector< double > fDecayConstsS
 
std::vector< int > fKernMapR
 
std::vector< int > fKernMapS
 

Detailed Description

Definition at line 42 of file CalWire_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

caldata::CalWire::CalWire ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 80 of file CalWire_module.cc.

References fDigitModuleLabel, fExpEndBins, fPostsample, and fResponseFile.

80  : EDProducer{pset}
81  {
82  fDigitModuleLabel = pset.get<std::string>("DigitModuleLabel", "daq");
83  cet::search_path sp("FW_SEARCH_PATH");
84  sp.find_file(pset.get<std::string>("ResponseFile"), fResponseFile);
85  fExpEndBins = pset.get<int>("ExponentialEndBins");
86  fPostsample = pset.get<int>("PostsampleBins");
87 
88  produces<std::vector<recob::Wire>>();
89  produces<art::Assns<raw::RawDigit, recob::Wire>>();
90  }
std::string fResponseFile
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::string fDigitModuleLabel
module that made digits
int fExpEndBins
number of end bins to consider for tail fit
int fPostsample
number of postsample bins

Member Function Documentation

void caldata::CalWire::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 93 of file CalWire_module.cc.

References bin, f, fDecayConstsR, fDecayConstsS, fKernelR, fKernelS, fKernMapR, fKernMapS, fResponseFile, and MF_LOG_DEBUG.

94  {
95 
96  MF_LOG_DEBUG("CalWire") << "CalWire_plugin: Opening Electronics Response File: "
97  << fResponseFile.c_str();
98 
99  TFile f(fResponseFile.c_str());
100  if (f.IsZombie())
101  mf::LogWarning("CalWire") << "Cannot open response file " << fResponseFile.c_str();
102 
103  TH2D* respRe = dynamic_cast<TH2D*>(f.Get("real/RespRe"));
104  TH2D* respIm = dynamic_cast<TH2D*>(f.Get("real/RespIm"));
105  TH1D* decayHist = dynamic_cast<TH1D*>(f.Get("real/decayHist"));
106  unsigned int wires = decayHist->GetNbinsX();
107  unsigned int bins = respRe->GetYaxis()->GetNbins();
108  unsigned int bin = 0;
109  unsigned int wire = 0;
110  fDecayConstsR.resize(wires);
111  fKernMapR.resize(wires);
112  fKernelR.resize(respRe->GetXaxis()->GetNbins());
113  const TArrayD* edges = respRe->GetXaxis()->GetXbins();
114  for (int i = 0; i < respRe->GetXaxis()->GetNbins(); ++i) {
115  fKernelR[i].resize(bins);
116  for (bin = 0; bin < bins; ++bin) {
117 
118  const TComplex a(respRe->GetBinContent(i + 1, bin + 1),
119  respIm->GetBinContent(i + 1, bin + 1));
120  fKernelR[i][bin] = a;
121  }
122  for (; wire < (*edges)[i + 1]; ++wire) {
123  fKernMapR[wire] = i;
124  fDecayConstsR[wire] = decayHist->GetBinContent(wire + 1);
125  }
126  }
127  respRe = dynamic_cast<TH2D*>(f.Get("sim/RespRe"));
128  respIm = dynamic_cast<TH2D*>(f.Get("sim/RespIm"));
129  decayHist = dynamic_cast<TH1D*>(f.Get("sim/decayHist"));
130  wires = decayHist->GetNbinsX();
131  bins = respRe->GetYaxis()->GetNbins();
132  fDecayConstsS.resize(wires);
133  fKernMapS.resize(wires);
134  fKernelS.resize(respRe->GetXaxis()->GetNbins());
135  const TArrayD* edges1 = respRe->GetXaxis()->GetXbins();
136  wire = 0;
137  for (int i = 0; i < respRe->GetXaxis()->GetNbins(); ++i) {
138  fKernelS[i].resize(bins);
139  for (bin = 0; bin < bins; ++bin) {
140  const TComplex b(respRe->GetBinContent(i + 1, bin + 1),
141  respIm->GetBinContent(i + 1, bin + 1));
142  fKernelS[i][bin] = b;
143  }
144  for (; wire < (*edges1)[i + 1]; ++wire) {
145  fKernMapS[wire] = i;
146  fDecayConstsS[wire] = decayHist->GetBinContent(wire + 1);
147  }
148  }
149 
150  f.Close();
151  }
std::string fResponseFile
std::vector< int > fKernMapR
std::vector< double > fDecayConstsR
TFile f
Definition: plotHisto.C:6
std::vector< double > fDecayConstsS
float bin[41]
Definition: plottest35.C:14
std::vector< std::vector< TComplex > > fKernelR
std::vector< std::vector< TComplex > > fKernelS
#define MF_LOG_DEBUG(id)
std::vector< int > fKernMapS
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void caldata::CalWire::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 154 of file CalWire_module.cc.

References util::abs(), raw::RawDigit::ADCs(), bin, raw::RawDigit::Channel(), raw::RawDigit::Compression(), util::LArFFT::Convolute(), util::CreateAssn(), DEFINE_ART_MODULE, e, fDecayConstsR, fDecayConstsS, fDigitModuleLabel, fExpEndBins, util::LArFFT::FFTSize(), fKernelR, fKernelS, fKernMapR, fKernMapS, fPostsample, art::ProductRetriever::getByLabel(), raw::RawDigit::GetPedestal(), raw::InvalidChannelID, art::Event::isRealData(), geo::kCollection, art::Ptr< T >::key(), geo::kInduction, art::errors::ProductRegistrationFailure, art::Event::put(), raw::RawDigit::Samples(), geo::GeometryCore::SignalType(), and raw::Uncompress().

155  {
156 
157  // get the geometry
159 
160  std::vector<double> decayConsts;
161  std::vector<int> kernMap;
162  std::vector<std::vector<TComplex>> kernel;
163  //Put correct response functions and decay constants in place
164  if (evt.isRealData()) {
165  decayConsts = fDecayConstsR;
166  kernMap = fKernMapR;
167  kernel = fKernelR;
168  }
169  else {
170  decayConsts = fDecayConstsS;
171  kernMap = fKernMapS;
172  kernel = fKernelS;
173  }
174 
175  // get the FFT service to have access to the FFT size
177 
178  // make a collection of Wires
179  std::unique_ptr<std::vector<recob::Wire>> wirecol(new std::vector<recob::Wire>);
180  // ... and an association set
181  std::unique_ptr<art::Assns<raw::RawDigit, recob::Wire>> WireDigitAssn(
183 
184  // Read in the digit List object(s).
186  evt.getByLabel(fDigitModuleLabel, digitVecHandle);
187 
188  if (!digitVecHandle->size()) return;
189  mf::LogInfo("CalWire") << "CalWire:: digitVecHandle size is " << digitVecHandle->size();
190 
191  // Use the handle to get a particular (0th) element of collection.
192  art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
193 
194  unsigned int dataSize = digitVec0->Samples(); //size of raw data vectors
195 
196  int transformSize = fFFT->FFTSize();
197  raw::ChannelID_t channel(raw::InvalidChannelID); // channel number
198  unsigned int bin(0); // time bin loop variable
199 
200  double decayConst = 0.; // exponential decay constant of electronics shaping
201  double fitAmplitude = 0.; //This is the seed value for the amplitude in the exponential tail fit
202  std::vector<float> holder; // holds signal data
203  std::vector<short> rawadc(transformSize); // vector holding uncompressed adc values
204  std::vector<TComplex> freqHolder(transformSize + 1); // temporary frequency data
205 
206  // loop over all wires
207  for (unsigned int rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) { // ++ move
208  holder.clear();
209 
210  art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
211  channel = digitVec->Channel();
212 
213  holder.resize(transformSize);
214 
215  // uncompress the data
216  raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->Compression());
217 
218  for (bin = 0; bin < dataSize; ++bin)
219  holder[bin] = (rawadc[bin] - digitVec->GetPedestal());
220  // fExpEndBins only nonzero for detectors needing exponential tail fitting
221  if (fExpEndBins && std::abs(decayConsts[channel]) > 0.0) {
222 
223  TH1D expTailData(
224  "expTailData", "Tail data for fit", fExpEndBins, dataSize - fExpEndBins, dataSize);
225  TF1 expFit("expFit", "[0]*exp([1]*x)");
226 
227  for (bin = 0; bin < (unsigned int)fExpEndBins; ++bin)
228  expTailData.Fill(dataSize - fExpEndBins + bin, holder[dataSize - fExpEndBins + bin]);
229  decayConst = decayConsts[channel];
230  fitAmplitude = holder[dataSize - fExpEndBins] / exp(decayConst * (dataSize - fExpEndBins));
231  expFit.FixParameter(1, decayConst);
232  expFit.SetParameter(0, fitAmplitude);
233  expTailData.Fit(&expFit, "QWN", "", dataSize - fExpEndBins, dataSize);
234  expFit.SetRange(dataSize, transformSize);
235  for (bin = 0; bin < dataSize; ++bin)
236  holder[dataSize + bin] = expFit.Eval(bin + dataSize);
237  }
238  // This is actually deconvolution, by way of convolution with the inverted
239  // kernel. This code assumes the response function has already been
240  // been transformed and inverted. This way a complex multiplication, rather
241  // than a complex division is performed saving 2 multiplications and
242  // 2 divsions
243 
244  // the example below is for MicroBooNE, experiments should
245  // adapt as appropriate
246 
247  // Figure out which kernel to use (0=induction, 1=collection).
248  geo::SigType_t sigtype = geom->SignalType(channel);
249  size_t k;
250  if (sigtype == geo::kInduction)
251  k = 0;
252  else if (sigtype == geo::kCollection)
253  k = 1;
254  else
255  throw cet::exception("CalWire") << "Bad signal type = " << sigtype << "\n";
256  if (k >= kernel.size()) throw cet::exception("CalWire") << "kernel size < " << k << "!\n";
257 
258  fFFT->Convolute(holder, kernel[k]);
259 
260  holder.resize(dataSize, 1e-5);
261  //This restores the DC component to signal removed by the deconvolution.
262  if (fPostsample) {
263  double average = 0.0;
264  for (bin = 0; bin < (unsigned int)fPostsample; ++bin)
265  average += holder[holder.size() - 1 - bin] / (double)fPostsample;
266  for (bin = 0; bin < holder.size(); ++bin)
267  holder[bin] -= average;
268  }
269  wirecol->push_back(recob::WireCreator(holder, *digitVec).move());
270  // add an association between the last object in wirecol
271  // (that we just inserted) and digitVec
272  if (!util::CreateAssn(evt, *wirecol, digitVec, *WireDigitAssn)) {
274  << "Can't associate wire #" << (wirecol->size() - 1) << " with raw digit #"
275  << digitVec.key();
276  } // if failed to add association
277  } // for raw digits
278 
279  if (wirecol->size() == 0) mf::LogWarning("CalWire") << "No wires made for this event.";
280 
281  evt.put(std::move(wirecol));
282  evt.put(std::move(WireDigitAssn));
283 
284  return;
285  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< int > fKernMapR
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< double > fDecayConstsR
bool isRealData() const
Definition: Event.cc:53
Class managing the creation of a new recob::Wire object.
Definition: WireCreator.h:55
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
std::vector< double > fDecayConstsS
int FFTSize() const
Definition: LArFFT.h:66
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
Signal from induction planes.
Definition: geo_types.h:151
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
void Convolute(std::vector< T > &input, std::vector< T > &respFunc)
Definition: LArFFT.h:170
float bin[41]
Definition: plottest35.C:14
std::vector< std::vector< TComplex > > fKernelR
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.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::string fDigitModuleLabel
module that made digits
std::vector< std::vector< TComplex > > fKernelS
int fExpEndBins
number of end bins to consider for tail fit
int fPostsample
number of postsample bins
std::vector< int > fKernMapS
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:744
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
Signal from collection planes.
Definition: geo_types.h:152
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

std::vector<double> caldata::CalWire::fDecayConstsR
private

vector holding RC decay constants

Definition at line 65 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

std::vector<double> caldata::CalWire::fDecayConstsS
private

vector holding RC decay constants

Definition at line 67 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

std::string caldata::CalWire::fDigitModuleLabel
private

module that made digits

Definition at line 59 of file CalWire_module.cc.

Referenced by CalWire(), and produce().

int caldata::CalWire::fExpEndBins
private

number of end bins to consider for tail fit

Definition at line 57 of file CalWire_module.cc.

Referenced by CalWire(), and produce().

std::vector<std::vector<TComplex> > caldata::CalWire::fKernelR
private

holds transformed induction response function

Definition at line 61 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

std::vector<std::vector<TComplex> > caldata::CalWire::fKernelS
private

holds transformed induction response function

Definition at line 63 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

std::vector<int> caldata::CalWire::fKernMapR
private

map telling which channels have which response functions

Definition at line 69 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

std::vector<int> caldata::CalWire::fKernMapS
private

map telling which channels have which response functions

Definition at line 71 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

int caldata::CalWire::fPostsample
private

number of postsample bins

Definition at line 58 of file CalWire_module.cc.

Referenced by CalWire(), and produce().

std::string caldata::CalWire::fResponseFile
private

response file containing transformed shape histograms and decay constants

Definition at line 53 of file CalWire_module.cc.

Referenced by beginJob(), and CalWire().


The documentation for this class was generated from the following file: