CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PedsFullNoiseAlgorithm Class Reference

Histogram-based analysis for pedestal run. More...

#include <PedsFullNoiseAlgorithm.h>

Inheritance diagram for PedsFullNoiseAlgorithm:
CommissioningAlgorithm

Public Member Functions

const HistohNoise () const
 
const HistohNoise2D () const
 
const HistohPeds () const
 
 PedsFullNoiseAlgorithm (const edm::ParameterSet &pset, PedsFullNoiseAnalysis *const)
 
 ~PedsFullNoiseAlgorithm () override
 
- Public Member Functions inherited from CommissioningAlgorithm
void analysis (const std::vector< TH1 *> &)
 
 CommissioningAlgorithm (CommissioningAnalysis *const)
 
 CommissioningAlgorithm ()
 
virtual ~CommissioningAlgorithm ()
 

Private Member Functions

void analyse () override
 
void extract (const std::vector< TH1 *> &) override
 
 PedsFullNoiseAlgorithm ()
 
void reset (PedsFullNoiseAnalysis *)
 

Private Attributes

float adProbabCut_
 
float amplitudeRatio_
 
float ashmanDistance_
 
float chi2ProbabCut_
 
bool generateRandomHisto_
 
Histo hNoise2D_
 
Histo hNoise_
 
Histo hPeds_
 
int integralNsigma_
 
float integralTailCut_
 
float jbProbabCut_
 
float ksProbabCut_
 
float kurtosisCut_
 
float maxDriftResidualCut_
 
float maxStripNoiseCut_
 
float maxStripNoiseSignificanceCut_
 
float minStripNoiseCut_
 

Additional Inherited Members

- Public Types inherited from CommissioningAlgorithm
typedef std::pair< TH1 *, std::string > Histo
 
- Protected Member Functions inherited from CommissioningAlgorithm
CommissioningAnalysis *const anal () const
 
uint32_t extractFedKey (const TH1 *const)
 

Detailed Description

Histogram-based analysis for pedestal run.

Author
M. Wingham, R.Bainbridge

Definition at line 17 of file PedsFullNoiseAlgorithm.h.

Constructor & Destructor Documentation

◆ PedsFullNoiseAlgorithm() [1/2]

PedsFullNoiseAlgorithm::PedsFullNoiseAlgorithm ( const edm::ParameterSet pset,
PedsFullNoiseAnalysis * const  anal 
)

Definition at line 26 of file PedsFullNoiseAlgorithm.cc.

References adProbabCut_, chi2ProbabCut_, integralNsigma_, integralTailCut_, jbProbabCut_, ksProbabCut_, kurtosisCut_, LogDebug, maxDriftResidualCut_, maxStripNoiseCut_, maxStripNoiseSignificanceCut_, minStripNoiseCut_, and sistrip::mlCommissioning_.

28  hPeds_(nullptr, ""),
29  hNoise_(nullptr, ""),
30  hNoise2D_(nullptr, ""),
31  maxDriftResidualCut_(pset.getParameter<double>("MaxDriftResidualCut")),
32  minStripNoiseCut_(pset.getParameter<double>("MinStripNoiseCut")),
33  maxStripNoiseCut_(pset.getParameter<double>("MaxStripNoiseCut")),
34  maxStripNoiseSignificanceCut_(pset.getParameter<double>("MaxStripNoiseSignificanceCut")),
35  adProbabCut_(pset.getParameter<double>("AdProbabCut")),
36  ksProbabCut_(pset.getParameter<double>("KsProbabCut")),
37  generateRandomHisto_(pset.getParameter<bool>("GenerateRandomHisto")),
38  jbProbabCut_(pset.getParameter<double>("JbProbabCut")),
39  chi2ProbabCut_(pset.getParameter<double>("Chi2ProbabCut")),
40  kurtosisCut_(pset.getParameter<double>("KurtosisCut")),
41  integralTailCut_(pset.getParameter<double>("IntegralTailCut")),
42  integralNsigma_(pset.getParameter<int>("IntegralNsigma")),
43  ashmanDistance_(pset.getParameter<double>("AshmanDistance")),
44  amplitudeRatio_(pset.getParameter<double>("AmplitudeRatio")) {
45  LogDebug(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]"
46  << " Set maximum drift of the mean value to: " << maxDriftResidualCut_
47  << " Set minimum noise value to: " << minStripNoiseCut_
48  << " Set maximum noise value to: " << maxStripNoiseCut_
49  << " Set maximum noise significance value to: " << maxStripNoiseSignificanceCut_
50  << " Set minimum Anderson-Darling p-value to: " << adProbabCut_
51  << " Set minimum Kolmogorov-Smirnov p-value to: " << ksProbabCut_
52  << " Set minimum Jacque-Bera p-value to: " << jbProbabCut_
53  << " Set minimum Chi2 p-value to: " << chi2ProbabCut_
54  << " Set N-sigma for the integral to : " << integralNsigma_
55  << " Set maximum integral tail at N-sigma to : " << integralTailCut_
56  << " Set maximum Kurtosis to : " << kurtosisCut_;
57 }
CommissioningAnalysis *const anal() const
static const char mlCommissioning_[]
#define LogDebug(id)

◆ ~PedsFullNoiseAlgorithm()

PedsFullNoiseAlgorithm::~PedsFullNoiseAlgorithm ( )
inlineoverride

Definition at line 21 of file PedsFullNoiseAlgorithm.h.

21 { ; }

◆ PedsFullNoiseAlgorithm() [2/2]

