All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
caldata::RawDigitCharacterizationAlg Class Reference

#include <RawDigitCharacterizationAlg.h>

Public Member Functions

 RawDigitCharacterizationAlg (fhicl::ParameterSet const &pset)
 
 ~RawDigitCharacterizationAlg ()
 Destructor. More...
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void initializeHists (art::ServiceHandle< art::TFileService > &)
 Begin job method. More...
 
void getMeanAndRms (const RawDigitVector &rawWaveform, float &aveVal, float &rmsVal, int &numBins) const
 
void getMeanAndTruncRms (const RawDigitVector &rawWaveform, float &aveVal, float &rmsVal, float &rmsTrunc, int &numBins) const
 
void getTruncatedRMS (const RawDigitVector &rawWaveform, float &pedestal, float &truncRms) const
 
void getMeanRmsAndPedCor (const RawDigitVector &rawWaveform, unsigned int channel, unsigned int view, unsigned int wire, float &aveVal, float &rmsVal, float &pedCorVal) const
 
void getWaveformParams (const RawDigitVector &rawWaveform, unsigned int channel, unsigned int view, unsigned int wire, float &truncMean, float &truncRms, short &mean, short &median, short &mode, float &skewness, float &rms, short &minMax, float &neighborRatio, float &pedCorVal) const
 
bool classifyRawDigitVec (RawDigitVector &rawWaveform, unsigned int viewIdx, unsigned int wire, float truncRms, short minMax, short mean, float skewness, float neighborRatio, GroupToDigitIdxPairMap &groupToDigitIdxPairMap) const
 
template<class T >
getMedian (std::vector< T > &, T) const
 

Private Attributes

float fTruncMeanFraction
 Fraction for truncated mean. More...
 
std::vector< float > fRmsRejectionCutHi
 Maximum rms for input channels, reject if larger. More...
 
std::vector< float > fRmsRejectionCutLow
 Minimum rms to consider channel "alive". More...
 
std::vector< float > fRmsSelectionCut
 Don't use/apply correction to wires below this. More...
 
std::vector< short > fMinMaxSelectionCut
 Plane by plane cuts for spread cut. More...
 
unsigned int fTheChosenWire
 For example hist. More...
 
double fMaxPedestalDiff
 Max pedestal diff to db to warn. More...
 
std::vector< size_t > fHistsWireGroup
 Wire Group to pick on. More...
 
std::vector< size_t > fNumWiresToGroup
 If smoothing, the number of wires to look at. More...
 
bool fFillHistograms
 if true then will fill diagnostic hists More...
 
bool fHistsInitialized
 
TH1D * fAdcCntHist [3]
 
TH1D * fAveValHist [3]
 
TH1D * fRmsTValHist [3]
 
TH1D * fRmsFValHist [3]
 
TH1D * fPedValHist [3]
 
TH1D * fAverageHist [3]
 
TProfile * fRmsValProf [3]
 
TProfile * fMinMaxValProf [3]
 
TProfile * fPedValProf [3]
 
std::vector< TProfile * > fMinMaxProfiles
 
std::vector< TProfile * > fSkewnessProfiles
 
std::vector< TProfile * > fModeRatioProfiles
 
caldata::ChannelGroups fChannelGroups
 
art::ServiceHandle< geo::GeometryfGeometry
 Detector properties service. More...
 
const lariov::DetPedestalProviderfPedestalRetrievalAlg
 Keep track of an instance to the pedestal retrieval alg. More...
 

Detailed Description

Definition at line 45 of file RawDigitCharacterizationAlg.h.

Constructor & Destructor Documentation

caldata::RawDigitCharacterizationAlg::RawDigitCharacterizationAlg ( fhicl::ParameterSet const &  pset)

Constructor.

Arguments:

pset - Fcl parameters.

Definition at line 18 of file RawDigitCharacterizationAlg.cxx.

18  :
19  fHistsInitialized(false),
20  fChannelGroups(pset),
21  fPedestalRetrievalAlg(art::ServiceHandle<lariov::DetPedestalService>()->GetPedestalProvider())
22 
23 {
24  reconfigure(pset);
25 
26  // Report.
27  mf::LogInfo("RawDigitCharacterizationAlg") << "RawDigitCharacterizationAlg configured\n";
28 }
void reconfigure(fhicl::ParameterSet const &pset)
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
Keep track of an instance to the pedestal retrieval alg.
caldata::RawDigitCharacterizationAlg::~RawDigitCharacterizationAlg ( )

Destructor.

Definition at line 32 of file RawDigitCharacterizationAlg.cxx.

33 {}

Member Function Documentation

bool caldata::RawDigitCharacterizationAlg::classifyRawDigitVec ( RawDigitVector rawWaveform,
unsigned int  viewIdx,
unsigned int  wire,
float  truncRms,
short  minMax,
short  mean,
float  skewness,
float  neighborRatio,
GroupToDigitIdxPairMap groupToDigitIdxPairMap 
) const

