Resolve conflicts manually.
This commit is contained in:
parent
aa6579af41
commit
904471b664
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* Copyright (C) 2007-2019 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -38,7 +38,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <TString.h>
|
||||
#include <TObjArray.h>
|
||||
@ -93,9 +92,9 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
|
||||
fPacking = fMsrInfo->GetMsrGlobal()->GetPacking();
|
||||
}
|
||||
if (fPacking == -1) { // this should NOT happen, somethin is severely wrong
|
||||
cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -106,16 +105,16 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
|
||||
|
||||
// check if alpha is given
|
||||
if (fRunInfo->GetAlphaParamNo() == -1) { // no alpha given
|
||||
cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
// check if alpha parameter is within proper bounds
|
||||
if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > (Int_t)param->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo();
|
||||
cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
cerr << endl;
|
||||
if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast<Int_t>(param->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo();
|
||||
std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -129,10 +128,10 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
|
||||
Bool_t betaFixedToOne = false;
|
||||
if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1
|
||||
betaFixedToOne = true;
|
||||
} else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > (Int_t)param->size())) { // check if beta parameter is within proper bounds
|
||||
cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo();
|
||||
cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
cerr << endl;
|
||||
} else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > static_cast<Int_t>(param->size()))) { // check if beta parameter is within proper bounds
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo();
|
||||
std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
} else { // check if beta is fixed
|
||||
@ -210,7 +209,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
switch (fAlphaBetaTag) {
|
||||
case 1: // alpha == 1, beta == 1
|
||||
asymFcnValue = fTheory->Func(time, par, fFuncValues);
|
||||
@ -268,7 +267,7 @@ Double_t PRunAsymmetry::CalcChiSquareExpected(const std::vector<Double_t>& par)
|
||||
*/
|
||||
Double_t PRunAsymmetry::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
{
|
||||
cout << endl << "PRunAsymmetry::CalcMaxLikelihood(): not implemented yet ..." << endl;
|
||||
std::cout << std::endl << "PRunAsymmetry::CalcMaxLikelihood(): not implemented yet ..." << std::endl;
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
@ -304,8 +303,8 @@ UInt_t PRunAsymmetry::GetNoOfFitBins()
|
||||
*/
|
||||
void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
{
|
||||
TObjArray *tok = 0;
|
||||
TObjString *ostr = 0;
|
||||
TObjArray *tok = nullptr;
|
||||
TObjString *ostr = nullptr;
|
||||
TString str;
|
||||
Ssiz_t idx = -1;
|
||||
Int_t offset = 0;
|
||||
@ -314,7 +313,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
|
||||
if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -326,7 +325,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(2);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(2));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -340,11 +339,11 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
Int_t pos = 2*(fRunNo+1)-1;
|
||||
|
||||
if (pos + 1 >= tok->GetEntries()) {
|
||||
cerr << endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
} else {
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(pos);
|
||||
ostr = static_cast<TObjString*>(tok->At(pos));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -356,7 +355,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(pos+1);
|
||||
ostr = static_cast<TObjString*>(tok->At(pos+1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -368,8 +367,8 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution;
|
||||
}
|
||||
} else { // error
|
||||
cerr << endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
}
|
||||
|
||||
// clean up
|
||||
@ -395,7 +394,7 @@ void PRunAsymmetry::CalcNoOfFitBins()
|
||||
fEndTimeBin = fData.GetValue()->size();
|
||||
|
||||
if (fEndTimeBin > fStartTimeBin)
|
||||
fNoOfFitBins = fEndTimeBin - fStartTimeBin;
|
||||
fNoOfFitBins = static_cast<UInt_t>(fEndTimeBin - fStartTimeBin);
|
||||
else
|
||||
fNoOfFitBins = 0;
|
||||
}
|
||||
@ -424,7 +423,7 @@ void PRunAsymmetry::CalcTheory()
|
||||
Double_t a, b, f;
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
switch (fAlphaBetaTag) {
|
||||
case 1: // alpha == 1, beta == 1
|
||||
asymFcnValue = fTheory->Func(time, par, fFuncValues);
|
||||
@ -487,8 +486,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
// get the correct run
|
||||
PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName()));
|
||||
if (!runData) { // run not found
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -499,10 +498,10 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
forwardHistoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(forwardHistoNo[i])) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
// clean up
|
||||
forwardHistoNo.clear();
|
||||
backwardHistoNo.clear();
|
||||
@ -513,10 +512,10 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
backwardHistoNo.push_back(fRunInfo->GetBackwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(backwardHistoNo[i])) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
// clean up
|
||||
forwardHistoNo.clear();
|
||||
backwardHistoNo.clear();
|
||||
@ -524,10 +523,10 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
}
|
||||
}
|
||||
if (forwardHistoNo.size() != backwardHistoNo.size()) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> # of forward histograms different from # of backward histograms.";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms.";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
// clean up
|
||||
forwardHistoNo.clear();
|
||||
backwardHistoNo.clear();
|
||||
@ -536,8 +535,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
|
||||
// keep the time resolution in (us)
|
||||
fTimeResolution = runData->GetTimeResolution()/1.0e3;
|
||||
cout.precision(10);
|
||||
cout << endl << ">> PRunAsymmetry::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl;
|
||||
std::cout.precision(10);
|
||||
std::cout << std::endl << ">> PRunAsymmetry::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl;
|
||||
|
||||
// get all the proper t0's and addt0's for the current RUN block
|
||||
if (!GetProperT0(runData, globalBlock, forwardHistoNo, backwardHistoNo)) {
|
||||
@ -545,7 +544,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
}
|
||||
|
||||
// keep the histo of each group at this point (addruns handled below)
|
||||
vector<PDoubleVector> forward, backward;
|
||||
std::vector<PDoubleVector> forward, backward;
|
||||
forward.resize(forwardHistoNo.size()); // resize to number of groups
|
||||
backward.resize(backwardHistoNo.size()); // resize to numer of groups
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
@ -562,9 +561,9 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
for (UInt_t i=1; i<fRunInfo->GetRunNameSize(); i++) {
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i)));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -574,8 +573,9 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(forwardHistoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(forwardHistoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if (((Int_t)j+(Int_t)fAddT0s[i-1][2*k]-(Int_t)fT0s[2*k] >= 0) && (j+(Int_t)fAddT0s[i-1][2*k]-(Int_t)fT0s[2*k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+(Int_t)fAddT0s[i-1][2*k]-(Int_t)fT0s[2*k]);
|
||||
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fAddT0s[i-1][2*k])-static_cast<Int_t>(fT0s[2*k]) >= 0) &&
|
||||
(j+static_cast<Int_t>(fAddT0s[i-1][2*k])-static_cast<Int_t>(fT0s[2*k]) < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+static_cast<Int_t>(fAddT0s[i-1][2*k])-static_cast<Int_t>(fT0s[2*k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -585,8 +585,9 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(backwardHistoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(backwardHistoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if (((Int_t)j+(Int_t)fAddT0s[i-1][2*k+1]-(Int_t)fT0s[2*k+1] >= 0) && (j+(Int_t)fAddT0s[i-1][2*k+1]-(Int_t)fT0s[2*k+1] < addRunSize)) {
|
||||
backward[k][j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+(Int_t)fAddT0s[i-1][2*k+1]-(Int_t)fT0s[2*k+1]);
|
||||
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fAddT0s[i-1][2*k+1])-static_cast<Int_t>(fT0s[2*k+1]) >= 0) &&
|
||||
(j+static_cast<Int_t>(fAddT0s[i-1][2*k+1])-static_cast<Int_t>(fT0s[2*k+1]) < addRunSize)) {
|
||||
backward[k][j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+static_cast<Int_t>(fAddT0s[i-1][2*k+1])-static_cast<Int_t>(fT0s[2*k+1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -606,7 +607,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
for (UInt_t j=0; j<runData->GetDataBin(forwardHistoNo[i])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays within proper range
|
||||
if ((j+fT0s[2*i]-fT0s[0] >= 0) && (j+fT0s[2*i]-fT0s[0] < runData->GetDataBin(forwardHistoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+(Int_t)fT0s[2*i]-(Int_t)fT0s[0]];
|
||||
fForward[j] += forward[i][j+static_cast<Int_t>(fT0s[2*i])-static_cast<Int_t>(fT0s[0])];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -616,7 +617,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
for (UInt_t j=0; j<runData->GetDataBin(backwardHistoNo[i])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays within proper range
|
||||
if ((j+fT0s[2*i+1]-fT0s[1] >= 0) && (j+fT0s[2*i+1]-fT0s[1] < runData->GetDataBin(backwardHistoNo[i])->size())) {
|
||||
fBackward[j] += backward[i][j+(Int_t)fT0s[2*i+1]-(Int_t)fT0s[1]];
|
||||
fBackward[j] += backward[i][j+static_cast<Int_t>(fT0s[2*i+1])-static_cast<Int_t>(fT0s[1])];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -631,12 +632,12 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.1), 2);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.6), 3);
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
cerr << endl << ">> Will try the following:";
|
||||
cerr << endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
cerr << endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
std::cerr << std::endl << ">> Will try the following:";
|
||||
std::cerr << std::endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
std::cerr << std::endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
std::cerr << std::endl;
|
||||
if (!SubtractEstimatedBkg())
|
||||
return false;
|
||||
}
|
||||
@ -761,7 +762,7 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
|
||||
Int_t end[2] = {fRunInfo->GetBkgRange(1), fRunInfo->GetBkgRange(3)};
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (end[i] < start[i]) {
|
||||
cout << endl << "PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";
|
||||
std::cout << std::endl << "PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";
|
||||
UInt_t keep = end[i];
|
||||
end[i] = start[i];
|
||||
start[i] = keep;
|
||||
@ -771,11 +772,11 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
|
||||
// calculate proper background range
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (beamPeriod != 0.0) {
|
||||
Double_t timeBkg = (Double_t)(end[i]-start[i])*(fTimeResolution*fPacking); // length of the background intervall in time
|
||||
UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
Double_t timeBkg = static_cast<Double_t>(end[i]-start[i])*(fTimeResolution*fPacking); // length of the background intervall in time
|
||||
UInt_t fullCycles = static_cast<UInt_t>(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
// correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce
|
||||
end[i] = start[i] + (UInt_t) ((fullCycles*beamPeriod)/(fTimeResolution*fPacking));
|
||||
cout << "PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << endl;
|
||||
end[i] = start[i] + static_cast<UInt_t>((fullCycles*beamPeriod)/(fTimeResolution*fPacking));
|
||||
std::cout << "PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << std::endl;
|
||||
if (end[i] == start[i])
|
||||
end[i] = fRunInfo->GetBkgRange(2*i+1);
|
||||
}
|
||||
@ -784,18 +785,18 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
|
||||
// check if start is within histogram bounds
|
||||
if ((start[0] < 0) || (start[0] >= fForward.size()) ||
|
||||
(start[1] < 0) || (start[1] >= fBackward.size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cerr << endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ").";
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
std::cerr << std::endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ").";
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if end is within histogram bounds
|
||||
if ((end[0] < 0) || (end[0] >= fForward.size()) ||
|
||||
(end[1] < 0) || (end[1] >= fBackward.size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cerr << endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ").";
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
std::cerr << std::endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ").";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -808,14 +809,14 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
|
||||
bkg[0] += fForward[i];
|
||||
errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
|
||||
bkg[0] /= static_cast<Double_t>(end[0] - start[0] + 1);
|
||||
cout << endl << ">> estimated forward histo background: " << bkg[0];
|
||||
std::cout << std::endl << ">> estimated forward histo background: " << bkg[0];
|
||||
|
||||
// backward
|
||||
for (UInt_t i=start[1]; i<=end[1]; i++)
|
||||
bkg[1] += fBackward[i];
|
||||
errBkg[1] = TMath::Sqrt(bkg[1])/(end[1] - start[1] + 1);
|
||||
bkg[1] /= static_cast<Double_t>(end[1] - start[1] + 1);
|
||||
cout << endl << ">> estimated backward histo background: " << bkg[1] << endl;
|
||||
std::cout << std::endl << ">> estimated backward histo background: " << bkg[1] << std::endl;
|
||||
|
||||
// correct error for forward, backward
|
||||
Double_t errVal = 0.0;
|
||||
@ -925,8 +926,8 @@ Bool_t PRunAsymmetry::PrepareFitData()
|
||||
Double_t f, b, ef, eb;
|
||||
// fill data time start, and step
|
||||
// data start at data_start-t0 shifted by (pack-1)/2
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-fT0s[0]+(Double_t)(fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(Double_t)fPacking);
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-fT0s[0]+static_cast<Double_t>(fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(fPacking));
|
||||
for (UInt_t i=0; i<noOfBins; i++) {
|
||||
// to make the formulae more readable
|
||||
f = forwardPacked.GetValue()->at(i);
|
||||
@ -997,7 +998,7 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
// first get start data, end data, and t0
|
||||
Int_t start[2] = {fGoodBins[0], fGoodBins[2]};
|
||||
Int_t end[2] = {fGoodBins[1], fGoodBins[3]};
|
||||
Int_t t0[2] = {(Int_t)fT0s[0], (Int_t)fT0s[1]};
|
||||
Int_t t0[2] = {static_cast<Int_t>(fT0s[0]), static_cast<Int_t>(fT0s[1])};
|
||||
|
||||
// check if the data ranges and t0's between forward/backward are compatible
|
||||
Int_t fgb[2];
|
||||
@ -1005,13 +1006,13 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) {
|
||||
fgb[0] = start[0];
|
||||
fgb[1] = t0[1] + start[0]-t0[0];
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift backward fgb from ";
|
||||
cerr << start[1] << " to " << fgb[1] << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift backward fgb from ";
|
||||
std::cerr << start[1] << " to " << fgb[1] << std::endl;
|
||||
} else {
|
||||
fgb[0] = t0[0] + start[1]-t0[1];
|
||||
fgb[1] = start[1];
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift forward fgb from ";
|
||||
cerr << start[0] << " to " << fgb[0] << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift forward fgb from ";
|
||||
std::cerr << start[0] << " to " << fgb[0] << std::endl;
|
||||
}
|
||||
} else { // fgb aligning is correct
|
||||
fgb[0] = start[0];
|
||||
@ -1044,21 +1045,21 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
start[i] = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end[i] < 0) || (end[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 4th check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((t0[i] < 0) || (t0[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1127,8 +1128,8 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0;
|
||||
// set data time start, and step
|
||||
// data start at data_start-t0
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start[0]-t0[0]+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(Double_t)packing);
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start[0])-t0[0]+static_cast<Double_t>(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(packing));
|
||||
|
||||
// get the proper alpha and beta
|
||||
switch (fAlphaBetaTag) {
|
||||
@ -1192,12 +1193,12 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo[0])->size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size;
|
||||
factor = static_cast<Double_t>(runData->GetDataBin(histoNo[0])->size()) / static_cast<Double_t>(size);
|
||||
}
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (Double_t)i*fTimeResolution*factor;
|
||||
time = fData.GetTheoryTimeStart() + static_cast<Double_t>(i)*fTimeResolution*factor;
|
||||
value = fTheory->Func(time, par, fFuncValues);
|
||||
if (fabs(value) > 10.0) { // dirty hack needs to be fixed!!
|
||||
value = 0.0;
|
||||
@ -1244,7 +1245,7 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
// first get start data, end data, and t0
|
||||
Int_t start[2] = {fGoodBins[0], fGoodBins[2]};
|
||||
Int_t end[2] = {fGoodBins[1], fGoodBins[3]};
|
||||
Int_t t0[2] = {(Int_t)fT0s[0], (Int_t)fT0s[1]};
|
||||
Int_t t0[2] = {static_cast<Int_t>(fT0s[0]), static_cast<Int_t>(fT0s[1])};
|
||||
UInt_t packing = fMsrInfo->GetMsrPlotList()->at(0).fRRFPacking;
|
||||
|
||||
// check if the data ranges and t0's between forward/backward are compatible
|
||||
@ -1253,13 +1254,13 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) {
|
||||
fgb[0] = start[0];
|
||||
fgb[1] = t0[1] + start[0]-t0[0];
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift backward fgb from ";
|
||||
cerr << start[1] << " to " << fgb[1] << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift backward fgb from ";
|
||||
std::cerr << start[1] << " to " << fgb[1] << std::endl;
|
||||
} else {
|
||||
fgb[0] = t0[0] + start[1]-t0[1];
|
||||
fgb[1] = start[1];
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift forward fgb from ";
|
||||
cerr << start[1] << " to " << fgb[0] << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift forward fgb from ";
|
||||
std::cerr << start[1] << " to " << fgb[0] << std::endl;
|
||||
}
|
||||
} else { // fgb aligning is correct
|
||||
fgb[0] = start[0];
|
||||
@ -1292,21 +1293,21 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
start[i] = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end[i] < 0) || (end[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 4th check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((t0[i] < 0) || (t0[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1582,11 +1583,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
|
||||
fT0s[2*i] = runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i], 2*i);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
|
||||
@ -1594,26 +1595,26 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
|
||||
fT0s[2*i+1] = runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
if ((fT0s[2*i] < 0) || (fT0s[2*i] > (Int_t)runData->GetDataBin(forwardHistoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!";
|
||||
cerr << endl << ">> forwardHistoNo " << forwardHistoNo[i];
|
||||
cerr << endl;
|
||||
if ((fT0s[2*i] < 0) || (fT0s[2*i] > static_cast<Int_t>(runData->GetDataBin(forwardHistoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl << ">> forwardHistoNo " << forwardHistoNo[i];
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > (Int_t)runData->GetDataBin(backwardHistoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
|
||||
cerr << endl << ">> backwardHistoNo " << backwardHistoNo[i];
|
||||
cerr << endl;
|
||||
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast<Int_t>(runData->GetDataBin(backwardHistoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i];
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1626,8 +1627,8 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i)));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1666,11 +1667,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
|
||||
fAddT0s[i-1][2*j] = addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j], i-1, 2*j);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
|
||||
@ -1678,11 +1679,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
|
||||
fAddT0s[i-1][2*j+1] = addRunData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j+1], i-1, 2*j+1);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1727,36 +1728,36 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]
|
||||
}
|
||||
|
||||
Double_t t0[2] = {fT0s[0], fT0s[1]};
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns
|
||||
Int_t offset = static_cast<Int_t>((10.0e-3/fTimeResolution)); // needed in case first good bin is not given, default = 10ns
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start[0] < 0) {
|
||||
start[0] = (Int_t)t0[0]+offset;
|
||||
start[0] = static_cast<Int_t>(t0[0])+offset;
|
||||
fRunInfo->SetDataRange(start[0], 0);
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (start[1] < 0) {
|
||||
start[1] = (Int_t)t0[1]+offset;
|
||||
start[1] = static_cast<Int_t>(t0[1])+offset;
|
||||
fRunInfo->SetDataRange(start[1], 2);
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end[0] < 0) {
|
||||
end[0] = runData->GetDataBin(histoNo[0])->size();
|
||||
fRunInfo->SetDataRange(end[0], 1);
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end[1] < 0) {
|
||||
end[1] = runData->GetDataBin(histoNo[1])->size();
|
||||
fRunInfo->SetDataRange(end[1], 3);
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// check if start, end, and t0 make any sense
|
||||
@ -1768,27 +1769,27 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]
|
||||
start[i] = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if (end[i] < 0) {
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size()) {
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ").";
|
||||
cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
|
||||
cerr << endl;
|
||||
end[i] = (Int_t)runData->GetDataBin(histoNo[i])->size()-1;
|
||||
if (end[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size())) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()) << ").";
|
||||
std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl;
|
||||
std::cerr << std::endl;
|
||||
end[i] = static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size())-1;
|
||||
}
|
||||
// 4th check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((t0[i] < 0) || (t0[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1797,18 +1798,18 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]
|
||||
if (fabs(static_cast<Double_t>(start[0])-t0[0]) > fabs(static_cast<Double_t>(start[1])-t0[1])){
|
||||
start[1] = static_cast<Int_t>(t0[1] + static_cast<Double_t>(start[0]) - t0[0]);
|
||||
end[1] = static_cast<Int_t>(t0[1] + static_cast<Double_t>(end[0]) - t0[0]);
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift backward data range.";
|
||||
cerr << endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3);
|
||||
cerr << endl << ">> used : " << start[1] << ", " << end[1];
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift backward data range.";
|
||||
std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3);
|
||||
std::cerr << std::endl << ">> used : " << start[1] << ", " << end[1];
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (fabs(static_cast<Double_t>(start[0])-t0[0]) < fabs(static_cast<Double_t>(start[1])-t0[1])){
|
||||
start[0] = static_cast<Int_t>(t0[0] + static_cast<Double_t>(start[1]) - t0[1]);
|
||||
end[0] = static_cast<Int_t>(t0[0] + static_cast<Double_t>(end[1]) - t0[1]);
|
||||
cerr << endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift forward data range.";
|
||||
cerr << endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1);
|
||||
cerr << endl << ">> used : " << start[0] << ", " << end[0];
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift forward data range.";
|
||||
std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1);
|
||||
std::cerr << std::endl << ">> used : " << start[0] << ", " << end[0];
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// keep good bins for potential latter use
|
||||
@ -1863,7 +1864,7 @@ void PRunAsymmetry::GetProperFitRange(PMsrGlobalBlock *globalBlock)
|
||||
if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) {
|
||||
fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt
|
||||
fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt
|
||||
cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl;
|
||||
cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl;
|
||||
std::cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
|
||||
std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* Copyright (C) 2007-2019 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -39,7 +39,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
#include <TString.h>
|
||||
#include <TObjArray.h>
|
||||
@ -85,9 +84,9 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat
|
||||
|
||||
fRRFPacking = fMsrInfo->GetMsrGlobal()->GetRRFPacking();
|
||||
if (fRRFPacking == -1) { // this should NOT happen, somethin is severely wrong
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **SEVERE ERROR**: Couldn't find any RRF packing information!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **SEVERE ERROR**: Couldn't find any RRF packing information!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -98,16 +97,16 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat
|
||||
|
||||
// check if alpha is given
|
||||
if (fRunInfo->GetAlphaParamNo() == -1) { // no alpha given
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
// check if alpha parameter is within proper bounds
|
||||
if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > (Int_t)param->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo();
|
||||
cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
cerr << endl;
|
||||
if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast<Int_t>(param->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo();
|
||||
std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -121,10 +120,10 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat
|
||||
Bool_t betaFixedToOne = false;
|
||||
if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1
|
||||
betaFixedToOne = true;
|
||||
} else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > (Int_t)param->size())) { // check if beta parameter is within proper bounds
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo();
|
||||
cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
cerr << endl;
|
||||
} else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > static_cast<Int_t>(param->size()))) { // check if beta parameter is within proper bounds
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo();
|
||||
std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
} else { // check if beta is fixed
|
||||
@ -202,7 +201,7 @@ Double_t PRunAsymmetryRRF::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
switch (fAlphaBetaTag) {
|
||||
case 1: // alpha == 1, beta == 1
|
||||
asymFcnValue = fTheory->Func(time, par, fFuncValues);
|
||||
@ -260,7 +259,7 @@ Double_t PRunAsymmetryRRF::CalcChiSquareExpected(const std::vector<Double_t>& pa
|
||||
*/
|
||||
Double_t PRunAsymmetryRRF::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
{
|
||||
cout << endl << "PRunAsymmetryRRF::CalcMaxLikelihood(): not implemented yet ..." << endl;
|
||||
std::cout << std::endl << "PRunAsymmetryRRF::CalcMaxLikelihood(): not implemented yet ..." << std::endl;
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
@ -296,8 +295,8 @@ UInt_t PRunAsymmetryRRF::GetNoOfFitBins()
|
||||
*/
|
||||
void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
|
||||
{
|
||||
TObjArray *tok = 0;
|
||||
TObjString *ostr = 0;
|
||||
TObjArray *tok = nullptr;
|
||||
TObjString *ostr = nullptr;
|
||||
TString str;
|
||||
Ssiz_t idx = -1;
|
||||
Int_t offset = 0;
|
||||
@ -306,7 +305,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
|
||||
|
||||
if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(1);
|
||||
ostr = static_cast<TObjString*>(tok->At(1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -318,7 +317,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(2);
|
||||
ostr = static_cast<TObjString*>(tok->At(2));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -332,11 +331,11 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
|
||||
Int_t pos = 2*(fRunNo+1)-1;
|
||||
|
||||
if (pos + 1 >= tok->GetEntries()) {
|
||||
cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
} else {
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(pos);
|
||||
ostr = static_cast<TObjString*>(tok->At(pos));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -348,7 +347,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(pos+1);
|
||||
ostr = static_cast<TObjString*>(tok->At(pos+1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -360,8 +359,8 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
|
||||
fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution;
|
||||
}
|
||||
} else { // error
|
||||
cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
}
|
||||
|
||||
// clean up
|
||||
@ -416,7 +415,7 @@ void PRunAsymmetryRRF::CalcTheory()
|
||||
Double_t a, b, f;
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
switch (fAlphaBetaTag) {
|
||||
case 1: // alpha == 1, beta == 1
|
||||
asymFcnValue = fTheory->Func(time, par, fFuncValues);
|
||||
@ -479,8 +478,8 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
// get the correct run
|
||||
PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName()));
|
||||
if (!runData) { // run not found
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -491,10 +490,10 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
forwardHistoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(forwardHistoNo[i])) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
// clean up
|
||||
forwardHistoNo.clear();
|
||||
backwardHistoNo.clear();
|
||||
@ -505,10 +504,10 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
backwardHistoNo.push_back(fRunInfo->GetBackwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(backwardHistoNo[i])) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
// clean up
|
||||
forwardHistoNo.clear();
|
||||
backwardHistoNo.clear();
|
||||
@ -516,10 +515,10 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
}
|
||||
}
|
||||
if (forwardHistoNo.size() != backwardHistoNo.size()) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> # of forward histograms different from # of backward histograms.";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms.";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
// clean up
|
||||
forwardHistoNo.clear();
|
||||
backwardHistoNo.clear();
|
||||
@ -528,8 +527,8 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
|
||||
// keep the time resolution in (us)
|
||||
fTimeResolution = runData->GetTimeResolution()/1.0e3;
|
||||
cout.precision(10);
|
||||
cout << endl << ">> PRunAsymmetryRRF::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl;
|
||||
std::cout.precision(10);
|
||||
std::cout << std::endl << ">> PRunAsymmetryRRF::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl;
|
||||
|
||||
// get all the proper t0's and addt0's for the current RUN block
|
||||
if (!GetProperT0(runData, globalBlock, forwardHistoNo, backwardHistoNo)) {
|
||||
@ -537,7 +536,7 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
}
|
||||
|
||||
// keep the histo of each group at this point (addruns handled below)
|
||||
vector<PDoubleVector> forward, backward;
|
||||
std::vector<PDoubleVector> forward, backward;
|
||||
forward.resize(forwardHistoNo.size()); // resize to number of groups
|
||||
backward.resize(backwardHistoNo.size()); // resize to numer of groups
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
@ -554,9 +553,9 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
for (UInt_t i=1; i<fRunInfo->GetRunNameSize(); i++) {
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i)));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -623,12 +622,12 @@ Bool_t PRunAsymmetryRRF::PrepareData()
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.1), 2);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.6), 3);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
cerr << endl << ">> Will try the following:";
|
||||
cerr << endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
cerr << endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
std::cerr << std::endl << ">> Will try the following:";
|
||||
std::cerr << std::endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
std::cerr << std::endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
std::cerr << std::endl;
|
||||
if (!SubtractEstimatedBkg())
|
||||
return false;
|
||||
}
|
||||
@ -746,11 +745,11 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg()
|
||||
beamPeriod = 0.0;
|
||||
|
||||
// check if start and end are in proper order
|
||||
UInt_t start[2] = {(UInt_t)fRunInfo->GetBkgRange(0), (UInt_t)fRunInfo->GetBkgRange(2)};
|
||||
UInt_t end[2] = {(UInt_t)fRunInfo->GetBkgRange(1), (UInt_t)fRunInfo->GetBkgRange(3)};
|
||||
UInt_t start[2] = {static_cast<UInt_t>(fRunInfo->GetBkgRange(0)), static_cast<UInt_t>(fRunInfo->GetBkgRange(2))};
|
||||
UInt_t end[2] = {static_cast<UInt_t>(fRunInfo->GetBkgRange(1)), static_cast<UInt_t>(fRunInfo->GetBkgRange(3))};
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (end[i] < start[i]) {
|
||||
cout << endl << "PRunAsymmetryRRF::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";
|
||||
std::cout << std::endl << "PRunAsymmetryRRF::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";
|
||||
UInt_t keep = end[i];
|
||||
end[i] = start[i];
|
||||
start[i] = keep;
|
||||
@ -760,11 +759,11 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg()
|
||||
// calculate proper background range
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (beamPeriod != 0.0) {
|
||||
Double_t timeBkg = (Double_t)(end[i]-start[i])*fTimeResolution; // length of the background intervall in time
|
||||
UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
Double_t timeBkg = static_cast<Double_t>(end[i]-start[i])*fTimeResolution; // length of the background intervall in time
|
||||
UInt_t fullCycles = static_cast<UInt_t>(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
// correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce
|
||||
end[i] = start[i] + (UInt_t) ((fullCycles*beamPeriod)/fTimeResolution);
|
||||
cout << "PRunAsymmetryRRF::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << endl;
|
||||
end[i] = start[i] + static_cast<UInt_t>((fullCycles*beamPeriod)/fTimeResolution);
|
||||
std::cout << "PRunAsymmetryRRF::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << std::endl;
|
||||
if (end[i] == start[i])
|
||||
end[i] = fRunInfo->GetBkgRange(2*i+1);
|
||||
}
|
||||
@ -772,17 +771,17 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg()
|
||||
|
||||
// check if start is within histogram bounds
|
||||
if ((start[0] >= fForward.size()) || (start[1] >= fBackward.size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cerr << endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ").";
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
std::cerr << std::endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ").";
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if end is within histogram bounds
|
||||
if ((end[0] >= fForward.size()) || (end[1] >= fBackward.size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cerr << endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ").";
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
std::cerr << std::endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ").";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -795,14 +794,14 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg()
|
||||
bkg[0] += fForward[i];
|
||||
errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
|
||||
bkg[0] /= static_cast<Double_t>(end[0] - start[0] + 1);
|
||||
cout << endl << ">> estimated forward histo background: " << bkg[0];
|
||||
std::cout << std::endl << ">> estimated forward histo background: " << bkg[0];
|
||||
|
||||
// backward
|
||||
for (UInt_t i=start[1]; i<=end[1]; i++)
|
||||
bkg[1] += fBackward[i];
|
||||
errBkg[1] = TMath::Sqrt(bkg[1])/(end[1] - start[1] + 1);
|
||||
bkg[1] /= static_cast<Double_t>(end[1] - start[1] + 1);
|
||||
cout << endl << ">> estimated backward histo background: " << bkg[1] << endl;
|
||||
std::cout << std::endl << ">> estimated backward histo background: " << bkg[1] << std::endl;
|
||||
|
||||
// correct error for forward, backward
|
||||
Double_t errVal = 0.0;
|
||||
@ -845,17 +844,17 @@ Bool_t PRunAsymmetryRRF::PrepareFitData()
|
||||
// 1st: form the asymmetry of the original data
|
||||
|
||||
// forward and backward detectors might have different fgb-t0 offset. Take the maximum of both.
|
||||
Int_t fgbOffset = fGoodBins[0]-(Int_t)fT0s[0];
|
||||
if (fgbOffset < fGoodBins[2]-(Int_t)fT0s[1])
|
||||
fgbOffset = fGoodBins[2]-(Int_t)fT0s[1];
|
||||
Int_t fgbOffset = fGoodBins[0]-static_cast<Int_t>(fT0s[0]);
|
||||
if (fgbOffset < fGoodBins[2]-static_cast<Int_t>(fT0s[1]))
|
||||
fgbOffset = fGoodBins[2]-static_cast<Int_t>(fT0s[1]);
|
||||
// last good bin (lgb) is the minimum of forward/backward lgb
|
||||
Int_t lgb_offset = fGoodBins[1]-(Int_t)fT0s[0]+fgbOffset;
|
||||
if (lgb_offset < fGoodBins[3]-(Int_t)fT0s[1]+fgbOffset)
|
||||
lgb_offset = fGoodBins[3]-(Int_t)fT0s[1]+fgbOffset;
|
||||
Int_t lgb_offset = fGoodBins[1]-static_cast<Int_t>(fT0s[0])+fgbOffset;
|
||||
if (lgb_offset < fGoodBins[3]-static_cast<Int_t>(fT0s[1])+fgbOffset)
|
||||
lgb_offset = fGoodBins[3]-static_cast<Int_t>(fT0s[1])+fgbOffset;
|
||||
|
||||
Int_t fgb = (Int_t)fT0s[0]+fgbOffset;
|
||||
Int_t fgb = static_cast<Int_t>(fT0s[0])+fgbOffset;
|
||||
Int_t lgb = fgb + lgb_offset;
|
||||
Int_t dt0 = (Int_t)fT0s[0]-(Int_t)fT0s[1];
|
||||
Int_t dt0 = static_cast<Int_t>(fT0s[0])-static_cast<Int_t>(fT0s[1]);
|
||||
|
||||
PDoubleVector asym;
|
||||
PDoubleVector asymErr;
|
||||
@ -883,7 +882,7 @@ Bool_t PRunAsymmetryRRF::PrepareFitData()
|
||||
Double_t wRRF = globalBlock->GetRRFFreq("Mc");
|
||||
Double_t phaseRRF = globalBlock->GetRRFPhase()*TMath::TwoPi()/180.0;
|
||||
|
||||
Double_t startTime = fTimeResolution * (Double_t)fgbOffset;
|
||||
Double_t startTime = fTimeResolution * static_cast<Double_t>(fgbOffset);
|
||||
Double_t time=0.0;
|
||||
for (UInt_t i=0; i<asym.size(); i++) {
|
||||
time = startTime + i*fTimeResolution;
|
||||
@ -912,8 +911,8 @@ Bool_t PRunAsymmetryRRF::PrepareFitData()
|
||||
asymValErr += asymErr[i]*asymErr[i];
|
||||
}
|
||||
|
||||
fData.SetDataTimeStart(startTime+fTimeResolution*((Double_t)(fRRFPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(Double_t)fRRFPacking);
|
||||
fData.SetDataTimeStart(startTime+fTimeResolution*(static_cast<Double_t>(fRRFPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(fRRFPacking));
|
||||
|
||||
for (UInt_t i=0; i<asymRRF.size(); i++) {
|
||||
fData.AppendValue(asymRRF[i]);
|
||||
@ -965,7 +964,7 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
// first get start data, end data, and t0
|
||||
Int_t start[2] = {fGoodBins[0], fGoodBins[2]};
|
||||
Int_t end[2] = {fGoodBins[1], fGoodBins[3]};
|
||||
Int_t t0[2] = {(Int_t)fT0s[0], (Int_t)fT0s[1]};
|
||||
Int_t t0[2] = {static_cast<Int_t>(fT0s[0]), static_cast<Int_t>(fT0s[1])};
|
||||
|
||||
// check if the data ranges and t0's between forward/backward are compatible
|
||||
Int_t fgb[2];
|
||||
@ -973,13 +972,13 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) {
|
||||
fgb[0] = start[0];
|
||||
fgb[1] = t0[1] + start[0]-t0[0];
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift backward fgb from ";
|
||||
cerr << start[1] << " to " << fgb[1] << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift backward fgb from ";
|
||||
std::cerr << start[1] << " to " << fgb[1] << std::endl;
|
||||
} else {
|
||||
fgb[0] = t0[0] + start[1]-t0[1];
|
||||
fgb[1] = start[1];
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift forward fgb from ";
|
||||
cerr << start[0] << " to " << fgb[0] << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift forward fgb from ";
|
||||
std::cerr << start[0] << " to " << fgb[0] << std::endl;
|
||||
}
|
||||
} else { // fgb aligning is correct
|
||||
fgb[0] = start[0];
|
||||
@ -999,21 +998,21 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
// check if start, end, and t0 make any sense
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
// 1st check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 2nd check if end is within proper bounds
|
||||
if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end[i] < 0) || (end[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((t0[i] < 0) || (t0[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1077,7 +1076,7 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
PMsrGlobalBlock *globalBlock = fMsrInfo->GetMsrGlobal();
|
||||
Double_t wRRF = globalBlock->GetRRFFreq("Mc");
|
||||
Double_t phaseRRF = globalBlock->GetRRFPhase()*TMath::TwoPi()/180.0;
|
||||
Double_t startTime=fTimeResolution*((Double_t)start[0]-t0[0]);
|
||||
Double_t startTime=fTimeResolution*(static_cast<Double_t>(start[0])-t0[0]);
|
||||
Double_t time = 0.0;
|
||||
for (UInt_t i=0; i<asymVec.size(); i++) {
|
||||
time = startTime + i * fTimeResolution;
|
||||
@ -1105,8 +1104,8 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
dval += asymErr[i]*asymErr[i];
|
||||
}
|
||||
|
||||
fData.SetDataTimeStart(startTime+fTimeResolution*((Double_t)(fRRFPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(Double_t)fRRFPacking);
|
||||
fData.SetDataTimeStart(startTime+fTimeResolution*(static_cast<Double_t>(fRRFPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(fRRFPacking));
|
||||
|
||||
for (UInt_t i=0; i<asymRRF.size(); i++) {
|
||||
fData.AppendValue(asymRRF[i]);
|
||||
@ -1136,12 +1135,12 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo[0])->size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size;
|
||||
factor = static_cast<Double_t>(runData->GetDataBin(histoNo[0])->size()) / static_cast<Double_t>(size);
|
||||
}
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (Double_t)i*fTimeResolution*factor;
|
||||
time = fData.GetTheoryTimeStart() + static_cast<Double_t>(i)*fTimeResolution*factor;
|
||||
dval = fTheory->Func(time, par, fFuncValues);
|
||||
if (fabs(dval) > 10.0) { // dirty hack needs to be fixed!!
|
||||
dval = 0.0;
|
||||
@ -1193,7 +1192,7 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
|
||||
|
||||
// fill in the missing T0's from the GLOBAL block section (if present)
|
||||
for (UInt_t i=0; i<globalBlock->GetT0BinSize(); i++) {
|
||||
if (fT0s[i] == -1) { // i.e. not given in the RUN block section
|
||||
if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section
|
||||
fT0s[i] = globalBlock->GetT0Bin(i);
|
||||
}
|
||||
}
|
||||
@ -1220,11 +1219,11 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
|
||||
fT0s[2*i] = runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i], 2*i);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
|
||||
@ -1232,26 +1231,26 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
|
||||
fT0s[2*i+1] = runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
if ((fT0s[2*i] < 0) || (fT0s[2*i] > (Int_t)runData->GetDataBin(forwardHistoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!";
|
||||
cerr << endl << ">> forwardHistoNo " << forwardHistoNo[i];
|
||||
cerr << endl;
|
||||
if ((fT0s[2*i] < 0) || (fT0s[2*i] > static_cast<Int_t>(runData->GetDataBin(forwardHistoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl << ">> forwardHistoNo " << forwardHistoNo[i];
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > (Int_t)runData->GetDataBin(backwardHistoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
|
||||
cerr << endl << ">> backwardHistoNo " << backwardHistoNo[i];
|
||||
cerr << endl;
|
||||
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast<Int_t>(runData->GetDataBin(backwardHistoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i];
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1263,9 +1262,9 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
|
||||
for (UInt_t i=1; i<fRunInfo->GetRunNameSize(); i++) {
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i)));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1304,11 +1303,11 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
|
||||
fAddT0s[i-1][2*j] = addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j], i-1, 2*j);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
|
||||
@ -1316,11 +1315,11 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
|
||||
fAddT0s[i-1][2*j+1] = addRunData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j+1], i-1, 2*j+1);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1365,36 +1364,36 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo
|
||||
}
|
||||
|
||||
Double_t t0[2] = {fT0s[0], fT0s[1]};
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start[0] < 0) {
|
||||
start[0] = (Int_t)t0[0]+offset;
|
||||
start[0] = static_cast<Int_t>(t0[0])+offset;
|
||||
fRunInfo->SetDataRange(start[0], 0);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (start[1] < 0) {
|
||||
start[1] = (Int_t)t0[1]+offset;
|
||||
start[1] = static_cast<Int_t>(t0[1])+offset;
|
||||
fRunInfo->SetDataRange(start[1], 2);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end[0] < 0) {
|
||||
end[0] = runData->GetDataBin(histoNo[0])->size();
|
||||
fRunInfo->SetDataRange(end[0], 1);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end[1] < 0) {
|
||||
end[1] = runData->GetDataBin(histoNo[1])->size();
|
||||
fRunInfo->SetDataRange(end[1], 3);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// check if start, end, and t0 make any sense
|
||||
@ -1406,27 +1405,27 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo
|
||||
start[i] = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if (end[i] < 0) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size()) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ").";
|
||||
cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
|
||||
cerr << endl;
|
||||
end[i] = (Int_t)runData->GetDataBin(histoNo[i])->size()-1;
|
||||
if (end[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size())) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ").";
|
||||
std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl;
|
||||
std::cerr << std::endl;
|
||||
end[i] = static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size())-1;
|
||||
}
|
||||
// 4th check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((t0[i] < 0) || (t0[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1435,18 +1434,18 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo
|
||||
if (fabs(static_cast<Double_t>(start[0])-t0[0]) > fabs(static_cast<Double_t>(start[1])-t0[1])){
|
||||
start[1] = static_cast<Int_t>(t0[1] + static_cast<Double_t>(start[0]) - t0[0]);
|
||||
end[1] = static_cast<Int_t>(t0[1] + static_cast<Double_t>(end[0]) - t0[0]);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift backward data range.";
|
||||
cerr << endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3);
|
||||
cerr << endl << ">> used : " << start[1] << ", " << end[1];
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift backward data range.";
|
||||
std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3);
|
||||
std::cerr << std::endl << ">> used : " << start[1] << ", " << end[1];
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (fabs(static_cast<Double_t>(start[0])-t0[0]) < fabs(static_cast<Double_t>(start[1])-t0[1])){
|
||||
start[0] = static_cast<Int_t>(t0[0] + static_cast<Double_t>(start[1]) - t0[1]);
|
||||
end[0] = static_cast<Int_t>(t0[0] + static_cast<Double_t>(end[1]) - t0[1]);
|
||||
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift forward data range.";
|
||||
cerr << endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1);
|
||||
cerr << endl << ">> used : " << start[0] << ", " << end[0];
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift forward data range.";
|
||||
std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1);
|
||||
std::cerr << std::endl << ">> used : " << start[0] << ", " << end[0];
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// keep good bins for potential latter use
|
||||
@ -1501,7 +1500,7 @@ void PRunAsymmetryRRF::GetProperFitRange(PMsrGlobalBlock *globalBlock)
|
||||
if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) {
|
||||
fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt
|
||||
fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt
|
||||
cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl;
|
||||
cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl;
|
||||
std::cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
|
||||
std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* Copyright (C) 2007-2019 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -36,7 +36,6 @@
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <TString.h>
|
||||
#include <TObjArray.h>
|
||||
@ -86,9 +85,9 @@ PRunMuMinus::PRunMuMinus(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t
|
||||
fPacking = fMsrInfo->GetMsrGlobal()->GetPacking();
|
||||
}
|
||||
if (fPacking == -1) { // this should NOT happen, somethin is severely wrong
|
||||
cerr << endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -102,9 +101,9 @@ PRunMuMinus::PRunMuMinus(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t
|
||||
fEndTimeBin = -1;
|
||||
|
||||
if (!PrepareData()) {
|
||||
cerr << endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't prepare data for fitting!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't prepare data for fitting!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
}
|
||||
}
|
||||
@ -159,7 +158,7 @@ Double_t PRunMuMinus::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
diff = fData.GetValue()->at(i) - fTheory->Func(time, par, fFuncValues);
|
||||
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
|
||||
}
|
||||
@ -207,7 +206,7 @@ Double_t PRunMuMinus::CalcChiSquareExpected(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
theo = fTheory->Func(time, par, fFuncValues);
|
||||
diff = fData.GetValue()->at(i) - theo;
|
||||
chisq += diff*diff / theo;
|
||||
@ -256,14 +255,14 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
// calculate theory for the given parameter set
|
||||
theo = fTheory->Func(time, par, fFuncValues);
|
||||
|
||||
data = fData.GetValue()->at(i);
|
||||
|
||||
if (theo <= 0.0) {
|
||||
cerr << ">> PRunMuMinus::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl;
|
||||
std::cerr << ">> PRunMuMinus::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -308,8 +307,8 @@ UInt_t PRunMuMinus::GetNoOfFitBins()
|
||||
*/
|
||||
void PRunMuMinus::SetFitRangeBin(const TString fitRange)
|
||||
{
|
||||
TObjArray *tok = 0;
|
||||
TObjString *ostr = 0;
|
||||
TObjArray *tok = nullptr;
|
||||
TObjString *ostr = nullptr;
|
||||
TString str;
|
||||
Ssiz_t idx = -1;
|
||||
Int_t offset = 0;
|
||||
@ -318,7 +317,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange)
|
||||
|
||||
if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -330,7 +329,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(2);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(2));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -344,11 +343,11 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange)
|
||||
Int_t pos = 2*(fRunNo+1)-1;
|
||||
|
||||
if (pos + 1 >= tok->GetEntries()) {
|
||||
cerr << endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
} else {
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(pos);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(pos));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -360,7 +359,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(pos+1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(pos+1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -372,8 +371,8 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange)
|
||||
fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution;
|
||||
}
|
||||
} else { // error
|
||||
cerr << endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
}
|
||||
|
||||
// clean up
|
||||
@ -429,7 +428,7 @@ void PRunMuMinus::CalcTheory()
|
||||
Double_t resolution = fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = start + (Double_t)i*resolution;
|
||||
time = start + static_cast<Double_t>(i)*resolution;
|
||||
fData.AppendTheoryValue(fTheory->Func(time, par, fFuncValues));
|
||||
}
|
||||
|
||||
@ -463,8 +462,8 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
// get the proper run
|
||||
PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName());
|
||||
if (!runData) { // couldn't get run
|
||||
cerr << endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -474,10 +473,10 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
histoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(histoNo[i])) {
|
||||
cerr << endl << ">> PRunMuMinus::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
histoNo.clear();
|
||||
return false;
|
||||
}
|
||||
@ -485,8 +484,8 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
|
||||
// keep the time resolution in (us)
|
||||
fTimeResolution = runData->GetTimeResolution()/1.0e3;
|
||||
cout.precision(10);
|
||||
cout << endl << ">> PRunMuMinus::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl;
|
||||
std::cout.precision(10);
|
||||
std::cout << std::endl << ">> PRunMuMinus::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl;
|
||||
|
||||
// get all the proper t0's and addt0's for the current RUN block
|
||||
if (!GetProperT0(runData, globalBlock, histoNo)) {
|
||||
@ -494,7 +493,7 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
}
|
||||
|
||||
// keep the histo of each group at this point (addruns handled below)
|
||||
vector<PDoubleVector> forward;
|
||||
std::vector<PDoubleVector> forward;
|
||||
forward.resize(histoNo.size()); // resize to number of groups
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
forward[i].resize(runData->GetDataBin(histoNo[i])->size());
|
||||
@ -508,9 +507,9 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -520,8 +519,9 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(histoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if (((Int_t)j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k]);
|
||||
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) >= 0) &&
|
||||
(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,8 +538,8 @@ Bool_t PRunMuMinus::PrepareData()
|
||||
for (UInt_t i=1; i<histoNo.size(); i++) { // loop over the groupings
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays within proper range
|
||||
if (((Int_t)j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+(Int_t)fT0s[i]-(Int_t)fT0s[0]];
|
||||
if ((static_cast<Int_t>(j)+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+static_cast<Int_t>(fT0s[i])-static_cast<Int_t>(fT0s[0])];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -589,11 +589,11 @@ Bool_t PRunMuMinus::PrepareFitData(PRawRunData* runData, const UInt_t histoNo)
|
||||
// for the single histo fit, just the rebinned raw data are copied
|
||||
|
||||
// fill data set
|
||||
Int_t t0 = (Int_t)fT0s[0];
|
||||
Int_t t0 = static_cast<Int_t>(fT0s[0]);
|
||||
Double_t value = 0.0;
|
||||
// data start at data_start-t0
|
||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-(Double_t)t0+(Double_t)(fPacking-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-static_cast<Double_t>(t0)+static_cast<Double_t>(fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*fPacking);
|
||||
for (Int_t i=fGoodBins[0]; i<fGoodBins[1]; i++) {
|
||||
if (fPacking == 1) {
|
||||
@ -652,7 +652,7 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN
|
||||
// calculate necessary norms
|
||||
Double_t theoryNorm = 1.0;
|
||||
if (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0) {
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking;
|
||||
theoryNorm = static_cast<Double_t>(fMsrInfo->GetMsrPlotList()->at(0).fViewPacking)/static_cast<Double_t>(fPacking);
|
||||
}
|
||||
|
||||
// raw data, since PMusrCanvas is doing ranging etc.
|
||||
@ -662,12 +662,12 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN
|
||||
Int_t end = start + ((fForward.size()-start)/packing)*packing;
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = ((Int_t)fT0s[0]+offset) - (((Int_t)fT0s[0]+offset)/packing)*packing;
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution);
|
||||
start = (static_cast<Int_t>(fT0s[0])+offset) - ((static_cast<Int_t>(fT0s[0])+offset)/packing)*packing;
|
||||
end = start + ((fForward.size()-start)/packing)*packing;
|
||||
cerr << endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
@ -677,15 +677,15 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start < 0) || (start > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end < 0) || (end > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -696,11 +696,11 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
Int_t t0 = (Int_t)fT0s[0];
|
||||
Int_t t0 = static_cast<Int_t>(fT0s[0]);
|
||||
Double_t value = 0.0;
|
||||
// data start at data_start-t0
|
||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start)-static_cast<Double_t>(t0)+static_cast<Double_t>(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*packing);
|
||||
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
@ -735,7 +735,7 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > fForward.size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)fForward.size() / (Double_t)size;
|
||||
factor = static_cast<Double_t>(fForward.size()) / static_cast<Double_t>(size);
|
||||
}
|
||||
Double_t time;
|
||||
Double_t theoryValue;
|
||||
@ -791,7 +791,7 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo
|
||||
|
||||
// fill in the T0's from the GLOBAL block section (if present)
|
||||
for (UInt_t i=0; i<globalBlock->GetT0BinSize(); i++) {
|
||||
if (fT0s[i] == -1) { // i.e. not given in the RUN block section
|
||||
if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section
|
||||
fT0s[i] = globalBlock->GetT0Bin(i);
|
||||
}
|
||||
}
|
||||
@ -812,19 +812,19 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo
|
||||
fT0s[i] = runData->GetT0BinEstimated(histoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunMuMinus::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((fT0s[i] < 0) || (fT0s[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -837,9 +837,9 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunMuMinus::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -870,19 +870,19 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo
|
||||
fAddT0s[i-1][j] = addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][j], i-1, j); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) {
|
||||
cerr << endl << ">> PRunMuMinus::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > static_cast<Int_t>(addRunData->GetDataBin(histoNo[j])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -923,19 +923,19 @@ Bool_t PRunMuMinus::GetProperDataRange()
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = (Int_t)fT0s[0]+offset;
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution);
|
||||
start = static_cast<Int_t>(fT0s[0])+offset;
|
||||
fRunInfo->SetDataRange(start, 0);
|
||||
cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = fForward.size();
|
||||
fRunInfo->SetDataRange(end, 1);
|
||||
cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// check if start and end make any sense
|
||||
@ -946,15 +946,15 @@ Bool_t PRunMuMinus::GetProperDataRange()
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start < 0) || (start > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end < 0) || (end > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1008,7 +1008,7 @@ void PRunMuMinus::GetProperFitRange(PMsrGlobalBlock *globalBlock)
|
||||
if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) {
|
||||
fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt
|
||||
fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt
|
||||
cerr << ">> PRunMuMinus::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl;
|
||||
cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl;
|
||||
std::cerr << ">> PRunMuMinus::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
|
||||
std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* Copyright (C) 2007-2019 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -38,7 +38,6 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
#include <TString.h>
|
||||
#include <TObjArray.h>
|
||||
@ -91,9 +90,9 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData,
|
||||
fPacking = fMsrInfo->GetMsrGlobal()->GetPacking();
|
||||
}
|
||||
if (fPacking == -1) { // this should NOT happen, somethin is severely wrong
|
||||
cerr << endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -107,9 +106,9 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData,
|
||||
fEndTimeBin = -1;
|
||||
|
||||
if (!PrepareData()) {
|
||||
cerr << endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't prepare data for fitting!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't prepare data for fitting!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
}
|
||||
}
|
||||
@ -174,7 +173,7 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
|
||||
// calculate functions
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
UInt_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
|
||||
@ -195,7 +194,7 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
diff = fData.GetValue()->at(i) -
|
||||
(N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg);
|
||||
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
|
||||
@ -280,7 +279,7 @@ Double_t PRunSingleHisto::CalcChiSquareExpected(const std::vector<Double_t>& par
|
||||
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg;
|
||||
diff = fData.GetValue()->at(i) - theo;
|
||||
chisq += diff*diff / theo;
|
||||
@ -316,7 +315,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
N0 = par[fRunInfo->GetNormParamNo()-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
|
||||
Int_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
@ -342,7 +341,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
|
||||
// calculate functions
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
UInt_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
|
||||
@ -371,7 +370,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
// calculate theory for the given parameter set
|
||||
theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg;
|
||||
theo *= normalizer;
|
||||
@ -379,7 +378,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
data = normalizer*fData.GetValue()->at(i);
|
||||
|
||||
if (theo <= 0.0) {
|
||||
cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl;
|
||||
std::cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -415,7 +414,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector<Double_t>&
|
||||
N0 = par[fRunInfo->GetNormParamNo()-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
|
||||
Int_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
@ -441,7 +440,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector<Double_t>&
|
||||
|
||||
// calculate functions
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
UInt_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
|
||||
@ -470,7 +469,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector<Double_t>&
|
||||
#pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
// calculate theory for the given parameter set
|
||||
theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg;
|
||||
theo *= normalizer;
|
||||
@ -478,7 +477,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector<Double_t>&
|
||||
data = normalizer*fData.GetValue()->at(i);
|
||||
|
||||
if (theo <= 0.0) {
|
||||
cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl;
|
||||
std::cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -511,7 +510,7 @@ void PRunSingleHisto::CalcTheory()
|
||||
N0 = par[fRunInfo->GetNormParamNo()-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
|
||||
Int_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
@ -546,7 +545,7 @@ void PRunSingleHisto::CalcTheory()
|
||||
Double_t resolution = fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = start + (Double_t)i*resolution;
|
||||
time = start + static_cast<Double_t>(i)*resolution;
|
||||
fData.AppendTheoryValue(N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg);
|
||||
}
|
||||
|
||||
@ -585,8 +584,8 @@ UInt_t PRunSingleHisto::GetNoOfFitBins()
|
||||
*/
|
||||
void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
|
||||
{
|
||||
TObjArray *tok = 0;
|
||||
TObjString *ostr = 0;
|
||||
TObjArray *tok = nullptr;
|
||||
TObjString *ostr = nullptr;
|
||||
TString str;
|
||||
Ssiz_t idx = -1;
|
||||
Int_t offset = 0;
|
||||
@ -595,7 +594,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
|
||||
|
||||
if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -607,7 +606,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(2);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(2));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -621,11 +620,11 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
|
||||
Int_t pos = 2*(fRunNo+1)-1;
|
||||
|
||||
if (pos + 1 >= tok->GetEntries()) {
|
||||
cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
} else {
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(pos);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(pos));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -637,7 +636,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(pos+1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(pos+1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -649,8 +648,8 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
|
||||
fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution;
|
||||
}
|
||||
} else { // error
|
||||
cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
}
|
||||
|
||||
// clean up
|
||||
@ -707,8 +706,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
// get the proper run
|
||||
PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName());
|
||||
if (!runData) { // couldn't get run
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -718,10 +717,10 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
histoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(histoNo[i])) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
histoNo.clear();
|
||||
return false;
|
||||
}
|
||||
@ -729,8 +728,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
|
||||
// keep the time resolution in (us)
|
||||
fTimeResolution = runData->GetTimeResolution()/1.0e3;
|
||||
cout.precision(10);
|
||||
cout << endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl;
|
||||
std::cout.precision(10);
|
||||
std::cout << std::endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl;
|
||||
|
||||
// get all the proper t0's and addt0's for the current RUN block
|
||||
if (!GetProperT0(runData, globalBlock, histoNo)) {
|
||||
@ -738,7 +737,7 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
}
|
||||
|
||||
// keep the histo of each group at this point (addruns handled below)
|
||||
vector<PDoubleVector> forward;
|
||||
std::vector<PDoubleVector> forward;
|
||||
forward.resize(histoNo.size()); // resize to number of groups
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
forward[i].resize(runData->GetDataBin(histoNo[i])->size());
|
||||
@ -752,9 +751,9 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -764,8 +763,9 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(histoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if (((Int_t)j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k]);
|
||||
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) >= 0) &&
|
||||
(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -782,8 +782,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
for (UInt_t i=1; i<histoNo.size(); i++) { // loop over the groupings
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays within proper range
|
||||
if (((Int_t)j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+(Int_t)fT0s[i]-(Int_t)fT0s[0]];
|
||||
if ((static_cast<Int_t>(j)+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+static_cast<Int_t>(fT0s[i])-static_cast<Int_t>(fT0s[0])];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -854,10 +854,10 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
} else { // no background given to do the job, try estimate
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
std::cerr << std::endl;
|
||||
if (!EstimateBkg(histoNo))
|
||||
return false;
|
||||
}
|
||||
@ -869,7 +869,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
Int_t t0 = (Int_t)fT0s[0];
|
||||
Int_t t0 = static_cast<Int_t>(fT0s[0]);
|
||||
Double_t value = 0.0;
|
||||
Double_t normalizer = 1.0;
|
||||
// in order that after rebinning the fit does not need to be redone (important for plots)
|
||||
@ -878,7 +878,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
normalizer = fPacking * (fTimeResolution * 1.0e3); // fTimeResolution us->ns
|
||||
// data start at data_start-t0
|
||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-(Double_t)t0+(Double_t)(fPacking-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-static_cast<Double_t>(t0)+static_cast<Double_t>(fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*fPacking);
|
||||
for (Int_t i=fGoodBins[0]; i<fGoodBins[1]; i++) {
|
||||
if (fPacking == 1) {
|
||||
@ -941,22 +941,22 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
if (fScaleN0AndBkg) {
|
||||
dataNorm = 1.0/ (packing * (fTimeResolution * 1.0e3)); // fTimeResolution us->ns
|
||||
} else if (!fScaleN0AndBkg && (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0)) {
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking;
|
||||
theoryNorm = static_cast<Double_t>(fMsrInfo->GetMsrPlotList()->at(0).fViewPacking)/static_cast<Double_t>(fPacking);
|
||||
}
|
||||
|
||||
// raw data, since PMusrCanvas is doing ranging etc.
|
||||
// start = the first bin which is a multiple of packing backward from first good data bin
|
||||
Int_t start = fGoodBins[0] - (fGoodBins[0]/packing)*packing;
|
||||
// end = last bin starting from start which is a multipl of packing and still within the data
|
||||
// end = last bin starting from start which is a multiple of packing and still within the data
|
||||
Int_t end = start + ((fForward.size()-start)/packing)*packing;
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = ((Int_t)fT0s[0]+offset) - (((Int_t)fT0s[0]+offset)/packing)*packing;
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution);
|
||||
start = (static_cast<Int_t>(fT0s[0])+offset) - ((static_cast<Int_t>(fT0s[0])+offset)/packing)*packing;
|
||||
end = start + ((fForward.size()-start)/packing)*packing;
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
@ -966,24 +966,24 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start < 0) || (start > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end < 0) || (end > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
Int_t t0 = (Int_t)fT0s[0];
|
||||
Int_t t0 = static_cast<Int_t>(fT0s[0]);
|
||||
Double_t value = 0.0;
|
||||
// data start at data_start-t0
|
||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start)-static_cast<Double_t>(t0)+static_cast<Double_t>(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*packing);
|
||||
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
@ -1039,10 +1039,10 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
} else { // no background given to do the job, try estimate
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
std::cerr << std::endl;
|
||||
if (!EstimateBkg(histoNo))
|
||||
return false;
|
||||
}
|
||||
@ -1065,7 +1065,7 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > fForward.size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)fForward.size() / (Double_t)size;
|
||||
factor = static_cast<Double_t>(fForward.size()) / static_cast<Double_t>(size);
|
||||
}
|
||||
Double_t time;
|
||||
Double_t theoryValue;
|
||||
@ -1132,13 +1132,13 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
if (fScaleN0AndBkg) {
|
||||
dataNorm = 1.0/ (packing * (fTimeResolution * 1.0e3)); // fTimeResolution us->ns
|
||||
} else if (!fScaleN0AndBkg && (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0)) {
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking;
|
||||
theoryNorm = static_cast<Double_t>(fMsrInfo->GetMsrPlotList()->at(0).fViewPacking)/static_cast<Double_t>(fPacking);
|
||||
}
|
||||
|
||||
// transform raw histo data. This is done the following way (for details see the manual):
|
||||
// for the single histo fit, just the rebinned raw data are copied
|
||||
// first get start data, end data, and t0
|
||||
Int_t t0 = (Int_t)fT0s[0];
|
||||
Int_t t0 = static_cast<Int_t>(fT0s[0]);
|
||||
|
||||
// start = the first bin which is a multiple of packing backward from first good data bin
|
||||
Int_t start = fGoodBins[0] - (fGoodBins[0]/packing)*packing;
|
||||
@ -1147,12 +1147,12 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = ((Int_t)fT0s[0]+offset) - (((Int_t)fT0s[0]+offset)/packing)*packing;
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution);
|
||||
start = (static_cast<Int_t>(fT0s[0])+offset) - ((static_cast<Int_t>(fT0s[0])+offset)/packing)*packing;
|
||||
end = start + ((fForward.size()-start)/packing)*packing;
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// check if start, end, and t0 make any sense
|
||||
@ -1163,15 +1163,15 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start < 0) || (start > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((end < 0) || (end > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1213,10 +1213,10 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
} else { // no background given to do the job, try estimate
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
std::cerr << std::endl;
|
||||
if (!EstimateBkg(histoNo))
|
||||
return false;
|
||||
}
|
||||
@ -1235,7 +1235,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
Double_t time = 0.0;
|
||||
|
||||
// data start at data_start-t0 shifted by (pack-1)/2
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start)-static_cast<Double_t>(t0)+static_cast<Double_t>(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*packing);
|
||||
|
||||
// data is always normalized to (per nsec!!)
|
||||
@ -1244,7 +1244,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
if (((i-start) % packing == 0) && (i != start)) { // fill data
|
||||
value *= dataNorm;
|
||||
time = (((Double_t)i-(Double_t)(packing-1)/2.0)-t0)*fTimeResolution;
|
||||
time = ((static_cast<Double_t>(i)-static_cast<Double_t>(packing-1)/2.0)-t0)*fTimeResolution;
|
||||
expval = TMath::Exp(+time/tau)/N0;
|
||||
fData.AppendValue(-1.0+expval*(value-bkg));
|
||||
fData.AppendErrorValue(expval*TMath::Sqrt(value*dataNorm));
|
||||
@ -1285,7 +1285,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
value = 0.0;
|
||||
error = 0.0;
|
||||
}
|
||||
time = ((Double_t)i-t0)*fTimeResolution;
|
||||
time = (static_cast<Double_t>(i)-t0)*fTimeResolution;
|
||||
expval = TMath::Exp(+time/tau)/N0;
|
||||
rrf_val = (-1.0+expval*(fForward[i]/(fTimeResolution*1.0e3)-bkg))*TMath::Cos(wRRF * time + phaseRRF);
|
||||
value += rrf_val;
|
||||
@ -1310,7 +1310,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
// check if a finer binning for the theory is needed
|
||||
if (fData.GetValue()->size() * 10 > fForward.size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)fForward.size() / (Double_t)size;
|
||||
factor = static_cast<Double_t>(fForward.size()) / static_cast<Double_t>(size);
|
||||
}
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
@ -1321,7 +1321,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
}
|
||||
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (Double_t)i*fData.GetTheoryTimeStep();
|
||||
time = fData.GetTheoryTimeStart() + static_cast<Double_t>(i)*fData.GetTheoryTimeStep();
|
||||
theoryValue = fTheory->Func(time, par, fFuncValues);
|
||||
if (wRRF != 0.0) {
|
||||
theoryValue *= 2.0*TMath::Cos(wRRF * time + phaseRRF);
|
||||
@ -1399,7 +1399,7 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa
|
||||
|
||||
// fill in the T0's from the GLOBAL block section (if present)
|
||||
for (UInt_t i=0; i<globalBlock->GetT0BinSize(); i++) {
|
||||
if (fT0s[i] == -1) { // i.e. not given in the RUN block section
|
||||
if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section
|
||||
fT0s[i] = globalBlock->GetT0Bin(i);
|
||||
}
|
||||
}
|
||||
@ -1420,19 +1420,19 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa
|
||||
fT0s[i] = runData->GetT0BinEstimated(histoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((fT0s[i] < 0.0) || (fT0s[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1445,9 +1445,9 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1478,19 +1478,19 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa
|
||||
fAddT0s[i-1][j] = addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][j], i-1, j); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((fAddT0s[i-1][j] < 0.0) || (fAddT0s[i-1][j] > static_cast<Int_t>(addRunData->GetDataBin(histoNo[j])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1531,19 +1531,19 @@ Bool_t PRunSingleHisto::GetProperDataRange()
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = (Int_t)fT0s[0]+offset;
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution);
|
||||
start = static_cast<Int_t>(fT0s[0])+offset;
|
||||
fRunInfo->SetDataRange(start, 0);
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = fForward.size();
|
||||
fRunInfo->SetDataRange(end, 1);
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// check if start and end make any sense
|
||||
@ -1554,22 +1554,22 @@ Bool_t PRunSingleHisto::GetProperDataRange()
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start < 0) || (start > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if (end < 0) {
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (end > (Int_t)fForward.size()) {
|
||||
cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << (Int_t)fForward.size() << ").";
|
||||
cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
|
||||
cerr << endl;
|
||||
end = (Int_t)fForward.size()-1;
|
||||
if (end > static_cast<Int_t>(fForward.size())) {
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << fForward.size() << ").";
|
||||
std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl;
|
||||
std::cerr << std::endl;
|
||||
end = static_cast<Int_t>(fForward.size())-1;
|
||||
}
|
||||
|
||||
// keep good bins for potential later use
|
||||
@ -1622,8 +1622,8 @@ void PRunSingleHisto::GetProperFitRange(PMsrGlobalBlock *globalBlock)
|
||||
if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) {
|
||||
fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt
|
||||
fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt
|
||||
cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl;
|
||||
cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl;
|
||||
std::cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
|
||||
std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1646,7 +1646,7 @@ void PRunSingleHisto::EstimateN0()
|
||||
assert(param);
|
||||
|
||||
if (paramNo > param->size()) {
|
||||
cerr << endl << ">> PRunSingleHisto::EstimateN0: **ERROR** found parameter number " << paramNo << ", which is larger than the number of parameters = " << param->size() << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::EstimateN0: **ERROR** found parameter number " << paramNo << ", which is larger than the number of parameters = " << param->size() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1663,7 +1663,7 @@ void PRunSingleHisto::EstimateN0()
|
||||
if ((paramNoBkg > 10000) || (paramNoBkg == -1)) { // i.e. fun or map
|
||||
scaleBkg = false;
|
||||
} else {
|
||||
if (paramNoBkg-1 < (Int_t)param->size()) {
|
||||
if (paramNoBkg-1 < static_cast<Int_t>(param->size())) {
|
||||
bkg = param->at(paramNoBkg-1).fValue;
|
||||
errBkg = param->at(paramNoBkg-1).fStep;
|
||||
}
|
||||
@ -1673,7 +1673,7 @@ void PRunSingleHisto::EstimateN0()
|
||||
Double_t dt = fTimeResolution;
|
||||
Double_t tau = PMUON_LIFETIME;
|
||||
|
||||
UInt_t t0 = (UInt_t)round(fT0s[0]);
|
||||
UInt_t t0 = static_cast<UInt_t>(round(fT0s[0]));
|
||||
Double_t dval = 0.0;
|
||||
Double_t nom = 0.0;
|
||||
Double_t denom = 0.0;
|
||||
@ -1681,13 +1681,13 @@ void PRunSingleHisto::EstimateN0()
|
||||
|
||||
// calc nominator
|
||||
for (UInt_t i=t0; i<fForward.size(); i++) {
|
||||
xx = exp(-dt*(Double_t)(i-t0)/tau);
|
||||
xx = exp(-dt*static_cast<Double_t>(i-t0)/tau);
|
||||
nom += xx;
|
||||
}
|
||||
|
||||
// calc denominator
|
||||
for (UInt_t i=t0; i<fForward.size(); i++) {
|
||||
xx = exp(-dt*(Double_t)(i-t0)/tau);
|
||||
xx = exp(-dt*static_cast<Double_t>(i-t0)/tau);
|
||||
dval = fForward[i];
|
||||
if (dval > 0)
|
||||
denom += xx*xx/dval;
|
||||
@ -1707,9 +1707,9 @@ void PRunSingleHisto::EstimateN0()
|
||||
errBkg *= rescale;
|
||||
}
|
||||
|
||||
cout << ">> PRunSingleHisto::EstimateN0: found N0=" << param->at(paramNo-1).fValue << ", will set it to N0=" << N0 << endl;
|
||||
std::cout << ">> PRunSingleHisto::EstimateN0: found N0=" << param->at(paramNo-1).fValue << ", will set it to N0=" << N0 << std::endl;
|
||||
if (scaleBkg)
|
||||
cout << ">> PRunSingleHisto::EstimateN0: found Bkg=" << param->at(paramNoBkg-1).fValue << ", will set it to Bkg=" << bkg << endl;
|
||||
std::cout << ">> PRunSingleHisto::EstimateN0: found Bkg=" << param->at(paramNoBkg-1).fValue << ", will set it to Bkg=" << bkg << std::endl;
|
||||
fMsrInfo->SetMsrParamValue(paramNo-1, N0);
|
||||
fMsrInfo->SetMsrParamStep(paramNo-1, sqrt(fabs(N0)));
|
||||
if (scaleBkg) {
|
||||
@ -1745,41 +1745,41 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo)
|
||||
beamPeriod = 0.0;
|
||||
|
||||
// check if start and end are in proper order
|
||||
UInt_t start = fRunInfo->GetBkgRange(0);
|
||||
UInt_t end = fRunInfo->GetBkgRange(1);
|
||||
Int_t start = fRunInfo->GetBkgRange(0);
|
||||
Int_t end = fRunInfo->GetBkgRange(1);
|
||||
if (end < start) {
|
||||
cout << endl << "PRunSingleHisto::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!";
|
||||
UInt_t keep = end;
|
||||
std::cout << std::endl << "PRunSingleHisto::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!";
|
||||
Int_t keep = end;
|
||||
end = start;
|
||||
start = keep;
|
||||
}
|
||||
|
||||
// calculate proper background range
|
||||
if (beamPeriod != 0.0) {
|
||||
Double_t timeBkg = (Double_t)(end-start)*(fTimeResolution*fPacking); // length of the background intervall in time
|
||||
UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
Double_t timeBkg = static_cast<Double_t>(end-start)*(fTimeResolution*fPacking); // length of the background intervall in time
|
||||
UInt_t fullCycles = static_cast<UInt_t>(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
// correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce
|
||||
end = start + (UInt_t) ((fullCycles*beamPeriod)/(fTimeResolution*fPacking));
|
||||
cout << endl << "PRunSingleHisto::EstimatBkg(): Background " << start << ", " << end;
|
||||
end = start + static_cast<UInt_t>((fullCycles*beamPeriod)/(fTimeResolution*fPacking));
|
||||
std::cout << std::endl << "PRunSingleHisto::EstimatBkg(): Background " << start << ", " << end;
|
||||
if (end == start)
|
||||
end = fRunInfo->GetBkgRange(1);
|
||||
}
|
||||
|
||||
// check if start is within histogram bounds
|
||||
if (start >= fForward.size()) {
|
||||
cerr << endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths = " << fForward.size();
|
||||
cerr << endl << ">> background start = " << start;
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths = " << fForward.size();
|
||||
std::cerr << std::endl << ">> background start = " << start;
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if end is within histogram bounds
|
||||
if (end >= fForward.size()) {
|
||||
cerr << endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths = " << fForward.size();
|
||||
cerr << endl << ">> background end = " << end;
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths = " << fForward.size();
|
||||
std::cerr << std::endl << ">> background end = " << end;
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1821,13 +1821,13 @@ Bool_t PRunSingleHisto::IsScaleN0AndBkg()
|
||||
PMsrLines *cmd = fMsrInfo->GetMsrCommands();
|
||||
for (UInt_t i=0; i<cmd->size(); i++) {
|
||||
if (cmd->at(i).fLine.Contains("SCALE_N0_BKG", TString::kIgnoreCase)) {
|
||||
TObjArray *tokens = 0;
|
||||
TObjString *ostr = 0;
|
||||
TObjArray *tokens = nullptr;
|
||||
TObjString *ostr = nullptr;
|
||||
TString str;
|
||||
tokens = cmd->at(i).fLine.Tokenize(" \t");
|
||||
if (tokens->GetEntries() != 2) {
|
||||
cerr << endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it.";
|
||||
cerr << endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it.";
|
||||
std::cerr << std::endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << std::endl;
|
||||
return willScale;
|
||||
}
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
|
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* Copyright (C) 2007-2019 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -38,7 +38,6 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
#include <TString.h>
|
||||
#include <TObjArray.h>
|
||||
@ -88,24 +87,24 @@ PRunSingleHistoRRF::PRunSingleHistoRRF(PMsrHandler *msrInfo, PRunDataHandler *ra
|
||||
PMsrGlobalBlock *global = msrInfo->GetMsrGlobal();
|
||||
|
||||
if (!global->IsPresent()) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no GLOBAL-block present!";
|
||||
cerr << endl << ">> For Single Histo RRF the GLOBAL-block is mandatory! Please fix this first.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no GLOBAL-block present!";
|
||||
std::cerr << std::endl << ">> For Single Histo RRF the GLOBAL-block is mandatory! Please fix this first.";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!global->GetRRFUnit().CompareTo("??")) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Frequency found!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Frequency found!";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
fRRFPacking = global->GetRRFPacking();
|
||||
if (fRRFPacking == -1) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Packing found!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Packing found!";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -118,9 +117,9 @@ PRunSingleHistoRRF::PRunSingleHistoRRF(PMsrHandler *msrInfo, PRunDataHandler *ra
|
||||
fN0EstimateEndTime = 1.0; // end time in (us) over which N0 is estimated.
|
||||
|
||||
if (!PrepareData()) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: Couldn't prepare data for fitting!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: Couldn't prepare data for fitting!";
|
||||
std::cerr << std::endl << ">> This is very bad :-(, will quit ...";
|
||||
std::cerr << std::endl;
|
||||
fValid = false;
|
||||
}
|
||||
}
|
||||
@ -154,7 +153,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
|
||||
// calculate functions
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
UInt_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
|
||||
@ -175,7 +174,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
diff = fData.GetValue()->at(i) - fTheory->Func(time, par, fFuncValues);
|
||||
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
|
||||
}
|
||||
@ -202,7 +201,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquareExpected(const std::vector<Double_t>&
|
||||
|
||||
// calculate functions
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
UInt_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par);
|
||||
}
|
||||
|
||||
@ -223,7 +222,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquareExpected(const std::vector<Double_t>&
|
||||
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
|
||||
#endif
|
||||
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
|
||||
theo = fTheory->Func(time, par, fFuncValues);
|
||||
diff = fData.GetValue()->at(i) - theo;
|
||||
chisq += diff*diff / theo;
|
||||
@ -275,7 +274,7 @@ void PRunSingleHistoRRF::CalcTheory()
|
||||
Double_t resolution = fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = start + (Double_t)i*resolution;
|
||||
time = start + static_cast<Double_t>(i)*resolution;
|
||||
fData.AppendTheoryValue(fTheory->Func(time, par, fFuncValues));
|
||||
}
|
||||
|
||||
@ -314,8 +313,8 @@ UInt_t PRunSingleHistoRRF::GetNoOfFitBins()
|
||||
*/
|
||||
void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
|
||||
{
|
||||
TObjArray *tok = 0;
|
||||
TObjString *ostr = 0;
|
||||
TObjArray *tok = nullptr;
|
||||
TObjString *ostr = nullptr;
|
||||
TString str;
|
||||
Ssiz_t idx = -1;
|
||||
Int_t offset = 0;
|
||||
@ -324,7 +323,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
|
||||
|
||||
if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -336,7 +335,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(2);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(2));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -350,11 +349,11 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
|
||||
Int_t pos = 2*(fRunNo+1)-1;
|
||||
|
||||
if (pos + 1 >= tok->GetEntries()) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
} else {
|
||||
// handle fgb+n0 entry
|
||||
ostr = (TObjString*) tok->At(pos);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(pos));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("+");
|
||||
@ -366,7 +365,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
|
||||
fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution;
|
||||
|
||||
// handle lgb-n1 entry
|
||||
ostr = (TObjString*) tok->At(pos+1);
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(pos+1));
|
||||
str = ostr->GetString();
|
||||
// check if there is an offset present
|
||||
idx = str.First("-");
|
||||
@ -378,8 +377,8 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
|
||||
fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution;
|
||||
}
|
||||
} else { // error
|
||||
cerr << endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl;
|
||||
}
|
||||
|
||||
// clean up
|
||||
@ -436,8 +435,8 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
// get the proper run
|
||||
PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName());
|
||||
if (!runData) { // couldn't get run
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -447,10 +446,10 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
histoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (!runData->IsPresent(histoNo[i])) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareData(): **PANIC ERROR**:";
|
||||
std::cerr << std::endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
std::cerr << std::endl << ">> Will quit :-(";
|
||||
std::cerr << std::endl;
|
||||
histoNo.clear();
|
||||
return false;
|
||||
}
|
||||
@ -458,8 +457,8 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
|
||||
// keep the time resolution in (us)
|
||||
fTimeResolution = runData->GetTimeResolution()/1.0e3;
|
||||
cout.precision(10);
|
||||
cout << endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl;
|
||||
std::cout.precision(10);
|
||||
std::cout << std::endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl;
|
||||
|
||||
// get all the proper t0's and addt0's for the current RUN block
|
||||
if (!GetProperT0(runData, globalBlock, histoNo)) {
|
||||
@ -467,7 +466,7 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
}
|
||||
|
||||
// keep the histo of each group at this point (addruns handled below)
|
||||
vector<PDoubleVector> forward;
|
||||
std::vector<PDoubleVector> forward;
|
||||
forward.resize(histoNo.size()); // resize to number of groups
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
forward[i].resize(runData->GetDataBin(histoNo[i])->size());
|
||||
@ -481,9 +480,9 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -493,8 +492,9 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(histoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if (((Int_t)j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k]);
|
||||
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) >= 0) &&
|
||||
(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -511,8 +511,9 @@ Bool_t PRunSingleHistoRRF::PrepareData()
|
||||
for (UInt_t i=1; i<histoNo.size(); i++) { // loop over the groupings
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays within proper range
|
||||
if (((Int_t)j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+(Int_t)fT0s[i]-(Int_t)fT0s[0]];
|
||||
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fT0s[i])-static_cast<Int_t>(fT0s[0]) >= 0) &&
|
||||
(j+static_cast<Int_t>(fT0s[i])-static_cast<Int_t>(fT0s[0]) < runData->GetDataBin(histoNo[i])->size())) {
|
||||
fForward[j] += forward[i][j+static_cast<Int_t>(fT0s[i])-static_cast<Int_t>(fT0s[0])];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -567,13 +568,13 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
|
||||
rawNt.push_back(fForward[i]); // N(t) without any corrections
|
||||
}
|
||||
Double_t freqMax = GetMainFrequency(rawNt);
|
||||
cout << "info> freqMax=" << freqMax << " (MHz)" << endl;
|
||||
std::cout << "info> freqMax=" << freqMax << " (MHz)" << std::endl;
|
||||
|
||||
// "optimal packing"
|
||||
Double_t optNoPoints = 8;
|
||||
if (freqMax < 271.0) // < 271 MHz, i.e ~ 2T
|
||||
optNoPoints = 5;
|
||||
cout << "info> optimal packing: " << (Int_t)(1.0 / (fTimeResolution*(freqMax - fMsrInfo->GetMsrGlobal()->GetRRFFreq("MHz"))) / optNoPoints);
|
||||
std::cout << "info> optimal packing: " << static_cast<Int_t>(1.0 / (fTimeResolution*(freqMax - fMsrInfo->GetMsrGlobal()->GetRRFFreq("MHz"))) / optNoPoints);
|
||||
|
||||
// initially fForward is the "raw data set" (i.e. grouped histo and raw runs already added) to be fitted. This means fForward = N(t) at this point.
|
||||
|
||||
@ -586,10 +587,10 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
|
||||
} else { // no background given to do the job, try estimate
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
|
||||
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
|
||||
cerr << endl << ">> PRunSingleHistoRRF::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!";
|
||||
std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
|
||||
std::cerr << std::endl;
|
||||
if (!EstimateBkg(histoNo))
|
||||
return false;
|
||||
}
|
||||
@ -604,10 +605,10 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
|
||||
}
|
||||
// here fForward = N(t) - Nbkg
|
||||
|
||||
Int_t t0 = (Int_t)fT0s[0];
|
||||
Int_t t0 = static_cast<Int_t>(fT0s[0]);
|
||||
|
||||
// 2) N(t) - Nbkg -> exp(+t/tau) [N(t)-Nbkg]
|
||||
Double_t startTime = fTimeResolution * ((Double_t)fGoodBins[0] - (Double_t)t0);
|
||||
Double_t startTime = fTimeResolution * (static_cast<Double_t>(fGoodBins[0]) - static_cast<Double_t>(t0));
|
||||
|
||||
Double_t time_tau=0.0;
|
||||
Double_t exp_t_tau=0.0;
|
||||
@ -650,7 +651,7 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
|
||||
Double_t phaseRRF = globalBlock->GetRRFPhase()*TMath::TwoPi()/180.0;
|
||||
Double_t time = 0.0;
|
||||
for (Int_t i=fGoodBins[0]; i<=fGoodBins[1]; i++) {
|
||||
time = startTime + fTimeResolution * ((Double_t)i - (Double_t)fGoodBins[0]);
|
||||
time = startTime + fTimeResolution * (static_cast<Double_t>(i) - static_cast<Double_t>(fGoodBins[0]));
|
||||
fForward[i] *= 2.0*cos(wRRF * time + phaseRRF);
|
||||
}
|
||||
|
||||
@ -683,7 +684,7 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
|
||||
}
|
||||
|
||||
// set start time and time step
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-(Double_t)t0+(Double_t)(fRRFPacking-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-static_cast<Double_t>(t0)+static_cast<Double_t>(fRRFPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*fRRFPacking);
|
||||
|
||||
CalcNoOfFitBins();
|
||||
@ -723,8 +724,8 @@ Bool_t PRunSingleHistoRRF::PrepareViewData(PRawRunData* runData, const UInt_t hi
|
||||
Int_t viewPacking = fMsrInfo->GetMsrPlotList()->at(0).fViewPacking;
|
||||
if (viewPacking > 0) {
|
||||
if (viewPacking < fRRFPacking) {
|
||||
cerr << ">> PRunSingleHistoRRF::PrepareViewData(): **WARNING** Found View Packing (" << viewPacking << ") < RRF Packing (" << fRRFPacking << ").";
|
||||
cerr << ">> Will ignore View Packing." << endl;
|
||||
std::cerr << ">> PRunSingleHistoRRF::PrepareViewData(): **WARNING** Found View Packing (" << viewPacking << ") < RRF Packing (" << fRRFPacking << ").";
|
||||
std::cerr << ">> Will ignore View Packing." << std::endl;
|
||||
} else {
|
||||
// STILL MISSING
|
||||
}
|
||||
@ -753,14 +754,14 @@ Bool_t PRunSingleHistoRRF::PrepareViewData(PRawRunData* runData, const UInt_t hi
|
||||
|
||||
if (fData.GetValue()->size() * 10 > fForward.size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)fForward.size() / (Double_t)size;
|
||||
factor = static_cast<Double_t>(fForward.size()) / static_cast<Double_t>(size);
|
||||
}
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
|
||||
// calculate theory
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (Double_t)i*fData.GetTheoryTimeStep();
|
||||
time = fData.GetTheoryTimeStart() + static_cast<Double_t>(i)*fData.GetTheoryTimeStep();
|
||||
theoryValue = fTheory->Func(time, par, fFuncValues);
|
||||
if (fabs(theoryValue) > 10.0) { // dirty hack needs to be fixed!!
|
||||
theoryValue = 0.0;
|
||||
@ -808,7 +809,7 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl
|
||||
|
||||
// fill in the T0's from the GLOBAL block section (if present)
|
||||
for (UInt_t i=0; i<globalBlock->GetT0BinSize(); i++) {
|
||||
if (fT0s[i] == -1) { // i.e. not given in the RUN block section
|
||||
if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section
|
||||
fT0s[i] = globalBlock->GetT0Bin(i);
|
||||
}
|
||||
}
|
||||
@ -829,19 +830,19 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl
|
||||
fT0s[i] = runData->GetT0BinEstimated(histoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((fT0s[i] < 0.0) || (fT0s[i] > static_cast<Int_t>(runData->GetDataBin(histoNo[i])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -854,9 +855,9 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
cerr << endl;
|
||||
if (addRunData == nullptr) { // couldn't get run
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -887,19 +888,19 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl
|
||||
fAddT0s[i-1][j] = addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(fAddT0s[i-1][j], i-1, j); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data();
|
||||
std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > static_cast<Int_t>(addRunData->GetDataBin(histoNo[j])->size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -940,19 +941,19 @@ Bool_t PRunSingleHistoRRF::GetProperDataRange()
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = (Int_t)fT0s[0]+offset;
|
||||
Int_t offset = static_cast<Int_t>(10.0e-3/fTimeResolution);
|
||||
start = static_cast<Int_t>(fT0s[0])+offset;
|
||||
fRunInfo->SetDataRange(start, 0);
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = fForward.size();
|
||||
fRunInfo->SetDataRange(end, 1);
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
cerr << endl << ">> NO GUARANTEE THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
// check if start and end make any sense
|
||||
@ -963,22 +964,22 @@ Bool_t PRunSingleHistoRRF::GetProperDataRange()
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
if ((start < 0) || (start > static_cast<Int_t>(fForward.size()))) {
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if (end < 0) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (end > (Int_t)fForward.size()) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << (Int_t)fForward.size() << ").";
|
||||
cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
|
||||
cerr << endl;
|
||||
end = (Int_t)fForward.size()-1;
|
||||
if (end > static_cast<Int_t>(fForward.size())) {
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << fForward.size() << ").";
|
||||
std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl;
|
||||
std::cerr << std::endl;
|
||||
end = static_cast<Int_t>(fForward.size()-1);
|
||||
}
|
||||
|
||||
// keep good bins for potential later use
|
||||
@ -1031,8 +1032,8 @@ void PRunSingleHistoRRF::GetProperFitRange(PMsrGlobalBlock *globalBlock)
|
||||
if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) {
|
||||
fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt
|
||||
fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt
|
||||
cerr << ">> PRunSingleHistoRRF::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl;
|
||||
cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl;
|
||||
std::cerr << ">> PRunSingleHistoRRF::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
|
||||
std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1102,7 +1103,7 @@ Double_t PRunSingleHistoRRF::EstimateN0(Double_t &errN0, Double_t freqMax)
|
||||
{
|
||||
// endBin is estimated such that the number of full cycles (according to the maximum frequency of the data)
|
||||
// is approximately the time fN0EstimateEndTime.
|
||||
Int_t endBin = (Int_t)round(ceil(fN0EstimateEndTime*freqMax/TMath::TwoPi()) * (TMath::TwoPi()/freqMax) / fTimeResolution);
|
||||
Int_t endBin = static_cast<Int_t>(round(ceil(fN0EstimateEndTime*freqMax/TMath::TwoPi()) * (TMath::TwoPi()/freqMax) / fTimeResolution));
|
||||
|
||||
Double_t n0 = 0.0;
|
||||
Double_t wN = 0.0;
|
||||
@ -1120,7 +1121,7 @@ Double_t PRunSingleHistoRRF::EstimateN0(Double_t &errN0, Double_t freqMax)
|
||||
}
|
||||
errN0 = sqrt(errN0)/wN;
|
||||
|
||||
cout << "info> PRunSingleHistoRRF::EstimateN0(): N0=" << n0 << "(" << errN0 << ")" << endl;
|
||||
std::cout << "info> PRunSingleHistoRRF::EstimateN0(): N0=" << n0 << "(" << errN0 << ")" << std::endl;
|
||||
|
||||
return n0;
|
||||
}
|
||||
@ -1155,7 +1156,7 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo)
|
||||
UInt_t start = fRunInfo->GetBkgRange(0);
|
||||
UInt_t end = fRunInfo->GetBkgRange(1);
|
||||
if (end < start) {
|
||||
cout << endl << "PRunSingleHistoRRF::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!";
|
||||
std::cout << std::endl << "PRunSingleHistoRRF::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!";
|
||||
UInt_t keep = end;
|
||||
end = start;
|
||||
start = keep;
|
||||
@ -1163,30 +1164,30 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo)
|
||||
|
||||
// calculate proper background range
|
||||
if (beamPeriod != 0.0) {
|
||||
Double_t timeBkg = (Double_t)(end-start)*fTimeResolution; // length of the background intervall in time
|
||||
UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
Double_t timeBkg = static_cast<Double_t>(end-start)*fTimeResolution; // length of the background intervall in time
|
||||
UInt_t fullCycles = static_cast<UInt_t>(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall
|
||||
// correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce
|
||||
end = start + (UInt_t) ((fullCycles*beamPeriod)/fTimeResolution);
|
||||
cout << endl << "PRunSingleHistoRRF::EstimatBkg(): Background " << start << ", " << end;
|
||||
end = start + static_cast<UInt_t>((fullCycles*beamPeriod)/fTimeResolution);
|
||||
std::cout << std::endl << "PRunSingleHistoRRF::EstimatBkg(): Background " << start << ", " << end;
|
||||
if (end == start)
|
||||
end = fRunInfo->GetBkgRange(1);
|
||||
}
|
||||
|
||||
// check if start is within histogram bounds
|
||||
if (start >= fForward.size()) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths = " << fForward.size();
|
||||
cerr << endl << ">> background start = " << start;
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths = " << fForward.size();
|
||||
std::cerr << std::endl << ">> background start = " << start;
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if end is within histogram bounds
|
||||
if (end >= fForward.size()) {
|
||||
cerr << endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths = " << fForward.size();
|
||||
cerr << endl << ">> background end = " << end;
|
||||
cerr << endl;
|
||||
std::cerr << std::endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
std::cerr << std::endl << ">> histo lengths = " << fForward.size();
|
||||
std::cerr << std::endl << ">> background end = " << end;
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1205,7 +1206,7 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo)
|
||||
bkg += pow(fForward[i]-fBackground, 2.0);
|
||||
fBkgErr = sqrt(bkg/(static_cast<Double_t>(end - start)));
|
||||
|
||||
cout << endl << "info> fBackground=" << fBackground << "(" << fBkgErr << ")" << endl;
|
||||
std::cout << std::endl << "info> fBackground=" << fBackground << "(" << fBkgErr << ")" << std::endl;
|
||||
|
||||
fRunInfo->SetBkgEstimated(fBackground, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user