PedsFullNoiseAlgorithm::PedsFullNoiseAlgorithm ( )
inlineprivate

Definition at line 28 of file PedsFullNoiseAlgorithm.h.

28 { ; }

Member Function Documentation

◆ analyse()

void PedsFullNoiseAlgorithm::analyse ( )
overrideprivatevirtual

Performs histogram anaysis.

Implements CommissioningAlgorithm.

Definition at line 154 of file PedsFullNoiseAlgorithm.cc.

References funct::abs(), CommissioningAnalysis::addErrorCode(), PedsFullNoiseAnalysis::adProbab_, adProbabCut_, amplitudeRatio_, CommissioningAlgorithm::anal(), ashmanDistance_, PedsFullNoiseAnalysis::badADProbab_, PedsFullNoiseAnalysis::badChi2Probab_, PedsFullNoiseAnalysis::badDoublePeakStrip_, PedsFullNoiseAnalysis::badFitStatus_, PedsFullNoiseAnalysis::badJBProbab_, PedsFullNoiseAnalysis::badKSProbab_, PedsFullNoiseAnalysis::badStrip_, PedsFullNoiseAnalysis::badStripBit_, PedsFullNoiseAnalysis::badTailStrip_, PedsFullNoiseAnalysis::chi2Probab_, chi2ProbabCut_, PedsFullNoiseAnalysis::deadStrip_, PedsFullNoiseAnalysis::deadStripBit_, CommissioningAnalysis::fecKey(), generateRandomHisto_, hNoise2D_, hNoise_, hPeds_, integralNsigma_, integralTailCut_, PedsFullNoiseAnalysis::jbProbab_, jbProbabCut_, PedsFullNoiseAnalysis::ksProbab_, ksProbabCut_, kurtosisCut_, PedsFullNoiseAnalysis::largeNoiseSignificance_, PedsFullNoiseAnalysis::largeNoiseStrip_, LogTrace, PedsFullNoiseAnalysis::lowNoiseStrip_, SiStripPI::max, maxDriftResidualCut_, sistrip::maximum_, maxStripNoiseCut_, maxStripNoiseSignificanceCut_, SiStripPI::min, minStripNoiseCut_, sistrip::mlCommissioning_, sistrip::mlDqmClient_, PedsFullNoiseAnalysis::noise_, PedsFullNoiseAnalysis::noiseMax_, PedsFullNoiseAnalysis::noiseMean_, PedsFullNoiseAnalysis::noiseMin_, PedsFullNoiseAnalysis::noiseSignificance_, PedsFullNoiseAnalysis::noiseSpread_, sistrip::nullPtr_, sistrip::numberOfBins_, or, PedsFullNoiseAnalysis::peds_, PedsFullNoiseAnalysis::pedsMax_, PedsFullNoiseAnalysis::pedsMean_, PedsFullNoiseAnalysis::pedsMin_, PedsFullNoiseAnalysis::pedsSpread_, funct::pow(), PedsFullNoiseAnalysis::raw_, PedsFullNoiseAnalysis::rawMax_, PedsFullNoiseAnalysis::rawMean_, PedsFullNoiseAnalysis::rawMin_, PedsFullNoiseAnalysis::rawSpread_, reset(), PedsFullNoiseAnalysis::residualIntegral_, PedsFullNoiseAnalysis::residualIntegralNsigma_, PedsFullNoiseAnalysis::residualKurtosis_, PedsFullNoiseAnalysis::residualMean_, PedsFullNoiseAnalysis::residualRMS_, PedsFullNoiseAnalysis::residualSigmaGaus_, PedsFullNoiseAnalysis::residualSkewness_, mps_fire::result, PedsFullNoiseAnalysis::shiftedStrip_, mathSSE::sqrt(), createJobs::tmp, and relativeConstraints::value.

