All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
recowireraw::RecoWireICARUSRaw Class Reference
Inheritance diagram for recowireraw::RecoWireICARUSRaw:

Public Member Functions

 RecoWireICARUSRaw (fhicl::ParameterSet const &pset)
 
virtual ~RecoWireICARUSRaw ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
void reconfigure (fhicl::ParameterSet const &p)
 
void OfflineIntegration (std::vector< float > &)
 
void DoubleRebinning (std::vector< float > &)
 

Private Attributes

std::string fDigitModuleLabel
 module that made digits More...
 
TH1F * fWireRMS
 
const
lariov::ChannelStatusProvider
fChannelFilter = lar::providerFrom<lariov::ChannelStatusService>()
 

Detailed Description

Definition at line 50 of file RecoWireICARUSRaw_module.cc.

Constructor & Destructor Documentation

recowireraw::RecoWireICARUSRaw::RecoWireICARUSRaw ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 82 of file RecoWireICARUSRaw_module.cc.

82  : EDProducer{pset}
83  {
84  this->reconfigure(pset);
85 
86  produces< std::vector<recob::Wire> >();
87  produces<art::Assns<raw::RawDigit, recob::Wire>>();
88 
89 
90 
91  }
void reconfigure(fhicl::ParameterSet const &p)
recowireraw::RecoWireICARUSRaw::~RecoWireICARUSRaw ( )
virtual

Definition at line 94 of file RecoWireICARUSRaw_module.cc.

95  {
96  }

Member Function Documentation

void recowireraw::RecoWireICARUSRaw::beginJob ( )

Definition at line 105 of file RecoWireICARUSRaw_module.cc.

106  {
107  // get access to the TFile service
108  art::ServiceHandle<art::TFileService> tfs;
109 
110  fWireRMS = tfs->make<TH1F>("fWireRMS", "RMS(ADC#)", 1000, 0, 10);
111  }
art::ServiceHandle< art::TFileService > tfs
void recowireraw::RecoWireICARUSRaw::DoubleRebinning ( std::vector< float > &  data)

Definition at line 300 of file RecoWireICARUSRaw_module.cc.

301  {
302  int win=12;
303  double wout=100;
304 
305 
306  double output[4096];
307 
308  for(int js=0;js<4096;js++)
309  {
310  int il=js-wout/2;
311  if(il<0)
312  il=0;
313  int fl=js-(win/2);
314  if(fl<0)
315  fl=0;
316  int ir=js+win/2;
317  if(ir>4095)
318  ir=4095;
319  int fr=js+wout/2;
320  if(fr>4095)
321  fr=4095;
322 
323  double lreb=0;
324  // double insl=js/wout;
325  std::vector<int> vout;
326  for(int jj=il;jj<=fr;jj++) {
327  lreb+=data[jj];
328  }
329 
330  //int middle=(wout)/2;
331  lreb/=(wout+1);
332 
333  double sreb=0;
334  for(int jj=fl;jj<ir;jj++)
335  sreb+=data[jj];
336  sreb/=(win);
337 
338  if(win==0)
339  sreb=data[js];
340  double diff;
341  diff=sreb-lreb;
342 
343  // std::cout << " before output " << std::endl;
344  output[js]=diff;
345 
346  }
347  for(int j=0;j<3996;j++)
348  data[j]=output[j];
349  for(int j=3996;j<4096;j++)
350  data[j]=0;
351 
352  }
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
void recowireraw::RecoWireICARUSRaw::endJob ( )

Definition at line 114 of file RecoWireICARUSRaw_module.cc.

115  {
116  }
void recowireraw::RecoWireICARUSRaw::OfflineIntegration ( std::vector< float > &  data)

Definition at line 220 of file RecoWireICARUSRaw_module.cc.

221  {
222  //std::cout << " offline integration " << std::endl;
223 
224  double signal[4096];
225  double integral[4096];
226  double check[4096];
227 
228  // double tau0=100;
229  for(int j=0;j<4096;j++)
230  signal[j]=data[j];
231 
232  double tau0=100;
233 
234  integral[0]=signal[0];
235  for(int j=1;j<4096;j++)
236  integral[j]=integral[j-1]*exp(-0.4/tau0)+signal[j];
237 
238  double outl[4096];
239  double outb[4096];
240  double outs[4096];
241  double tl=1000;
242  double ts=0;
243 
244  ts=0;
245  tl=27;
246 
247 
248 
249 
250  outl[0]=integral[0];
251  double sum_tot=0;
252  for(int j=1;j<4096;j++) {
253  sum_tot+=integral[j];
254  outl[j]=outl[j-1]*exp(-0.4/tl)+integral[j];
255  }
256 
257 
258  outb[4095]=integral[4095];
259 
260  for(int j=4094;j>=0;j--) {
261  outb[j]=outb[j+1]*exp(-0.4/tl)+integral[j];
262  }
263 
264  outs[0]=integral[0];
265  sum_tot=0;
266  for(int j=1;j<4096;j++) {
267  sum_tot+=integral[j];
268  if(ts>0)
269  outs[j]=outs[j-1]*exp(-0.4/ts)+integral[j];
270  else
271  outs[j]=integral[j];
272 
273  }
274  double nl=(1-exp(-0.4/tl));
275  double ns=(1-exp(-0.4/ts));
276 
277  double intl=0;
278  double ints=0;
279  double int0=0;
280  double intc=0;
281  for(int j=0;j<4096;j++)
282  intl+=outl[j];
283  for(int j=0;j<4096;j++)
284  ints+=outs[j];
285  for(int j=0;j<4096;j++)
286  int0+=integral[j];
287  for(int j=0;j<4096;j++)
288  intc+=check[j];
289 
290 
291  for(int j=0;j<4096;j++) {
292  double media=0.5*(outl[j]+outb[j]);
293  data[j]=round(outs[j]*(ns*1.)-media*(nl*1.));
294  data[j]=round(integral[j]);
295  }
296 
297 
298  //cout << " end simulating amplifier " << endl;
299  }
process_name tightIsolTest check
void recowireraw::RecoWireICARUSRaw::produce ( art::Event &  evt)

