LArSoft  v10_04_05
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 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 Member Functions

void produce (art::Event &evt) override
 
void beginJob () override
 

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 76 of file CalWire_module.cc.

References fDigitModuleLabel, fExpEndBins, fPostsample, and fResponseFile.

76  : EDProducer{pset}
77  {
78  fDigitModuleLabel = pset.get<std::string>("DigitModuleLabel", "daq");
79  cet::search_path sp("FW_SEARCH_PATH");
80  sp.find_file(pset.get<std::string>("ResponseFile"), fResponseFile);
81  fExpEndBins = pset.get<int>("ExponentialEndBins");
82  fPostsample = pset.get<int>("PostsampleBins");
83 
84  produces<std::vector<recob::Wire>>();
85  produces<art::Assns<raw::RawDigit, recob::Wire>>();
86  }
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 ( )
overrideprivatevirtual

Reimplemented from art::EDProducer.

Definition at line 89 of file CalWire_module.cc.

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

90  {
91  MF_LOG_DEBUG("CalWire") << "CalWire_plugin: Opening Electronics Response File: "
92  << fResponseFile.c_str();
93 
94  TFile f(fResponseFile.c_str());
95  if (f.IsZombie())
96  mf::LogWarning("CalWire") << "Cannot open response file " << fResponseFile.c_str();
97 
98  TH2D* respRe = dynamic_cast<TH2D*>(f.Get("real/RespRe"));
99  TH2D* respIm = dynamic_cast<TH2D*>(f.Get("real/RespIm"));
100  TH1D* decayHist = dynamic_cast<TH1D*>(f.Get("real/decayHist"));
101  unsigned int wires = decayHist->GetNbinsX();
102  unsigned int bins = respRe->GetYaxis()->GetNbins();
103  unsigned int bin = 0;
104  unsigned int wire = 0;
105  fDecayConstsR.resize(wires);
106  fKernMapR.resize(wires);
107  fKernelR.resize(respRe->GetXaxis()->GetNbins());
108  const TArrayD* edges = respRe->GetXaxis()->GetXbins();
109  for (int i = 0; i < respRe->GetXaxis()->GetNbins(); ++i) {
110  fKernelR[i].resize(bins);
111  for (bin = 0; bin < bins; ++bin) {
112  const TComplex a(respRe->GetBinContent(i + 1, bin + 1),
113  respIm->GetBinContent(i + 1, bin + 1));
114  fKernelR[i][bin] = a;
115  }
116  for (; wire < (*edges)[i + 1]; ++wire) {
117  fKernMapR[wire] = i;
118  fDecayConstsR[wire] = decayHist->GetBinContent(wire + 1);
119  }
120  }
121  respRe = dynamic_cast<TH2D*>(f.Get("sim/RespRe"));
122  respIm = dynamic_cast<TH2D*>(f.Get("sim/RespIm"));
123  decayHist = dynamic_cast<TH1D*>(f.Get("sim/decayHist"));
124  wires = decayHist->GetNbinsX();
125  bins = respRe->GetYaxis()->GetNbins();
126  fDecayConstsS.resize(wires);
127  fKernMapS.resize(wires);
128  fKernelS.resize(respRe->GetXaxis()->GetNbins());
129  const TArrayD* edges1 = respRe->GetXaxis()->GetXbins();
130  wire = 0;
131  for (int i = 0; i < respRe->GetXaxis()->GetNbins(); ++i) {
132  fKernelS[i].resize(bins);
133  for (bin = 0; bin < bins; ++bin) {
134  const TComplex b(respRe->GetBinContent(i + 1, bin + 1),
135  respIm->GetBinContent(i + 1, bin + 1));
136  fKernelS[i][bin] = b;
137  }
138  for (; wire < (*edges1)[i + 1]; ++wire) {
139  fKernMapS[wire] = i;
140  fDecayConstsS[wire] = decayHist->GetBinContent(wire + 1);
141  }
142  }
143 
144  f.Close();
145  }
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)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 148 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, geo::WireReadout::Get(), 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::WireReadoutGeom::SignalType(), and raw::Uncompress().