Definition at line 451 of file RawDigitCharacterizationAlg.cxx.

460 {
461  // This simply classifies the input waveform:
462  // a) determines if it should be added to the list of waveforms to process
463  // b) if to be analyzed, places in the group of wires to process
464  bool classified(false);
465 
466  // Dereference the selection/rejection cut
467  float selectionCut = fMinMaxSelectionCut[viewIdx];
468  float rejectionCut = fRmsRejectionCutHi[viewIdx];
469 
470  // Selection to process
471  if (minMax > selectionCut && truncRms < rejectionCut)
472  {
473  size_t group = fChannelGroups.channelGroup(viewIdx,wire);
474 
475  if (groupToDigitIdxPairMap.find(group) == groupToDigitIdxPairMap.end())
476  groupToDigitIdxPairMap.insert(std::pair<size_t,RawDigitAdcIdxPair>(group,RawDigitAdcIdxPair()));
477 
478  groupToDigitIdxPairMap.at(group).first.insert(WireToRawDigitVecPair(wire,rawWaveform));
479  groupToDigitIdxPairMap.at(group).second.insert(std::pair<size_t,RawDigitVectorIdxPair>(wire,RawDigitVectorIdxPair(0,rawWaveform.size())));
480 
481  // Look for chirping wire sections. Confine this to only the V plane
482  if (viewIdx == 1)
483  {
484  // Do wire shape corrections to look for chirping wires and other oddities to avoid
485  // Recover our objects...
486  WireToAdcIdxMap& wireToAdcIdxMap = groupToDigitIdxPairMap.at(group).second;
487 
488  // Set a threshold
489  short threshold(6);
490 
491  // If going from quiescent to on again, then the min/max will be large
492  //if (skewnessWireVec[wireIdx] > 0. && minMaxWireVec[wireIdx] > 50 && truncRmsWireVec[wireIdx] > 2.)
493  if (skewness > 0. && neighborRatio < 0.7 && minMax > 50)
494  {
495  RawDigitVector::iterator stopChirpItr = std::find_if(rawWaveform.begin(),rawWaveform.end(),[mean,threshold](const short& elem){return abs(elem - mean) > threshold;});
496 
497  size_t threshIndex = std::distance(rawWaveform.begin(),stopChirpItr);
498 
499  if (threshIndex > 60) wireToAdcIdxMap[wire].first = threshIndex;
500  }
501  // Check in the reverse direction?
502  else if (minMax > 20 && neighborRatio < 0.7)
503  {
504  threshold = 3;
505 
506  RawDigitVector::reverse_iterator startChirpItr = std::find_if(rawWaveform.rbegin(),rawWaveform.rend(),[mean,threshold](const short& elem){return abs(elem - mean) > threshold;});
507 
508  size_t threshIndex = std::distance(rawWaveform.rbegin(),startChirpItr);
509 
510  if (threshIndex > 60) wireToAdcIdxMap[wire].second = rawWaveform.size() - threshIndex;
511  }
512  }
513 
514  classified = true;
515  }
516 
517  return classified;
518 }
std::vector< short > fMinMaxSelectionCut
Plane by plane cuts for spread cut.
std::pair< WireToRawDigitVecMap, WireToAdcIdxMap > RawDigitAdcIdxPair
std::pair< size_t, size_t > RawDigitVectorIdxPair
T abs(T value)
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
size_t channelGroup(size_t view, size_t wire) const
std::pair< size_t, RawDigitVector & > WireToRawDigitVecPair
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
std::vector< float > fRmsRejectionCutHi
Maximum rms for input channels, reject if larger.
std::map< size_t, RawDigitVectorIdxPair > WireToAdcIdxMap
void caldata::RawDigitCharacterizationAlg::getMeanAndRms ( const RawDigitVector rawWaveform,
float &  aveVal,
float &  rmsVal,
int &  numBins 
) const

Definition at line 326 of file RawDigitCharacterizationAlg.cxx.