154  {
155  // check base analysis object
156  if (!anal()) {
157  edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]"
158  << " NULL pointer to base Analysis object!";
159  return;
160  }
161 
163  PedsFullNoiseAnalysis* ana = dynamic_cast<PedsFullNoiseAnalysis*>(tmp);
164 
165  // check PedsFullNoiseAnalysis object
166  if (!ana) {
167  edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]"
168  << " NULL pointer to derived Analysis object!";
169  return;
170  }
171 
172  // check if the histograms exists
173  if (!hPeds_.first) {
175  return;
176  }
177 
178  if (!hNoise_.first) {
180  return;
181  }
182 
183  if (!hNoise2D_.first) {
185  return;
186  }
187 
188  // take the histograms
189  TProfile* histoPeds = dynamic_cast<TProfile*>(hPeds_.first);
190  TProfile* histoNoiseMean = dynamic_cast<TProfile*>(hNoise_.first);
191  TH2S* histoNoise = dynamic_cast<TH2S*>(hNoise2D_.first);
192 
193  // Make sanity checks about pointers
194  if (not histoPeds) {
196  return;
197  }
198 
199  if (not histoNoiseMean) {
201  return;
202  }
203 
204  if (not histoNoise) {
206  return;
207  }
208 
209  // check the binning --> each x-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips
210  if (histoPeds->GetNbinsX() != 256) {
212  return;
213  }
214 
215  //check the binning --> each x-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips
216  if (histoNoiseMean->GetNbinsX() != 256) {
218  return;
219  }
220 
221  //check the binning --> each y-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips
222  if (histoNoise->GetNbinsY() != 256) {
224  return;
225  }
226 
227  //Reset values
228  reset(ana);
229 
230  // loop on each strip
231  uint32_t apvID = -1;
232 
233  // Save basic information at strip / APV level
234  vector<float> ped_max;
235  vector<float> ped_min;
236  vector<float> raw_max;
237  vector<float> raw_min;
238  vector<float> noise_max;
239  vector<float> noise_min;
240 
241  // loop on each strip in the lldChannel
242  for (int iStrip = 0; iStrip < histoPeds->GetNbinsX(); iStrip++) {
243  if (iStrip < histoPeds->GetNbinsX() / 2)
244  apvID = 0;
245  else
246  apvID = 1;
247 
248  int stripBin = 0;
249  if (iStrip >= 128)
250  stripBin = iStrip - 128;
251  else
252  stripBin = iStrip;
253 
254  ana->peds_[apvID][stripBin] = histoPeds->GetBinContent(iStrip + 1); // pedestal value
255  ana->noise_[apvID][stripBin] = histoNoiseMean->GetBinContent(iStrip + 1); // noise value
256  ana->raw_[apvID][stripBin] = histoPeds->GetBinError(iStrip + 1); // raw noise value
257 
258  ana->pedsMean_[apvID] += ana->peds_[apvID][stripBin]; // mean pedestal
259  ana->rawMean_[apvID] += ana->raw_[apvID][stripBin]; // mean raw noise
260  ana->noiseMean_[apvID] += ana->noise_[apvID][stripBin]; // mean noise
261 
262  // max pedestal
263  if (ped_max.size() < apvID + 1)
264  ped_max.push_back(ana->peds_[apvID][stripBin]);
265  else {
266  if (ana->peds_[apvID][stripBin] > ped_max.at(apvID))
267  ped_max.at(apvID) = ana->peds_[apvID][stripBin];
268  }
269 
270  // min pedestal
271  if (ped_min.size() < apvID + 1)
272  ped_min.push_back(ana->peds_[apvID][stripBin]);
273  else {
274  if (ana->peds_[apvID][stripBin] < ped_min.at(apvID))
275  ped_min.at(apvID) = ana->peds_[apvID][stripBin]; // min pedestal
276  }
277 
278  // max noise
279  if (noise_max.size() < apvID + 1)
280  noise_max.push_back(ana->noise_[apvID][stripBin]);
281  else {
282  if (ana->noise_[apvID][stripBin] > noise_max.at(apvID))
283  noise_max.at(apvID) = ana->noise_[apvID][stripBin];
284  }
285 
286  // min noise
287  if (noise_min.size() < apvID + 1)
288  noise_min.push_back(ana->noise_[apvID][stripBin]);
289  else {
290  if (ana->noise_[apvID][stripBin] < noise_min.at(apvID))
291  noise_min.at(apvID) = ana->noise_[apvID][stripBin];
292  }
293 
294  // max raw
295  if (raw_max.size() < apvID + 1)
296  raw_max.push_back(ana->raw_[apvID][stripBin]);
297  else {
298  if (ana->raw_[apvID][stripBin] > raw_max.at(apvID))
299  raw_max.at(apvID) = ana->raw_[apvID][stripBin];
300  }
301 
302  // min raw
303  if (raw_min.size() < apvID + 1)
304  raw_min.push_back(ana->raw_[apvID][stripBin]);
305  else {
306  if (ana->raw_[apvID][stripBin] < raw_min.at(apvID))
307  raw_min.at(apvID) = ana->raw_[apvID][stripBin];
308  }
309  }
310 
311  // Mean values
312  for (unsigned int iApv = 0; iApv < ana->pedsMean_.size(); iApv++) {
313  ana->pedsMean_.at(iApv) /= (ana->peds_[iApv].size()); // calculate mean pedestal per APV
314  ana->rawMean_.at(iApv) /= (ana->raw_[iApv].size()); // calculate mean raw noise per APV
315  ana->noiseMean_.at(iApv) /= (ana->noise_[iApv].size()); // calculate mean noise per APV
316  }
317 
318  // Min and Max
319  for (unsigned int iApv = 0; iApv < ped_max.size(); iApv++) {
320  if (ped_max.at(iApv) > sistrip::maximum_)
321  ana->pedsMax_.at(iApv) = sistrip::maximum_;
322  else if (ped_max.at(iApv) < -1. * sistrip::maximum_)
323  ana->pedsMax_.at(iApv) = -1. * sistrip::maximum_;
324  else
325  ana->pedsMax_.at(iApv) = ped_max.at(iApv);
326 
327  if (ped_min.at(iApv) > sistrip::maximum_)
328  ana->pedsMin_.at(iApv) = sistrip::maximum_;
329  else if (ped_min.at(iApv) < -1. * sistrip::maximum_)
330  ana->pedsMin_.at(iApv) = -1. * sistrip::maximum_;
331  else
332  ana->pedsMin_.at(iApv) = ped_min.at(iApv);
333 
334  if (noise_max.at(iApv) > sistrip::maximum_)
335  ana->noiseMax_.at(iApv) = sistrip::maximum_;
336  else if (noise_max.at(iApv) < -1. * sistrip::maximum_)
337  ana->noiseMax_.at(iApv) = -1. * sistrip::maximum_;
338  else
339  ana->noiseMax_.at(iApv) = noise_max.at(iApv);
340 
341  if (noise_min.at(iApv) > sistrip::maximum_)
342  ana->noiseMin_.at(iApv) = sistrip::maximum_;
343  else if (noise_min.at(iApv) < -1. * sistrip::maximum_)
344  ana->noiseMin_.at(iApv) = -1. * sistrip::maximum_;
345  else
346  ana->noiseMin_.at(iApv) = noise_min.at(iApv);
347 
348  if (raw_max.at(iApv) > sistrip::maximum_)
349  ana->rawMax_.at(iApv) = sistrip::maximum_;
350  else if (raw_max.at(iApv) < -1. * sistrip::maximum_)
351  ana->rawMax_.at(iApv) = -1. * sistrip::maximum_;
352  else
353  ana->rawMax_.at(iApv) = raw_max.at(iApv);
354 
355  if (raw_min.at(iApv) > sistrip::maximum_)
356  ana->rawMin_.at(iApv) = sistrip::maximum_;
357  else if (raw_min.at(iApv) < -1. * sistrip::maximum_)
358  ana->rawMin_.at(iApv) = -1. * sistrip::maximum_;
359  else
360  ana->rawMin_.at(iApv) = raw_min.at(iApv);
361  }
362 
363  // Calculate the spread for noise and pedestal
364  apvID = -1;
365 
366  for (int iStrip = 0; iStrip < histoNoiseMean->GetNbinsX(); iStrip++) {
367  if (iStrip < histoNoiseMean->GetNbinsX() / 2)
368  apvID = 0;
369  else
370  apvID = 1;
371  ana->pedsSpread_[apvID] += pow(histoPeds->GetBinContent(iStrip + 1) - ana->pedsMean_.at(apvID), 2);
372  ana->noiseSpread_[apvID] += pow(histoNoiseMean->GetBinContent(iStrip + 1) - ana->noiseMean_.at(apvID), 2);
373  ana->rawSpread_[apvID] += pow(histoPeds->GetBinError(iStrip + 1) - ana->rawMean_.at(apvID), 2);
374  }
375 
376  for (unsigned int iApv = 0; iApv < ana->pedsSpread_.size(); iApv++) {
377  ana->pedsSpread_[iApv] = sqrt(ana->pedsSpread_[iApv]) / sqrt(ana->peds_[iApv].size() - 1);
378  ana->noiseSpread_[iApv] = sqrt(ana->noiseSpread_[iApv]) / sqrt(ana->noise_[iApv].size() - 1);
379  ana->rawSpread_[iApv] = sqrt(ana->rawSpread_[iApv]) / sqrt(ana->raw_[iApv].size() - 1);
380  }
381 
382  // loop on each strip in the lldChannel
383  apvID = 0;
384  TH1S* histoResidualStrip = new TH1S("histoResidualStrip",
385  "",
386  histoNoise->GetNbinsX(),
387  histoNoise->GetXaxis()->GetXmin(),
388  histoNoise->GetXaxis()->GetXmax());
389  histoResidualStrip->Sumw2();
390  histoResidualStrip->SetDirectory(nullptr);
391  TF1* fitFunc = new TF1("fitFunc", "gaus(0)", histoNoise->GetXaxis()->GetXmin(), histoNoise->GetXaxis()->GetXmax());
392  TF1* fit2Gaus = nullptr;
393  TH1F* randomHisto = nullptr;
394  TFitResultPtr result;
395 
396  for (int iStrip = 0; iStrip < histoNoise->GetNbinsY(); iStrip++) {
397  // tell which APV
398  if (iStrip < histoNoise->GetNbinsY() / 2)
399  apvID = 0;
400  else
401  apvID = 1;
402  histoResidualStrip->Reset();
403 
404  int stripBin = 0;
405  if (iStrip >= 128)
406  stripBin = iStrip - 128;
407  else
408  stripBin = iStrip;
409 
410  for (int iBinX = 0; iBinX < histoNoise->GetNbinsX(); iBinX++) {
411  histoResidualStrip->SetBinContent(iBinX + 1, histoNoise->GetBinContent(iBinX + 1, iStrip + 1));
412  histoResidualStrip->SetBinError(iBinX + 1, histoNoise->GetBinError(iBinX + 1, iStrip + 1));
413  }
414 
415  if (histoResidualStrip->Integral() == 0) { // dead strip --> i.e. no data
416 
417  // set default values
418  ana->adProbab_[apvID][stripBin] = 0;
419  ana->ksProbab_[apvID][stripBin] = 0;
420  ana->jbProbab_[apvID][stripBin] = 0;
421  ana->chi2Probab_[apvID][stripBin] = 0;
422  ana->noiseSignificance_[apvID][stripBin] = 0;
423  ana->residualMean_[apvID][stripBin] = 0;
424  ana->residualRMS_[apvID][stripBin] = 0;
425  ana->residualSigmaGaus_[apvID][stripBin] = 0;
426  ana->residualSkewness_[apvID][stripBin] = 0;
427  ana->residualKurtosis_[apvID][stripBin] = 0;
428  ana->residualIntegralNsigma_[apvID][stripBin] = 0;
429  ana->residualIntegral_[apvID][stripBin] = 0;
430  ana->deadStrip_[apvID].push_back(stripBin);
431  ana->deadStripBit_[apvID][stripBin] = 1;
432  ana->badStripBit_[apvID][stripBin] = 0;
433 
434  SiStripFecKey fec_key(ana->fecKey());
435  LogTrace(mlDqmClient_) << "DeadStrip: fecCrate "
436  << " " << fec_key.fecCrate() << " fecSlot " << fec_key.fecSlot() << " fecRing "
437  << fec_key.fecRing() << " ccuAddr " << fec_key.ccuAddr() << " ccChan "
438  << fec_key.ccuChan() << " lldChan " << fec_key.lldChan() << " apvID " << apvID
439  << " stripID " << iStrip;
440 
441  continue;
442  }
443 
444  // set / calculated basic quantities
445  ana->residualMean_[apvID][stripBin] = histoResidualStrip->GetMean();
446  ana->residualRMS_[apvID][stripBin] = histoResidualStrip->GetRMS();
447  ana->residualSkewness_[apvID][stripBin] = histoResidualStrip->GetSkewness();
448  ana->residualKurtosis_[apvID][stripBin] = histoResidualStrip->GetKurtosis();
449  ana->noiseSignificance_[apvID][stripBin] =
450  (ana->noise_[apvID][stripBin] - ana->noiseMean_[apvID]) / ana->noiseSpread_[apvID];
451  ana->residualIntegral_[apvID][stripBin] = histoResidualStrip->Integral();
452  ana->residualIntegralNsigma_[apvID][stripBin] =
453  (histoResidualStrip->Integral(histoResidualStrip->FindBin(ana->residualMean_[apvID][stripBin] +
454  ana->residualRMS_[apvID][stripBin] * integralNsigma_),
455  histoResidualStrip->GetNbinsX() + 1) +
456  histoResidualStrip->Integral(
457  0,
458  histoResidualStrip->FindBin(ana->residualMean_[apvID][stripBin] -
459  ana->residualRMS_[apvID][stripBin] * integralNsigma_))) /
460  ana->residualIntegral_[apvID][stripBin];
461 
462  // performing a Gaussian fit of the residual distribution
463  fitFunc->SetRange(histoNoise->GetXaxis()->GetXmin(), histoNoise->GetXaxis()->GetXmax());
464  fitFunc->SetParameters(ana->residualIntegral_[apvID][stripBin],
465  ana->residualMean_[apvID][stripBin],
466  ana->residualRMS_[apvID][stripBin]);
467  result = histoResidualStrip->Fit(fitFunc, "QSRN");
468 
469  // Good gaussian fit
470  if (result.Get()) {
471  ana->residualSigmaGaus_[apvID][stripBin] = fitFunc->GetParameter(2);
472  ana->chi2Probab_[apvID][stripBin] = result->Prob();
473 
474  // jacque bera probability
475  float jbVal =
476  (ana->residualIntegral_[apvID][stripBin] / 6) *
477  (pow(ana->residualSkewness_[apvID][stripBin], 2) + pow(ana->residualKurtosis_[apvID][stripBin], 2) / 4);
478  ana->jbProbab_[apvID][stripBin] = ROOT::Math::chisquared_cdf_c(jbVal, 2);
479 
480  //Kolmogorov Smirnov and Anderson Darlong
481  if (randomHisto == nullptr)
482  randomHisto = (TH1F*)histoResidualStrip->Clone("randomHisto");
483  randomHisto->Reset();
484  randomHisto->SetDirectory(nullptr);
485 
486  if (generateRandomHisto_) {
487  randomHisto->FillRandom("fitFunc", histoResidualStrip->Integral());
488  if (randomHisto->Integral() != 0) {
489  ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto, "N");
490  ana->adProbab_[apvID][stripBin] = histoResidualStrip->AndersonDarlingTest(randomHisto);
491  } else {
492  ana->ksProbab_[apvID][stripBin] = 0;
493  ana->adProbab_[apvID][stripBin] = 0;
494  }
495 
496  } else {
497  randomHisto->Add(fitFunc);
498  if (randomHisto->Integral() != 0) {
499  ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto, "N");
500  ROOT::Fit::BinData data1;
501  ROOT::Fit::BinData data2;
502  ROOT::Fit::FillData(data1, histoResidualStrip, nullptr);
503  data2.Initialize(randomHisto->GetNbinsX() + 1, 1);
504  for (int ibin = 0; ibin < randomHisto->GetNbinsX(); ibin++) {
505  if (histoResidualStrip->GetBinContent(ibin + 1) != 0 or randomHisto->GetBinContent(ibin + 1) >= 1)
506  data2.Add(randomHisto->GetBinCenter(ibin + 1),
507  randomHisto->GetBinContent(ibin + 1),
508  randomHisto->GetBinError(ibin + 1));
509  }
510 
511  double probab, value;
512  ROOT::Math::GoFTest::AndersonDarling2SamplesTest(data1, data2, probab, value);
513  ana->adProbab_[apvID][stripBin] = probab;
514  } else {
515  ana->ksProbab_[apvID][stripBin] = 0;
516  ana->adProbab_[apvID][stripBin] = 0;
517  }
518  }
519  }
520 
521  // start applying selections storing output
522  bool badStripFlag = false;
523  ana->deadStripBit_[apvID][stripBin] = 0; // is not dead if the strip has data
524 
525  if (fabs(ana->residualMean_[apvID][stripBin]) > maxDriftResidualCut_ and not badStripFlag) { //mean value
526  ana->shiftedStrip_[apvID].push_back(stripBin);
527  badStripFlag = true;
528  }
529 
530  if (ana->residualRMS_[apvID][stripBin] < minStripNoiseCut_ and not badStripFlag) { // low noise
531  ana->lowNoiseStrip_[apvID].push_back(stripBin);
532  badStripFlag = true;
533  }
534 
535  if (ana->residualRMS_[apvID][stripBin] > maxStripNoiseCut_ and not badStripFlag) { // large noise
536  ana->largeNoiseStrip_[apvID].push_back(stripBin);
537  badStripFlag = true;
538  }
539 
540  if (fabs(ana->noiseSignificance_[apvID][stripBin]) > maxStripNoiseSignificanceCut_ and
541  not badStripFlag) { // large noise significance
542  ana->largeNoiseSignificance_[apvID].push_back(stripBin);
543  badStripFlag = true;
544  }
545 
546  if (result.Get() and result->Status() != 0) // bad fit status
547  ana->badFitStatus_[apvID].push_back(stripBin);
548 
549  if (ana->adProbab_[apvID][stripBin] < adProbabCut_ and not badStripFlag) // bad AD p-value --> store the strip-id
550  ana->badADProbab_[apvID].push_back(stripBin);
551 
552  if (ana->ksProbab_[apvID][stripBin] < ksProbabCut_ and not badStripFlag) // bad KS p-value --> store the strip-id
553  ana->badKSProbab_[apvID].push_back(stripBin);
554 
555  if (ana->jbProbab_[apvID][stripBin] < jbProbabCut_ and not badStripFlag) // bad JB p-value --> store the strip-id
556  ana->badJBProbab_[apvID].push_back(stripBin);
557 
558  if (ana->chi2Probab_[apvID][stripBin] < chi2ProbabCut_ and
559  not badStripFlag) // bad CHI2 p-value --> store the strip-id
560  ana->badChi2Probab_[apvID].push_back(stripBin);
561 
562  if (ana->adProbab_[apvID][stripBin] < adProbabCut_ and ana->ksProbab_[apvID][stripBin] < ksProbabCut_ and
563  ana->jbProbab_[apvID][stripBin] < jbProbabCut_ and ana->chi2Probab_[apvID][stripBin] < chi2ProbabCut_)
564  badStripFlag = true; // bad strip is flagged as bad by all the methods
565 
566  if (ana->residualKurtosis_[apvID][stripBin] > kurtosisCut_ and
567  ana->residualIntegralNsigma_[apvID][stripBin] > integralTailCut_ and not badStripFlag) { // bad tails
568  ana->badTailStrip_[apvID].push_back(stripBin);
569  badStripFlag = true;
570  }
571 
572  if (badStripFlag) { // loop for double peaked
573 
574  fit2Gaus = new TF1("dgaus",
575  "[0]*exp(-((x-[1])*(x-[1]))/(2*[2]*[2]))+[3]*exp(-((x-[4])*(x-[4]))/(2*[5]*[5]))",
576  histoNoise->GetXaxis()->GetXmin(),
577  histoNoise->GetXaxis()->GetXmax());
578  fit2Gaus->SetParameter(0, fitFunc->GetParameter(0) / 2);
579  fit2Gaus->SetParameter(3, fitFunc->GetParameter(0) / 2);
580  fit2Gaus->SetParameter(1, 1.);
581  fit2Gaus->SetParameter(4, -1.);
582  fit2Gaus->SetParameter(2, fitFunc->GetParameter(2));
583  fit2Gaus->SetParameter(5, fitFunc->GetParameter(2));
584  fit2Gaus->SetParLimits(1, 0., histoNoise->GetXaxis()->GetXmax());
585  fit2Gaus->SetParLimits(4, histoNoise->GetXaxis()->GetXmin(), 0);
586  result = histoResidualStrip->Fit(fit2Gaus, "QSR");
587 
588  // ashman distance
589  float ashman = TMath::Power(2, 0.5) * abs(fit2Gaus->GetParameter(1) - fit2Gaus->GetParameter(4)) /
590  (sqrt(pow(fit2Gaus->GetParameter(2), 2) + pow(fit2Gaus->GetParameter(5), 2)));
591  // amplitude
592  float amplitudeRatio = std::min(fit2Gaus->GetParameter(0), fit2Gaus->GetParameter(3)) /
593  std::max(fit2Gaus->GetParameter(0), fit2Gaus->GetParameter(3));
594 
595  if (ashman > ashmanDistance_ and amplitudeRatio > amplitudeRatio_)
596  ana->badDoublePeakStrip_[apvID].push_back(stripBin);
597  }
598 
599  if (badStripFlag) { // save the final bit
600 
601  ana->badStrip_[apvID].push_back(stripBin);
602  ana->badStripBit_[apvID][stripBin] = 1;
603 
604  SiStripFecKey fec_key(ana->fecKey());
605  LogTrace(mlDqmClient_) << "BadStrip: fecCrate "
606  << " " << fec_key.fecCrate() << " fecSlot " << fec_key.fecSlot() << " fecRing "
607  << fec_key.fecRing() << " ccuAddr " << fec_key.ccuAddr() << " ccChan "
608  << fec_key.ccuChan() << " lldChan " << fec_key.lldChan() << " apvID " << apvID
609  << " stripID " << stripBin;
610 
611  } else
612  ana->badStripBit_[apvID][stripBin] = 0;
613  }
614 
615  ped_max.clear();
616  ped_min.clear();
617  raw_max.clear();
618  raw_min.clear();
619  noise_max.clear();
620  noise_min.clear();
621  if (histoResidualStrip)
622  delete histoResidualStrip;
623  if (fitFunc)
624  delete fitFunc;
625  if (randomHisto)
626  delete randomHisto;
627  if (fit2Gaus)
628  delete fit2Gaus;
629 }
CommissioningAnalysis *const anal() const
VVFloat peds_
Quantitles that are always filled for every strip.
static const char mlDqmClient_[]
VVInt deadStrip_
Quantities filled only for bad strips i.e. vectors of strip-id.
static const char numberOfBins_[]
#define LogTrace(id)
Histogram-based analysis for pedestal run.
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static const char mlCommissioning_[]
T sqrt(T t)
Definition: SSEVec.h:23
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static const uint16_t maximum_
Definition: Constants.h:20
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual void addErrorCode(const std::string &error)
const uint32_t & fecKey() const
Definition: value.py:1
void reset(PedsFullNoiseAnalysis *)
Abstract base for derived classes that provide analysis of commissioning histograms.
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
static const char nullPtr_[]

