CMS 3D CMS Logo

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

#include <TMatacq.h>

Inheritance diagram for TMatacq:

Public Member Functions

int compute_trise ()
 
int countBadPulses (Int_t)
 
int doFit ()
 
void enterdata (Int_t)
 
int findPeak ()
 
double getAmpl ()
 
double getBaseLine ()
 
double getFwhm ()
 
int getPt1 ()
 
int getPt2 ()
 
int getPtm ()
 
double getsigBaseLine ()
 
double getsigTimpeak ()
 
double getSlide ()
 
double getTimax ()
 
double getTimpeak ()
 
double getTrise ()
 
double getWidth20 ()
 
double getWidth80 ()
 
void init ()
 
void printitermatacqData (Int_t, Int_t, Int_t)
 
void printmatacqData (Int_t, Int_t, Int_t)
 
int rawPulseAnalysis (Int_t, Double_t *)
 
 TMatacq (int, int, int, int, int, int, int, int, int, int, int)
 
 ~TMatacq () override
 

Static Public Attributes

static constexpr int NMAXSAMP = 100
 
static constexpr int NSPARAB = 16
 

Private Member Functions

double interpolate (double)
 

Private Attributes

double ampl
 
int bing [101]
 
double bl
 
double bong [NMAXSAMP]
 
double comp_peak [1200]
 
double comp_trise [1200]
 
int endsample
 
int firstsample
 
int fNsamples
 
int fNum_samp_aft_max
 
int fNum_samp_bef_max
 
double fv1 [NSPARAB]
 
double fv2 [NSPARAB]
 
double fv3 [NSPARAB]
 
int lastsample
 
double level1
 
double level2
 
double level3
 
double meantrise
 
int nevlasers
 
int nevmtq0
 
int nevmtq1
 
double nsigcut
 
int nslide
 
double pkval
 
int presample
 
int samplemax
 
double sigbl
 
double sigpkval
 
double sigtrise
 
double slidingmean
 
int status [1200]
 
double t [NSPARAB]
 
double timeatmax
 
double trise
 
double val [NSPARAB]
 
double val_max
 
double width20
 
double width50
 
double width80
 

Detailed Description

Definition at line 6 of file TMatacq.h.

Constructor & Destructor Documentation

◆ TMatacq()

TMatacq::TMatacq ( int  Ntot,
int  Nsamp1,
int  Nsamp2,
int  cut,
int  Nbef,
int  Naft,
int  niv1,
int  niv2,
int  niv3,
int  nevl,
int  NSlide 
)

Definition at line 31 of file TMatacq.cc.

References DMR_cfg::cut, dqmdumpme::k, getInfo::level1, and mps_update::status.

32  {
33  fNsamples = Ntot;
34  presample = Nsamp1;
35  endsample = Nsamp2;
36  nsigcut = (double)cut;
37  fNum_samp_bef_max = Nbef;
38  fNum_samp_aft_max = Naft;
39  level1 = ((double)niv1) / 100.;
40  level2 = ((double)niv2) / 100.;
41  level3 = ((double)niv3) / 100.;
42  nevlasers = nevl;
43  slidingmean = 0.0;
44  nslide = NSlide;
45  for (int k = 0; k < nevlasers; k++)
46  status[k] = 0;
47  for (int k = 0; k < nevlasers; k++)
48  status[k + nevlasers] = 0;
49 
50  nevmtq0 = 0;
51  nevmtq1 = 0;
52 }
int fNum_samp_bef_max
Definition: TMatacq.h:13
int endsample
Definition: TMatacq.h:16
int fNum_samp_aft_max
Definition: TMatacq.h:14
int status[1200]
Definition: TMatacq.h:31
double nsigcut
Definition: TMatacq.h:18
int nslide
Definition: TMatacq.h:34
double level1
Definition: TMatacq.h:19
double level2
Definition: TMatacq.h:19
int fNsamples
Definition: TMatacq.h:12
double slidingmean
Definition: TMatacq.h:33
double level3
Definition: TMatacq.h:19
int nevlasers
Definition: TMatacq.h:30
int nevmtq0
Definition: TMatacq.h:30
int nevmtq1
Definition: TMatacq.h:30
int presample
Definition: TMatacq.h:16

◆ ~TMatacq()

TMatacq::~TMatacq ( )
override

Definition at line 55 of file TMatacq.cc.

55 {}

Member Function Documentation

◆ compute_trise()

int TMatacq::compute_trise ( )

Definition at line 347 of file TMatacq.cc.

References relativeConstraints::error, createfilelist::int, and HiCaloJetParameters_cff::interpolate.

Referenced by EcalMatacqAnalyzer::endJob().

