stream  0.10.0
stream analysis framework
TdcProcessor.h
1 #ifndef HADAQ_TDCPROCESSOR_H
2 #define HADAQ_TDCPROCESSOR_H
3 
4 #include "hadaq/SubProcessor.h"
5 
6 #include "hadaq/TdcMessage.h"
7 #include "hadaq/TdcIterator.h"
8 #include "hadaq/TdcSubEvent.h"
9 
10 #include <vector>
11 #include <cmath>
12 #include <string>
13 
14 namespace hadaq {
15 
16  enum { FineCounterBins = 600, TotBins = 3000, ToTvalue = 20, ToThmin = 15, ToThmax = 60 };
17 
32  class TdcProcessor : public SubProcessor {
33 
34  friend class TrbProcessor;
35 
36  protected:
37 
39  struct ChannelRec {
40  unsigned refch;
41  unsigned reftdc;
42  bool refabs;
43  unsigned doublerefch;
44  unsigned doublereftdc;
45  unsigned refch_tmds;
46  bool docalibr;
47  bool hascalibr;
48  bool check_calibr;
49  base::H1handle fRisingFine;
50  base::H1handle fRisingMult;
51  base::H1handle fRisingRef;
52  base::C1handle fRisingRefCond;
53  base::H1handle fRisingCalibr;
54  base::H2handle fRisingRef2D;
55  base::H1handle fRisingRefRef;
56  base::H2handle fRisingDoubleRef;
57  base::H1handle fRisingTmdsRef;
58  base::H1handle fFallingFine;
59  base::H1handle fFallingMult;
60  base::H1handle fTot;
61  base::H1handle fTot0D;
62  base::H1handle fFallingCalibr;
63  int rising_cnt;
65  double rising_hit_tm;
66  double rising_last_tm;
68  double rising_ref_tm;
69  double rising_tmds;
70  unsigned rising_coarse;
71  unsigned rising_fine;
72  unsigned last_rising_fine;
73  unsigned last_falling_fine;
76  std::vector<uint32_t> rising_stat;
77  std::vector<float> rising_calibr;
78  std::vector<uint32_t> falling_stat;
79  std::vector<float> falling_calibr;
80  float last_tot;
81  long tot0d_cnt;
82  std::vector<uint32_t> tot0d_hist;
83  float tot_shift;
84  float tot_dev;
86  float trig0d_coef;
92 
95  refch(0xffffff),
96  reftdc(0xffffffff),
97  refabs(false),
98  doublerefch(0xffffff),
99  doublereftdc(0xffffff),
100  refch_tmds(0xffffff),
101  docalibr(true),
102  hascalibr(false),
103  check_calibr(false),
104  fRisingFine(0),
105  fRisingMult(0),
106  fRisingRef(0),
107  fRisingRefCond(0),
108  fRisingCalibr(0),
109  fRisingRef2D(0),
110  fRisingRefRef(0),
111  fRisingDoubleRef(0),
112  fRisingTmdsRef(0),
113  fFallingFine(0),
114  fFallingMult(0),
115  fTot(0),
116  fTot0D(0),
117  fFallingCalibr(0),
118  rising_cnt(0),
119  falling_cnt(0),
120  rising_hit_tm(0.),
121  rising_last_tm(0),
122  rising_new_value(false),
123  rising_ref_tm(0.),
124  rising_tmds(0.),
125  rising_coarse(0),
126  rising_fine(0),
127  last_rising_fine(0),
129  all_rising_stat(0),
130  all_falling_stat(0),
131  rising_stat(),
132  rising_calibr(),
133  falling_stat(),
134  falling_calibr(),
135  last_tot(0.),
136  tot0d_cnt(0),
137  tot0d_hist(),
138  tot_shift(0.),
139  tot_dev(0.),
141  trig0d_coef(0.),
142  rising_cond_prnt(-1),
147  {
148  }
149 
151  void CreateCalibr(unsigned numfine, double coarse_unit = -1.)
152  {
153  rising_stat.resize(numfine);
154  falling_stat.resize(numfine);
155 
156  FillCalibr(numfine, coarse_unit);
157  }
158 
160  void FillCalibr(unsigned numfine, double coarse_unit = -1.)
161  {
162  for (unsigned n=0;n<numfine;n++)
163  falling_stat[n] = rising_stat[n] = 0;
164 
166  }
167 
169  void SetLinearCalibr(unsigned finemin, unsigned finemax, double coarse_unit = -1)
170  {
171  rising_calibr.resize(5,0);
172  falling_calibr.resize(5,0);
173 
174  // to support old API where factor for default coarse unit was possible to specify
175  if (coarse_unit < 0)
176  coarse_unit = hadaq::TdcMessage::CoarseUnit();
177  else if (coarse_unit > 0.01)
178  coarse_unit = coarse_unit * hadaq::TdcMessage::CoarseUnit();
179 
180  rising_calibr[0] = 2; // 2 values
181  rising_calibr[1] = finemin;
182  rising_calibr[2] = 0.;
183  rising_calibr[3] = finemax;
184  rising_calibr[4] = coarse_unit;
185 
186  for (int n=0;n<5;++n)
188  }
189 
192  {
193  rising_stat.clear();
194  rising_calibr.clear();
195  falling_stat.clear();
196  falling_calibr.clear();
197  }
198 
201  {
202  tot0d_hist.resize(TotBins);
203  for (unsigned n=0;n<TotBins;n++)
204  tot0d_hist[n] = 0;
205  }
206 
209  {
210  tot0d_hist.clear();
211 
212  }
213  };
214 
215  bool fVersion4{false};
216 
219 
220  base::H1handle fChannels;
221  base::H1handle fHits;
222  base::H1handle fErrors;
223  base::H1handle fUndHits;
224  base::H1handle fCorrHits;
225  base::H1handle fMsgsKind;
226  base::H2handle fAllFine;
227  base::H2handle fAllCoarse;
228  base::H2handle fRisingCalibr;
229  base::H2handle fFallingCalibr;
230  base::H1handle fHitsRate;
231  base::H1handle fTotShifts;
232  base::H1handle fTempDistr;
233 
234  base::H2handle fhRaisingFineCalibr;
235  base::H2handle fhTotVsChannel;
236  base::H1handle fhTotMoreCounter;
237  base::H1handle fhTotMinusCounter;
238 
239  unsigned fHldId;
240  base::H1handle *fHitsPerHld;
241  base::H1handle *fErrPerHld;
242  base::H2handle *fChHitsPerHld;
243  base::H2handle *fChErrPerHld;
244  base::H2handle *fChCorrPerHld;
245  base::H2handle *fQaFinePerHld;
246  base::H2handle *fQaToTPerHld;
247  base::H2handle *fQaEdgesPerHld;
248  base::H2handle *fQaErrorsPerHld;
249 
250  unsigned fNumChannels;
251  unsigned fNumFineBins;
252  std::vector<ChannelRec> fCh;
253  float fCalibrTemp;
257 
258  bool fToTdflt;
259  double fToTvalue;
260  double fToThmin;
261  double fToThmax;
262  double fTotUpperLimit;
264  double fTotRMSLimit;
265 
268  std::string fCalibrStatus;
269  double fCalibrQuality;
270  // 0 - not exists
271  // 0..0.3 - bad (red color)
272  // 0.3..0.7 - poor (yellow color)
273  // 0.7..0.8 - accumulating (blue color)
274  // 0.8..1.0 - ok (green color)
275 
277  float fCurrentTemp;
278  unsigned fDesignId;
282 
283  std::vector<hadaq::TdcMessageExt> fDummyVect;
284  std::vector<hadaq::TdcMessageExt> *pStoreVect;
285 
286  std::vector<hadaq::MessageFloat> fDummyFloat;
287  std::vector<hadaq::MessageFloat> *pStoreFloat;
288 
289  std::vector<hadaq::MessageDouble> fDummyDouble;
290  std::vector<hadaq::MessageDouble> *pStoreDouble;
291 
297  unsigned fEdgeMask;
299  bool fAutoCalibr;
304 
305  std::string fWriteCalibr;
307  bool fUseLinear;
309 
310  bool fEveryEpoch;
311 
312  bool fUseLastHit;
313 
315 
317 
319 
320  bool fCh0Enabled;
321 
324 
325  long fRateCnt;
326  double fLastRateTm;
327 
328  unsigned fSkipTdcMessages;
329  bool f400Mhz;
330  double fCustomMhz;
331 
332  std::vector<std::string> fCalibrLog;
333 
336  virtual bool doTriggerSelection() const { return false; }
337 
338  static unsigned gNumFineBins;
339  static unsigned gTotRange;
340  static unsigned gHist2dReduce;
341  static unsigned gErrorMask;
342  static bool gAllHistos;
343  static double gTrigDWindowLow;
344  static double gTrigDWindowHigh;
345  static bool gUseDTrigForRef;
346  static bool gUseAsDTrig;
348  static int gTotStatLimit;
349  static double gTotRMSLimit;
351  static bool gIgnoreCalibrMsgs;
352  static bool gStoreCalibrTables;
353 
354  virtual void AppendTrbSync(uint32_t syncid);
355 
358  virtual double MaximumDisorderTm() const { return 2e-6; }
359 
360  bool DoBufferScan(const base::Buffer &buf, bool isfirst);
361  bool DoBuffer4Scan(const base::Buffer &buf, bool isfirst);
362 
363  double DoTestToT(int iCh);
364  double DoTestErrors(int iCh);
365  double DoTestEdges(int iCh);
366  double DoTestFineTimeH2(int iCh, base::H2handle h);
367  double DoTestFineTime(double hRebin[], int nBinsRebin, int nEntries);
368 
369  virtual void BeforeFill();
370  virtual void AfterFill(SubProcMap* = 0);
371 
372  long CheckChannelStat(unsigned ch);
373 
374  double CalibrateChannel(unsigned nch, bool rising, const std::vector<uint32_t> &statistic, std::vector<float> &calibr, bool use_linear = false, bool preliminary = false);
375  void CopyCalibration(const std::vector<float> &calibr, base::H1handle hcalibr, unsigned ch = 0, base::H2handle h2calibr = 0);
376 
377  bool CalibrateTot(unsigned ch, std::vector<uint32_t> &hist, float &tot_shift, float &tot_dev, float cut = 0.);
378 
379  bool CheckPrintError();
380 
381  bool CreateChannelHistograms(unsigned ch);
382 
383  double TestCanCalibrate(bool fillhist = false, std::string *status = nullptr);
384 
385  bool PerformAutoCalibrate();
386 
387  void ClearChannelStat(unsigned ch);
388 
389  float ExtractCalibr(const std::vector<float> &func, unsigned bin);
390 
392  inline float ExtractCalibrDirect(const std::vector<float> &func, unsigned bin)
393  {
394  if (func.size() > 100) return func[bin];
395 
396  // here only two-point linear approximation is supported
397  // later one can extend approximation for N-points linear function
398  if (bin <= func[1]) return func[2];
399  int pnt = func.size() - 2; // 3 for simple linear point
400  if (bin >= func[pnt]) return func[pnt+1];
401 
402  if (pnt > 3) {
403  int segm = std::ceil((bin - func[1]) / (func[pnt] - func[1]) * (func[0] - 1)); // segment in linear approx
404  pnt = 1 + segm*2; // first segment should have pnt = 3, second segment pnt = 5 and so on
405  }
406 
407  return func[pnt-1] + (bin - func[pnt-2]) / (func[pnt] - func[pnt-2]) * (func[pnt+1] - func[pnt-1]);
408  }
409 
410  void CreateV4CalibrTable(unsigned ch, uint32_t *table);
411  void SetTable(uint32_t *table, unsigned addr, uint32_t value);
412 
413  void FindFMinMax(const std::vector<float> &func, int nbin, int &fmin, int &fmax);
414 
415  virtual void CreateBranch(TTree*);
416 
417  void AddError(unsigned code, const char *args, ...);
418 
419  public:
420 
422  enum EErrors {
429  errMismatchDouble,
432  errMisc
433  };
434 
436  enum EEdgesMasks {
441  };
442 
443  TdcProcessor(TrbProcessor* trb, unsigned tdcid, unsigned numchannels = MaxNumTdcChannels, unsigned edge_mask = 1, bool ver4 = false);
444  virtual ~TdcProcessor();
445 
446  static void SetMaxBoardId(unsigned);
447 
448  static void SetDefaults(unsigned numfinebins = 600, unsigned totrange = 100, unsigned hist2dreduced = 10);
449 
450  static void SetErrorMask(unsigned mask = 0xffffffffU);
451 
452  static void SetAllHistos(bool on = true);
453 
454  static void SetIgnoreCalibrMsgs(bool on = true);
455 
456  static void SetHadesMonitorInterval(int tm = -1);
457  static int GetHadesMonitorInterval();
458 
459  static void SetUseDTrigForRef(bool on = true);
460 
461  static void SetTriggerDWindow(double low = -25, double high = 50);
462 
463  static void SetToTCalibr(int minstat = 100, double rms = 0.15);
464 
465  static void SetDefaultLinearNumPoints(int cnt = 2);
466 
467  static void SetUseAsDTrig(bool on = true);
468 
469  static void SetStoreCalibrTables(bool on = true);
470 
472  void SetSkipTdcMessages(unsigned cnt = 0) { fSkipTdcMessages = cnt; }
473 
474  void Set400Mhz(bool on = true);
475 
476  void SetCustomMhz(float freq = 400.);
477 
479  void SetTotStatLimit(int minstat = 100) { fTotStatLimit = minstat; }
481  void SetTotRMSLimit(double rms = 0.15) { fTotRMSLimit = rms; }
482 
484  inline unsigned NumChannels() const { return fNumChannels; }
486  inline bool DoRisingEdge() const { return true; }
488  inline bool DoFallingEdge() const { return fEdgeMask > 1; }
490  inline unsigned GetEdgeMask() const { return fEdgeMask; }
491 
493  double GetCalibrProgress() const { return fCalibrProgress; }
495  std::string GetCalibrStatus() const { return fCalibrStatus; }
497  double GetCalibrQuality() const { return fCalibrQuality; }
499  void AcknowledgeCalibrQuality(double lvl = 1.)
500  {
501  if (fCalibrQuality < lvl) {
502  fCalibrQuality = lvl;
503  fCalibrProgress = 1.;
504  fCalibrStatus = "Ready";
505  }
506  }
508  std::vector<std::string> TakeCalibrLog()
509  {
510  std::vector<std::string> res;
511  std::swap(res, fCalibrLog);
512  return res;
513  }
514 
516  int GetNumHist() const { return 9; }
517 
519  const char* GetHistName(int k) const
520  {
521  switch(k) {
522  case 0: return "RisingFine";
523  case 1: return "RisingCoarse";
524  case 2: return "RisingRef";
525  case 3: return "FallingFine";
526  case 4: return "FallingCoarse";
527  case 5: return "Tot";
528  case 6: return "RisingMult";
529  case 7: return "FallingMult";
530  case 8: return "RisingTmdsRef";
531  }
532  return "";
533  }
534 
536  base::H1handle GetHist(unsigned ch, int k = 0)
537  {
538  if (ch>=NumChannels()) return 0;
539  switch (k) {
540  case 0: return fCh[ch].fRisingFine;
541  case 1: return 0;
542  case 2: return fCh[ch].fRisingRef;
543  case 3: return fCh[ch].fFallingFine;
544  case 4: return 0;
545  case 5: return fCh[ch].fTot;
546  case 6: return fCh[ch].fRisingMult;
547  case 7: return fCh[ch].fFallingMult;
548  case 8: return fCh[ch].fRisingTmdsRef;
549  }
550  return 0;
551  }
552 
553  void CreateHistograms(int *arr = 0);
554 
556  void AssignPerHldHistos(unsigned id, base::H1handle *hHits, base::H1handle *hErrs,
557  base::H2handle *hChHits, base::H2handle *hChErrs,
558  base::H2handle *hChCorr,
559  base::H2handle *hQaFine, base::H2handle *hQaToT,
560  base::H2handle *hQaEdges, base::H2handle *hQaErrors)
561  {
562  fHldId = id;
563  fHitsPerHld = hHits;
564  fErrPerHld = hErrs;
565  fChHitsPerHld = hChHits;
566  fChErrPerHld = hChErrs;
567  fChCorrPerHld = hChCorr;
568  fQaFinePerHld = hQaFine;
569  fQaToTPerHld = hQaToT;
570  fQaEdgesPerHld = hQaEdges;
571  fQaErrorsPerHld = hQaErrors;
572  }
573 
578  void SetCalibrTrigger(int typ1 = 0xFFFF, unsigned typ2 = 0, unsigned typ3 = 0, unsigned typ4 = 0)
579  {
580  fCalibrTriggerMask = 0;
581  if (typ1<0) return;
582  if (typ1 >= 0xFFFF) { fCalibrTriggerMask = 0xFFFF; return; }
583  if (typ1 && (typ1<=0xF)) fCalibrTriggerMask |= (1 << typ1);
584  if (typ2 && (typ2<=0xF)) fCalibrTriggerMask |= (1 << typ2);
585  if (typ3 && (typ3<=0xF)) fCalibrTriggerMask |= (1 << typ3);
586  if (typ4 && (typ4<=0xF)) fCalibrTriggerMask |= (1 << typ4);
587  }
588 
591  void SetCalibrTriggerMask(unsigned trigmask)
592  {
593  fCalibrTriggerMask = trigmask & 0x3FFF;
594  fCalibrUseTemp = (trigmask & 0x80000000) != 0;
595  }
596 
599  void SetCalibrTempCoef(float coef)
600  {
601  fCalibrTempCoef = coef;
602  }
603 
605  void SetChannelTempShift(unsigned ch, float shift_per_grad)
606  {
607  if (ch < fCh.size()) fCh[ch].time_shift_per_grad = shift_per_grad;
608  }
609 
611  void SetChannelTotShift(unsigned ch, float tot_shift)
612  {
613  if (ch < fCh.size()) fCh[ch].tot_shift = tot_shift;
614  }
615 
616  void DisableCalibrationFor(unsigned firstch, unsigned lastch = 0);
617 
618  void SetRefChannel(unsigned ch, unsigned refch, unsigned reftdc = 0xffff, int npoints = 5000, double left = -10., double right = 10., bool twodim = false);
619 
620 
621  void SetRefTmds(unsigned ch, unsigned refch, int npoints, double left, double right);
622 
623  bool SetDoubleRefChannel(unsigned ch1, unsigned ch2,
624  int npx = 200, double xmin = -10., double xmax = 10.,
625  int npy = 200, double ymin = -10., double ymax = 10.);
626 
627  void CreateRateHisto(int np = 1000, double xmin = 0., double xmax = 1e5);
628 
630  void SetTotUpperLimit(double lmt = 20) { fTotUpperLimit = lmt; }
631 
633  double GetTotUpperLimit() const { return fTotUpperLimit; }
634 
635  bool EnableRefCondPrint(unsigned ch, double left = -10, double right = 10, int numprint = 0);
636 
638  void SetEveryEpoch(bool on) { fEveryEpoch = on; }
640  bool IsEveryEpoch() const { return fEveryEpoch; }
641 
642  void SetLinearCalibration(unsigned nch, unsigned finemin=30, unsigned finemax=500);
643 
645  void SetAutoCalibration(long cnt = 100000) { fCalibrCounts = cnt % 1000000000L; fAutoCalibrOnce = (cnt>1000000000L); fAutoCalibr = (cnt >= 0); }
646 
649 
652 
653  void BeginCalibration(long cnt);
654 
655  void CompleteCalibration(bool dummy = false, const std::string &filename = "", const std::string &subdir = "");
656 
657  bool LoadCalibration(const std::string& fprefix);
658 
661  void SetWriteCalibration(const std::string &fprefix, bool every_time = false, bool use_linear = false)
662  {
663  fWriteCalibr = fprefix;
664  fWriteEveryTime = every_time;
665  fUseLinear = use_linear;
666  }
667 
669  void SetUseLinear(bool on = true) { fUseLinear = on; }
670 
672  bool IsUseLinear() const { return fUseLinear; }
673 
675  void SetLinearNumPoints(int cnt = 2) { fLinearNumPoints = (cnt < 2) ? 2 : ((cnt > 100) ? 100 : cnt); }
677  int GetLinearNumPoints() const { return fLinearNumPoints; }
678 
679  void SetToTRange(double tot_0xd, double hmin, double hmax);
680 
681  void ConfigureToTByHwType(unsigned hwtype);
682 
686  void SetUseLastHit(bool on = true) { fUseLastHit = on; }
687 
689  bool IsUseLastHist() const { return fUseLastHit; }
690 
692  const TdcMessage& GetLastTdcHeader() const { return fLastTdcHeader; }
693 
695  const TdcMessage& GetLastTdcTrailer() const { return fLastTdcTrailer; }
696 
697  virtual void UserPostLoop();
698 
700  base::H1handle GetChannelRefHist(unsigned ch, bool = true)
701  { return ch < fCh.size() ? fCh[ch].fRisingRef : 0; }
702 
704  void ClearChannelRefHist(unsigned ch, bool rising = true)
705  { ClearH1(GetChannelRefHist(ch, rising)); }
706 
708  void SetCh0Enabled(bool on = true) { fCh0Enabled = on; }
709 
712  virtual bool FirstBufferScan(const base::Buffer& buf)
713  {
714  return fVersion4 ? DoBuffer4Scan(buf, true) : DoBufferScan(buf, true);
715  }
716 
718  virtual bool SecondBufferScan(const base::Buffer& buf)
719  {
720  return fVersion4 ? DoBuffer4Scan(buf, false) : DoBufferScan(buf, false);
721  }
722 
723  void IncCalibration(unsigned ch, bool rising, unsigned fine, unsigned value);
724 
725  void ProduceCalibration(bool clear_stat = true, bool use_linear = false, bool dummy = false, bool preliminary = false);
726 
729  float GetCalibrTemp() const { return fCalibrTemp; }
730 
732  void SetCalibrTemp(float v) { fCalibrTemp = v; }
733 
734  void StoreCalibration(const std::string& fname, unsigned fileid = 0);
735 
736  virtual void Store(base::Event*);
737 
738  virtual void ResetStore();
739 
740  unsigned TransformTdcData(hadaqs::RawSubevent* sub, uint32_t *rawdata, unsigned indx, unsigned datalen, hadaqs::RawSubevent* tgt = 0, unsigned tgtindx = 0);
741 
742  void EmulateTransform(int dummycnt);
743 
744  void DoHadesHistAnalysis();
745 
746  void FillToTHistogram();
747  };
748 
749 }
750 
751 #endif
Memory management class.
Definition: Buffer.h:49
Event - collection of several subevents.
Definition: Event.h:17
void ClearH1(H1handle h1)
Clear 1-D histogram.
Definition: base/Processor.h:132
Abstract processor of HADAQ sub-sub-event.
Definition: SubProcessor.h:26
TDC iterator.
Definition: TdcIterator.h:16
TDC processor.
Definition: TdcProcessor.h:32
double fCalibrTempSum1
! sum1 used to check temperature during calibration
Definition: TdcProcessor.h:280
void SetCalibrTemp(float v)
Set temperature used for calibration.
Definition: TdcProcessor.h:732
virtual void ResetStore()
reset store
Definition: TdcProcessor.cxx:3859
unsigned fNumFineBins
! number of fine-counter bins
Definition: TdcProcessor.h:251
void CreateRateHisto(int np=1000, double xmin=0., double xmax=1e5)
Create rate histogram to count hits per second (excluding channel 0)
Definition: TdcProcessor.cxx:680
bool fUseLastHit
! if true, last hit will be used in reference calculations
Definition: TdcProcessor.h:312
double fToThmin
! histogram min
Definition: TdcProcessor.h:260
EEdgesMasks
edges mask
Definition: TdcProcessor.h:436
@ edge_Rising
process only rising edge
Definition: TdcProcessor.h:437
@ edge_CommonStatistic
accumulate common statistic for both
Definition: TdcProcessor.h:440
@ edge_ForceRising
use rising edge calibration for falling
Definition: TdcProcessor.h:439
@ edge_BothIndepend
process rising and falling endges independent
Definition: TdcProcessor.h:438
static void SetDefaultLinearNumPoints(int cnt=2)
Set default number of point in linear approximation.
Definition: TdcProcessor.cxx:113
virtual ~TdcProcessor()
destructor
Definition: TdcProcessor.cxx:318
base::H1handle fChannels
! histogram with messages per channel
Definition: TdcProcessor.h:220
float fTempCorrection
! correction for temperature sensor
Definition: TdcProcessor.h:276
std::vector< hadaq::MessageFloat > fDummyFloat
! vector with compact messages
Definition: TdcProcessor.h:286
bool fCalibrUseTemp
! when true, use temperature adjustment for calibration
Definition: TdcProcessor.h:255
TdcMessage fLastTdcTrailer
! copy of last TDC trailer
Definition: TdcProcessor.h:323
bool DoRisingEdge() const
Returns true if processing rising edge.
Definition: TdcProcessor.h:486
bool f400Mhz
! is 400Mhz mode (debug)
Definition: TdcProcessor.h:329
static void SetStoreCalibrTables(bool on=true)
enable storage of calibration tables for V4 TDC
Definition: TdcProcessor.cxx:153
void CreateV4CalibrTable(unsigned ch, uint32_t *table)
Create V4 calibration table.
Definition: TdcProcessor.cxx:3603
virtual bool doTriggerSelection() const
Returns true when processor used to select trigger signal TDC not yet able to perform trigger selecti...
Definition: TdcProcessor.h:336
double TestCanCalibrate(bool fillhist=false, std::string *status=nullptr)
Check if automatic calibration can be performed - enough statistic is accumulated.
Definition: TdcProcessor.cxx:866
base::H2handle * fChHitsPerHld
! hits per TDC channel - from HLD
Definition: TdcProcessor.h:242
bool fCompensateEpochReset
! if true, compensates epoch reset
Definition: TdcProcessor.h:316
float GetCalibrTemp() const
Access value of temperature during calibration.
Definition: TdcProcessor.h:729
static unsigned gHist2dReduce
! reduce factor for points in 2D histogram
Definition: TdcProcessor.h:340
unsigned fDesignId
! design ID, taken from status message
Definition: TdcProcessor.h:278
base::H2handle fhTotVsChannel
! histogram of ToT vs channel
Definition: TdcProcessor.h:235
bool SetDoubleRefChannel(unsigned ch1, unsigned ch2, int npx=200, double xmin=-10., double xmax=10., int npy=200, double ymin=-10., double ymax=10.)
Configure double-reference histogram Required that for both channels references are specified via Set...
Definition: TdcProcessor.cxx:613
long fCalibrCounts
! indicates minimal number of counts in each channel required to produce calibration
Definition: TdcProcessor.h:298
double fTotRMSLimit
! maximal RMS valus for complete calibration
Definition: TdcProcessor.h:264
std::vector< hadaq::MessageFloat > * pStoreFloat
! pointer on store vector
Definition: TdcProcessor.h:287
static void SetAllHistos(bool on=true)
Automatically create histograms for all channels - even they not appear in data.
Definition: TdcProcessor.cxx:76
unsigned fSkipTdcMessages
! number of first messages, skipped from analysis
Definition: TdcProcessor.h:328
TdcIterator fIter2
! iterator for the second scan
Definition: TdcProcessor.h:218
static bool gUseDTrigForRef
! when true, use special triggers for ref calculations
Definition: TdcProcessor.h:345
double CalibrateChannel(unsigned nch, bool rising, const std::vector< uint32_t > &statistic, std::vector< float > &calibr, bool use_linear=false, bool preliminary=false)
Calibrate channel.
Definition: TdcProcessor.cxx:3001
double DoTestFineTime(double hRebin[], int nBinsRebin, int nEntries)
Test fine time.
Definition: TdcProcessor.cxx:2922
virtual bool SecondBufferScan(const base::Buffer &buf)
Scan buffer for selecting messages inside trigger window.
Definition: TdcProcessor.h:718
std::string GetCalibrStatus() const
Returns calibration status.
Definition: TdcProcessor.h:495
base::H1handle fhTotMoreCounter
! histogram of counter with ToT >20 ns per channel
Definition: TdcProcessor.h:236
unsigned fHldId
! sequence number of processor in HLD
Definition: TdcProcessor.h:239
static unsigned gErrorMask
! mask for errors to display
Definition: TdcProcessor.h:341
bool LoadCalibration(const std::string &fprefix)
Load calibration from the file.
Definition: TdcProcessor.cxx:3668
void SetToTRange(double tot_0xd, double hmin, double hmax)
set real ToT value for 0xD trigger and min/max for histogram accumulation default is 30ns,...
Definition: TdcProcessor.cxx:437
int GetNumHist() const
Get number of indexed histograms.
Definition: TdcProcessor.h:516
void SetAutoCalibration(long cnt=100000)
configure auto calibration
Definition: TdcProcessor.h:645
bool DoFallingEdge() const
Returns true if processing falling.
Definition: TdcProcessor.h:488
unsigned TransformTdcData(hadaqs::RawSubevent *sub, uint32_t *rawdata, unsigned indx, unsigned datalen, hadaqs::RawSubevent *tgt=0, unsigned tgtindx=0)
Method transform TDC data, if output specified, use it otherwise change original data.
Definition: TdcProcessor.cxx:1008
static void SetTriggerDWindow(double low=-25, double high=50)
Configure window (in nanoseconds), where time stamps from 0xD trigger will be accepted for calibratio...
Definition: TdcProcessor.cxx:93
bool fWriteEveryTime
! write calibration every time automatic calibration performed
Definition: TdcProcessor.h:306
void CreateHistograms(int *arr=0)
Create basic histograms for specified channels.
Definition: TdcProcessor.cxx:487
unsigned fCalibrTriggerMask
! mask with enabled for trigger events ids, default all
Definition: TdcProcessor.h:256
std::vector< hadaq::MessageDouble > fDummyDouble
! vector with compact messages
Definition: TdcProcessor.h:289
base::H1handle fTempDistr
! temperature distribution
Definition: TdcProcessor.h:232
virtual void Store(base::Event *)
Store event.
Definition: TdcProcessor.cxx:3826
virtual bool FirstBufferScan(const base::Buffer &buf)
Scan all messages, find reference signals if returned false, buffer has error and must be discarded.
Definition: TdcProcessor.h:712
base::H2handle * fQaErrorsPerHld
! QA Errors per TDC channel - from HLD
Definition: TdcProcessor.h:248
void FillToTHistogram()
Fill ToT histogram.
Definition: TdcProcessor.cxx:3405
base::H2handle fRisingCalibr
! histogram with all rising calibrations
Definition: TdcProcessor.h:228
void UseExplicitCalibration()
Configure mode, when calibration should be start/stop explicitly.
Definition: TdcProcessor.h:648
void SetCalibrTriggerMask(unsigned trigmask)
Set calibration trigger mask directly, 1bit per each trigger type if bit 0x80000000 configured,...
Definition: TdcProcessor.h:591
void ClearChannelStat(unsigned ch)
Clear channel statistic used for calibrations.
Definition: TdcProcessor.cxx:3418
double DoTestToT(int iCh)
Test ToT.
Definition: TdcProcessor.cxx:2807
static void SetUseDTrigForRef(bool on=true)
Enable usage of 0xD trigger in ref histogram filling.
Definition: TdcProcessor.cxx:121
void DoHadesHistAnalysis()
Special hades histograms creation.
Definition: TdcProcessor.cxx:2789
double DoTestEdges(int iCh)
Test edges count.
Definition: TdcProcessor.cxx:2868
static void SetUseAsDTrig(bool on=true)
Use all data as 0xD trigger.
Definition: TdcProcessor.cxx:129
bool DoBuffer4Scan(const base::Buffer &buf, bool isfirst)
Scan all messages, find reference signals Major data analysis method.
Definition: TdcProcessor.cxx:2196
TdcIterator fIter1
! iterator for the first scan
Definition: TdcProcessor.h:217
void SetLinearCalibration(unsigned nch, unsigned finemin=30, unsigned finemax=500)
Configure linear calibration for the channel.
Definition: TdcProcessor.cxx:2992
unsigned fEdgeMask
EdgeMask defines how TDC calibration for falling edge is performed 0,1 - use only rising edge,...
Definition: TdcProcessor.h:297
bool IsUseLastHist() const
Returns true if last hit used in reference histogram calculations.
Definition: TdcProcessor.h:689
static int GetHadesMonitorInterval()
Return interval in seconds for HADES monitoring histograms filling.
Definition: TdcProcessor.cxx:145
void FindFMinMax(const std::vector< float > &func, int nbin, int &fmin, int &fmax)
Find min and max values of fine counter in calibration.
Definition: TdcProcessor.cxx:961
static bool gUseAsDTrig
! when true, all events are analyzed as 0xD trigger
Definition: TdcProcessor.h:346
bool CheckPrintError()
Check if error should be printed.
Definition: TdcProcessor.cxx:353
void SetUseLinear(bool on=true)
Enable linear calibrations.
Definition: TdcProcessor.h:669
void AcknowledgeCalibrQuality(double lvl=1.)
Acknowledge calibration quality.
Definition: TdcProcessor.h:499
float ExtractCalibrDirect(const std::vector< float > &func, unsigned bin)
extract calibration value
Definition: TdcProcessor.h:392
long CheckChannelStat(unsigned ch)
Return number of accumulated statistics for the channel.
Definition: TdcProcessor.cxx:845
const TdcMessage & GetLastTdcTrailer() const
Return last TDC header, seen by the processor.
Definition: TdcProcessor.h:695
base::H1handle fhTotMinusCounter
! histogram of counter with ToT < 0 ns per channel
Definition: TdcProcessor.h:237
void SetChannelTempShift(unsigned ch, float shift_per_grad)
Set shift for the channel time stamp, which is added with temperature change.
Definition: TdcProcessor.h:605
void IncCalibration(unsigned ch, bool rising, unsigned fine, unsigned value)
For expert use - artificially set calibration statistic.
Definition: TdcProcessor.cxx:3785
static unsigned gTotRange
! default range for TOT histogram
Definition: TdcProcessor.h:339
base::H2handle * fQaFinePerHld
! QA fine counter per TDC channel - from HLD
Definition: TdcProcessor.h:245
void SetTotStatLimit(int minstat=100)
Set minimal counts number for ToT calibration.
Definition: TdcProcessor.h:479
static int gDefaultLinearNumPoints
! number of points when linear calibration is used
Definition: TdcProcessor.h:350
static unsigned gNumFineBins
! default value for number of bins in histograms for fine bins
Definition: TdcProcessor.h:338
unsigned GetEdgeMask() const
Returns value of edge mask.
Definition: TdcProcessor.h:490
double fCustomMhz
! new design Mhz
Definition: TdcProcessor.h:330
base::H1handle GetHist(unsigned ch, int k=0)
Get histogram by index and channel id.
Definition: TdcProcessor.h:536
std::vector< ChannelRec > fCh
! full description for each channels
Definition: TdcProcessor.h:252
double DoTestFineTimeH2(int iCh, base::H2handle h)
Test fine time.
Definition: TdcProcessor.cxx:2899
unsigned NumChannels() const
Returns number of TDC channels.
Definition: TdcProcessor.h:484
std::vector< hadaq::MessageDouble > * pStoreDouble
! pointer on store vector
Definition: TdcProcessor.h:290
int fLinearNumPoints
! number of linear points
Definition: TdcProcessor.h:308
void SetSkipTdcMessages(unsigned cnt=0)
Set number of TDC messages, which should be skipped from subevent before analyzing it.
Definition: TdcProcessor.h:472
int fAllCalibrMode
! use all data for calibrations, used with DABC -1 - disabled, 0 - off, 1 - on
Definition: TdcProcessor.h:301
static double gTrigDWindowHigh
! high limit of time stamps for 0xD trigger used for calibration
Definition: TdcProcessor.h:344
base::H1handle fTotShifts
! histogram with all TOT shifts
Definition: TdcProcessor.h:231
int fAllTotMode
! ToT calibration mode -1 - disabled, 0 - accumulate stat for channels, 1 - accumulate stat for ToT
Definition: TdcProcessor.h:302
void SetEveryEpoch(bool on)
If set, each hit must be supplied with epoch message.
Definition: TdcProcessor.h:638
void AddError(unsigned code, const char *args,...)
add new error
Definition: TdcProcessor.cxx:361
unsigned fCompensateEpochCounter
! counter to compensate epoch reset
Definition: TdcProcessor.h:318
void SetTotRMSLimit(double rms=0.15)
Set maximal allowed RMS for ToT histogram in ns.
Definition: TdcProcessor.h:481
int GetLinearNumPoints() const
Return number of points in linear calibrations.
Definition: TdcProcessor.h:677
static bool gAllHistos
! when true, all histos for all channels created simultaneously
Definition: TdcProcessor.h:342
double fLastRateTm
! last ch0 time when rate was calculated
Definition: TdcProcessor.h:326
int fAllDTrigCnt
! number of 0xD triggers
Definition: TdcProcessor.h:303
base::H2handle * fChErrPerHld
! errors per TDC channel - from HLD
Definition: TdcProcessor.h:243
bool fToTdflt
! indicate if default setting used, which can be adjusted after seeing first event
Definition: TdcProcessor.h:258
float fCalibrTemp
! temperature when calibration was performed
Definition: TdcProcessor.h:253
std::vector< std::string > fCalibrLog
! error log messages during calibration
Definition: TdcProcessor.h:332
static void SetToTCalibr(int minstat=100, double rms=0.15)
Configure ToT calibration parameters.
Definition: TdcProcessor.cxx:104
bool IsEveryEpoch() const
Return true if each hit must be supplied with epoch message.
Definition: TdcProcessor.h:640
void DisableCalibrationFor(unsigned firstch, unsigned lastch=0)
Disable calibration for specified channels.
Definition: TdcProcessor.cxx:425
void SetCh0Enabled(bool on=true)
Enable/disable store of channel 0 in output event.
Definition: TdcProcessor.h:708
bool fAutoCalibrOnce
! when true, auto calibration will be executed once
Definition: TdcProcessor.h:300
base::H2handle fAllCoarse
! histogram of all coarse counters
Definition: TdcProcessor.h:227
void Set400Mhz(bool on=true)
Configure 400 MHz mode.
Definition: TdcProcessor.cxx:329
base::H1handle * fHitsPerHld
! hits per TDC - from HLD
Definition: TdcProcessor.h:240
double fCalibrTempSum0
! sum0 used to check temperature during calibration
Definition: TdcProcessor.h:279
const char * GetHistName(int k) const
Get histogram name by index.
Definition: TdcProcessor.h:519
bool fVersion4
if version4 TDC is analyzed
Definition: TdcProcessor.h:215
long fRateCnt
! counter used for rate calculation
Definition: TdcProcessor.h:325
bool fCh0Enabled
! when true, channel 0 stored in output event
Definition: TdcProcessor.h:320
static void SetDefaults(unsigned numfinebins=600, unsigned totrange=100, unsigned hist2dreduced=10)
Set default values for TDC creation.
Definition: TdcProcessor.cxx:57
std::vector< hadaq::TdcMessageExt > * pStoreVect
! pointer on store vector
Definition: TdcProcessor.h:284
static void SetHadesMonitorInterval(int tm=-1)
Configure interval in seconds for HADES monitoring histograms filling.
Definition: TdcProcessor.cxx:137
int fTotStatLimit
! how much statistic required for ToT calibration
Definition: TdcProcessor.h:263
static int gTotStatLimit
! how much statistic required for ToT calibration
Definition: TdcProcessor.h:348
void BeginCalibration(long cnt)
Start mode, when all data will be used for calibrations.
Definition: TdcProcessor.cxx:921
void SetCustomMhz(float freq=400.)
Set custom frequency.
Definition: TdcProcessor.cxx:341
bool fUseLinear
! create linear calibrations for the channel
Definition: TdcProcessor.h:307
double GetCalibrQuality() const
Returns calibration quality.
Definition: TdcProcessor.h:497
double fCalibrProgress
! current progress in calibration
Definition: TdcProcessor.h:267
void SetCalibrTempCoef(float coef)
Set temperature coefficient, which is applied to calibration curves Typical value is about 0....
Definition: TdcProcessor.h:599
static bool gStoreCalibrTables
! when enabled, store calibration tables for v4 TDC
Definition: TdcProcessor.h:352
void SetTotUpperLimit(double lmt=20)
Configure upper limit for ToT.
Definition: TdcProcessor.h:630
float ExtractCalibr(const std::vector< float > &func, unsigned bin)
Extract calibration value.
Definition: TdcProcessor.cxx:981
base::H1handle GetChannelRefHist(unsigned ch, bool=true)
Get ref histogram for specified channel.
Definition: TdcProcessor.h:700
TdcMessage fLastTdcHeader
! copy of last TDC header
Definition: TdcProcessor.h:322
bool EnableRefCondPrint(unsigned ch, double left=-10, double right=10, int numprint=0)
Enable print of TDC data when time difference to ref channel belong to specified interval Work ONLY w...
Definition: TdcProcessor.cxx:692
const TdcMessage & GetLastTdcHeader() const
Return last TDC header, seen by the processor.
Definition: TdcProcessor.h:692
void SetTable(uint32_t *table, unsigned addr, uint32_t value)
Set V4 table values.
Definition: TdcProcessor.cxx:3533
bool fAutoCalibr
! when true, perform auto calibration
Definition: TdcProcessor.h:299
std::vector< std::string > TakeCalibrLog()
Take all messages from calibration log.
Definition: TdcProcessor.h:508
void ProduceCalibration(bool clear_stat=true, bool use_linear=false, bool dummy=false, bool preliminary=false)
For expert use - produce calibration.
Definition: TdcProcessor.cxx:3266
bool CalibrateTot(unsigned ch, std::vector< uint32_t > &hist, float &tot_shift, float &tot_dev, float cut=0.)
Calibrate ToT.
Definition: TdcProcessor.cxx:3171
void SetRefChannel(unsigned ch, unsigned refch, unsigned reftdc=0xffff, int npoints=5000, double left=-10., double right=10., bool twodim=false)
Set reference signal for the TDC channel ch.
Definition: TdcProcessor.cxx:516
void CopyCalibration(const std::vector< float > &calibr, base::H1handle hcalibr, unsigned ch=0, base::H2handle h2calibr=0)
Copy calibration.
Definition: TdcProcessor.cxx:3253
float fCurrentTemp
! current measured temperature
Definition: TdcProcessor.h:277
base::H2handle fAllFine
! histogram of all fine counters
Definition: TdcProcessor.h:226
double DoTestErrors(int iCh)
Test errors in channel.
Definition: TdcProcessor.cxx:2838
static void SetErrorMask(unsigned mask=0xffffffffU)
Set errors mask which are printout, set 0 to disable errors printout See hadaq::TdcProcessor::EErrors...
Definition: TdcProcessor.cxx:68
std::vector< hadaq::TdcMessageExt > fDummyVect
! dummy empty vector
Definition: TdcProcessor.h:283
static bool gIgnoreCalibrMsgs
! ignore calibration messages
Definition: TdcProcessor.h:351
std::string fWriteCalibr
! file which should be written at the end of data processing
Definition: TdcProcessor.h:305
void SetRefTmds(unsigned ch, unsigned refch, int npoints, double left, double right)
Set reference signal for time extracted from v4 TMDS message.
Definition: TdcProcessor.cxx:577
virtual void BeforeFill()
Reset different values before scan subevent.
Definition: TdcProcessor.cxx:720
void SetWriteCalibration(const std::string &fprefix, bool every_time=false, bool use_linear=false)
When specified, calibration will be written to the file If every_time == true, write every time when ...
Definition: TdcProcessor.h:661
double fCalibrQuality
! calibration quality:
Definition: TdcProcessor.h:269
static void SetIgnoreCalibrMsgs(bool on=true)
Configure to ignore all kind of calibration data stored in HLD file Let analysis HLD stored by HADES ...
Definition: TdcProcessor.cxx:85
virtual void AfterFill(SubProcMap *=0)
Fill histograms after scan subevent.
Definition: TdcProcessor.cxx:735
void SetCalibrTrigger(int typ1=0xFFFF, unsigned typ2=0, unsigned typ3=0, unsigned typ4=0)
Set calibration trigger type(s) One could specify up-to 4 different trigger types,...
Definition: TdcProcessor.h:578
static double gTotRMSLimit
! allowed RMS value
Definition: TdcProcessor.h:349
static int gHadesMonitorInterval
! how often special HADES monitoring procedure called
Definition: TdcProcessor.h:347
base::H1handle fHits
! histogram with hits per channel
Definition: TdcProcessor.h:221
double GetCalibrProgress() const
Returns calibration progress.
Definition: TdcProcessor.h:493
void EmulateTransform(int dummycnt)
Emulate transformation.
Definition: TdcProcessor.cxx:1322
base::H2handle * fQaToTPerHld
! QA ToT per TDC channel - from HLD
Definition: TdcProcessor.h:246
void StoreCalibration(const std::string &fname, unsigned fileid=0)
For expert use - store calibration in the file.
Definition: TdcProcessor.cxx:3433
float fCalibrTempCoef
! coefficient to scale calibration curve (real value -1)
Definition: TdcProcessor.h:254
void ClearChannelRefHist(unsigned ch, bool rising=true)
Clear ref histogram for specified channel.
Definition: TdcProcessor.h:704
unsigned fNumChannels
! number of channels
Definition: TdcProcessor.h:250
bool PerformAutoCalibrate()
Perform automatic calibration of channels.
Definition: TdcProcessor.cxx:905
base::H2handle * fChCorrPerHld
! corrections per TDC channel - from HLD
Definition: TdcProcessor.h:244
void SetChannelTotShift(unsigned ch, float tot_shift)
Set channel TOT shift in nano-seconds, typical value is around 30 ns.
Definition: TdcProcessor.h:611
virtual double MaximumDisorderTm() const
This is maximum disorder time for TDC messages TODO: derive this value from sub-items.
Definition: TdcProcessor.h:358
double fToTvalue
! ToT of 0xd trigger
Definition: TdcProcessor.h:259
base::H1handle fMsgsKind
! messages kinds
Definition: TdcProcessor.h:225
bool fEveryEpoch
! if true, each hit must be supplied with epoch
Definition: TdcProcessor.h:310
base::H1handle * fErrPerHld
! errors per TDC - from HLD
Definition: TdcProcessor.h:241
static double gTrigDWindowLow
! low limit of time stamps for 0xD trigger used for calibration
Definition: TdcProcessor.h:343
base::H2handle * fQaEdgesPerHld
! QA Edges per TDC channel - from HLD
Definition: TdcProcessor.h:247
long fCalibrAmount
! current accumulated calibr data
Definition: TdcProcessor.h:266
void SetLinearNumPoints(int cnt=2)
Set number of points in linear calibrations.
Definition: TdcProcessor.h:675
double fCalibrTempSum2
! sum2 used to check temperature during calibration
Definition: TdcProcessor.h:281
bool IsUseLinear() const
Returns true is linear calibrations are configured.
Definition: TdcProcessor.h:672
virtual void CreateBranch(TTree *)
Create TTree branch.
Definition: TdcProcessor.cxx:3803
std::string fCalibrStatus
! calibration status
Definition: TdcProcessor.h:268
virtual void AppendTrbSync(uint32_t syncid)
Method will be called by TRB processor if SYNC message was found One should change 4 first bytes in t...
Definition: TdcProcessor.cxx:2979
bool fUseNativeTrigger
! if true, TRB3 trigger is used as event time
Definition: TdcProcessor.h:314
base::H2handle fhRaisingFineCalibr
! histogram of calibrated raising fine counter vs channel
Definition: TdcProcessor.h:234
int GetExplicitCalibrationMode()
Return explicit calibr mode, -1 - off, 0 - normal data processing, 1 - accumulating calibration.
Definition: TdcProcessor.h:651
static void SetMaxBoardId(unsigned)
obsolete, noop
Definition: TdcProcessor.cxx:47
void CompleteCalibration(bool dummy=false, const std::string &filename="", const std::string &subdir="")
Complete calibration mode, create calibration and calibration files.
Definition: TdcProcessor.cxx:943
void SetUseLastHit(bool on=true)
When enabled, last hit time in the channel used for reference time calculations By default,...
Definition: TdcProcessor.h:686
void ConfigureToTByHwType(unsigned hwtype)
Configure 0xD trigger ToT based on hwtype.
Definition: TdcProcessor.cxx:448
base::H2handle fFallingCalibr
! histogram all rising calibrations
Definition: TdcProcessor.h:229
base::H1handle fHitsRate
! histogram with data rate
Definition: TdcProcessor.h:230
EErrors
error codes
Definition: TdcProcessor.h:422
@ err3ff
0x3ff error
Definition: TdcProcessor.h:427
@ errFine
bad fine counter
Definition: TdcProcessor.h:426
@ errDesignId
mismatch in design id
Definition: TdcProcessor.h:431
@ errEpoch
wrong/missing epoch
Definition: TdcProcessor.h:425
@ errUncknHdr
uncknown header
Definition: TdcProcessor.h:430
@ errMisc
all other errors
Definition: TdcProcessor.h:432
@ errNoHeader
no header found
Definition: TdcProcessor.h:423
@ errCh0
nissig channel 0
Definition: TdcProcessor.h:428
@ errChId
wrong channel id
Definition: TdcProcessor.h:424
double GetTotUpperLimit() const
Get configured upper limit for ToT.
Definition: TdcProcessor.h:633
void AssignPerHldHistos(unsigned id, base::H1handle *hHits, base::H1handle *hErrs, base::H2handle *hChHits, base::H2handle *hChErrs, base::H2handle *hChCorr, base::H2handle *hQaFine, base::H2handle *hQaToT, base::H2handle *hQaEdges, base::H2handle *hQaErrors)
Assign per HLD histos.
Definition: TdcProcessor.h:556
double fTotUpperLimit
! upper limit for ToT range check
Definition: TdcProcessor.h:262
bool DoBufferScan(const base::Buffer &buf, bool isfirst)
Scan all messages, find reference signals Major data analysis method.
Definition: TdcProcessor.cxx:1594
virtual void UserPostLoop()
execute posloop function - check if calibration should be performed
Definition: TdcProcessor.cxx:472
base::H1handle fCorrHits
! histogram with corrected hits per channel
Definition: TdcProcessor.h:224
base::H1handle fUndHits
! histogram with undetected hits per channel
Definition: TdcProcessor.h:223
base::H1handle fErrors
! histogram with errors per channel
Definition: TdcProcessor.h:222
bool CreateChannelHistograms(unsigned ch)
create all histograms for the channel
Definition: TdcProcessor.cxx:392
double fToThmax
! histogram max
Definition: TdcProcessor.h:261
TdcProcessor(TrbProcessor *trb, unsigned tdcid, unsigned numchannels=MaxNumTdcChannels, unsigned edge_mask=1, bool ver4=false)
constructor
Definition: TdcProcessor.cxx:166
TRB processor.
Definition: TrbProcessor.h:46
TDC message.
Definition: TdcMessage.h:70
static unsigned GetFineMaxValue()
get pre-configured max fine counter
Definition: TdcMessage.h:303
static unsigned GetFineMinValue()
get pre-configured min fine counter
Definition: TdcMessage.h:301
static double CoarseUnit()
default coarse unit for 200 MHz
Definition: TdcMessage.h:280
TDC channel record.
Definition: TdcProcessor.h:39
double rising_last_tm
! last leading edge time
Definition: TdcProcessor.h:66
base::H2handle fRisingRef2D
! histogram
Definition: TdcProcessor.h:54
float time_shift_per_grad
! delay in channel (ns/C), caused by temperature change
Definition: TdcProcessor.h:85
base::H1handle fTot0D
! TOT from 0xD trigger (used for shift calibration)
Definition: TdcProcessor.h:61
long calibr_stat_falling
! accumulated statistic during last calibration
Definition: TdcProcessor.h:91
ChannelRec()
constructor
Definition: TdcProcessor.h:94
float last_tot
! last tot
Definition: TdcProcessor.h:80
base::H2handle fRisingDoubleRef
! correlation with diff time from other channel
Definition: TdcProcessor.h:56
double rising_tmds
! first detected rising time from TMDS
Definition: TdcProcessor.h:69
bool docalibr
! if false, simple calibration will be used
Definition: TdcProcessor.h:46
int falling_cnt
! number of falling hits in last event
Definition: TdcProcessor.h:64
base::C1handle fRisingRefCond
! condition to print raw events
Definition: TdcProcessor.h:52
void ReleaseToTHist()
Release memory for ToT histogram
Definition: TdcProcessor.h:208
unsigned doublerefch
! double reference channel
Definition: TdcProcessor.h:43
base::H1handle fFallingMult
! number of hits per event
Definition: TdcProcessor.h:59
std::vector< uint32_t > rising_stat
! rising stat
Definition: TdcProcessor.h:76
base::H1handle fFallingCalibr
! histogram of channel calibration function
Definition: TdcProcessor.h:62
bool hascalibr
! indicate if channel has valid calibration (not simple linear)
Definition: TdcProcessor.h:47
unsigned refch
! reference channel for specified
Definition: TdcProcessor.h:40
std::vector< uint32_t > falling_stat
! falling stat
Definition: TdcProcessor.h:78
bool refabs
! if true, absolute difference (without channel 0) will be used
Definition: TdcProcessor.h:42
long all_rising_stat
! all rising stat
Definition: TdcProcessor.h:74
base::H1handle fRisingMult
! number of hits per event
Definition: TdcProcessor.h:50
unsigned refch_tmds
! reference channel for TMDS messages
Definition: TdcProcessor.h:45
float tot_dev
! tot shift deviation after calibration
Definition: TdcProcessor.h:84
void CreateCalibr(unsigned numfine, double coarse_unit=-1.)
create calibration structures
Definition: TdcProcessor.h:151
std::vector< float > rising_calibr
! rising calibr
Definition: TdcProcessor.h:77
base::H1handle fFallingFine
! histogram of all fine counters
Definition: TdcProcessor.h:58
unsigned reftdc
! tdc of reference channel
Definition: TdcProcessor.h:41
base::H1handle fRisingRef
! histogram of time diff to ref channel
Definition: TdcProcessor.h:51
double rising_hit_tm
! leading edge time, used in correlation analysis. can be first or last time
Definition: TdcProcessor.h:65
unsigned doublereftdc
! tdc of double reference channel
Definition: TdcProcessor.h:44
float tot_shift
! calibrated tot shift
Definition: TdcProcessor.h:83
void CreateToTHist()
Create ToT histogram
Definition: TdcProcessor.h:200
long tot0d_cnt
! counter of tot0d statistic for calibration
Definition: TdcProcessor.h:81
float calibr_quality_falling
! quality of last calibration 0. is nothing
Definition: TdcProcessor.h:89
long calibr_stat_rising
! accumulated statistic during last calibration
Definition: TdcProcessor.h:90
base::H1handle fRisingRefRef
! difference of two ref times, connected with double ref
Definition: TdcProcessor.h:55
base::H1handle fRisingCalibr
! histogram of channel calibration function
Definition: TdcProcessor.h:53
bool check_calibr
! flag used to indicate that calibration was checked
Definition: TdcProcessor.h:48
float calibr_quality_rising
! quality of last calibration 0. is nothing
Definition: TdcProcessor.h:88
std::vector< uint32_t > tot0d_hist
! histogram used for TOT calibration, allocated only when required
Definition: TdcProcessor.h:82
float trig0d_coef
! scaling coefficient, applied when build calibration from 0xD trigger (reserved)
Definition: TdcProcessor.h:86
base::H1handle fRisingFine
! histogram of all fine counters
Definition: TdcProcessor.h:49
long all_falling_stat
! all falling stat
Definition: TdcProcessor.h:75
unsigned rising_fine
! rising fine
Definition: TdcProcessor.h:71
bool rising_new_value
! used to calculate TOT and avoid errors after single leading and double trailing edge
Definition: TdcProcessor.h:67
base::H1handle fTot
! histogram of time-over-threshold measurement
Definition: TdcProcessor.h:60
void SetLinearCalibr(unsigned finemin, unsigned finemax, double coarse_unit=-1)
Assign linear calibration.
Definition: TdcProcessor.h:169
base::H1handle fRisingTmdsRef
! histogram of time diff to ref channel for TMDS message
Definition: TdcProcessor.h:57
unsigned rising_coarse
! rising coarse
Definition: TdcProcessor.h:70
void ReleaseCalibr()
Release memory used by calibration structures.
Definition: TdcProcessor.h:191
void FillCalibr(unsigned numfine, double coarse_unit=-1.)
Initialize claibration with default values.
Definition: TdcProcessor.h:160
unsigned last_falling_fine
! last falling fine
Definition: TdcProcessor.h:73
double rising_ref_tm
! rising ref time
Definition: TdcProcessor.h:68
std::vector< float > falling_calibr
! falling calibr
Definition: TdcProcessor.h:79
int rising_cond_prnt
! rising condition print
Definition: TdcProcessor.h:87
int rising_cnt
! number of rising hits in last event
Definition: TdcProcessor.h:63
unsigned last_rising_fine
! last rising fine
Definition: TdcProcessor.h:72
Raw hades subevent.
Definition: definess.h:408