◆ extract()

void PedsFullNoiseAlgorithm::extract ( const std::vector< TH1 *> &  histos)
overrideprivatevirtual

Extracts and organises histograms.

Implements CommissioningAlgorithm.

Definition at line 62 of file PedsFullNoiseAlgorithm.cc.

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::extrainfo::commonMode_, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), combine::histos, hNoise2D_, hNoise_, hPeds_, sistrip::mlCommissioning_, sistrip::extrainfo::noise2D_, sistrip::extrainfo::noiseProfile_, sistrip::numberOfHistos_, sistrip::extrainfo::pedestals_, sistrip::PEDS_FULL_NOISE, sistrip::extrainfo::roughPedestals_, runGCPTkAlMap::title, sistrip::unexpectedExtraInfo_, and sistrip::unexpectedTask_.

62  {
63  if (!anal()) {
64  edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]"
65  << " NULL pointer to Analysis object!";
66  return;
67  }
68 
69  // Check number of histograms --> Pedestal, noise and noise2D
70  if (histos.size() != 3) {
72  }
73 
74  // Extract FED key from histo title --> i.e. APV pairs or LLD channel
75  if (!histos.empty()) {
76  anal()->fedKey(extractFedKey(histos.front()));
77  }
78 
79  // Extract 1D histograms
80  std::vector<TH1*>::const_iterator ihis = histos.begin();
81  for (; ihis != histos.end(); ihis++) {
82  // Check for NULL pointer
83  if (!(*ihis)) {
84  continue;
85  }
86 
87  SiStripHistoTitle title((*ihis)->GetName());
88  if (title.runType() != sistrip::PEDS_FULL_NOISE) {
90  continue;
91  }
92 
93  // Extract peds histos
94  if (title.extraInfo().find(sistrip::extrainfo::roughPedestals_) != std::string::npos) {
95  //@@ something here for rough peds?
96  } else if (title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos) {
97  hPeds_.first = *ihis;
98  hPeds_.second = (*ihis)->GetName();
99  } else if (title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos) {
100  //@@ something here for CM plots?
101  } else if (title.extraInfo().find(sistrip::extrainfo::noiseProfile_) != std::string::npos) {
102  //@@ something here for noise profile plot?
103  hNoise_.first = *ihis;
104  hNoise_.second = (*ihis)->GetName();
105  } else if (title.extraInfo().find(sistrip::extrainfo::noise2D_) != std::string::npos) {
106  hNoise2D_.first = *ihis;
107  hNoise2D_.second = (*ihis)->GetName();
108  } else {
110  }
111  }
112 }
CommissioningAnalysis *const anal() const
static const char unexpectedTask_[]
Utility class that holds histogram title.
static const char numberOfHistos_[]
static const char unexpectedExtraInfo_[]
uint32_t extractFedKey(const TH1 *const)
static const char noise2D_[]
static const char mlCommissioning_[]
static const char roughPedestals_[]
virtual void addErrorCode(const std::string &error)
static const char commonMode_[]
static const char noiseProfile_[]
const uint32_t & fedKey() const
static const char pedestals_[]
histos
Definition: combine.py:4
Log< level::Warning, false > LogWarning