330 {
331  // The strategy for finding the average for a given wire will be to
332  // find the most populated bin and the average using the neighboring bins
333  // To do this we'll use a map with key the bin number and data the count in that bin
334  std::pair<RawDigitVector::const_iterator,RawDigitVector::const_iterator> minMaxValItr = std::minmax_element(rawWaveform.begin(),rawWaveform.end());
335 
336  int minVal = std::floor(*minMaxValItr.first);
337  int maxVal = std::ceil(*minMaxValItr.second);
338  int range = maxVal - minVal + 1;
339 
340  std::vector<int> frequencyVec(range, 0);
341  int mpCount(0);
342  int mpVal(0);
343 
344  for(const auto& val : rawWaveform)
345  {
346  int intVal = std::round(val) - minVal;
347 
348  frequencyVec[intVal]++;
349 
350  if (frequencyVec.at(intVal) > mpCount)
351  {
352  mpCount = frequencyVec[intVal];
353  mpVal = intVal;
354  }
355  }
356 
357  // take a weighted average of two neighbor bins
358  int meanCnt = 0;
359  int meanSum = 0;
360  int binRange = std::min(16, int(range/2 + 1));
361 
362  for(int idx = mpVal-binRange; idx <= mpVal+binRange; idx++)
363  {
364  if (idx < 0 || idx >= range) continue;
365 
366  meanSum += (idx + minVal) * frequencyVec[idx];
367  meanCnt += frequencyVec[idx];
368  }
369 
370  aveVal = float(meanSum) / float(meanCnt);
371 
372  // do rms calculation - the old fashioned way and over all adc values
373  std::vector<float> adcLessPedVec(rawWaveform.size());
374 
375  std::transform(rawWaveform.begin(),rawWaveform.end(),adcLessPedVec.begin(),std::bind(std::minus<float>(),std::placeholders::_1,aveVal));
376 
377  // recalculate the rms for truncation
378  rmsVal = std::inner_product(adcLessPedVec.begin(), adcLessPedVec.end(), adcLessPedVec.begin(), 0.);
379  rmsVal = std::sqrt(std::max(float(0.),rmsVal / float(adcLessPedVec.size())));
380  numBins = meanCnt;
381 
382  return;
383 }
static constexpr Sample_t transform(Sample_t sample)
void caldata::RawDigitCharacterizationAlg::getMeanAndTruncRms ( const RawDigitVector rawWaveform,
float &  aveVal,
float &  rmsVal,
float &  rmsTrunc,
int &  numBins 
) const

Definition at line 385 of file RawDigitCharacterizationAlg.cxx.

390 {
391  // The strategy for finding the average for a given wire will be to
392  // find the most populated bin and the average using the neighboring bins
393  // To do this we'll use a map with key the bin number and data the count in that bin
394  std::pair<RawDigitVector::const_iterator,RawDigitVector::const_iterator> minMaxValItr = std::minmax_element(rawWaveform.begin(),rawWaveform.end());
395 
396  int minVal = std::floor(*minMaxValItr.first);
397  int maxVal = std::ceil(*minMaxValItr.second);
398  int range = maxVal - minVal + 1;
399 
400  std::vector<int> frequencyVec(range, 0);
401  int mpCount(0);
402  int mpVal(0);
403 
404  for(const auto& val : rawWaveform)
405  {
406  int intVal = std::round(val) - minVal;
407 
408  frequencyVec[intVal]++;
409 
410  if (frequencyVec.at(intVal) > mpCount)
411  {
412  mpCount = frequencyVec[intVal];
413  mpVal = intVal;
414  }
415  }
416 
417  // take a weighted average of two neighbor bins
418  int meanCnt = 0;
419  int meanSum = 0;
420  int binRange = std::min(16, int(range/2 + 1));
421 
422  for(int idx = mpVal-binRange; idx <= mpVal+binRange; idx++)
423  {
424  if (idx < 0 || idx >= range) continue;
425 
426  meanSum += (idx + minVal) * frequencyVec[idx];
427  meanCnt += frequencyVec[idx];
428  }
429 
430  aveVal = float(meanSum) / float(meanCnt);
431 
432  // do rms calculation - the old fashioned way and over all adc values
433  std::vector<float> adcLessPedVec(rawWaveform.size());
434 
435  std::transform(rawWaveform.begin(),rawWaveform.end(),adcLessPedVec.begin(),std::bind(std::minus<float>(),std::placeholders::_1,aveVal));
436 
437  // recalculate the rms for truncation
438  rmsVal = std::inner_product(adcLessPedVec.begin(), adcLessPedVec.end(), adcLessPedVec.begin(), 0.);
439  rmsVal = std::sqrt(std::max(float(0.),rmsVal / float(adcLessPedVec.size())));
440 
441  // Drop the "large" rms values and recompute
442  std::vector<float>::iterator newEndItr = std::remove_if(adcLessPedVec.begin(),adcLessPedVec.end(),[rmsVal](const auto& val){return std::abs(val) > 2.5*rmsVal;});
443 
444  rmsTrunc = std::inner_product(adcLessPedVec.begin(), newEndItr, adcLessPedVec.begin(), 0.);
445  numBins = std::distance(adcLessPedVec.begin(),newEndItr);
446  rmsTrunc = std::sqrt(std::max(float(0.),rmsTrunc / float(numBins)));
447 
448  return;
449 }
static constexpr Sample_t transform(Sample_t sample)
T abs(T value)
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
void caldata::RawDigitCharacterizationAlg::getMeanRmsAndPedCor ( const RawDigitVector rawWaveform,
unsigned int  channel,
unsigned int  view,
unsigned int  wire,
float &  aveVal,
float &  rmsVal,
float &  pedCorVal 
) const