347  {
348  int error;
349  trise = 0.;
350 
351  double t20 = interpolate(ampl * level2);
352  if (t20 < 0.) {
353  error = (int)-t20;
354  return error;
355  }
356  double t80 = interpolate(ampl * level3);
357  if (t80 < 0.) {
358  error = (int)-t80;
359  return error;
360  }
361  trise = t80 - t20;
362 
363  return 0;
364 }
double trise
Definition: TMatacq.h:26
double interpolate(double)
Definition: TMatacq.cc:366
double level2
Definition: TMatacq.h:19
double ampl
Definition: TMatacq.h:24
double level3
Definition: TMatacq.h:19

◆ countBadPulses()

int TMatacq::countBadPulses ( Int_t  )

Definition at line 484 of file TMatacq.cc.

References corrVsCorr::filename, mps_fire::i, and mps_update::status.

484  {
485  FILE *fmatacq;
486  char filename[80];
487  sprintf(filename, "badevtsMatacq%d.dat", gRunNumber);
488  fmatacq = fopen(filename, "w");
489  if (fmatacq == nullptr)
490  printf("Error while opening file : %s\n", filename);
491 
492  int nevbad = 0;
493  for (Int_t i = 0; i < nevmtq0 + nevmtq1; i++) {
494  if (comp_trise[i] < meantrise - 3. * sigtrise) {
495  nevbad++;
496  fprintf(fmatacq, "%d \n", status[i]);
497  status[i] = -1;
498  }
499  if (comp_trise[i] > meantrise + 3. * sigtrise) {
500  nevbad++;
501  fprintf(fmatacq, "%d \n", status[i]);
502  status[i] = -1;
503  }
504  }
505 
506  int iret = fclose(fmatacq);
507  printf(" Closing file : %d\n", iret);
508  return nevbad;
509 }
double meantrise
Definition: TMatacq.h:28
int status[1200]
Definition: TMatacq.h:31
double sigtrise
Definition: TMatacq.h:28
double comp_trise[1200]
Definition: TMatacq.h:32
int nevmtq0
Definition: TMatacq.h:30
int nevmtq1
Definition: TMatacq.h:30

◆ doFit()

int TMatacq::doFit ( )

Definition at line 213 of file TMatacq.cc.

References a, b, HltBtagPostValidation_cff::c, DeadROC_duringRun::f1, DeadROC_duringRun::f2, mps_fire::i, dqmiolumiharvest::j, heppy_batch::val, and ApeEstimator_cff::width.

Referenced by EcalMatacqAnalyzer::endJob().

