102 if (bkgRange[0] >= -1) {
107 if (bkgRange[1] >= -1) {
119 errMsg = TString::Format(
"start bkg range < 0 (given: %d), will ignore it.", bkgRange[0]);
122 errMsg = TString::Format(
"end bkg range < 0 (given: %d), will ignore it.", bkgRange[1]);
125 errMsg = TString::Format(
"start/end bkg range < 0 (given: %d/%d), will ignore it.", bkgRange[0], bkgRange[1]);
128 errMsg = TString(
"??");
133 std::cerr << std::endl <<
">> PPrepFourier::SetBkgRange: **WARNING** " << errMsg << std::endl;
151 for (UInt_t i=0; i<bkg.size(); i++)
152 fBkg.push_back(bkg[i]);
172 std::cerr << std::endl <<
">> PPrepFourier::SetPacking: **WARNING** found packing=" << packing <<
" < 0, will ignore it." << std::endl;
223 for (UInt_t i=0; i<
fRawData.size(); i++) {
225 std::cerr << std::endl <<
"PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!";
231 for (UInt_t i=0; i<
fRawData.size(); i++) {
237 std::cout <<
"info> background " << i <<
": " << bkg << std::endl;
240 for (UInt_t j=0; j<
fData[i].size(); j++)
245 if (
fBkg.size() == 0)
250 std::cerr << std::endl <<
"PPrepFourier::DoBkgCorrection() **ERROR** #bkg values != #histos. Will do nothing here." << std::endl;
254 for (UInt_t i=0; i<
fData.size(); i++)
255 for (UInt_t j=0; j<
fData[i].size(); j++)
285 for (UInt_t i=0; i<
fData.size(); i++) {
288 for (UInt_t j=0; j<
fData[i].size(); j++) {
289 if ((j %
fPacking == 0) && (j != 0)) {
290 tmpData.push_back(dval);
331 for (UInt_t i=0; i<
fData.size(); i++) {
333 for (UInt_t j=0; j<
fData[i].size(); j++) {
334 fData[i][j] *= exp(j*scale);
341 for (UInt_t i=0; i<
fData.size(); i++) {
343 for (UInt_t j=0; j<
fData[i].size(); j++) {
346 N0 = dval/
fData[i].size();
348 for (UInt_t j=0; j<
fData[i].size(); j++) {
413 std::vector<TH1F*> data;
414 data.resize(
fData.size());
417 if (
fData.size() == 0)
428 for (UInt_t i=0; i<
fData.size(); i++) {
429 name = TString::Format(
"histo%2d", i);
435 size =
fData[i].size();
441 size =
static_cast<UInt_t
>((end-start)/dt);
443 startIdx =
static_cast<UInt_t
>(start/dt)+1;
444 endIdx =
static_cast<UInt_t
>(end/dt)+1;
446 std::cerr << std::endl <<
">> PPrepFourier::GetData **WARNING** found start time < 0.0, will set it to 0.0" << std::endl;
447 endIdx =
static_cast<UInt_t
>(end/dt)+1;
458 end = (
fData[i].size()-1)*dt+dt/2.0;
463 data[i] =
new TH1F(name.Data(),
fRawData[i].info.Data(), size, start, end);
464 for (UInt_t j=startIdx; j<endIdx; j++)
465 data[i]->SetBinContent(j-startIdx+1,
fData[i][j]);
490 if (
fData.size() == 0)
493 if (idx >
fData.size())
496 TString name = TString::Format(
"histo%2d", idx);
498 Double_t start =
fRawData[idx].timeRange[0];
499 Double_t end =
fRawData[idx].timeRange[1];
500 UInt_t size =
fData[idx].size();
502 UInt_t endIdx = size;
506 size =
static_cast<UInt_t
>((end-start)/dt);
508 startIdx =
static_cast<UInt_t
>(start/dt)+1;
509 endIdx =
static_cast<UInt_t
>(end/dt)+1;
511 std::cerr << std::endl <<
">> PPrepFourier::GetData **WARNING** found start time < 0.0, will set it to 0.0" << std::endl;
512 endIdx =
static_cast<UInt_t
>(end/dt)+1;
523 end = (
fData[idx].size()-1)*dt+dt/2.0;
528 TH1F *data =
new TH1F(name.Data(),
fRawData[idx].info.Data(), size, start, end);
529 for (UInt_t i=startIdx; i<endIdx; i++)
530 data->SetBinContent(i-startIdx+1,
fData[idx][i]);
552 for (UInt_t i=0; i<
fRawData.size(); i++) {
557 for (UInt_t j=t0; j<
fRawData[i].rawData.size(); j++) {
std::vector< Double_t > PDoubleVector
virtual void InitData()
Initializes processed data from raw data.
Int_t fBkgRange[2]
Background range: [0]=start bin, [1]=end bin (-1=unused)
std::vector< PDoubleVector > fData
Processed data (after t0, corrections, packing)
PPrepFourier()
Default constructor (requires separate configuration)
virtual void DoLifeTimeCorrection(Double_t fudge)
Applies muon lifetime correction for theory-free analysis.
Int_t fPacking
Rebinning factor (1=no rebinning, N=combine N bins)
virtual void SetPacking(const Int_t packing)
Sets rebinning/packing factor for data reduction.
std::vector< musrFT_data > fRawData
Raw input data sets with metadata.
PDoubleVector fBkg
Explicit background values (one per data set)
virtual void SetBkg(PDoubleVector bkg)
Sets explicit background values for each data set.
Int_t GetDataSetTag(const UInt_t idx)
Returns data set tag identifier.
virtual void AddData(musrFT_data &data)
Adds a time-domain data set for processing.
std::vector< TH1F * > GetData()
Creates ROOT histograms for all processed data sets.
virtual ~PPrepFourier()
Destructor.
virtual void DoBkgCorrection()
Applies background correction to all data sets.
virtual void SetBkgRange(const Int_t *bkgRange)
Sets background range for automatic background calculation.
TString GetInfo(const UInt_t idx)
Returns metadata string for a specific data set.
virtual void DoPacking()
Applies rebinning/packing to reduce data points.
Data structure holding raw time-domain μSR data with metadata.