Definition at line 272 of file RawDigitCharacterizationAlg.cxx.

279 {
280  // The strategy for finding the average for a given wire will be to
281  // find the most populated bin and the average using the neighboring bins
282  // To do this we'll use a map with key the bin number and data the count in that bin
283  int meanCnt;
284 
285  getMeanAndRms(rawWaveform, truncMean, rmsVal, meanCnt);
286 
287  // Recover the database version of the pedestal
288  float pedestal(0.);
289 
290  try
291  {
292  pedestal = fPedestalRetrievalAlg.PedMean(channel);
293  }
294  catch(...)
295  {
296  pedestal = truncMean;
297  }
298 
299  pedCorVal = truncMean - pedestal;
300 
301  // Fill some histograms here
302  if (fHistsInitialized)
303  {
304  short maxVal = *std::max_element(rawWaveform.begin(),rawWaveform.end());
305  short minVal = *std::min_element(rawWaveform.begin(),rawWaveform.end());
306  short minMax = std::min(maxVal - minVal,199);
307 
308  fAdcCntHist[view]->Fill(meanCnt, 1.);
309  fAveValHist[view]->Fill(std::max(-29.9, std::min(29.9,double(truncMean - pedestal))), 1.);
310  fRmsFValHist[view]->Fill(std::min(19.9, double(rmsVal)), 1.);
311  fRmsValProf[view]->Fill(wire, double(rmsVal), 1.);
312  fMinMaxValProf[view]->Fill(wire, double(minMax), 1.);
313  fPedValProf[view]->Fill(wire, truncMean, 1.);
314  fPedValHist[view]->Fill(truncMean, 1.);
315  }
316 
317  // Output a message is there is significant different to the pedestal
318  if (abs(truncMean - pedestal) > fMaxPedestalDiff)
319  {
320  mf::LogInfo("RawDigitCharacterizationAlg") << ">>> Pedestal mismatch, channel: " << channel << ", new value: " << truncMean << ", original: " << pedestal << ", rms: " << rmsVal << std::endl;
321  }
322 
323  return;
324 }
void getMeanAndRms(const RawDigitVector &rawWaveform, float &aveVal, float &rmsVal, int &numBins) const
double fMaxPedestalDiff
Max pedestal diff to db to warn.
T abs(T value)
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
Keep track of an instance to the pedestal retrieval alg.
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
template<class T >
T caldata::RawDigitCharacterizationAlg::getMedian ( std::vector< T > &  valuesVec,
defaultValue 
) const

Definition at line 520 of file RawDigitCharacterizationAlg.cxx.

521 {
522  T medianValue(defaultValue);
523 
524  if (!valuesVec.empty())
525  {
526  std::sort(valuesVec.begin(),valuesVec.end());
527 
528  size_t medianIdx = valuesVec.size() / 2;
529 
530  medianValue = valuesVec[medianIdx];
531 
532  if (valuesVec.size() > 1 && medianIdx % 2) medianValue = (medianValue + valuesVec[medianIdx+1]) / 2;
533  }
534 
535  return std::max(medianValue,defaultValue);
536 }
void caldata::RawDigitCharacterizationAlg::getTruncatedRMS ( const RawDigitVector rawWaveform,
float &  pedestal,
float &  truncRms 
) const

Definition at line 248 of file RawDigitCharacterizationAlg.cxx.

251 {
252  // do rms calculation - the old fashioned way and over all adc values
253  std::vector<float> adcLessPedVec;
254 
255  adcLessPedVec.resize(rawWaveform.size());
256 
257  // Fill the vector
258  std::transform(rawWaveform.begin(),rawWaveform.end(),adcLessPedVec.begin(),std::bind(std::minus<short>(),std::placeholders::_1,pedestal));
259 
260  // sort in ascending order so we can truncate the sume
261  std::sort(adcLessPedVec.begin(), adcLessPedVec.end(),[](const auto& left, const auto& right){return std::fabs(left) < std::fabs(right);});
262 
263  int minNumBins = (1. - fTruncMeanFraction) * rawWaveform.size();
264 
265  // Get the truncated sum
266  truncRms = std::inner_product(adcLessPedVec.begin(), adcLessPedVec.begin() + minNumBins, adcLessPedVec.begin(), 0.);
267  truncRms = std::sqrt(std::max(0.,truncRms / double(minNumBins)));
268 
269  return;
270 }
static constexpr Sample_t transform(Sample_t sample)
walls no right
Definition: selectors.fcl:105
walls no left
Definition: selectors.fcl:105
float fTruncMeanFraction
Fraction for truncated mean.
void caldata::RawDigitCharacterizationAlg::getWaveformParams ( const RawDigitVector rawWaveform,
unsigned int  channel,
unsigned int  view,
unsigned int  wire,
float &  truncMean,
float &  truncRms,
short &  mean,
short &  median,
short &  mode,
float &  skewness,
float &  rms,
short &  minMax,
float &  neighborRatio,
float &  pedCorVal 
) const