213  {
214  int testneg = 0;
215  ampl = 0.;
216  timeatmax = 0.;
217  int heresamplemax = samplemax - firstsample;
218 
219  int beginfit = heresamplemax - fNum_samp_bef_max;
220  int endfit = heresamplemax + fNum_samp_aft_max;
221 
222  int nval = endfit - beginfit + 1;
223  if (nval != NSPARAB)
224  return 201;
225  for (int kn = beginfit; kn <= endfit; kn++) {
226  if (bong[kn] <= 0)
227  testneg = 1;
228  }
229  if (testneg == 1)
230  return 202;
231 
232  for (int i = 0; i < nval; i++) {
233  val[i] = bong[beginfit + i];
234  fv1[i] = 1.;
235  fv2[i] = (double)(i);
236  fv3[i] = ((double)(i)) * ((double)(i));
237  }
238 
239  TVectorD y(nval, val);
240  TVectorD f1(nval, fv1);
241  TVectorD f2(nval, fv2);
242  TVectorD f3(nval, fv3);
243 
244  double bj[3];
245  bj[0] = f1 * y;
246  bj[1] = f2 * y;
247  bj[2] = f3 * y;
248  TVectorD b(3, bj);
249 
250  double aij[9];
251  aij[0] = f1 * f1;
252  aij[1] = f1 * f2;
253  aij[2] = f1 * f3;
254  aij[3] = f2 * f1;
255  aij[4] = f2 * f2;
256  aij[5] = f2 * f3;
257  aij[6] = f3 * f1;
258  aij[7] = f3 * f2;
259  aij[8] = f3 * f3;
260  TMatrixD a(3, 3, aij);
261 
262  double det1;
263  a.InvertFast(&det1);
264 
265  TVectorD c = a * b;
266 
267  double *par = c.GetMatrixArray();
268  if (par[2] != 0.) {
269  timeatmax = -par[1] / (2. * par[2]);
270  ampl = par[0] - par[2] * (timeatmax * timeatmax);
271  }
272 
273  if (ampl <= 0.) {
274  ampl = bong[heresamplemax];
275  return 203;
276  }
277 
278  if ((int)timeatmax > NSPARAB)
279  return 204;
280  if ((int)timeatmax < 0)
281  return 205;
282 
283  timeatmax += (beginfit + firstsample);
284 
285  int tplus[3], tminus[3];
286  double xampl[3];
287  xampl[0] = 0.2 * ampl;
288  xampl[1] = 0.5 * ampl;
289  xampl[2] = 0.8 * ampl;
290 
291  int hitplus[3];
292  int hitminus[3];
293  double width[3];
294 
295  for (int i = 0; i < 3; i++) {
296  hitplus[i] = 0;
297  hitminus[i] = 0;
298  width[i] = 0.0;
299  tplus[i] = firstsample + lastsample;
300  tminus[i] = 0;
301  }
302 
303  // calculate first estimate of half width
304  int im = heresamplemax;
305  int iplusbound = firstsample + lastsample - im;
306 
307  for (int j = 0; j < 3; j++) {
308  for (int i = 1; i < im; i++) {
309  if (bong[im - i] < xampl[j] && bong[im - i + 1] > xampl[j]) {
310  tminus[j] = im - i;
311  hitminus[j]++;
312  i = im;
313  }
314  }
315 
316  for (int i = 0; i < iplusbound; i++) {
317  if (bong[im + i] > xampl[j] && bong[im + i + 1] < xampl[j]) {
318  tplus[j] = im + i;
319  hitplus[j]++;
320  i = iplusbound;
321  }
322  }
323 
324  // interpolate to get a better estimate
325 
326  double slopeplus = double(bong[tplus[j] + 1] - bong[tplus[j]]);
327  double slopeminus = double(bong[tminus[j] + 1] - bong[tminus[j]]);
328 
329  double timeminus = double(tminus[j]) + 0.5;
330  if (slopeminus != 0)
331  timeminus = tminus[j] + (xampl[j] - double(bong[tminus[j]])) / slopeminus;
332 
333  double timeplus = double(tplus[j]) + 0.5;
334  if (slopeplus != 0)
335  timeplus = tplus[j] + (xampl[j] - double(bong[tplus[j]])) / slopeplus;
336 
337  width[j] = timeplus - timeminus;
338  }
339 
340  width20 = width[0];
341  width50 = width[1];
342  width80 = width[2];
343 
344  return 0;
345 }
int fNum_samp_bef_max
Definition: TMatacq.h:13
double bong[NMAXSAMP]
Definition: TMatacq.h:20
double fv1[NSPARAB]
Definition: TMatacq.h:22
int fNum_samp_aft_max
Definition: TMatacq.h:14
int samplemax
Definition: TMatacq.h:16
double fv3[NSPARAB]
Definition: TMatacq.h:22
double val[NSPARAB]
Definition: TMatacq.h:21
double width20
Definition: TMatacq.h:27
static constexpr int NSPARAB
Definition: TMatacq.h:9
double width50
Definition: TMatacq.h:27
double fv2[NSPARAB]
Definition: TMatacq.h:22
double ampl
Definition: TMatacq.h:24
double width80
Definition: TMatacq.h:27
double timeatmax
Definition: TMatacq.h:24
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
int firstsample
Definition: TMatacq.h:16
int lastsample
Definition: TMatacq.h:16

◆ enterdata()

void TMatacq::enterdata ( Int_t  anevt)

Definition at line 397 of file TMatacq.cc.

References mps_update::status.

397  {
398  if (anevt < 2 * nevlasers) {
399  if (anevt < nevlasers) {
400  nevmtq0++;
401  status[nevmtq0 - 1] = anevt;
402  comp_trise[nevmtq0 - 1] = trise;
403  comp_peak[nevmtq0 - 1] = pkval;
404  } else {
405  nevmtq1++;
406  status[nevmtq0 + nevmtq1 - 1] = anevt;
407  comp_trise[nevmtq0 + nevmtq1 - 1] = trise;
408  comp_peak[nevmtq0 + nevmtq1 - 1] = pkval;
409  }
410  } else {
411  if (anevt < 3 * nevlasers) {
412  nevmtq0++;
413  status[nevmtq0 - 1] = anevt;
414  comp_trise[nevmtq0 - 1] = trise;
415  comp_peak[nevmtq0 - 1] = pkval;
416  } else {
417  nevmtq1++;
418  status[nevmtq0 + nevmtq1 - 1] = anevt;
419  comp_trise[nevmtq0 + nevmtq1 - 1] = trise;
420  comp_peak[nevmtq0 + nevmtq1 - 1] = pkval;
421  }
422  }
423 }
double trise
Definition: TMatacq.h:26
int status[1200]
Definition: TMatacq.h:31
double comp_peak[1200]
Definition: TMatacq.h:32
double pkval
Definition: TMatacq.h:25
double comp_trise[1200]
Definition: TMatacq.h:32
int nevlasers
Definition: TMatacq.h:30
int nevmtq0
Definition: TMatacq.h:30
int nevmtq1
Definition: TMatacq.h:30

