Added some minor extensions to PMsrHandler and PMsrRunBlock

This commit is contained in:
Bastian M. Wojek 2010-06-08 21:35:19 +00:00
parent c385618291
commit 52d91435c1
3 changed files with 105 additions and 43 deletions

View File

@ -1258,6 +1258,7 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
if (commentsRUN) { if (commentsRUN) {
iter = commentsRUN->find(i + 1); iter = commentsRUN->find(i + 1);
if (iter != commentsRUN->end()) { if (iter != commentsRUN->end()) {
if (!i)
fout << endl; fout << endl;
fout << "# " << iter->second.Data() << endl; fout << "# " << iter->second.Data() << endl;
fout << endl; fout << endl;
@ -1614,10 +1615,10 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << endl; fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << endl;
} }
// phase_increment -- seems to be not used... write it anyway for completeness // // phase_increment -- not used in msr-files at the moment (can only be set through the xml-file)
if (fFourier.fPhaseIncrement) { // if (fFourier.fPhaseIncrement) {
fout << "phase_increment " << fFourier.fPhaseIncrement << endl; // fout << "phase_increment " << fFourier.fPhaseIncrement << endl;
} // }
fout << endl; fout << endl;
fout << hline.Data() << endl; fout << hline.Data() << endl;
@ -1719,7 +1720,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
} }
// rrf_phase // rrf_phase
if (fPlots[i].fRRFPhase) { if (fPlots[i].fRRFPhaseParamNo > 0) {
fout << "rrf_phase par" << fPlots[i].fRRFPhaseParamNo << endl;
} else if (fPlots[i].fRRFPhase) {
fout << "rrf_phase " << fPlots[i].fRRFPhase << endl; fout << "rrf_phase " << fPlots[i].fRRFPhase << endl;
} }
@ -3205,6 +3208,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
param.fRRFPacking = 0; // i.e. if not overwritten it will not be a valid RRF param.fRRFPacking = 0; // i.e. if not overwritten it will not be a valid RRF
param.fRRFFreq = 0.0; // i.e. no RRF whished param.fRRFFreq = 0.0; // i.e. no RRF whished
param.fRRFUnit = RRF_UNIT_MHz; param.fRRFUnit = RRF_UNIT_MHz;
param.fRRFPhaseParamNo = 0; // initial parameter no = 0 means not a parameter
param.fRRFPhase = 0.0; param.fRRFPhase = 0.0;
// find next plot if any is present // find next plot if any is present
@ -3538,6 +3542,9 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
if ((Int_t)fParam.size() < no) { if ((Int_t)fParam.size() < no) {
error = true; error = true;
} else { } else {
// keep the parameter number in case parX was used
param.fRRFPhaseParamNo = no;
// get parameter value
param.fRRFPhase = fParam[no-1].fValue; param.fRRFPhase = fParam[no-1].fValue;
} }
} }

View File

@ -599,6 +599,8 @@ PMsrRunBlock::~PMsrRunBlock()
fBackwardHistoNo.clear(); fBackwardHistoNo.clear();
fMap.clear(); fMap.clear();
fT0.clear(); fT0.clear();
fParGlobal.clear();
fMapGlobal.clear();
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -641,6 +643,9 @@ void PMsrRunBlock::CleanUp()
for (UInt_t i=0; i<fAddT0.size(); i++) for (UInt_t i=0; i<fAddT0.size(); i++)
fAddT0[i].clear(); fAddT0[i].clear();
fAddT0.clear(); fAddT0.clear();
fParGlobal.clear();
fMapGlobal.clear();
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -1217,3 +1222,37 @@ void PMsrRunBlock::SetFitRange(Double_t dval, UInt_t idx)
fFitRange[idx] = dval; fFitRange[idx] = dval;
} }
//--------------------------------------------------------------------------
// SetParGlobal
//--------------------------------------------------------------------------
/**
* <p> store the information that a certain parameter used in the block is global
*
* \param str key (label) telling how the parameter is addressed
* \param ival value to be set (global == 1, run specific == 0, tag not present == -1)
*/
void PMsrRunBlock::SetParGlobal(const TString &str, Int_t ival)
{
fParGlobal[str] = ival; // will either create a new entry or overwrite an old one if the key "str" is present
return;
}
//--------------------------------------------------------------------------
// SetMapGlobal
//--------------------------------------------------------------------------
/**
* <p> store the information that a certain mapped parameter in the block is global
*
* \param idx map-index (0, 1, 2, 3, ...)
* \param ival value to be set (global == 1, run specific == 0, tag not present == -1)
*/
void PMsrRunBlock::SetMapGlobal(UInt_t idx, Int_t ival)
{
if (fMapGlobal.empty())
fMapGlobal.resize(fMap.size(), -1);
if (idx < fMap.size() && fMap[idx] > 0)
fMapGlobal[idx] = ival;
// else do nothing at the moment
return;
}