Definition at line 123 of file RawDigitCharacterizationAlg.cxx.

137 {
138  // We start by finding the most likely baseline which is most easily done by
139  // finding the most populated bin and the average using the neighboring bins
140  // To do this we'll use a map with key the bin number and data the count in that bin
141  int numTruncBins;
142 
143  getMeanAndTruncRms(rawWaveform, truncMean, rms, truncRms, numTruncBins);
144 
145  // The pedCorVal will transform from the average of waveform calculated here to the expected value of the pedestal.
146  pedCorVal = 0.;
147 
148  // Determine the range of ADC values on this wire
149  std::pair<RawDigitVector::const_iterator,RawDigitVector::const_iterator> minMaxItrPair = std::minmax_element(rawWaveform.begin(),rawWaveform.end());
150 
151  minMax = std::min(*minMaxItrPair.second - *minMaxItrPair.first + 1, 199); // for the purposes of histogramming
152 
153  // We also want mean, median, rms, etc., for all ticks on the waveform
154  std::vector<short> localTimeVec = rawWaveform;
155 
156  std::sort(localTimeVec.begin(),localTimeVec.end(),[](const auto& left, const auto& right){return std::fabs(left) < std::fabs(right);});
157 
158  float realMean(float(std::accumulate(localTimeVec.begin(),localTimeVec.end(),0))/float(localTimeVec.size()));
159 
160  median = localTimeVec[localTimeVec.size()/2];
161  mean = std::round(realMean);
162 
163  std::vector<float> adcLessPedVec;
164 
165  adcLessPedVec.resize(localTimeVec.size());
166 
167  std::transform(localTimeVec.begin(),localTimeVec.end(),adcLessPedVec.begin(),std::bind(std::minus<float>(),std::placeholders::_1,realMean));
168 
169  rms = std::sqrt(std::inner_product(adcLessPedVec.begin(), adcLessPedVec.end(), adcLessPedVec.begin(), 0.) / float(adcLessPedVec.size()));
170  skewness = 3. * float(realMean - median) / rms;
171 
172  // Final task is to get the mode and neighbor ratio
173  // Define the map first
174  std::unordered_map<short,short> binAdcMap;
175 
176  // Populate the map
177  for(const auto& adcVal : rawWaveform) binAdcMap[adcVal]++;
178 
179  // Find the max bin and the count
180  std::unordered_map<short,short>::iterator maxBinItr = std::max_element(binAdcMap.begin(),binAdcMap.end(),[](const auto& lhs,const auto& rhs){return lhs.second < rhs.second;});
181 
182  short neighborSum(0);
183  short leftNeighbor(maxBinItr->second);
184  short rightNeighbor(maxBinItr->second);
185  short cnt(0);
186 
187  mode = maxBinItr->first;
188 
189  if (binAdcMap.find(mode-1) != binAdcMap.end())
190  {
191  leftNeighbor = binAdcMap.find(mode-1)->second;
192  neighborSum += leftNeighbor;
193  cnt++;
194  }
195 
196  if (binAdcMap.find(mode+1) != binAdcMap.end())
197  {
198  rightNeighbor = binAdcMap.find(mode+1)->second;
199  neighborSum += rightNeighbor;
200  cnt++;
201  }
202 
203  neighborRatio = float(neighborSum) / float(2*maxBinItr->second);
204 
205  neighborRatio = float(std::min(leftNeighbor,rightNeighbor)) / float(maxBinItr->second);
206 // float leastNeighborRatio = float(std::min(leftNeighbor,rightNeighbor)) / float(maxBinItr->second);
207 
208  // Fill some histograms here
209  if (fHistsInitialized)
210  {
211  short maxVal = *std::max_element(rawWaveform.begin(),rawWaveform.end());
212  short minVal = *std::min_element(rawWaveform.begin(),rawWaveform.end());
213  short minMax = std::min(maxVal - minVal,199);
214 
215  fAdcCntHist[view]->Fill(numTruncBins, 1.);
216  fAveValHist[view]->Fill(std::max(-29.9, std::min(29.9,double(truncMean))), 1.);
217  fRmsTValHist[view]->Fill(std::min(19.9, double(truncRms)), 1.);
218  fRmsFValHist[view]->Fill(std::min(19.9, double(rms)), 1.);
219  fRmsValProf[view]->Fill(wire, double(truncRms), 1.);
220  fMinMaxValProf[view]->Fill(wire, double(minMax), 1.);
221  fPedValProf[view]->Fill(wire, truncMean, 1.);
222  fPedValHist[view]->Fill(truncMean, 1.);
223  }
224 
225 
226  if (wire / fNumWiresToGroup[view] == fHistsWireGroup[view])
227  {
228  float leastNeighborRatio = float(std::min(leftNeighbor,rightNeighbor)) / float(maxBinItr->second);
229  size_t wireIdx = wire % fNumWiresToGroup[view];
230 
231 // if (skewness > 0. && leastNeighborRatio < 0.7)
232 // {
233 // short threshold(6);
234 //
235 // RawDigitVector::const_iterator stopChirpItr = std::find_if(rawWaveform.begin(),rawWaveform.end(),[mean,threshold](const short& elem){return abs(elem - mean) > threshold;});
236 // }
237 
238  if (fHistsInitialized)
239  {
240  fMinMaxProfiles[view]->Fill(double(wireIdx+0.5), double(minMax), 1.);
241  fSkewnessProfiles[view]->Fill(double(wireIdx+0.5), double(skewness), 1.);
242  fModeRatioProfiles[view]->Fill(double(wireIdx+0.5), double(leastNeighborRatio), 1.);
243  }
244  }
245 
246  return;
247 }
static constexpr Sample_t transform(Sample_t sample)
walls no right
Definition: selectors.fcl:105
void getMeanAndTruncRms(const RawDigitVector &rawWaveform, float &aveVal, float &rmsVal, float &rmsTrunc, int &numBins) const
const char mode
Definition: noise_ana.cxx:20
walls no left
Definition: selectors.fcl:105
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
std::vector< size_t > fNumWiresToGroup
If smoothing, the number of wires to look at.
std::vector< size_t > fHistsWireGroup
Wire Group to pick on.
void caldata::RawDigitCharacterizationAlg::initializeHists ( art::ServiceHandle< art::TFileService > &  tfs)