◆ findPeak()

int TMatacq::findPeak ( )

Definition at line 136 of file TMatacq.cc.

References TMarkov::getPeakValue(), createfilelist::int, dqmdumpme::k, getInfo::level1, and TMarkov::peakFinder().

Referenced by EcalMatacqAnalyzer::endJob().

136  {
137  int k;
138  int nbinf = 0;
139  int jfind = 0;
140  int nbsup = 0;
141  double thres = val_max * level1;
142 
143  for (k = 0, jfind = 0; k < NMAXSAMP; k++) {
144  if (jfind == 0) {
145  if (bong[k] > thres) {
146  nbinf = k;
147  jfind = 1;
148  }
149  }
150  }
151  if (jfind == 0)
152  nbinf = 0;
153 
154  for (k = NMAXSAMP, jfind = 0; k > nbinf; k--) {
155  if (jfind == 0) {
156  if (bong[k] > thres) {
157  nbsup = k;
158  jfind = 1;
159  }
160  }
161  }
162  if (nbsup == 0)
163  nbsup = nbinf;
164 
165  pkval = 0.;
166  sigpkval = 0.5;
167  if (nbsup == nbinf) {
168  return 301;
169  } else {
170  if (nbinf > 4)
171  nbinf -= 3;
172  else
173  nbinf = 1;
174  if (nbsup < NMAXSAMP - 4)
175  nbsup += 3;
176  else
177  nbsup = NMAXSAMP;
178 
179  for (k = 0; k < nbinf; k++)
180  bong[k] = 0.;
181  for (k = nbsup; k < NMAXSAMP; k++)
182  bong[k] = 0.;
183 
184  for (k = 0, jfind = 0; k < NMAXSAMP; k++) {
185  if (bong[k] > 0.)
186  jfind++;
187  }
188  if (jfind == 0) {
189  return 302;
190  } else if (jfind == 1) {
191  return 303;
192  } else {
193  for (k = 0; k < NMAXSAMP; k++) {
194  if (k < 100)
195  bing[k + 1] = (int)bong[k];
196  }
197 
198  TMarkov *peak = new TMarkov();
199 
200  peak->peakFinder(&bing[0]);
201  pkval = peak->getPeakValue(0);
202  sigpkval = peak->getPeakValue(1);
203 
204  delete peak;
205 
206  pkval += (firstsample - 1);
207  }
208  }
209 
210  return 0;
211 }
double bong[NMAXSAMP]
Definition: TMatacq.h:20
int bing[101]
Definition: TMatacq.h:17
double getPeakValue(int i) const
Definition: TMarkov.h:24
double val_max
Definition: TMatacq.h:23
double level1
Definition: TMatacq.h:19
static constexpr int NMAXSAMP
Definition: TMatacq.h:8
Definition: TMarkov.h:6
void peakFinder(int *)
Definition: TMarkov.cc:105
double pkval
Definition: TMatacq.h:25
double sigpkval
Definition: TMatacq.h:25
int firstsample
Definition: TMatacq.h:16

◆ getAmpl()

double TMatacq::getAmpl ( )
inline

Definition at line 68 of file TMatacq.h.

References ampl.

Referenced by EcalMatacqAnalyzer::endJob().

68 { return ampl; }
double ampl
Definition: TMatacq.h:24

◆ getBaseLine()

double TMatacq::getBaseLine ( )
inline

Definition at line 62 of file TMatacq.h.

References bl.

Referenced by EcalMatacqAnalyzer::endJob().

62 { return bl; }
double bl
Definition: TMatacq.h:23

◆ getFwhm()

double TMatacq::getFwhm ( )
inline

Definition at line 72 of file TMatacq.h.

References width50.

Referenced by EcalMatacqAnalyzer::endJob().

72 { return width50; }
double width50
Definition: TMatacq.h:27

◆ getPt1()

int TMatacq::getPt1 ( )
inline

Definition at line 58 of file TMatacq.h.

References firstsample.

58 { return firstsample; }
int firstsample
Definition: TMatacq.h:16

◆ getPt2()

int TMatacq::getPt2 ( )
inline

Definition at line 59 of file TMatacq.h.

References lastsample.

59 { return lastsample; }
int lastsample
Definition: TMatacq.h:16

◆ getPtm()

int TMatacq::getPtm ( )
inline

Definition at line 60 of file TMatacq.h.

References samplemax.

60 { return samplemax; }
int samplemax
Definition: TMatacq.h:16

◆ getsigBaseLine()

double TMatacq::getsigBaseLine ( )
inline

Definition at line 63 of file TMatacq.h.

References sigbl.

Referenced by EcalMatacqAnalyzer::endJob().

63 { return sigbl; }
double sigbl
Definition: TMatacq.h:23

◆ getsigTimpeak()

