|
| 1 | +/// This is example of automatic TDC creation |
| 2 | + |
| 3 | +#include "base/ProcMgr.h" |
| 4 | +#include "hadaq/HldProcessor.h" |
| 5 | +#include "hadaq/TdcProcessor.h" |
| 6 | +#include "hadaq/TrbProcessor.h" |
| 7 | + |
| 8 | +void first() |
| 9 | +{ |
| 10 | + base::ProcMgr::instance()->SetRawAnalysis(true); |
| 11 | + // base::ProcMgr::instance()->SetTriggeredAnalysis(true); |
| 12 | + |
| 13 | + // all new instances get this value |
| 14 | + base::ProcMgr::instance()->SetHistFilling(4); |
| 15 | + |
| 16 | + // default for TDC processor |
| 17 | + // first value - range for fine counter |
| 18 | + // second - ToT histogram range |
| 19 | + // third - reduce factor for 2D histogram, not needed for low number of fine counters |
| 20 | + hadaq::TdcProcessor::SetDefaults(16, 50, 1); |
| 21 | + |
| 22 | + // this limits used for liner calibrations when nothing else is available |
| 23 | + hadaq::TdcMessage::SetFineLimits(0, 15); |
| 24 | + |
| 25 | + // configure ToT calibration parameter |
| 26 | + // first - minimal number of counts |
| 27 | + // second - RMS in ns to reject produced ToT value |
| 28 | + hadaq::TdcProcessor::SetToTCalibr(1000, 0.5); |
| 29 | + |
| 30 | + // use D trigger also for normal ref histograms |
| 31 | + hadaq::TdcProcessor::SetUseDTrigForRef(true); |
| 32 | + |
| 33 | + // default channel numbers and edges mask |
| 34 | + // 1 - use only rising edge, falling edge is ignore |
| 35 | + // 2 - falling edge enabled and fully independent from rising edge |
| 36 | + // 3 - falling edge enabled and uses calibration from rising edge |
| 37 | + // 4 - falling edge enabled and common statistic is used for calibration |
| 38 | + hadaq::TrbProcessor::SetDefaults(32, 2); |
| 39 | + |
| 40 | + // [min..max] range for TDC ids |
| 41 | + hadaq::TrbProcessor::SetTDCRange(0x1000, 0x7FFF); |
| 42 | + |
| 43 | + // true indicates that dogma data are expected |
| 44 | + auto proc = new hadaq::TrbProcessor(0, nullptr, 4, true); |
| 45 | + |
| 46 | + auto vect = proc->CreateTDC5(0xd060); |
| 47 | + |
| 48 | + for (auto tdc : vect) { |
| 49 | + |
| 50 | + tdc->SetCustomMhz(150.); |
| 51 | + tdc->SetToTRange(19.2, 15., 45.); |
| 52 | + |
| 53 | + for (int nch = 1; nch < tdc->NumChannels(); nch++) |
| 54 | + tdc->SetRefChannel(nch, nch - 1, 0xffffff, 160, -20., 20.); |
| 55 | + } |
| 56 | + |
| 57 | + // first parameter if filename prefix for calibration files |
| 58 | + // and calibration mode (empty string - no file I/O) |
| 59 | + // second parameter is hits count for autocalibration |
| 60 | + // 0 - only load calibration |
| 61 | + // -1 - accumulate data and store calibrations only at the end |
| 62 | + // -77 - accumulate data and store linear calibrations only at the end |
| 63 | + // >0 - automatic calibration after N hits in each active channel |
| 64 | + // if value ends with 77 like 10077 linear calibration will be calculated |
| 65 | + // >1000000000 - automatic calibration after N hits only once, 1e9 excluding |
| 66 | + // third parameter is trigger type mask used for calibration |
| 67 | + // (1 << 0xD) - special 0XD trigger with internal pulser, used also for TOT calibration |
| 68 | + // 0x3FFF - all kinds of trigger types will be used for calibration (excluding 0xE and 0xF) |
| 69 | + // 0x80000000 in mask enables usage of temperature correction |
| 70 | + proc->ConfigureCalibration("dogmacal", -1, 1 << 0xD /* 0x3fff */); |
| 71 | + |
| 72 | + // only accept trigger type 0x1 when storing file |
| 73 | + // new hadaq::HldFilter(0x1); |
| 74 | + |
| 75 | + // create ROOT file store |
| 76 | + // base::ProcMgr::instance()->CreateStore("td.root"); |
| 77 | + |
| 78 | + // 0 - disable store |
| 79 | + // 1 - std::vector<hadaq::TdcMessageExt> - includes original TDC message |
| 80 | + // 2 - std::vector<hadaq::MessageFloat> - compact form, without channel 0, stamp as float (relative to ch0) |
| 81 | + // 3 - std::vector<hadaq::MessageDouble> - compact form, with channel 0, absolute time stamp as double |
| 82 | + base::ProcMgr::instance()->SetStoreKind(0); |
| 83 | +} |
0 commit comments