Begin job method.

Definition at line 58 of file RawDigitCharacterizationAlg.cxx.

59 {
60  if (fFillHistograms)
61  {
62  // Define the histograms. Putting semi-colons around the title
63  // causes it to be displayed as the x-axis label if the histogram
64  // is drawn.
65  fAdcCntHist[0] = tfs->make<TH1D>("CntUPlane", ";#adc", 200, 2200., 4200.);
66  fAdcCntHist[1] = tfs->make<TH1D>("CntVPlane", ";#adc", 200, 2200., 4200.);
67  fAdcCntHist[2] = tfs->make<TH1D>("CntWPlane", ";#adc", 200, 2200., 4200.);
68  fAveValHist[0] = tfs->make<TH1D>("AveUPlane", ";Ave", 120, -20., 20.);
69  fAveValHist[1] = tfs->make<TH1D>("AveVPlane", ";Ave", 120, -20., 20.);
70  fAveValHist[2] = tfs->make<TH1D>("AveWPlane", ";Ave", 120, -20., 20.);
71  fRmsTValHist[0] = tfs->make<TH1D>("RmsTUPlane", ";RMS", 100, 0., 10.);
72  fRmsTValHist[1] = tfs->make<TH1D>("RmsTVPlane", ";RMS", 100, 0., 10.);
73  fRmsTValHist[2] = tfs->make<TH1D>("RmsTWPlane", ";RMS", 100, 0., 10.);
74  fRmsFValHist[0] = tfs->make<TH1D>("RmsFUPlane", ";RMS", 100, 0., 10.);
75  fRmsFValHist[1] = tfs->make<TH1D>("RmsFVPlane", ";RMS", 100, 0., 10.);
76  fRmsFValHist[2] = tfs->make<TH1D>("RmsFWPlane", ";RMS", 100, 0., 10.);
77  fPedValHist[0] = tfs->make<TH1D>("PedUPlane", ";Ped", 200, 1950, 2150.);
78  fPedValHist[1] = tfs->make<TH1D>("PedVPlane", ";Ped", 200, 1950, 2150.);
79  fPedValHist[2] = tfs->make<TH1D>("PedWPlane", ";Ped", 200, 350, 550.);
80 
81  fRmsValProf[0] = tfs->make<TProfile>("RmsPlane0Prof", ";Wire #", 1200, 0., 1200., 0., 100.);
82  fRmsValProf[1] = tfs->make<TProfile>("RmsPlane1Prof", ";Wire #", 5000, 0., 5000., 0., 100.);
83  fRmsValProf[2] = tfs->make<TProfile>("RmsPlane2Prof", ";Wire #", 5000, 0., 5000., 0., 100.);
84 
85  fMinMaxValProf[0] = tfs->make<TProfile>("MinMaxPlane0Prof", ";Wire #", 1200, 0., 1200., 0., 200.);
86  fMinMaxValProf[1] = tfs->make<TProfile>("MinMaxPlane1Prof", ";Wire #", 5000, 0., 5000., 0., 200.);
87  fMinMaxValProf[2] = tfs->make<TProfile>("MinMaxPlane2Prof", ";Wire #", 5000, 0., 5000., 0., 200.);
88 
89  fPedValProf[0] = tfs->make<TProfile>("PedPlane0Prof", ";Wire #", 1200, 0., 1200., 1500., 2500.);
90  fPedValProf[1] = tfs->make<TProfile>("PedPlane1Prof", ";Wire #", 5000, 0., 5000., 1500., 2500.);
91  fPedValProf[2] = tfs->make<TProfile>("PedPlane2Prof", ";Wire #", 5000, 0., 5000., 0., 1000.);
92 
93  fAverageHist[0] = tfs->make<TH1D>("Average0", ";Bin", 1000, 1500., 2500.);
94  fAverageHist[1] = tfs->make<TH1D>("Average1", ";Bin", 1000, 1500., 2500.);
95  fAverageHist[2] = tfs->make<TH1D>("Average2", ";Bin", 1000, 0., 1000.);
96 
97  fMinMaxProfiles.resize(3);
98  fSkewnessProfiles.resize(3);
99  fModeRatioProfiles.resize(3);
100 
101  for(size_t viewIdx = 0; viewIdx < 3; viewIdx++)
102  {
103  std::string minMaxName = "MinMax_" + std::to_string(viewIdx);
104 
105  fMinMaxProfiles[viewIdx] = tfs->make<TProfile>(minMaxName.c_str(), "Min/Max Profiles;Wire", fNumWiresToGroup[viewIdx], 0., fNumWiresToGroup[viewIdx], 0., 200.);
106 
107  minMaxName = "Skewness_" + std::to_string(viewIdx);
108 
109  fSkewnessProfiles[viewIdx] = tfs->make<TProfile>(minMaxName.c_str(), "Skewness Profiles;Wire", fNumWiresToGroup[viewIdx], 0., fNumWiresToGroup[viewIdx], -4., 4.);
110 
111  minMaxName = "ModeRatio_" + std::to_string(viewIdx);
112 
113  fModeRatioProfiles[viewIdx] = tfs->make<TProfile>(minMaxName.c_str(), "Mode Ratio;Wire", fNumWiresToGroup[viewIdx], 0., fNumWiresToGroup[viewIdx], 0., 1.2);
114  }
115 
116  fHistsInitialized = true;
117  }
118 
119  return;
120 }
bool fFillHistograms
if true then will fill diagnostic hists
std::string to_string(WindowPattern const &pattern)
std::vector< size_t > fNumWiresToGroup
If smoothing, the number of wires to look at.
art::ServiceHandle< art::TFileService > tfs
void caldata::RawDigitCharacterizationAlg::reconfigure ( fhicl::ParameterSet const &  pset)