double TMatacq::getsigTimpeak ( )
inline

Definition at line 66 of file TMatacq.h.

References sigpkval.

Referenced by EcalMatacqAnalyzer::endJob().

66 { return sigpkval; }
double sigpkval
Definition: TMatacq.h:25

◆ getSlide()

double TMatacq::getSlide ( )
inline

Definition at line 75 of file TMatacq.h.

References slidingmean.

Referenced by EcalMatacqAnalyzer::endJob().

75 { return slidingmean; }
double slidingmean
Definition: TMatacq.h:33

◆ getTimax()

double TMatacq::getTimax ( )
inline

Definition at line 69 of file TMatacq.h.

References timeatmax.

Referenced by EcalMatacqAnalyzer::endJob().

69 { return timeatmax; }
double timeatmax
Definition: TMatacq.h:24

◆ getTimpeak()

double TMatacq::getTimpeak ( )
inline

Definition at line 65 of file TMatacq.h.

References pkval.

Referenced by EcalMatacqAnalyzer::endJob().

65 { return pkval; }
double pkval
Definition: TMatacq.h:25

◆ getTrise()

double TMatacq::getTrise ( )
inline

Definition at line 71 of file TMatacq.h.

References trise.

Referenced by EcalMatacqAnalyzer::endJob().

71 { return trise; }
double trise
Definition: TMatacq.h:26

◆ getWidth20()

double TMatacq::getWidth20 ( )
inline

Definition at line 73 of file TMatacq.h.

References width20.

Referenced by EcalMatacqAnalyzer::endJob().

73 { return width20; }
double width20
Definition: TMatacq.h:27

◆ getWidth80()

double TMatacq::getWidth80 ( )
inline

Definition at line 74 of file TMatacq.h.

References width80.

Referenced by EcalMatacqAnalyzer::endJob().

74 { return width80; }
double width80
Definition: TMatacq.h:27

◆ init()

void TMatacq::init ( )

Definition at line 17 of file TMatacq.cc.

References dqmdumpme::k, and submitPVValidationJobs::t.

17  {
18  for (int k = 0; k < NMAXSAMP; k++)
19  bong[k] = 0.;
20 
21  for (int k = 0; k <= 100; k++)
22  bing[k] = 0;
23 
24  for (int k = 0; k < NSPARAB; k++)
25  t[k] = (double)k;
26 
27  return;
28 }
double bong[NMAXSAMP]
Definition: TMatacq.h:20
int bing[101]
Definition: TMatacq.h:17
double t[NSPARAB]
Definition: TMatacq.h:21
static constexpr int NSPARAB
Definition: TMatacq.h:9
static constexpr int NMAXSAMP
Definition: TMatacq.h:8

◆ interpolate()

double TMatacq::interpolate ( double  amplx)
private

Definition at line 366 of file TMatacq.cc.

References createfilelist::int, dqmdumpme::k, and slope.

366  {
367  double T;
368  int kmax = (int)pkval - firstsample;
369 
370  int bin_low = 0;
371  for (Int_t k = 0; k < kmax; k++)
372  if (0. < bong[k] && bong[k] < amplx) {
373  bin_low = k;
374  }
375  if (bin_low == 0)
376  return -301.;
377  int bin_high = 0;
378  for (Int_t k = kmax; k >= 0; k--)
379  if (bong[k] > amplx) {
380  bin_high = k;
381  }
382  if (bin_high == 0)
383  return -302.;
384  if (bin_high < bin_low)
385  return -303.;
386 
387  if (bin_low == bin_high) {
388  T = (double)bin_high;
389  } else {
390  double slope = (bong[bin_high] - bong[bin_low]) / ((double)(bin_high - bin_low));
391  T = (double)bin_high - (bong[bin_high] - amplx) / slope;
392  }
393 
394  return T;
395 }
double bong[NMAXSAMP]
Definition: TMatacq.h:20
static const double slope[3]
double pkval
Definition: TMatacq.h:25
int firstsample
Definition: TMatacq.h:16
long double T

◆ printitermatacqData()

void TMatacq::printitermatacqData ( Int_t  ,
Int_t  ,
Int_t   
)

Definition at line 511 of file TMatacq.cc.

References corrVsCorr::filename, mps_fire::i, mathSSE::sqrt(), contentValuesCheck::ss, and mps_update::status.

