Improved issue described in MuSR-121 (wrong run numbers in plot block). Started with the implementation of MuSR-120 (adding histos; no adding implemented yet).
This commit is contained in:
@ -1767,7 +1767,8 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
if (tokens->GetEntries() < 2) {
|
||||
error = true;
|
||||
} else {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
dval = str.Atoi();
|
||||
@ -1780,6 +1781,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// backward -----------------------------------------------
|
||||
if (iter->fLine.BeginsWith("backward", TString::kIgnoreCase)) {
|
||||
@ -1789,7 +1791,8 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
if (tokens->GetEntries() < 2) {
|
||||
error = true;
|
||||
} else {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
dval = str.Atoi();
|
||||
@ -1802,6 +1805,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// backgr.fix ----------------------------------------------
|
||||
if (iter->fLine.BeginsWith("backgr.fix", TString::kIgnoreCase)) {
|
||||
@ -2775,8 +2779,37 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
||||
}
|
||||
}
|
||||
|
||||
fPlots.push_back(param);
|
||||
// check if runs listed in the plot block indeed to exist
|
||||
for (UInt_t i=0; i<param.fRuns.size(); i++) {
|
||||
if (param.fRuns[i] > static_cast<Int_t>(fRuns.size())) {
|
||||
cerr << endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number " << param.fRuns[i] << ".";
|
||||
cerr << endl << ">> There are only " << fRuns.size() << " runs present, will ignore this run.";
|
||||
cerr << endl;
|
||||
param.fRuns.erase(param.fRuns.begin()+i);
|
||||
i--;
|
||||
}
|
||||
if (param.fRuns[i] == 0) {
|
||||
cerr << endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number 0.";
|
||||
cerr << endl << ">> Pot number needs to be > 0. Will ignore this entry.";
|
||||
cerr << endl;
|
||||
param.fRuns.erase(param.fRuns.begin()+i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (param.fRuns.size() > 0) {
|
||||
fPlots.push_back(param);
|
||||
} else {
|
||||
cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block entries, will ignore the entire PLOT block.";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fPlots.size() == 0) {
|
||||
error = true;
|
||||
cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block at all present. Fix this first!";
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
if (error) { // print error message
|
||||
|
@ -528,8 +528,6 @@ PMsrRunBlock::PMsrRunBlock()
|
||||
fPhaseParamNo = -1; // undefined phase parameter number
|
||||
fLifetimeParamNo = -1; // undefined lifetime parameter number
|
||||
fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview)
|
||||
fForwardHistoNo = -1; // undefined forward histogram number
|
||||
fBackwardHistoNo = -1; // undefined backward histogram number
|
||||
fFitRange[0] = PMUSR_UNDEFINED; // undefined start fit range
|
||||
fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range
|
||||
fPacking = -1; // undefined packing
|
||||
@ -551,6 +549,8 @@ PMsrRunBlock::~PMsrRunBlock()
|
||||
fBeamline.clear();
|
||||
fInstitute.clear();
|
||||
fFileFormat.clear();
|
||||
fForwardHistoNo.clear();
|
||||
fBackwardHistoNo.clear();
|
||||
fMap.clear();
|
||||
fBkgFix.clear();
|
||||
fBkgRange.clear();
|
||||
@ -574,8 +574,6 @@ void PMsrRunBlock::CleanUp()
|
||||
fPhaseParamNo = -1; // undefined phase parameter number
|
||||
fLifetimeParamNo = -1; // undefined lifetime parameter number
|
||||
fLifetimeCorrection = true; // lifetime correction == true by default (used in single histogram musrview)
|
||||
fForwardHistoNo = -1; // undefined forward histogram number
|
||||
fBackwardHistoNo = -1; // undefined backward histogram number
|
||||
fFitRange[0] = PMUSR_UNDEFINED; // undefined start fit range
|
||||
fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range
|
||||
fPacking = -1; // undefined packing
|
||||
@ -588,6 +586,8 @@ void PMsrRunBlock::CleanUp()
|
||||
fBeamline.clear();
|
||||
fInstitute.clear();
|
||||
fFileFormat.clear();
|
||||
fForwardHistoNo.clear();
|
||||
fBackwardHistoNo.clear();
|
||||
fMap.clear();
|
||||
fBkgFix.clear();
|
||||
fBkgRange.clear();
|
||||
@ -723,6 +723,86 @@ void PMsrRunBlock::SetFileFormat(TString &str, UInt_t i)
|
||||
fFileFormat[i] = str;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetForwardHistoNo
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> get forward histogram value at position i
|
||||
*
|
||||
* \param i index of the forward histogram value to be returned
|
||||
*/
|
||||
Int_t PMsrRunBlock::GetForwardHistoNo(UInt_t i)
|
||||
{
|
||||
if (fForwardHistoNo.empty())
|
||||
return -1;
|
||||
|
||||
if (i>fForwardHistoNo.size())
|
||||
return -1;
|
||||
|
||||
return fForwardHistoNo[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetForwardHistoNo
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set forward histogram value at position pos
|
||||
*
|
||||
* \param histoNo histogram value
|
||||
* \param idx index whithin the fForwardHistoNo vector where to set the value.
|
||||
* If idx == -1, then append the value to the vector.
|
||||
*/
|
||||
void PMsrRunBlock::SetForwardHistoNo(Int_t histoNo, Int_t idx)
|
||||
{
|
||||
if (idx == -1) { // i.e. append forward histo no
|
||||
fForwardHistoNo.push_back(histoNo);
|
||||
} else {
|
||||
if (idx >= static_cast<Int_t>(fForwardHistoNo.size()))
|
||||
fForwardHistoNo.resize(idx+1);
|
||||
fForwardHistoNo[idx] = histoNo;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetBackwardHistoNo
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> get backward histogram value at position i
|
||||
*
|
||||
* \param i index of the map value to be returned
|
||||
*/
|
||||
Int_t PMsrRunBlock::GetBackwardHistoNo(UInt_t i)
|
||||
{
|
||||
if (fBackwardHistoNo.empty())
|
||||
return -1;
|
||||
|
||||
if (i>fBackwardHistoNo.size())
|
||||
return -1;
|
||||
|
||||
return fBackwardHistoNo[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetBackwardHistoNo
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set backward histogram value at position pos
|
||||
*
|
||||
* \param histoNo histogram value
|
||||
* \param idx index whithin the fBackwardHistoNo vector where to set the value.
|
||||
* If idx == -1, then append the value to the vector.
|
||||
*/
|
||||
void PMsrRunBlock::SetBackwardHistoNo(Int_t histoNo, Int_t idx)
|
||||
{
|
||||
if (idx == -1) { // i.e. append forward histo no
|
||||
fBackwardHistoNo.push_back(histoNo);
|
||||
} else {
|
||||
if (idx >= static_cast<Int_t>(fBackwardHistoNo.size()))
|
||||
fBackwardHistoNo.resize(idx+1);
|
||||
fBackwardHistoNo[idx] = histoNo;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMap
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -157,7 +157,13 @@ typedef vector<Double_t> PDoubleVector;
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
typedef vector< pair<Double_t, Double_t> > PDoublePairVector;
|
||||
typedef pair<Double_t, Double_t> PDoublePair;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
typedef vector<PDoublePair> PDoublePairVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
@ -395,8 +401,8 @@ class PMsrRunBlock {
|
||||
virtual Bool_t IsLifetimeCorrected() { return fLifetimeCorrection; }
|
||||
virtual PIntVector* GetMap() { return &fMap; }
|
||||
virtual Int_t GetMap(UInt_t idx);
|
||||
virtual Int_t GetForwardHistoNo() { return fForwardHistoNo; }
|
||||
virtual Int_t GetBackwardHistoNo() { return fBackwardHistoNo; }
|
||||
virtual Int_t GetForwardHistoNo(UInt_t i=0);
|
||||
virtual Int_t GetBackwardHistoNo(UInt_t i=0);
|
||||
virtual UInt_t GetBkgFixSize() { return fBkgFix.size(); }
|
||||
virtual Double_t GetBkgFix(UInt_t i=0);
|
||||
virtual UInt_t GetBkgRangeSize() { return fBkgRange.size(); }
|
||||
@ -430,8 +436,8 @@ class PMsrRunBlock {
|
||||
virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; }
|
||||
virtual void AppendMap(Int_t ival) { fMap.push_back(ival); }
|
||||
virtual void SetMap(Int_t mapVal, UInt_t idx);
|
||||
virtual void SetForwardHistoNo(Int_t ival) { fForwardHistoNo = ival; }
|
||||
virtual void SetBackwardHistoNo(Int_t ival) { fBackwardHistoNo = ival; }
|
||||
virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1);
|
||||
virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1);
|
||||
virtual void AppendBkgFix(Double_t dval) { fBkgFix.push_back(dval); }
|
||||
virtual void SetBkgFix(Double_t dval, UInt_t idx);
|
||||
virtual void AppendBkgRange(Int_t ival) { fBkgRange.push_back(ival); }
|
||||
@ -461,8 +467,8 @@ class PMsrRunBlock {
|
||||
Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
|
||||
Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0)
|
||||
PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory
|
||||
Int_t fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
|
||||
Int_t fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
|
||||
PIntVector fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
|
||||
PIntVector fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
|
||||
PDoubleVector fBkgFix; ///< fixed background in (1/ns) (fit type 0, 2, 4)
|
||||
PIntVector fBkgRange; ///< background bin range (fit type 0, 2, 4)
|
||||
PIntVector fDataRange; ///< data bin range (fit type 0, 2, 4)
|
||||
|
Reference in New Issue
Block a user