11#include <framework/core/Module.h>
12#include <framework/datastore/StoreArray.h>
13#include <top/dataobjects/TOPDigit.h>
17#include <TMatrixDSym.h>
39 Hit(
double t,
double et,
int height,
double width)
60 TwoTimes(
double time1,
double time2,
double sig)
106 virtual void event()
override;
112 virtual void endRun()
override;
143 unsigned scrodID,
unsigned scrodChannel,
144 TH1F& Hchi2, TH1F& Hndf, TH1F& HDeltaT);
158 unsigned scrodID,
unsigned scrodChannel,
159 double meanTimeDifference,
160 TH1F& Hchi2, TH1F& Hndf, TH1F& HDeltaT);
175 unsigned scrodID,
unsigned scrodChannel,
176 double meanTimeDifference,
177 TH1F& Hchi2, TH1F& Hndf, TH1F& HDeltaT);
185 void Iteration(
const std::vector<TwoTimes>& ntuple, std::vector<double>& xval);
192 double Chisq(
const std::vector<TwoTimes>& ntuple,
const std::vector<double>& xxval);
203 const std::string& name,
204 const std::string& title,
205 const std::string& xTitle =
"",
206 const std::string& yTitle =
"")
const;
218 const std::vector<double>& err,
219 const std::string& name,
220 const std::string& title,
221 const std::string& xTitle =
"",
222 const std::string& yTitle =
"")
const;
231 const std::string& name,
232 const std::string& title)
const;
Accessor to arrays stored in the data store.
double m_deltamin
minumum chisq change in an iteration.
double m_xstep
unit for an interation of delta(X_s)
TH2F m_calPulseSecond
pulse height versus width of the second calibration pulse
double m_sigm2_exp
(sigma_0(dT))**2 for nomarlization of chisq = sum{dT^2/sigma^2}
std::vector< TwoTimes > m_ntuples[c_NumChannels]
channel wise data
double m_min_binwidth
minimum time interval of one sample
TH2F m_goodHits
pulse height versus width of all good hits
double m_syncTimeBase
synchronization time (two ASIC windows)
double m_new_xstep
m_xstep = m_new_xstep if m_dchi2dxv < m_change_step
double m_dt_min
minimum Delta T of raw calpulse
bool m_saveMatrix
if true, save also matrix and its inverse in a root file
double m_dt_max
maximum Delta T of raw calpulse
double m_dev_step
a step size to calculate the value of d(chisq)/dxval
double m_DtSigma
a reference resolution of sigma_0(dT)=42.4 ps from Run3524
unsigned m_conv_iter
Number of iteration with chisq changes less than deltamin.
unsigned m_method
method to use
@ c_NumBoardstacks
number of boardstacks per module
@ c_NumChannels
number of channels per module
@ c_TimeAxisSize
number of samples to calibrate
@ c_WindowSize
samples per window
double m_dchi2dxv
rms of 255 dchi2/dxval values
double m_max_binwidth
maximum time interval of one sample
unsigned m_minHits
minimal required hits per channel
double m_minTimeDiff
lower bound for time difference [samples]
double m_change_xstep
update m_xstep if m_dchi2dxv < m_change_step
StoreArray< TOPDigit > m_digits
collection of digits
unsigned m_numIterations
Number of Iterations of iTBC.
std::string m_directoryName
directory name for the output root files
int m_good
good events used for chisq cal.
TH2F m_calPulseFirst
pulse height versus width of the first calibration pulse
double m_dchi2_min
quit if chisq increase in iteratons is larger than this value.
bool m_useFallingEdge
if true, use falling edge instead of rising
double m_maxTimeDiff
upper bound for time difference [samples]
bool matrixInversion(const std::vector< TwoTimes > &ntuple, unsigned scrodID, unsigned scrodChannel, double meanTimeDifference, TH1F &Hchi2, TH1F &Hndf, TH1F &HDeltaT)
Method by matrix inversion.
bool calibrateChannel(std::vector< TwoTimes > &ntuple, unsigned scrodID, unsigned scrodChannel, TH1F &Hchi2, TH1F &Hndf, TH1F &HDeltaT)
calibrate single channel
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
virtual void beginRun() override
Called when entering a new run.
void Iteration(const std::vector< TwoTimes > &ntuple, std::vector< double > &xval)
Iteration function called by iterativeTBC()
virtual ~TOPTimeBaseCalibratorModule()
Destructor.
double Chisq(const std::vector< TwoTimes > &ntuple, const std::vector< double > &xxval)
Return the chisqure of one set of TBC constants (xval) in iTBC calculaton.
void saveAsHistogram(const std::vector< double > &vec, const std::string &name, const std::string &title, const std::string &xTitle="", const std::string &yTitle="") const
Save vector to histogram and write it out.
bool iterativeTBC(const std::vector< TwoTimes > &ntuple, unsigned scrodID, unsigned scrodChannel, double meanTimeDifference, TH1F &Hchi2, TH1F &Hndf, TH1F &HDeltaT)
Method by iteration of chi2 minimization.
TOPTimeBaseCalibratorModule()
Constructor.
Abstract base class for different kinds of events.
Structure to hold some of the calpulse data.
double pulseWidth
pulse width [ns]
int pulseHeight
pulse height [ADC counts]
Hit(double t, double et, int height, double width)
Full constructor.
double timeErr
raw time uncertainty [samples]
double time
raw time [samples]
Structure to hold calpulse raw times expressed in samples since sample 0 of window 0.
float t2
time of the second pulse [samples]
float t1
time of the first pulse [samples]
float sigma
uncertainty of time difference (r.m.s.)
TwoTimes(double time1, double time2, double sig)
Full constructor.