a first implementation for the triumf mud-format. Start migrating towards real CERN ROOT notation int->Int_t, etc.

This commit is contained in:
nemu
2009-09-30 13:21:49 +00:00
parent dcb77c2e48
commit e38d0793ba
5 changed files with 470 additions and 214 deletions

View File

@ -117,13 +117,25 @@ using namespace std;
/**
* <p> typedef to make to code more readable.
*/
typedef vector<int> PIntVector;
typedef vector<Int_t> PIntVector;
//-------------------------------------------------------------
/**
* <p>
*/
typedef vector<double> PDoubleVector;
typedef vector< pair<Int_t, Int_t> > PIntPairVector;
//-------------------------------------------------------------
/**
* <p>
*/
typedef vector<Double_t> PDoubleVector;
//-------------------------------------------------------------
/**
* <p>
*/
typedef vector< pair<Double_t, Double_t> > PDoublePairVector;
//-------------------------------------------------------------
/**
@ -149,14 +161,14 @@ enum EPMusrHandleTag { kEmpty, kFit, kView };
*/
typedef struct {
// data related info
double fDataTimeStart;
double fDataTimeStep;
Double_t fDataTimeStart;
Double_t fDataTimeStep;
PDoubleVector fX; // only used for non-muSR
PDoubleVector fValue;
PDoubleVector fError;
// theory related info
double fTheoryTimeStart;
double fTheoryTimeStep;
Double_t fTheoryTimeStart;
Double_t fTheoryTimeStep;
PDoubleVector fXTheory; // only used for non-muSR
PDoubleVector fTheory;
} PRunData;
@ -166,7 +178,7 @@ typedef struct {
* <p>
*/
typedef struct {
bool fFromAscii; ///< if true: data file was an ascii input file, otherwise it is a db input file
Bool_t fFromAscii; ///< if true: data file was an ascii input file, otherwise it is a db input file
PStringVector fLabels; ///< vector of all labels (used for x-, y-axis title in view)
PStringVector fDataTags; ///< vector of all data tags
vector<PDoubleVector> fData; ///< vector of all data
@ -181,14 +193,15 @@ typedef struct {
TString fRunName; ///< name of the run
TString fRunTitle; ///< run title
TString fSetup; ///< description of the setup of this run
double fField; ///< magnetic field value
// double fTemp; ///< temperature during the run
vector< pair<double, double> > fTemp; ///< measured temperatures and standard deviations during the run
double fEnergy; ///< implantation energy of the muon
double fTransport; ///< LEM transport settings (Moderator HV)
Double_t fField; ///< magnetic field value
PDoublePairVector fTemp; ///< measured temperatures and standard deviations during the run
Double_t fEnergy; ///< implantation energy of the muon
Double_t fTransport; ///< LEM transport settings (Moderator HV)
PDoubleVector fRingAnode; ///< LEM ring anode HVs (L,R[,T,B])
double fTimeResolution; ///< time resolution of the run
Double_t fTimeResolution; ///< time resolution of the run
PIntVector fT0s; ///< vector of t0's of a run
PIntPairVector fBkgBin; ///< background bins (first/last)
PIntPairVector fGoodDataBin; ///< data bins (first/last)
vector<PDoubleVector> fDataBin; ///< vector of all histos of a run
PNonMusrRawRunData fDataNonMusr; ///< keeps all ascii- or db-file info in case of nonMusr fit
} PRawRunData;
@ -204,7 +217,7 @@ typedef vector<PRawRunData> PRawRunDataList;
* <p> Helper structure for parsing. Keeps a msr-file line string and the corresponding line number.
*/
typedef struct {
int fLineNo; ///< original line number of the msr-file
Int_t fLineNo; ///< original line number of the msr-file
TString fLine; ///< msr-file line
} PMsrLineStructure;
@ -219,17 +232,17 @@ typedef vector<PMsrLineStructure> PMsrLines;
* <p> Holds the information of a parameter.
*/
typedef struct {
int fNoOfParams; ///< how many parameters are given
int fNo; ///< parameter number
TString fName; ///< name
double fValue; ///< value
double fStep; ///< step / error / neg_error, depending on the situation
bool fPosErrorPresent; ///< positive error is defined (as a number)
double fPosError; ///< positive error if present
bool fLowerBoundaryPresent; ///< flag showing if a lower boundary is present
double fLowerBoundary; ///< lower boundary for the fit parameter
bool fUpperBoundaryPresent; ///< flag showing if an upper boundary is present
double fUpperBoundary; ///< upper boundary for the fit parameter
Int_t fNoOfParams; ///< how many parameters are given
Int_t fNo; ///< parameter number
TString fName; ///< name
Double_t fValue; ///< value
Double_t fStep; ///< step / error / neg_error, depending on the situation
Bool_t fPosErrorPresent; ///< positive error is defined (as a number)
Double_t fPosError; ///< positive error if present
Bool_t fLowerBoundaryPresent; ///< flag showing if a lower boundary is present
Double_t fLowerBoundary; ///< lower boundary for the fit parameter
Bool_t fUpperBoundaryPresent; ///< flag showing if an upper boundary is present
Double_t fUpperBoundary; ///< upper boundary for the fit parameter
} PMsrParamStructure;
//-------------------------------------------------------------
@ -244,35 +257,35 @@ typedef vector<PMsrParamStructure> PMsrParamList;
*
*/
typedef struct {
PStringVector fRunName; ///< name of the run file
PStringVector fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type)
PStringVector fInstitute; ///< e.g. psi, ral, triumf (former: run format)
PStringVector fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db
int fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR
int fAlphaParamNo; ///< alpha parameter number (fit type 2, 4)
int fBetaParamNo; ///< beta parameter number (fit type 2, 4)
int fNormParamNo; ///< N0 parameter number (fit type 0)
int fBkgFitParamNo; ///< background fit parameter number (fit type 0)
int fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!!
int fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
bool 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 fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
int 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)
PIntVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
double fFitRange[2]; ///< fit range in (us)
int fPacking; ///< packing/rebinning
double fRRFFreq; ///< rotating reference frequency (fit type 4)
int fRRFPacking; ///< rotating reference packing (fit type 4)
int fAlpha2ParamNo; ///< rotating reference alpha2 (fit type 4)
int fBeta2ParamNo; ///< rotating reference beta2 (fit type 4)
int fRightHistoNo; ///< rotating reference right histogram number (fit type 4)
int fLeftHistoNo; ///< rotating reference left histogram number (fit type 4)
int 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)
PStringVector fRunName; ///< name of the run file
PStringVector fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type)
PStringVector fInstitute; ///< e.g. psi, ral, triumf (former: run format)
PStringVector fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db
Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR
Int_t fAlphaParamNo; ///< alpha parameter number (fit type 2, 4)
Int_t fBetaParamNo; ///< beta parameter number (fit type 2, 4)
Int_t fNormParamNo; ///< N0 parameter number (fit type 0)
Int_t fBkgFitParamNo; ///< background fit parameter number (fit type 0)
Int_t fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!!
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)
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)
PIntVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
Double_t fFitRange[2]; ///< fit range in (us)
Int_t fPacking; ///< packing/rebinning
Double_t fRRFFreq; ///< rotating reference frequency (fit type 4)
Int_t fRRFPacking; ///< rotating reference packing (fit type 4)
Int_t fAlpha2ParamNo; ///< rotating reference alpha2 (fit type 4)
Int_t fBeta2ParamNo; ///< rotating reference beta2 (fit type 4)
Int_t fRightHistoNo; ///< rotating reference right histogram number (fit type 4)
Int_t fLeftHistoNo; ///< rotating reference left histogram number (fit type 4)
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)
} PMsrRunStructure;
//-------------------------------------------------------------
@ -286,16 +299,16 @@ typedef vector<PMsrRunStructure> PMsrRunList;
* <p> Holds the information of the Fourier block
*/
typedef struct {
bool fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file
int fUnits; ///< flag used to indicate the units. 0=field units (G); 1=frequency units (MHz); 2=Mc/s
int fFourierPower; ///< i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
int fApodization; ///< tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak, 2=medium, 3=strong (for details see the docu)
int fPlotTag; ///< tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power, 4=phase
int fPhaseParamNo; ///< parameter number if used instead of a phase value
double fPhase; ///< phase
double fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction
double fPlotRange[2]; ///< field/frequency plot range
double fPhaseIncrement; ///< phase increment for manual phase optimization
Bool_t fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file
Int_t fUnits; ///< flag used to indicate the units. 0=field units (G); 1=frequency units (MHz); 2=Mc/s
Int_t fFourierPower; ///< i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
Int_t fApodization; ///< tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak, 2=medium, 3=strong (for details see the docu)
Int_t fPlotTag; ///< tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power, 4=phase
Int_t fPhaseParamNo; ///< parameter number if used instead of a phase value
Double_t fPhase; ///< phase
Double_t fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction
Double_t fPlotRange[2]; ///< field/frequency plot range
Double_t fPhaseIncrement; ///< phase increment for manual phase optimization
} PMsrFourierStructure;
//-------------------------------------------------------------
@ -303,16 +316,16 @@ typedef struct {
* <p> Holds the information of a single plot block
*/
typedef struct {
int fPlotType; ///< plot type
bool fUseFitRanges; ///< yes -> use the fit ranges to plot the data, no (default) -> use range information if present
bool fLogX; ///< yes -> x-axis in log-scale, no (default) -> x-axis in lin-scale
bool fLogY; ///< yes -> y-axis in log-scale, no (default) -> y-axis in lin-scale
int fViewPacking; ///< -1 -> use the run packing to generate the view, otherwise is fViewPacking for the binning of ALL runs.
PComplexVector fRuns; ///< list of runs to be plotted
PDoubleVector fTmin; ///< time minimum
PDoubleVector fTmax; ///< time maximum
PDoubleVector fYmin; ///< asymmetry/counts minimum
PDoubleVector fYmax; ///< asymmetry/counts maximum
Int_t fPlotType; ///< plot type
Bool_t fUseFitRanges; ///< yes -> use the fit ranges to plot the data, no (default) -> use range information if present
Bool_t fLogX; ///< yes -> x-axis in log-scale, no (default) -> x-axis in lin-scale
Bool_t fLogY; ///< yes -> y-axis in log-scale, no (default) -> y-axis in lin-scale
Int_t fViewPacking; ///< -1 -> use the run packing to generate the view, otherwise is fViewPacking for the binning of ALL runs.
PComplexVector fRuns; ///< list of runs to be plotted
PDoubleVector fTmin; ///< time minimum
PDoubleVector fTmax; ///< time maximum
PDoubleVector fYmin; ///< asymmetry/counts minimum
PDoubleVector fYmax; ///< asymmetry/counts maximum
} PMsrPlotStructure;
//-------------------------------------------------------------
@ -326,12 +339,12 @@ typedef vector<PMsrPlotStructure> PMsrPlotList;
* <p>
*/
typedef struct {
bool fValid;
Bool_t fValid;
PMsrLines fStatLines;
TString fDate; ///< string holding fitting date and time
bool fChisq; ///< flag telling if min = chi2 or min = max.likelyhood
double fMin; ///< chi2 or max. likelyhood
unsigned int fNdf; ///< number of degrees of freedom
Bool_t fChisq; ///< flag telling if min = chi2 or min = max.likelyhood
Double_t fMin; ///< chi2 or max. likelyhood
UInt_t fNdf; ///< number of degrees of freedom
} PMsrStatisticStructure;
#endif // _PMUSR_H_