◆ hNoise()

const PedsFullNoiseAlgorithm::Histo & PedsFullNoiseAlgorithm::hNoise ( ) const
inline

Definition at line 65 of file PedsFullNoiseAlgorithm.h.

References hNoise_.

◆ hNoise2D()

const PedsFullNoiseAlgorithm::Histo & PedsFullNoiseAlgorithm::hNoise2D ( ) const
inline

Definition at line 64 of file PedsFullNoiseAlgorithm.h.

References hNoise2D_.

◆ hPeds()

const PedsFullNoiseAlgorithm::Histo & PedsFullNoiseAlgorithm::hPeds ( ) const
inline

Definition at line 63 of file PedsFullNoiseAlgorithm.h.

References hPeds_.

63 { return hPeds_; }

◆ reset()

void PedsFullNoiseAlgorithm::reset ( PedsFullNoiseAnalysis ana)
private

reset vector

Definition at line 115 of file PedsFullNoiseAlgorithm.cc.

References PedsFullNoiseAnalysis::adProbab_, PedsFullNoiseAnalysis::badStripBit_, PedsFullNoiseAnalysis::chi2Probab_, PedsFullNoiseAnalysis::deadStripBit_, PedsFullNoiseAnalysis::jbProbab_, PedsFullNoiseAnalysis::ksProbab_, PedsFullNoiseAnalysis::noise_, PedsFullNoiseAnalysis::noiseMax_, PedsFullNoiseAnalysis::noiseMean_, PedsFullNoiseAnalysis::noiseMin_, PedsFullNoiseAnalysis::noiseSignificance_, PedsFullNoiseAnalysis::noiseSpread_, PedsFullNoiseAnalysis::peds_, PedsFullNoiseAnalysis::pedsMax_, PedsFullNoiseAnalysis::pedsMean_, PedsFullNoiseAnalysis::pedsMin_, PedsFullNoiseAnalysis::pedsSpread_, PedsFullNoiseAnalysis::raw_, PedsFullNoiseAnalysis::rawMax_, PedsFullNoiseAnalysis::rawMean_, PedsFullNoiseAnalysis::rawMin_, PedsFullNoiseAnalysis::rawSpread_, PedsFullNoiseAnalysis::residualIntegral_, PedsFullNoiseAnalysis::residualIntegralNsigma_, PedsFullNoiseAnalysis::residualKurtosis_, PedsFullNoiseAnalysis::residualMean_, PedsFullNoiseAnalysis::residualRMS_, PedsFullNoiseAnalysis::residualSigmaGaus_, and PedsFullNoiseAnalysis::residualSkewness_.