Reconfigure method.

Arguments:

pset - Fcl parameter set.

Definition at line 42 of file RawDigitCharacterizationAlg.cxx.

43 {
44  fTruncMeanFraction = pset.get<float> ("TruncMeanFraction", 0.15);
45  fRmsRejectionCutHi = pset.get<std::vector<float>> ("RMSRejectionCutHi", std::vector<float>() = {25.0,25.0,25.0});
46  fRmsRejectionCutLow = pset.get<std::vector<float>> ("RMSRejectionCutLow", std::vector<float>() = {0.70,0.70,0.70});
47  fRmsSelectionCut = pset.get<std::vector<float>> ("RMSSelectionCut", std::vector<float>() = {1.40,1.40,1.00});
48  fMinMaxSelectionCut = pset.get<std::vector<short>> ("MinMaxSelectionCut", std::vector<short>() = {13, 13, 11});
49  fTheChosenWire = pset.get<unsigned int> ("TheChosenWire", 1200);
50  fMaxPedestalDiff = pset.get<double> ("MaxPedestalDiff", 10.);
51  fHistsWireGroup = pset.get<std::vector<size_t>>("FFTHistsWireGroup", std::vector<size_t>() = {1, 33, 34});
52  fNumWiresToGroup = pset.get<std::vector<size_t>>("NumWiresToGroup", std::vector<size_t>() = {48, 48, 96});
53  fFillHistograms = pset.get<bool> ("FillHistograms", true);
54 }
std::vector< float > fRmsSelectionCut
Don&#39;t use/apply correction to wires below this.
std::vector< short > fMinMaxSelectionCut
Plane by plane cuts for spread cut.
double fMaxPedestalDiff
Max pedestal diff to db to warn.
bool fFillHistograms
if true then will fill diagnostic hists
unsigned int fTheChosenWire
For example hist.
std::vector< float > fRmsRejectionCutLow
Minimum rms to consider channel &quot;alive&quot;.
std::vector< size_t > fNumWiresToGroup
If smoothing, the number of wires to look at.
std::vector< float > fRmsRejectionCutHi
Maximum rms for input channels, reject if larger.
std::vector< size_t > fHistsWireGroup
Wire Group to pick on.
float fTruncMeanFraction
Fraction for truncated mean.

