MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
Loading...
Searching...
No Matches
CalibrateBeam.hpp
Go to the documentation of this file.
1#ifndef CALIBRATE_BEAM_HPP
2#define CALIBRATE_BEAM_HPP
3
4#include "BeamFit2D.hpp"
5#include "Constants.hpp"
6#include "FileSet.hpp"
7#include "IOUtils.hpp"
8#include "InitUtils.hpp"
9#include "Normalization.hpp"
10#include "Paths.hpp"
11#include "PlottingUtils.hpp"
12#include <Rtypes.h>
13#include <TCanvas.h>
14#include <TF1.h>
15#include <TFile.h>
16#include <TGraph.h>
17#include <TGraphErrors.h>
18#include <TH1D.h>
19#include <TH1F.h>
20#include <TH2F.h>
21#include <TLegend.h>
22#include <TLine.h>
23#include <TMath.h>
24#include <TROOT.h>
25#include <TString.h>
26#include <TTree.h>
27#include <algorithm>
28#include <cmath>
29#include <fstream>
30#include <iostream>
31#include <map>
32#include <mutex>
33#include <queue>
34#include <set>
35#include <thread>
36#include <vector>
37
44struct ChannelCal {
45 TString name;
48 Char_t side;
49 Int_t strip;
57 Double_t fit_adc = 0.0;
58 Long64_t n_samples = 0;
76 Double_t gain = -1.0;
81 Double_t offset_adc = 0.0;
91 Double_t ridge_ratio = 0.0;
94 Double_t ridge_offset = 0.0;
95};
96
116 Bool_t ok = kFALSE;
120 Double_t factors[18] = {};
124 Double_t offsets[18] = {};
126 Double_t centroids[18] = {};
129 Double_t pileups[18] = {};
130};
131
157public:
163 static std::vector<ChannelCal> BuildChannels();
164
171 static void
173 const std::vector<ChannelCal> &chans_template);
174
187 static void AggregateRidgeRatiosForRun(Int_t run,
188 const std::vector<FileSpec> &specs);
189
195 static void Run(const TString &file_label = "");
196};
197
198#endif
Dataset configuration.
Per-channel beam-peak calibration, gain matching and strip alignment.
static void Run(const TString &file_label="")
Calibrate every configured subfile, then aggregate per run.
static void CalibrateBeamOneSubfile(const FileSpec &spec, const std::vector< ChannelCal > &chans_template)
Calibrate one subfile end to end.
static std::vector< ChannelCal > BuildChannels()
One ChannelCal per readout channel in the active channel map.
static void AggregateRidgeRatiosForRun(Int_t run, const std::vector< FileSpec > &specs)
Replace each subfile's ridge ratio and short-end offset with the run-level medians.
One readout channel's beam-peak calibration.
Double_t ridge_offset
Short channels only: offset_adc in units of C_long, from this subfile's own ridge fit,...
Double_t offset_adc
ADC subtracted from this channel before its gain, only when the channel fired (a reading of 0 stays 0...
Char_t side
Readout end: 'L' or 'R' for the split strips 1-16, 'S' for the unsplit end strips 0 and 17,...
TString name
Channel name from the active channel map.
Double_t gain
Left/right gain-match override.
Double_t fit_adc
Modal beam peak, in ADC: the modal bin of the channel's beam-peak histogram (100 bins over the 5th-95...
Int_t strip
Anode strip index this channel reads; -1 for the cathode.
Long64_t n_samples
Events the anchor was taken from.
Double_t ridge_ratio
Short channels only: C_short / C_long = -1 / slope from this subfile's own ridge fit,...
One input file: a run number and the subfile suffix within it.
Definition FileSet.hpp:40
Output of the strip centroid alignment, the post-gain calibration step.
Double_t centroids[18]
Measured beam peak per strip before alignment, in calibrated units.
Double_t pileups[18]
Measured two-particle pile-up peak per strip before alignment, in calibrated units; 0 where none was ...
Double_t factors[18]
Per-strip multiplicative alignment factors, applied to every end.
Double_t offsets[18]
Per-strip additive offsets in calibrated units, applied after the factor to the strip total; EnergyVi...
Bool_t ok
Whether the step produced usable results.