Referenced by analyse().

115  {
116  for (size_t iapv = 0; iapv < ana->peds_.size(); iapv++) {
117  ana->pedsMean_[iapv] = 0.;
118  ana->rawMean_[iapv] = 0.;
119  ana->noiseMean_[iapv] = 0.;
120  ana->pedsSpread_[iapv] = 0.;
121  ana->noiseSpread_[iapv] = 0.;
122  ana->rawSpread_[iapv] = 0.;
123  ana->pedsMax_[iapv] = 0.;
124  ana->pedsMin_[iapv] = 0.;
125  ana->rawMax_[iapv] = 0.;
126  ana->rawMin_[iapv] = 0.;
127  ana->noiseMax_[iapv] = 0.;
128  ana->noiseMin_[iapv] = 0.;
129 
130  for (size_t istrip = 0; istrip < ana->peds_[iapv].size(); istrip++) {
131  ana->peds_[iapv][istrip] = 0.;
132  ana->noise_[iapv][istrip] = 0.;
133  ana->raw_[iapv][istrip] = 0.;
134  ana->adProbab_[iapv][istrip] = 0.;
135  ana->ksProbab_[iapv][istrip] = 0.;
136  ana->jbProbab_[iapv][istrip] = 0.;
137  ana->chi2Probab_[iapv][istrip] = 0.;
138  ana->residualRMS_[iapv][istrip] = 0.;
139  ana->residualSigmaGaus_[iapv][istrip] = 0.;
140  ana->noiseSignificance_[iapv][istrip] = 0.;
141  ana->residualMean_[iapv][istrip] = 0.;
142  ana->residualSkewness_[iapv][istrip] = 0.;
143  ana->residualKurtosis_[iapv][istrip] = 0.;
144  ana->residualIntegralNsigma_[iapv][istrip] = 0.;
145  ana->residualIntegral_[iapv][istrip] = 0.;
146  ana->deadStripBit_[iapv][istrip] = 0;
147  ana->badStripBit_[iapv][istrip] = 0;
148  }
149  }
150 }
VVFloat peds_
Quantitles that are always filled for every strip.

