musrfit 1.10.0
PRunBase.h
Go to the documentation of this file.
1/***************************************************************************
2
3 PRunBase.h
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8***************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2007-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
30#ifndef _PRUNBASE_H_
31#define _PRUNBASE_H_
32
33#include <vector>
34#include <memory>
35
36#include <TString.h>
37
38#include "PMusr.h"
39#include "PMsrHandler.h"
40#include "PRunDataHandler.h"
41#include "PTheory.h"
42
43//------------------------------------------------------------------------------------------
103{
104 public:
106 PRunBase();
107
123 PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
124
133 virtual ~PRunBase();
134
153 virtual Double_t CalcChiSquare(const std::vector<Double_t>& par) = 0;
154
168 virtual Double_t CalcChiSquareExpected(const std::vector<Double_t>& par) = 0;
169
189 virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par) = 0;
190
205 virtual void SetFitRange(PDoublePairVector fitRange);
206
222 virtual void CalcTheory() = 0;
223
228 virtual UInt_t GetRunNo() { return fRunNo; }
229
242 virtual PRunData* GetData() { return &fData; }
243
250 virtual void CleanUp();
251
263 virtual Bool_t IsValid() { return fValid; }
264
265 protected:
266 Bool_t fValid;
267
269
270 Int_t fRunNo;
274
279 std::vector<PDoubleVector> fAddT0s;
280
281 Double_t fFitStartTime;
282 Double_t fFitEndTime;
283
285 std::unique_ptr<PTheory> fTheory;
286
288
312 virtual Bool_t PrepareData() = 0;
313
320 virtual void DeadTimeCorrection(std::vector<PDoubleVector> &histos, PUIntVector &histoNo);
321
344 virtual void CalculateKaiserFilterCoeff(Double_t wc, Double_t A, Double_t dw);
345
364 virtual void FilterTheo();
365};
366
367#endif // _PRUNBASE_H_
std::vector< UInt_t > PUIntVector
Definition PMusr.h:361
EPMusrHandleTag
Definition PMusr.h:413
std::vector< PDoublePair > PDoublePairVector
Definition PMusr.h:397
std::vector< Double_t > PDoubleVector
Definition PMusr.h:385
MSR file parser and manager for the musrfit framework.
virtual void CleanUp()
Cleans up internal data structures.
Definition PRunBase.cpp:298
virtual void CalcTheory()=0
Evaluates theory function at all data points (pure virtual).
Double_t fTimeResolution
Time resolution of raw histogram data in microseconds (μs), e.g., 0.01953125 μs for PSI GPS.
Definition PRunBase.h:276
virtual ~PRunBase()
Virtual destructor.
Definition PRunBase.cpp:152
virtual Bool_t PrepareData()=0
Prepares raw data for fitting (pure virtual).
Bool_t fValid
Flag indicating if run object initialized successfully; false if any error occurred.
Definition PRunBase.h:266
virtual Double_t CalcChiSquareExpected(const std::vector< Double_t > &par)=0
Calculates expected chi-square for statistical analysis (pure virtual).
virtual Bool_t IsValid()
Returns validity status of this run object.
Definition PRunBase.h:263
Double_t fFitEndTime
Fit range end time in microseconds (μs) relative to t0.
Definition PRunBase.h:282
PDoubleVector fFuncValues
Cached values of user-defined functions from FUNCTIONS block, evaluated at current parameters.
Definition PRunBase.h:284
PDoubleVector fKaiserFilter
Kaiser window FIR filter coefficients for smoothing RRF theory curves.
Definition PRunBase.h:287
virtual void SetFitRange(PDoublePairVector fitRange)
Sets the fit time range for this run.
Definition PRunBase.cpp:252
virtual Double_t CalcMaxLikelihood(const std::vector< Double_t > &par)=0
Calculates maximum likelihood estimator (pure virtual).
PMsrHandler * fMsrInfo
Pointer to MSR file handler (owned externally, not deleted here)
Definition PRunBase.h:271
virtual void DeadTimeCorrection(std::vector< PDoubleVector > &histos, PUIntVector &histoNo)
carry out dead time correction
Definition PRunBase.cpp:171
PMetaData fMetaData
Experimental metadata extracted from data file header (magnetic field, temperature,...
Definition PRunBase.h:277
std::unique_ptr< PTheory > fTheory
Theory function evaluator (smart pointer, automatically deleted)
Definition PRunBase.h:285
std::vector< PDoubleVector > fAddT0s
Time-zero bin values for additional runs to be added to main run.
Definition PRunBase.h:279
EPMusrHandleTag fHandleTag
Operation mode: kFit (fitting), kView (display only), kEmpty (uninitialized)
Definition PRunBase.h:268
virtual void CalculateKaiserFilterCoeff(Double_t wc, Double_t A, Double_t dw)
Calculates Kaiser window FIR filter coefficients for RRF smoothing.
Definition PRunBase.cpp:339
PRunData fData
Processed data container: background-corrected, packed, with theory values.
Definition PRunBase.h:275
virtual UInt_t GetRunNo()
Returns the run number (0-based index in MSR file).
Definition PRunBase.h:228
PRunDataHandler * fRawData
Pointer to raw data handler (owned externally, not deleted here)
Definition PRunBase.h:273
PDoubleVector fT0s
Time-zero bin values for all histograms in this run (forward, backward, etc.)
Definition PRunBase.h:278
virtual PRunData * GetData()
Returns pointer to processed data container.
Definition PRunBase.h:242
PRunBase()
Default constructor.
Definition PRunBase.cpp:54
Int_t fRunNo
Run number (0-based index in MSR file RUN blocks)
Definition PRunBase.h:270
PMsrRunBlock * fRunInfo
Pointer to this run's RUN block settings within fMsrInfo.
Definition PRunBase.h:272
Double_t fFitStartTime
Fit range start time in microseconds (μs) relative to t0.
Definition PRunBase.h:281
virtual void FilterTheo()
Applies Kaiser FIR filter to theory values for RRF fits.
Definition PRunBase.cpp:405
virtual Double_t CalcChiSquare(const std::vector< Double_t > &par)=0
Calculates χ² between data and theory (pure virtual).
Raw data file reader and format converter for μSR data.