511  {
512  FILE *fmatacq;
513  char filename[80];
514  int i;
515  double ss;
516  sprintf(filename, "runiterMatacq%d.pedestal", gRunNumber);
517  fmatacq = fopen(filename, "w");
518  if (fmatacq == nullptr)
519  printf("Error while opening file : %s\n", filename);
520 
521  int nevmtqgood = 0;
522  double sumtrise = 0.;
523  double sumtrise2 = 0.;
524  int timestop = timestart + 3;
525  double mintrise = 10000.;
526  double maxtrise = 0.;
527  for (i = 0; i < nevmtq0; i++) {
528  if (status[i] >= 0) {
529  nevmtqgood++;
530  if (comp_trise[i] > maxtrise) {
531  maxtrise = comp_trise[i];
532  }
533  if (comp_trise[i] < mintrise) {
534  mintrise = comp_trise[i];
535  }
536  sumtrise += comp_trise[i];
537  sumtrise2 += comp_trise[i] * comp_trise[i];
538  }
539  }
540  meantrise = sumtrise / ((double)nevmtqgood);
541  ss = (sumtrise2 / ((double)nevmtqgood) - meantrise * meantrise);
542  if (ss < 0.)
543  ss = 0.;
544  sigtrise = sqrt(ss);
545  fprintf(fmatacq,
546  "%d %d %d %d %f %f %f %f\n",
547  nevmtqgood,
548  color,
549  timestart,
550  timestop,
551  meantrise,
552  sigtrise,
553  mintrise,
554  maxtrise);
555 
556  nevmtqgood = 0;
557  sumtrise = 0.;
558  sumtrise2 = 0.;
559  mintrise = 10000.;
560  maxtrise = 0.;
561  for (i = nevmtq0; i < nevmtq0 + nevmtq1; i++) {
562  if (status[i] >= 0) {
563  nevmtqgood++;
564  if (comp_trise[i] > maxtrise) {
565  maxtrise = comp_trise[i];
566  }
567  if (comp_trise[i] < mintrise) {
568  mintrise = comp_trise[i];
569  }
570  sumtrise += comp_trise[i];
571  sumtrise2 += comp_trise[i] * comp_trise[i];
572  }
573  }
574  meantrise = sumtrise / ((double)nevmtqgood);
575  ss = (sumtrise2 / ((double)nevmtqgood) - meantrise * meantrise);
576  if (ss < 0.)
577  ss = 0.;
578  sigtrise = sqrt(ss);
579  fprintf(fmatacq,
580  "%d %d %d %d %f %f %f %f\n",
581  nevmtqgood,
582  color,
583  timestart,
584  timestop,
585  meantrise,
586  sigtrise,
587  mintrise,
588  maxtrise);
589 
590  int iret = fclose(fmatacq);
591  printf(" Closing file : %d\n", iret);
592 }
double meantrise
Definition: TMatacq.h:28
int status[1200]
Definition: TMatacq.h:31
T sqrt(T t)
Definition: SSEVec.h:19
double sigtrise
Definition: TMatacq.h:28
double comp_trise[1200]
Definition: TMatacq.h:32
int nevmtq0
Definition: TMatacq.h:30
int nevmtq1
Definition: TMatacq.h:30

◆ printmatacqData()

void TMatacq::printmatacqData ( Int_t  ,
Int_t  ,
Int_t   
)

Definition at line 425 of file TMatacq.cc.

References corrVsCorr::filename, mps_fire::i, mathSSE::sqrt(), and contentValuesCheck::ss.

425  {
426  FILE *fmatacq;
427  char filename[80];
428  int i;
429  double ss;
430  sprintf(filename, "runMatacq%d.pedestal", gRunNumber);
431  fmatacq = fopen(filename, "w");
432  if (fmatacq == nullptr)
433  printf("Error while opening file : %s\n", filename);
434 
435  double sumtrise = 0.;
436  double sumtrise2 = 0.;
437  int timestop = timestart + 3;
438  double mintrise = 10000.;
439  double maxtrise = 0.;
440  for (i = 0; i < nevmtq0; i++) {
441  if (comp_trise[i] > maxtrise) {
442  maxtrise = comp_trise[i];
443  }
444  if (comp_trise[i] < mintrise) {
445  mintrise = comp_trise[i];
446  }
447  sumtrise += comp_trise[i];
448  sumtrise2 += comp_trise[i] * comp_trise[i];
449  }
450  meantrise = sumtrise / ((double)nevmtq0);
451  ss = (sumtrise2 / ((double)nevmtq0) - meantrise * meantrise);
452  if (ss < 0.)
453  ss = 0.;
454  sigtrise = sqrt(ss);
455  fprintf(
456  fmatacq, "%d %d %d %d %f %f %f %f\n", nevmtq0, color, timestart, timestop, meantrise, sigtrise, mintrise, maxtrise);
457 
458  sumtrise = 0.;
459  sumtrise2 = 0.;
460  mintrise = 10000.;
461  maxtrise = 0.;
462  for (i = nevmtq0; i < nevmtq0 + nevmtq1; i++) {
463  if (comp_trise[i] > maxtrise) {
464  maxtrise = comp_trise[i];
465  }
466  if (comp_trise[i] < mintrise) {
467  mintrise = comp_trise[i];
468  }
469  sumtrise += comp_trise[i];
470  sumtrise2 += comp_trise[i] * comp_trise[i];
471  }
472  meantrise = sumtrise / ((double)nevmtq1);
473  ss = (sumtrise2 / ((double)nevmtq1) - meantrise * meantrise);
474  if (ss < 0.)
475  ss = 0.;
476  sigtrise = sqrt(ss);
477  fprintf(
478  fmatacq, "%d %d %d %d %f %f %f %f\n", nevmtq1, color, timestart, timestop, meantrise, sigtrise, mintrise, maxtrise);
479 
480  int iret = fclose(fmatacq);
481  printf(" Closing file : %d\n", iret);
482 }
double meantrise
Definition: TMatacq.h:28
T sqrt(T t)
Definition: SSEVec.h:19
double sigtrise
Definition: TMatacq.h:28
double comp_trise[1200]
Definition: TMatacq.h:32
int nevmtq0
Definition: TMatacq.h:30
int nevmtq1
Definition: TMatacq.h:30

