MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
Loading...
Searching...
No Matches
PulseHistory.hpp File Reference

Pole-zero pulse-history correction on the raw hit stream. More...

#include "BinaryUtils.hpp"
#include <Rtypes.h>
#include <TString.h>
#include <vector>
Include dependency graph for PulseHistory.hpp:

Go to the source code of this file.

Classes

struct  PulseHistory::Kernel
 One fitted correction: a channel's own, or a group's. More...
struct  PulseHistory::Kernel::TauFit
 Single-exponential summary of the dt profile for this group. More...
struct  PulseHistory::Result
 Everything one subfile's pulse-history pass produced. More...

Namespaces

namespace  PulseHistory

Enumerations

enum  PulseHistory::ChannelGroup {
  PulseHistory::kNONE = 0 , PulseHistory::kLONG_LEFT = 1 , PulseHistory::kLONG_RIGHT = 2 , PulseHistory::kSHORT_LEFT = 3 ,
  PulseHistory::kSHORT_RIGHT = 4 , PulseHistory::kSTRIP0 = 5 , PulseHistory::kSTRIP17 = 6 , PulseHistory::kGRID = 7 ,
  PulseHistory::kNGROUPS = 8
}
 Channel groups, one kernel each. More...

Functions

const char * PulseHistory::GroupName (Int_t g)
 Human-readable name of a Group.
const char * PulseHistory::GroupTag (Int_t g)
 Short tag for filenames: L, R, Ls, Rs, S0, S17.
Int_t PulseHistory::ChainOf (Int_t g)
 Which readout chain a group belongs to.
Bool_t PulseHistory::IsLongGroup (Int_t g)
 Whether a group is a long end rather than a short end or an unsegmented strip.
Bool_t PulseHistory::GroupEnabled (Int_t g)
 Whether the groups in force (Constants::ActivePulseHistoryGroups()) have this group corrected.
Bool_t PulseHistory::GroupWantsForm (Int_t g)
 Whether the configuration asks for the pole-zero form on this group rather than the binned kernel.
Double_t PulseHistory::GroupTauUs (Int_t g)
 The preamp decay time the configuration gives for this group, in microseconds; 0 when it is to be profiled.
Int_t PulseHistory::BinOf (Double_t dt_s)
 Kernel bin for a time since the previous pulse.
Double_t PulseHistory::BinCentreUs (Int_t b)
 Centre of a kernel bin, in microseconds, for reports.
Int_t PulseHistory::AmpBinOf (Double_t e_prev, Double_t mode, Int_t n_amp)
 Amplitude band of a previous pulse.
std::vector< Int_t > PulseHistory::BuildGroupMap ()
 Group lookup for every (board, channel) under the active map.
Bool_t PulseHistory::Measure (std::vector< RawHit > &hits, const std::vector< Int_t > &group_of, Result &res, const TString &file_label)
 Measure the kernels on this subfile's beam-like events.
void PulseHistory::Apply (std::vector< RawHit > &hits, const std::vector< Int_t > &group_of, Result &res)
 Apply the measured kernels to the hit stream, in place.
TString PulseHistory::Report (const Result &res, const TString &file_label, Bool_t detail=kTRUE)
 Format the pass as a human-readable report.
void PulseHistory::SavePlots (Result &res, const TString &file_label)
 Draw and save the diagnostics, then free them.
void PulseHistory::WriteToEventsFile (const TString &events_subpath, const Result &res)
 Record the kernels and counters alongside a subfile's events.

Variables

const UInt_t PulseHistory::kFlagClamped = 0x2000
 Flag set on a hit whose correction was clamped rather than applied in full.
const Int_t PulseHistory::kNBins = 30
 Bins in the kernel, spanning kLogLo to kLogHi in log10 of dt: twelve per decade, 0.083 dex each.
const Double_t PulseHistory::kLogLo = -6.0
 Lowest dt bin edge: log10 of 1 us in seconds.
const Double_t PulseHistory::kLogHi
 Highest dt bin edge: log10 of 316 us in seconds.
const Int_t PulseHistory::kMAX_AMP_BINS = 6
 Maximum amplitude bands a kernel may split the previous pulse into.
const Long64_t PulseHistory::kMinPairsPerChannel = 2000
 Fewest (event, channel) pairs a channel needs for a kernel of its own; below it the channel is corrected with its group's kernel.
Pole-zero kernel analytic form

The preamp decay time of the analytic form (see kANALYTIC) is not linear in the fit, so it is profiled: the linear coefficients are solved for every tau of a logarithmic grid from kTauGridLoUs to kTauGridHiUs and the tau with the smallest residual is kept.

The grid step is the resolution of the profiled tau, about 15 percent at kNTauGrid = 21. A tau given in the configuration is solved for as well, at its exact value. The grid is the main cost of the fit scan: two features per tau, band and past pulse, so halving it roughly halves the pulse-history time when the form is on.

const Int_t PulseHistory::kNTauGrid = 21
const Double_t PulseHistory::kTauGridLoUs = 4.0
const Double_t PulseHistory::kTauGridHiUs = 64.0
Decay-time fit

Every fitted kernel's group additionally summarises the pre-correction deviation-against-dt profile with p0 + p1 exp(-dt / p2) + p3 dt over this window in microseconds.

p2 is the preamp decay time the pole-zero setting failed to cancel. The window starts after the trapezoid freeze (holdoff plus margin, where the deviation follows the residual itself) and ends inside the kernel reach, where the profile still carries the tail and the linear term has not drowned it.

const Double_t PulseHistory::kTauFitLoUs = 8.0
const Double_t PulseHistory::kTauFitHiUs = 130.0
const Int_t PulseHistory::kTauFitMinEntries = 100
 Below this many (event, channel) pairs in the window the fit is skipped.

Detailed Description

Pole-zero pulse-history correction on the raw hit stream.

A preamplifier's response to a pulse does not settle instantly, so a hit arriving soon after a previous one sits on the tail of that earlier pulse and reads high or low. This measures that shift per channel as a kernel over the time since the previous pulses, then subtracts it.

The kernels are measured on each subfile's own beam-like events rather than assumed, so they track whatever the electronics were doing during that run. Channels are configured in groups (the long and short ends of either chain, the two unsegmented strips): a group decides whether its channels are corrected, with which kernel shape and with which given decay time, and its own fit over all its channels is the fallback for a channel with too few pairs for a kernel of its own.

Definition in file PulseHistory.hpp.