Definition at line 119 of file RecoWireICARUSRaw_module.cc.

120  {
121  // get the geometry
122  art::ServiceHandle<geo::Geometry> geom;
123 
124  // make a collection of Wires
125  std::unique_ptr<std::vector<recob::Wire> > wirecol(new std::vector<recob::Wire>);
126  // ... and an association set
127  std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn(new art::Assns<raw::RawDigit,recob::Wire>);
128 
129  mf::LogDebug("RecoWireICARUSRaw") << " before wirecol size " << wirecol->size() << std::endl;
130 
131  // Read in the digit List object(s).
132  art::Handle< std::vector<raw::RawDigit> > digitVecHandle;
133  evt.getByLabel(fDigitModuleLabel, digitVecHandle);
134 
135  if (digitVecHandle.isValid() && digitVecHandle->size() > 0)
136  {
137  mf::LogInfo("RecoWireICARUSRaw") << "RecoWireICARUSRaw:: digitVecHandle size is " << digitVecHandle->size();
138 
139  // Use the handle to get a particular (0th) element of collection.
140  art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
141 
142  unsigned int dataSize = digitVec0->Samples(); //size of raw data vectors
143 
144  raw::ChannelID_t channel(raw::InvalidChannelID); // channel number
145 
146  unsigned int bin(0); // time bin loop variable
147 
148  std::vector<float> holder; // holds signal data
149  std::vector<short> rawadc(dataSize); // vector holding uncompressed adc values
150 
151  wirecol->reserve(digitVecHandle->size());
152  // loop over all wires
153 
154  for(unsigned int rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) { // ++ move
155  holder.clear();
156 
157  art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
158  channel = digitVec->Channel();
159 
160  // The following test is meant to be temporary until the "correct" solution is implemented
161  if (!fChannelFilter->IsPresent(channel)) continue;
162 
163  std::vector<geo::WireID> wids = geom->ChannelToWire(channel);
164 
165  if (wids.empty()) continue;
166 
167  geo::WireID wid = wids[0];
168 
169  holder.resize(dataSize);
170 
171  // uncompress the data
172  raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->Compression());
173 
174  for(bin = 0; bin < dataSize; ++bin)
175  holder[bin]=(rawadc[bin]-digitVec->GetPedestal());
176 
177  // std::cout << " pedestal " << digitVec->GetPedestal() << std::endl;
178 
179  if(wid.Plane==1) {
180  OfflineIntegration(holder);
181  DoubleRebinning(holder);
182  }
183 
184  float media=0;
185  float rms2=0;
186  for(int js=0;js<4096;js++)
187  media+=(holder[js]/4096.);
188  for(int js=0;js<4096;js++)
189  rms2+=(holder[js]-media)*(holder[js]-media)/4096.;
190  float rms=sqrt(rms2);
191  fWireRMS->Fill(rms);
192 
193  wirecol->push_back(recob::WireCreator(holder,*digitVec).move());
194 
195  // add an association between the last object in wirecol
196  // (that we just inserted) and digitVec
197  if (!util::CreateAssn(*this, evt, *wirecol, digitVec, *WireDigitAssn)) {
198  throw art::Exception(art::errors::ProductRegistrationFailure)
199  << "Can't associate wire #" << (wirecol->size() - 1)
200  << " with raw digit #" << digitVec.key();
201  } // if failed to add association
202  //else std::cout << " creating association channel " << channel << std::endl;
203 
204 
205  }
206  }
207 
208  //std::cout << " after wirecol size " << wirecol->size() << std::endl;
209 
210 
211  if(wirecol->size() == 0)
212  mf::LogWarning("RecoWireICARUSRaw") << "No wires made for this event.";
213 
214  evt.put(std::move(wirecol));
215  evt.put(std::move(WireDigitAssn));
216 
217  return;
218  }
void DoubleRebinning(std::vector< float > &)
Class managing the creation of a new recob::Wire object.
Definition: WireCreator.h:53
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::string fDigitModuleLabel
module that made digits
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:32
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
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.
const lariov::ChannelStatusProvider * fChannelFilter
TCEvent evt
Definition: DataStructs.cxx:8
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:776
void OfflineIntegration(std::vector< float > &)
void recowireraw::RecoWireICARUSRaw::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 99 of file RecoWireICARUSRaw_module.cc.

100  {
101  fDigitModuleLabel = p.get< std::string >("DigitModuleLabel", "daq");
102  }
pdgs p
Definition: selectors.fcl:22
std::string fDigitModuleLabel
module that made digits

Member Data Documentation

const lariov::ChannelStatusProvider* recowireraw::RecoWireICARUSRaw::fChannelFilter = lar::providerFrom<lariov::ChannelStatusService>()
private

Definition at line 72 of file RecoWireICARUSRaw_module.cc.

std::string recowireraw::RecoWireICARUSRaw::fDigitModuleLabel
private

module that made digits

Definition at line 69 of file RecoWireICARUSRaw_module.cc.

TH1F* recowireraw::RecoWireICARUSRaw::fWireRMS
private

Definition at line 70 of file RecoWireICARUSRaw_module.cc.


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