Member Data Documentation

TH1D* caldata::RawDigitCharacterizationAlg::fAdcCntHist[3]
private

Definition at line 130 of file RawDigitCharacterizationAlg.h.

TH1D* caldata::RawDigitCharacterizationAlg::fAverageHist[3]
private

Definition at line 135 of file RawDigitCharacterizationAlg.h.

TH1D* caldata::RawDigitCharacterizationAlg::fAveValHist[3]
private

Definition at line 131 of file RawDigitCharacterizationAlg.h.

caldata::ChannelGroups caldata::RawDigitCharacterizationAlg::fChannelGroups
private

Definition at line 144 of file RawDigitCharacterizationAlg.h.

bool caldata::RawDigitCharacterizationAlg::fFillHistograms
private

if true then will fill diagnostic hists

Definition at line 124 of file RawDigitCharacterizationAlg.h.

art::ServiceHandle<geo::Geometry> caldata::RawDigitCharacterizationAlg::fGeometry
private

Detector properties service.

pointer to Geometry service

Definition at line 147 of file RawDigitCharacterizationAlg.h.

bool caldata::RawDigitCharacterizationAlg::fHistsInitialized
private

Definition at line 127 of file RawDigitCharacterizationAlg.h.

std::vector<size_t> caldata::RawDigitCharacterizationAlg::fHistsWireGroup
private

Wire Group to pick on.

Definition at line 122 of file RawDigitCharacterizationAlg.h.

double caldata::RawDigitCharacterizationAlg::fMaxPedestalDiff
private

Max pedestal diff to db to warn.

Definition at line 121 of file RawDigitCharacterizationAlg.h.

std::vector<TProfile*> caldata::RawDigitCharacterizationAlg::fMinMaxProfiles
private

Definition at line 140 of file RawDigitCharacterizationAlg.h.

std::vector<short> caldata::RawDigitCharacterizationAlg::fMinMaxSelectionCut
private

Plane by plane cuts for spread cut.

Definition at line 119 of file RawDigitCharacterizationAlg.h.

TProfile* caldata::RawDigitCharacterizationAlg::fMinMaxValProf[3]
private

Definition at line 137 of file RawDigitCharacterizationAlg.h.

std::vector<TProfile*> caldata::RawDigitCharacterizationAlg::fModeRatioProfiles
private

Definition at line 142 of file RawDigitCharacterizationAlg.h.

std::vector<size_t> caldata::RawDigitCharacterizationAlg::fNumWiresToGroup
private

If smoothing, the number of wires to look at.

Definition at line 123 of file RawDigitCharacterizationAlg.h.

const lariov::DetPedestalProvider& caldata::RawDigitCharacterizationAlg::fPedestalRetrievalAlg
private

Keep track of an instance to the pedestal retrieval alg.

Definition at line 149 of file RawDigitCharacterizationAlg.h.

TH1D* caldata::RawDigitCharacterizationAlg::fPedValHist[3]
private

Definition at line 134 of file RawDigitCharacterizationAlg.h.

TProfile* caldata::RawDigitCharacterizationAlg::fPedValProf[3]
private

Definition at line 138 of file RawDigitCharacterizationAlg.h.

TH1D* caldata::RawDigitCharacterizationAlg::fRmsFValHist[3]
private

Definition at line 133 of file RawDigitCharacterizationAlg.h.

std::vector<float> caldata::RawDigitCharacterizationAlg::fRmsRejectionCutHi
private

Maximum rms for input channels, reject if larger.

Definition at line 116 of file RawDigitCharacterizationAlg.h.

std::vector<float> caldata::RawDigitCharacterizationAlg::fRmsRejectionCutLow
private

Minimum rms to consider channel "alive".

Definition at line 117 of file RawDigitCharacterizationAlg.h.

std::vector<float> caldata::RawDigitCharacterizationAlg::fRmsSelectionCut
private

Don't use/apply correction to wires below this.

Definition at line 118 of file RawDigitCharacterizationAlg.h.

TH1D* caldata::RawDigitCharacterizationAlg::fRmsTValHist[3]
private

Definition at line 132 of file RawDigitCharacterizationAlg.h.

TProfile* caldata::RawDigitCharacterizationAlg::fRmsValProf[3]
private

Definition at line 136 of file RawDigitCharacterizationAlg.h.

std::vector<TProfile*> caldata::RawDigitCharacterizationAlg::fSkewnessProfiles
private

Definition at line 141 of file RawDigitCharacterizationAlg.h.

unsigned int caldata::RawDigitCharacterizationAlg::fTheChosenWire
private

For example hist.

Definition at line 120 of file RawDigitCharacterizationAlg.h.

float caldata::RawDigitCharacterizationAlg::fTruncMeanFraction
private

Fraction for truncated mean.

Definition at line 115 of file RawDigitCharacterizationAlg.h.


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