Member Data Documentation

◆ adProbabCut_

float PedsFullNoiseAlgorithm::adProbabCut_
private

Definition at line 51 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ amplitudeRatio_

float PedsFullNoiseAlgorithm::amplitudeRatio_
private

Definition at line 60 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse().

◆ ashmanDistance_

float PedsFullNoiseAlgorithm::ashmanDistance_
private

Definition at line 59 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse().

◆ chi2ProbabCut_

float PedsFullNoiseAlgorithm::chi2ProbabCut_
private

Definition at line 55 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ generateRandomHisto_

bool PedsFullNoiseAlgorithm::generateRandomHisto_
private

Definition at line 53 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse().

◆ hNoise2D_

Histo PedsFullNoiseAlgorithm::hNoise2D_
private

Definition at line 44 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), extract(), and hNoise2D().

◆ hNoise_

Histo PedsFullNoiseAlgorithm::hNoise_
private

Noise and residuals

Definition at line 43 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), extract(), and hNoise().

◆ hPeds_

Histo PedsFullNoiseAlgorithm::hPeds_
private

Pedestals and raw noise

Definition at line 41 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), extract(), and hPeds().

◆ integralNsigma_

int PedsFullNoiseAlgorithm::integralNsigma_
private

Definition at line 58 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ integralTailCut_

float PedsFullNoiseAlgorithm::integralTailCut_
private

Definition at line 57 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ jbProbabCut_

float PedsFullNoiseAlgorithm::jbProbabCut_
private

Definition at line 54 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ ksProbabCut_

float PedsFullNoiseAlgorithm::ksProbabCut_
private

Definition at line 52 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ kurtosisCut_

float PedsFullNoiseAlgorithm::kurtosisCut_
private

Definition at line 56 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ maxDriftResidualCut_

float PedsFullNoiseAlgorithm::maxDriftResidualCut_
private

Analysis parameters

Definition at line 47 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ maxStripNoiseCut_

float PedsFullNoiseAlgorithm::maxStripNoiseCut_
private

Definition at line 49 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ maxStripNoiseSignificanceCut_

float PedsFullNoiseAlgorithm::maxStripNoiseSignificanceCut_
private

Definition at line 50 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().

◆ minStripNoiseCut_

float PedsFullNoiseAlgorithm::minStripNoiseCut_
private

Definition at line 48 of file PedsFullNoiseAlgorithm.h.

Referenced by analyse(), and PedsFullNoiseAlgorithm().