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

Classes

struct  Kernel
 The fitted correction for one channel group. More...
struct  Result
 Everything one subfile's pulse-history pass produced. More...

Enumerations

enum  Group {
  kNone = 0 , kLongLeft = 1 , kLongRight = 2 , kShortLeft = 3 ,
  kShortRight = 4 , kGuard0 = 5 , kGuard17 = 6 , kNGroups = 7
}
 Channel groups, one kernel each. More...

Functions

const char * GroupName (Int_t g)
 Human-readable name of a Group.
const char * GroupTag (Int_t g)
 Short tag for filenames: L, R, Ls, Rs, S0, S17.
Int_t ChainOf (Int_t g)
 Which readout chain a group belongs to.
Bool_t IsLongGroup (Int_t g)
 Whether a group is a long end rather than a short end or guard.
Int_t BinOf (Double_t dt_s)
 Kernel bin for a time since the previous pulse.
Double_t BinCentreUs (Int_t b)
 Centre of a kernel bin, in microseconds, for reports.
Int_t AmpBinOf (Double_t e_prev, Double_t mode, Int_t n_amp)
 Amplitude band of a previous pulse.
std::vector< Int_t > BuildGroupMap ()
 Group lookup for every (board, channel) under the active map.
Bool_t 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 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 Report (const Result &res, const TString &file_label)
 Format the pass as a human-readable report.
void SavePlots (Result &res, const TString &file_label)
 Draw and save the diagnostics, then free them.
void WriteToEventsFile (const TString &events_subpath, const Result &res)
 Record the kernels and counters alongside a subfile's events.

Variables

const UInt_t kFlagClamped = 0x2000
 Flag set on a hit whose correction was clamped rather than applied in full.
const Int_t kNBins = 12
 Bins in the kernel, spanning kLogLo to kLogHi in log10 of dt.
const Double_t kLogLo = -6.0
 Lowest dt bin edge: log10 of 1 us in seconds.
const Double_t kLogHi
 Highest dt bin edge: log10 of 100 us in seconds.
const Int_t kMaxAmpBins = 6
 Maximum amplitude bands a kernel may split the previous pulse into.

Enumeration Type Documentation

◆ Group

Channel groups, one kernel each.

The long and short end of the split strips on either chain, plus the two single-pad guards.

Note
A short end fires in only a fraction of beam events and its height follows the track position, so its kernel is fitted on the fired hits alone and describes a smaller share of its variance than a long end's.
Enumerator
kNone 

Not part of any corrected group.

kLongLeft 

Long end, left chain.

kLongRight 

Long end, right chain.

kShortLeft 

Short end, left chain.

kShortRight 

Short end, right chain.

kGuard0 

Single-pad guard before strip 0.

kGuard17 

Single-pad guard after strip 17.

kNGroups 

Count of groups; not a group itself.

Definition at line 47 of file PulseHistory.hpp.

Function Documentation

◆ AmpBinOf()

Int_t PulseHistory::AmpBinOf ( Double_t e_prev,
Double_t mode,
Int_t n_amp )

Amplitude band of a previous pulse.

Parameters
e_prevPrevious pulse energy, in ADC.
modeThat channel's beam peak, in ADC.
n_ampBands in use for this kernel.
Returns
The band index.

Definition at line 118 of file PulseHistory.cpp.

Referenced by Measure().

◆ Apply()

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.

Parameters
[in,out]hitsHits to correct.
group_ofGroup per channel, from BuildGroupMap().
[in,out]resKernels to apply; its clamp and shift counters are updated as it goes.
Note
Only bins up to Constants::cfg.PULSE_HISTORY_APPLY_MAX_US are used. Beyond that the fitted coefficients are degenerate with the intercept and physically zero, so applying them would add noise rather than remove it.

Definition at line 546 of file PulseHistory.cpp.

Referenced by RunFusedPipelineForFile().

◆ BinCentreUs()

Double_t PulseHistory::BinCentreUs ( Int_t b)

Centre of a kernel bin, in microseconds, for reports.

Parameters
bBin index.

Definition at line 113 of file PulseHistory.cpp.

Referenced by Report(), and WriteToEventsFile().

◆ BinOf()

Int_t PulseHistory::BinOf ( Double_t dt_s)

Kernel bin for a time since the previous pulse.

Parameters
dt_sTime difference, in seconds.
Returns
The bin index, or -1 outside the kernel's range.

Definition at line 104 of file PulseHistory.cpp.