View File

@ -428,6 +428,8 @@ class PMsrRunBlock {
virtual Int_t GetYDataIndex() { return fXYDataIndex[1]; } virtual Int_t GetYDataIndex() { return fXYDataIndex[1]; }
virtual TString* GetXDataLabel() { return &fXYDataLabel[0]; } virtual TString* GetXDataLabel() { return &fXYDataLabel[0]; }
virtual TString* GetYDataLabel() { return &fXYDataLabel[1]; } virtual TString* GetYDataLabel() { return &fXYDataLabel[1]; }
virtual map<TString, Int_t> *GetParGlobal() { return &fParGlobal; }
virtual PIntVector *GetMapGlobal() { return &fMapGlobal; }
virtual void SetRunName(TString &str, Int_t idx=-1); virtual void SetRunName(TString &str, Int_t idx=-1);
virtual void SetBeamline(TString &str, Int_t idx=-1); virtual void SetBeamline(TString &str, Int_t idx=-1);
@ -454,6 +456,8 @@ class PMsrRunBlock {
virtual void SetYDataIndex(Int_t ival) { fXYDataIndex[1] = ival; } virtual void SetYDataIndex(Int_t ival) { fXYDataIndex[1] = ival; }
virtual void SetXDataLabel(TString& str) { fXYDataLabel[0] = str; } virtual void SetXDataLabel(TString& str) { fXYDataLabel[0] = str; }
virtual void SetYDataLabel(TString& str) { fXYDataLabel[1] = str; } virtual void SetYDataLabel(TString& str) { fXYDataLabel[1] = str; }
virtual void SetParGlobal(const TString &str, Int_t ival);
virtual void SetMapGlobal(UInt_t idx, Int_t ival);
private: private:
PStringVector fRunName; ///< name of the run file PStringVector fRunName; ///< name of the run file
@ -479,6 +483,17 @@ class PMsrRunBlock {
Int_t fPacking; ///< packing/rebinning Int_t fPacking; ///< packing/rebinning
Int_t fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8) Int_t fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8)
TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files (fit type 8) TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files (fit type 8)
// Two members used for msr2data in the global mode: fParGlobal and fMapGlobal
// These are intended to track global and run specific parameters used in the RUN blocks
// Suggested keys for the std::map: (alpha, beta, norm, bkgfit, lifetime)
// Suggested values for the std::map: 1 -> parameter is global
// 0 -> parameter is run specific
// -1 -> tag not present in the RUN block
// The information about global parameters in the map line is stored in an std::vector which should have the same length as the map-vector
// The values in this std::vector can be the same as for the std::map of the other parameters.
map<TString, Int_t> fParGlobal; ///< here is stored if the parameters used in the RUN block are global or not
PIntVector fMapGlobal; ///< here is stored if the maps used in the RUN block are global or not
}; };
//------------------------------------------------------------- //-------------------------------------------------------------
@ -522,6 +537,7 @@ typedef struct {
UInt_t fRRFPacking; ///< rotating reference frame (RRF) packing UInt_t fRRFPacking; ///< rotating reference frame (RRF) packing
Double_t fRRFFreq; ///< RRF frequency Double_t fRRFFreq; ///< RRF frequency
UInt_t fRRFUnit; ///< RRF frequency unit. 0=kHz, 1=MHz, 2=Mc/s, 3=Gauss, 4=Tesla UInt_t fRRFUnit; ///< RRF frequency unit. 0=kHz, 1=MHz, 2=Mc/s, 3=Gauss, 4=Tesla
Int_t fRRFPhaseParamNo; ///< parameter number if used instead of a RRF phase value
Double_t fRRFPhase; ///< RRF phase Double_t fRRFPhase; ///< RRF phase
} PMsrPlotStructure; } PMsrPlotStructure;