◆ rawPulseAnalysis()

int TMatacq::rawPulseAnalysis ( Int_t  Nsamp,
Double_t *  adc 
)

Definition at line 57 of file TMatacq.cc.

References gpuClustering::adc, mps_fire::i, init, dqmdumpme::k, mathSSE::sqrt(), and contentValuesCheck::ss.

Referenced by EcalMatacqAnalyzer::endJob().

58 {
59  using namespace std;
60 
61  // std::cout << "Entering rawPulseAnalysis" << std::endl;
62 
63  int k, ithr;
64  double dsum = 0., dsum2 = 0.;
65 
66  // std::cout << "calling init" << std::endl;
67  init();
68  // std::cout << ".......done" << std::endl;
69 
70  if (Nsamp != fNsamples) {
71  printf("found different number of samples fNsamples=%d Nsamp=%d\n", fNsamples, Nsamp);
72  return 100;
73  }
74 
75  for (k = 0; k < presample; k++) {
76  dsum += adc[k];
77  dsum2 += adc[k] * adc[k];
78  }
79  bl = dsum / ((double)presample);
80  double ss = (dsum2 / ((double)presample) - bl * bl);
81  if (ss < 0.)
82  ss = 0.;
83  sigbl = sqrt(ss);
84  for (ithr = 0, k = presample; k < endsample; k++) {
85  if (adc[k] > (bl + nsigcut * sigbl) && ithr == 0) {
86  ithr = 1;
87  firstsample = k;
88  }
89  }
90 
91  if (ithr == 0)
92  return 101;
93 
94  for (ithr = 0, k = firstsample; k < Nsamp; k++) {
95  if (adc[k] < (bl + nsigcut * sigbl) && ithr == 0) {
96  ithr = 1;
97  lastsample = k;
98  }
99  }
100  if (ithr == 0)
101  lastsample = Nsamp;
102 
105 
106  val_max = 0.;
107  samplemax = 0;
108  for (Int_t is = firstsample; is < lastsample; is++) {
109  bong[is - firstsample] = adc[is] - bl;
110  if (bong[is - firstsample] > val_max) {
111  val_max = bong[is - firstsample];
112  samplemax = is;
113  }
114  }
115  if (samplemax == 0)
116  return 103;
117  if (samplemax > lastsample)
118  return 104;
119  if (samplemax < firstsample)
120  return 105;
121 
122  int endslide = samplemax - nslide;
123  int beginslide = nslide;
124  int islidingmean = 0;
125  slidingmean = 0.0;
126 
127  for (int i = beginslide; i < endslide; i++) {
128  slidingmean += adc[i];
129  islidingmean += 1;
130  }
131  if (islidingmean != 0)
132  slidingmean /= double(islidingmean);
133 
134  return 0;
135 }
double bong[NMAXSAMP]
Definition: TMatacq.h:20
int endsample
Definition: TMatacq.h:16
double sigbl
Definition: TMatacq.h:23
double bl
Definition: TMatacq.h:23
int samplemax
Definition: TMatacq.h:16
double val_max
Definition: TMatacq.h:23
void init()
Definition: TMatacq.cc:17
double nsigcut
Definition: TMatacq.h:18
int nslide
Definition: TMatacq.h:34
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr int NMAXSAMP
Definition: TMatacq.h:8
int fNsamples
Definition: TMatacq.h:12
double slidingmean
Definition: TMatacq.h:33
int firstsample
Definition: TMatacq.h:16
int lastsample
Definition: TMatacq.h:16
int presample
Definition: TMatacq.h:16
uint16_t *__restrict__ uint16_t const *__restrict__ adc

Member Data Documentation

◆ ampl

double TMatacq::ampl
private