Referenced by Measure().

◆ BuildGroupMap()

std::vector< Int_t > PulseHistory::BuildGroupMap ( )

Group lookup for every (board, channel) under the active map.

Returns
A vector indexed as the channel map is, holding a Group per channel.

Definition at line 126 of file PulseHistory.cpp.

Referenced by RunFusedPipelineForFile().

◆ ChainOf()

Int_t PulseHistory::ChainOf ( Int_t g)

Which readout chain a group belongs to.

Returns
0 for the left chain, 1 for the right, -1 for the guards.

Definition at line 63 of file PulseHistory.cpp.

Referenced by Measure().

◆ GroupName()

const char * PulseHistory::GroupName ( Int_t g)

Human-readable name of a Group.

Definition at line 27 of file PulseHistory.cpp.

Referenced by Report().

◆ GroupTag()

const char * PulseHistory::GroupTag ( Int_t g)

Short tag for filenames: L, R, Ls, Rs, S0, S17.

Definition at line 45 of file PulseHistory.cpp.

Referenced by Measure(), and SavePlots().

◆ IsLongGroup()

Bool_t PulseHistory::IsLongGroup ( Int_t g)

Whether a group is a long end rather than a short end or guard.

Definition at line 75 of file PulseHistory.cpp.

Referenced by Measure().

◆ Measure()

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.

Parameters
[in,out]hitsRaw hits for the subfile. Sorted in place if not already time-ordered, which the event builder needs anyway.
group_ofGroup per channel, from BuildGroupMap().
[out]resFitted kernels and diagnostics.
file_labelLabel from FileSet::FileLabel(), used in plots and logs.
Returns
kFALSE when no group could be fitted.
Todo
Always pass through pulse history, and sort here before event building by default, so the CUDA sort can be used.

Definition at line 205 of file PulseHistory.cpp.

Referenced by RunFusedPipelineForFile().

◆ Report()

TString PulseHistory::Report ( const Result & res,
const TString & file_label )

Format the pass as a human-readable report.

Parameters
resResult to summarise.
file_labelSubfile label.

Definition at line 590 of file PulseHistory.cpp.

Referenced by RunFusedPipelineForFile().

◆ SavePlots()

void PulseHistory::SavePlots ( Result & res,
const TString & file_label )

Draw and save the diagnostics, then free them.

Parameters
[in,out]resResult whose histograms are drawn and then deleted.
file_labelSubfile label, used in the plot names.

Definition at line 617 of file PulseHistory.cpp.

Referenced by RunFusedPipelineForFile().

◆ WriteToEventsFile()

void PulseHistory::WriteToEventsFile ( const TString & events_subpath,
const Result & res )

Record the kernels and counters alongside a subfile's events.

Parameters
events_subpathEvents file to write into.
resResult to record.

Definition at line 735 of file PulseHistory.cpp.

Referenced by RunFusedPipelineForFile().

Variable Documentation

◆ kFlagClamped

const UInt_t PulseHistory::kFlagClamped = 0x2000

Flag set on a hit whose correction was clamped rather than applied in full.

Definition at line 28 of file PulseHistory.hpp.

Referenced by Apply().

◆ kLogHi

const Double_t PulseHistory::kLogHi
Initial value:
=
-4.0

Highest dt bin edge: log10 of 100 us in seconds.

Definition at line 32 of file PulseHistory.hpp.

Referenced by BinCentreUs(), BinOf(), Measure(), and SavePlots().

◆ kLogLo

const Double_t PulseHistory::kLogLo = -6.0

Lowest dt bin edge: log10 of 1 us in seconds.

Definition at line 31 of file PulseHistory.hpp.

Referenced by BinCentreUs(), BinOf(), Measure(), and SavePlots().

◆ kMaxAmpBins

const Int_t PulseHistory::kMaxAmpBins = 6

Maximum amplitude bands a kernel may split the previous pulse into.

Definition at line 35 of file PulseHistory.hpp.

Referenced by PulseHistory::Kernel::Kernel(), Measure(), SavePlots(), and WriteToEventsFile().

◆ kNBins

const Int_t PulseHistory::kNBins = 12

Bins in the kernel, spanning kLogLo to kLogHi in log10 of dt.

Definition at line 30 of file PulseHistory.hpp.

Referenced by BinCentreUs(), BinOf(), PulseHistory::Kernel::Kernel(), Measure(), Report(), SavePlots(), and WriteToEventsFile().