149  {
151 
152  std::vector<double> decayConsts;
153  std::vector<int> kernMap;
154  std::vector<std::vector<TComplex>> kernel;
155  //Put correct response functions and decay constants in place
156  if (evt.isRealData()) {
157  decayConsts = fDecayConstsR;
158  kernMap = fKernMapR;
159  kernel = fKernelR;
160  }
161  else {
162  decayConsts = fDecayConstsS;
163  kernMap = fKernMapS;
164  kernel = fKernelS;
165  }
166 
167  // get the FFT service to have access to the FFT size
169 
170  // make a collection of Wires
171  std::unique_ptr<std::vector<recob::Wire>> wirecol(new std::vector<recob::Wire>);
172  // ... and an association set
173  std::unique_ptr<art::Assns<raw::RawDigit, recob::Wire>> WireDigitAssn(
175 
176  // Read in the digit List object(s).
178  evt.getByLabel(fDigitModuleLabel, digitVecHandle);
179 
180  if (!digitVecHandle->size()) return;
181  mf::LogInfo("CalWire") << "CalWire:: digitVecHandle size is " << digitVecHandle->size();
182 
183  // Use the handle to get a particular (0th) element of collection.
184  art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
185 
186  unsigned int dataSize = digitVec0->Samples(); //size of raw data vectors
187 
188  int transformSize = fFFT->FFTSize();
189  raw::ChannelID_t channel(raw::InvalidChannelID); // channel number
190  unsigned int bin(0); // time bin loop variable
191 
192  double decayConst = 0.; // exponential decay constant of electronics shaping
193  double fitAmplitude = 0.; //This is the seed value for the amplitude in the exponential tail fit
194  std::vector<float> holder; // holds signal data
195  std::vector<short> rawadc(transformSize); // vector holding uncompressed adc values
196  std::vector<TComplex> freqHolder(transformSize + 1); // temporary frequency data
197 
198  // loop over all wires
199  for (unsigned int rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) { // ++ move
200  holder.clear();
201 
202  art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
203  channel = digitVec->Channel();
204 
205  holder.resize(transformSize);
206 
207  // uncompress the data
208  raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->Compression());
209 
210  for (bin = 0; bin < dataSize; ++bin)
211  holder[bin] = (rawadc[bin] - digitVec->GetPedestal());
212  // fExpEndBins only nonzero for detectors needing exponential tail fitting
213  if (fExpEndBins && std::abs(decayConsts[channel]) > 0.0) {
214 
215  TH1D expTailData(
216  "expTailData", "Tail data for fit", fExpEndBins, dataSize - fExpEndBins, dataSize);
217  TF1 expFit("expFit", "[0]*exp([1]*x)");
218 
219  for (bin = 0; bin < (unsigned int)fExpEndBins; ++bin)
220  expTailData.Fill(dataSize - fExpEndBins + bin, holder[dataSize - fExpEndBins + bin]);
221  decayConst = decayConsts[channel];
222  fitAmplitude = holder[dataSize - fExpEndBins] / exp(decayConst * (dataSize - fExpEndBins));
223  expFit.FixParameter(1, decayConst);
224  expFit.SetParameter(0, fitAmplitude);
225  expTailData.Fit(&expFit, "QWN", "", dataSize - fExpEndBins, dataSize);
226  expFit.SetRange(dataSize, transformSize);
227  for (bin = 0; bin < dataSize; ++bin)
228  holder[dataSize + bin] = expFit.Eval(bin + dataSize);
229  }
230  // This is actually deconvolution, by way of convolution with the inverted kernel.
231  // This code assumes the response function has already been been transformed and
232  // inverted. This way a complex multiplication, rather than a complex division is
233  // performed saving 2 multiplications and 2 divsions
234 
235  // the example below is for MicroBooNE, experiments should adapt as appropriate
236 
237  // Figure out which kernel to use (0=induction, 1=collection).
238  geo::SigType_t sigtype = geom->Get().SignalType(channel);
239  size_t k;
240  if (sigtype == geo::kInduction)
241  k = 0;
242  else if (sigtype == geo::kCollection)
243  k = 1;
244  else
245  throw cet::exception("CalWire") << "Bad signal type = " << sigtype << "\n";
246  if (k >= kernel.size()) throw cet::exception("CalWire") << "kernel size < " << k << "!\n";
247 
248  fFFT->Convolute(holder, kernel[k]);
249 
250  holder.resize(dataSize, 1e-5);
251  //This restores the DC component to signal removed by the deconvolution.
252  if (fPostsample) {
253  double average = 0.0;
254  for (bin = 0; bin < (unsigned int)fPostsample; ++bin)
255  average += holder[holder.size() - 1 - bin] / (double)fPostsample;
256  for (bin = 0; bin < holder.size(); ++bin)
257  holder[bin] -= average;
258  }
259  wirecol->push_back(recob::WireCreator(holder, *digitVec).move());
260  // add an association between the last object in wirecol (that we just inserted) and
261  // digitVec
262  if (!util::CreateAssn(evt, *wirecol, digitVec, *WireDigitAssn)) {
264  << "Can't associate wire #" << (wirecol->size() - 1) << " with raw digit #"
265  << digitVec.key();
266  } // if failed to add association
267  } // for raw digits
268 
269  if (wirecol->empty()) mf::LogWarning("CalWire") << "No wires made for this event.";
270 
271  evt.put(std::move(wirecol));
272  evt.put(std::move(WireDigitAssn));
273  }
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
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
bool isRealData() const
Definition: Event.cc:53
Class managing the creation of a new recob::Wire object.
Definition: WireCreator.h:55
WireReadoutGeom const & Get() const
Definition: WireReadout.h:36
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:147
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
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:148
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 62 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 64 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

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

module that made digits

Definition at line 56 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 54 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 58 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 60 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 66 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 68 of file CalWire_module.cc.

Referenced by beginJob(), and produce().

int caldata::CalWire::fPostsample
private

number of postsample bins

Definition at line 55 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 52 of file CalWire_module.cc.

Referenced by beginJob(), and CalWire().


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