Definition at line 24 of file TMatacq.h.

Referenced by getAmpl().

◆ bing

int TMatacq::bing[101]
private

Definition at line 17 of file TMatacq.h.

◆ bl

double TMatacq::bl
private

Definition at line 23 of file TMatacq.h.

Referenced by getBaseLine().

◆ bong

double TMatacq::bong[NMAXSAMP]
private

Definition at line 20 of file TMatacq.h.

◆ comp_peak

double TMatacq::comp_peak[1200]
private

Definition at line 32 of file TMatacq.h.

◆ comp_trise

double TMatacq::comp_trise[1200]
private

Definition at line 32 of file TMatacq.h.

◆ endsample

int TMatacq::endsample
private

Definition at line 16 of file TMatacq.h.

◆ firstsample

int TMatacq::firstsample
private

Definition at line 16 of file TMatacq.h.

Referenced by getPt1().

◆ fNsamples

int TMatacq::fNsamples
private

Definition at line 12 of file TMatacq.h.

◆ fNum_samp_aft_max

int TMatacq::fNum_samp_aft_max
private

Definition at line 14 of file TMatacq.h.

◆ fNum_samp_bef_max

int TMatacq::fNum_samp_bef_max
private

Definition at line 13 of file TMatacq.h.

◆ fv1

double TMatacq::fv1[NSPARAB]
private

Definition at line 22 of file TMatacq.h.

◆ fv2

double TMatacq::fv2[NSPARAB]
private

Definition at line 22 of file TMatacq.h.

◆ fv3

double TMatacq::fv3[NSPARAB]
private

Definition at line 22 of file TMatacq.h.

◆ lastsample

int TMatacq::lastsample
private

Definition at line 16 of file TMatacq.h.

Referenced by getPt2().

◆ level1

double TMatacq::level1
private

Definition at line 19 of file TMatacq.h.

◆ level2

double TMatacq::level2
private

Definition at line 19 of file TMatacq.h.

◆ level3

double TMatacq::level3
private

Definition at line 19 of file TMatacq.h.

◆ meantrise

double TMatacq::meantrise
private

Definition at line 28 of file TMatacq.h.

◆ nevlasers

int TMatacq::nevlasers
private

Definition at line 30 of file TMatacq.h.

◆ nevmtq0

int TMatacq::nevmtq0
private

Definition at line 30 of file TMatacq.h.

◆ nevmtq1

int TMatacq::nevmtq1
private

Definition at line 30 of file TMatacq.h.

◆ NMAXSAMP

constexpr int TMatacq::NMAXSAMP = 100
static

Definition at line 8 of file TMatacq.h.

◆ nsigcut

double TMatacq::nsigcut
private

Definition at line 18 of file TMatacq.h.

◆ nslide

int TMatacq::nslide
private

Definition at line 34 of file TMatacq.h.

◆ NSPARAB

constexpr int TMatacq::NSPARAB = 16
static

Definition at line 9 of file TMatacq.h.

◆ pkval

double TMatacq::pkval
private

Definition at line 25 of file TMatacq.h.

Referenced by getTimpeak().

◆ presample

int TMatacq::presample
private

Definition at line 16 of file TMatacq.h.

◆ samplemax

int TMatacq::samplemax
private

Definition at line 16 of file TMatacq.h.

Referenced by getPtm().

◆ sigbl

double TMatacq::sigbl
private

Definition at line 23 of file TMatacq.h.

Referenced by getsigBaseLine().

◆ sigpkval

double TMatacq::sigpkval
private

Definition at line 25 of file TMatacq.h.

Referenced by getsigTimpeak().

◆ sigtrise

double TMatacq::sigtrise
private

Definition at line 28 of file TMatacq.h.

◆ slidingmean

double TMatacq::slidingmean
private

Definition at line 33 of file TMatacq.h.

Referenced by getSlide().

◆ status

int TMatacq::status[1200]
private

◆ t

double TMatacq::t[NSPARAB]
private

Definition at line 21 of file TMatacq.h.

◆ timeatmax

double TMatacq::timeatmax
private

Definition at line 24 of file TMatacq.h.

Referenced by getTimax().

◆ trise

double TMatacq::trise
private

Definition at line 26 of file TMatacq.h.

Referenced by getTrise().

◆ val

double TMatacq::val[NSPARAB]
private

◆ val_max

double TMatacq::val_max
private

Definition at line 23 of file TMatacq.h.

◆ width20

double TMatacq::width20
private

Definition at line 27 of file TMatacq.h.

Referenced by getWidth20().

◆ width50

double TMatacq::width50
private

Definition at line 27 of file TMatacq.h.

Referenced by getFwhm().

◆ width80

double TMatacq::width80
private

Definition at line 27 of file TMatacq.h.

Referenced by getWidth80().