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:
nemu
2010-01-28 08:16:40 +00:00
parent f21d5eb2d0
commit 673c5b4f41
3 changed files with 149 additions and 30 deletions

View File

@ -1767,16 +1767,18 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
if (tokens->GetEntries() < 2) { if (tokens->GetEntries() < 2) {
error = true; error = true;
} else { } else {
ostr = dynamic_cast<TObjString*>(tokens->At(1)); for (Int_t i=1; i<tokens->GetEntries(); i++) {
str = ostr->GetString(); ostr = dynamic_cast<TObjString*>(tokens->At(i));
if (str.IsDigit()) { str = ostr->GetString();
dval = str.Atoi(); if (str.IsDigit()) {
if (dval > 0) dval = str.Atoi();
param.SetForwardHistoNo(dval); if (dval > 0)
else param.SetForwardHistoNo(dval);
else
error = true;
} else {
error = true; error = true;
} else { }
error = true;
} }
} }
} }
@ -1789,16 +1791,18 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
if (tokens->GetEntries() < 2) { if (tokens->GetEntries() < 2) {
error = true; error = true;
} else { } else {
ostr = dynamic_cast<TObjString*>(tokens->At(1)); for (Int_t i=1; i<tokens->GetEntries(); i++) {
str = ostr->GetString(); ostr = dynamic_cast<TObjString*>(tokens->At(i));
if (str.IsDigit()) { str = ostr->GetString();
dval = str.Atoi(); if (str.IsDigit()) {
if (dval > 0) dval = str.Atoi();
param.SetBackwardHistoNo(dval); if (dval > 0)
else param.SetBackwardHistoNo(dval);
else
error = true;
} else {
error = true; error = true;
} else { }
error = true;
} }
} }
} }
@ -2775,10 +2779,39 @@ 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 if (error) { // print error message
--iter1; --iter1;
cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** in line " << iter1->fLineNo << ": " << iter1->fLine.Data(); cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** in line " << iter1->fLineNo << ": " << iter1->fLine.Data();

View File

@ -528,8 +528,6 @@ PMsrRunBlock::PMsrRunBlock()
fPhaseParamNo = -1; // undefined phase parameter number fPhaseParamNo = -1; // undefined phase parameter number
fLifetimeParamNo = -1; // undefined lifetime parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number
fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview) 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[0] = PMUSR_UNDEFINED; // undefined start fit range
fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range
fPacking = -1; // undefined packing fPacking = -1; // undefined packing
@ -551,6 +549,8 @@ PMsrRunBlock::~PMsrRunBlock()
fBeamline.clear(); fBeamline.clear();
fInstitute.clear(); fInstitute.clear();
fFileFormat.clear(); fFileFormat.clear();
fForwardHistoNo.clear();
fBackwardHistoNo.clear();
fMap.clear(); fMap.clear();
fBkgFix.clear(); fBkgFix.clear();
fBkgRange.clear(); fBkgRange.clear();
@ -574,8 +574,6 @@ void PMsrRunBlock::CleanUp()
fPhaseParamNo = -1; // undefined phase parameter number fPhaseParamNo = -1; // undefined phase parameter number
fLifetimeParamNo = -1; // undefined lifetime parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number
fLifetimeCorrection = true; // lifetime correction == true by default (used in single histogram musrview) 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[0] = PMUSR_UNDEFINED; // undefined start fit range
fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range
fPacking = -1; // undefined packing fPacking = -1; // undefined packing
@ -588,6 +586,8 @@ void PMsrRunBlock::CleanUp()
fBeamline.clear(); fBeamline.clear();
fInstitute.clear(); fInstitute.clear();
fFileFormat.clear(); fFileFormat.clear();
fForwardHistoNo.clear();
fBackwardHistoNo.clear();
fMap.clear(); fMap.clear();
fBkgFix.clear(); fBkgFix.clear();
fBkgRange.clear(); fBkgRange.clear();
@ -723,6 +723,86 @@ void PMsrRunBlock::SetFileFormat(TString &str, UInt_t i)
fFileFormat[i] = str; 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 // GetMap
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@ -157,7 +157,13 @@ typedef vector<Double_t> PDoubleVector;
/** /**
* <p> * <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 Bool_t IsLifetimeCorrected() { return fLifetimeCorrection; }
virtual PIntVector* GetMap() { return &fMap; } virtual PIntVector* GetMap() { return &fMap; }
virtual Int_t GetMap(UInt_t idx); virtual Int_t GetMap(UInt_t idx);
virtual Int_t GetForwardHistoNo() { return fForwardHistoNo; } virtual Int_t GetForwardHistoNo(UInt_t i=0);
virtual Int_t GetBackwardHistoNo() { return fBackwardHistoNo; } virtual Int_t GetBackwardHistoNo(UInt_t i=0);
virtual UInt_t GetBkgFixSize() { return fBkgFix.size(); } virtual UInt_t GetBkgFixSize() { return fBkgFix.size(); }
virtual Double_t GetBkgFix(UInt_t i=0); virtual Double_t GetBkgFix(UInt_t i=0);
virtual UInt_t GetBkgRangeSize() { return fBkgRange.size(); } virtual UInt_t GetBkgRangeSize() { return fBkgRange.size(); }
@ -430,8 +436,8 @@ class PMsrRunBlock {
virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; } virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; }
virtual void AppendMap(Int_t ival) { fMap.push_back(ival); } virtual void AppendMap(Int_t ival) { fMap.push_back(ival); }
virtual void SetMap(Int_t mapVal, UInt_t idx); virtual void SetMap(Int_t mapVal, UInt_t idx);
virtual void SetForwardHistoNo(Int_t ival) { fForwardHistoNo = ival; } virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1);
virtual void SetBackwardHistoNo(Int_t ival) { fBackwardHistoNo = ival; } virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1);
virtual void AppendBkgFix(Double_t dval) { fBkgFix.push_back(dval); } virtual void AppendBkgFix(Double_t dval) { fBkgFix.push_back(dval); }
virtual void SetBkgFix(Double_t dval, UInt_t idx); virtual void SetBkgFix(Double_t dval, UInt_t idx);
virtual void AppendBkgRange(Int_t ival) { fBkgRange.push_back(ival); } 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) Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (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 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) PIntVector fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
Int_t fBackwardHistoNo; ///< backward histogram number (fit type 2, 4) PIntVector fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
PDoubleVector fBkgFix; ///< fixed background in (1/ns) (fit type 0, 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 fBkgRange; ///< background bin range (fit type 0, 2, 4)
PIntVector fDataRange; ///< data bin range (fit type 0, 2, 4) PIntVector fDataRange; ///< data bin range (fit type 0, 2, 4)