musrfit  1.9.2
PRunDataHandler Class Reference

#include <PRunDataHandler.h>

Collaboration diagram for PRunDataHandler:

Public Member Functions

 PRunDataHandler ()
 
 PRunDataHandler (TString fileName, const TString fileFormat)
 
 PRunDataHandler (TString fileName, const TString fileFormat, const PStringVector dataPath)
 
 PRunDataHandler (TString fileName, const TString fileFormat, const TString dataPath, PRawRunData &runData)
 
 PRunDataHandler (PAny2ManyInfo *any2ManyInfo)
 
 PRunDataHandler (PAny2ManyInfo *any2ManyInfo, const PStringVector dataPath)
 
 PRunDataHandler (PMsrHandler *msrInfo)
 
 PRunDataHandler (PMsrHandler *msrInfo, const PStringVector dataPath)
 
virtual ~PRunDataHandler ()
 
virtual void ReadData ()
 
virtual void ConvertData ()
 
virtual Bool_t WriteData (TString fileName="")
 
virtual Bool_t IsAllDataAvailable () const
 
virtual PRawRunDataGetRunData (const TString &runName)
 
virtual PRawRunDataGetRunData (const UInt_t idx=0)
 
virtual Int_t GetNoOfRunData ()
 
virtual Bool_t SetRunData (PRawRunData *data, UInt_t idx=0)
 

Private Member Functions

virtual void Init (const Int_t tag=0)
 
virtual Bool_t ReadFilesMsr ()
 
virtual Bool_t ReadWriteFilesList ()
 
virtual Bool_t FileAlreadyRead (TString runName)
 
virtual void TestFileName (TString &runName, const TString &ext)
 
virtual Bool_t FileExistsCheck (PMsrRunBlock &runInfo, const UInt_t idx)
 
virtual Bool_t FileExistsCheck (const Bool_t fileName, const Int_t idx)
 
virtual Bool_t FileExistsCheck (const TString fileName)
 
virtual Bool_t ReadRootFile ()
 
virtual Bool_t ReadNexusFile ()
 
virtual Bool_t ReadWkmFile ()
 
virtual Bool_t ReadPsiBinFile ()
 
virtual Bool_t ReadMudFile ()
 
virtual Bool_t ReadMduAsciiFile ()
 
virtual Bool_t ReadAsciiFile ()
 
virtual Bool_t ReadDBFile ()
 
virtual Bool_t ReadDatFile ()
 
virtual Bool_t WriteMusrRootFile (TString fln="")
 
virtual Bool_t WriteRootFile (TString fln="")
 
virtual Bool_t WriteNexusFile (TString fln="")
 
virtual Bool_t WriteWkmFile (TString fln="")
 
virtual Bool_t WritePsiBinFile (TString fln="")
 
virtual Bool_t WriteMudFile (TString fln="")
 
virtual Bool_t WriteAsciiFile (TString fln="")
 
virtual Bool_t StripWhitespace (TString &str)
 
virtual Bool_t IsWhitespace (const Char_t *str)
 
virtual Double_t ToDouble (TString &str, Bool_t &ok)
 
virtual Int_t ToInt (TString &str, Bool_t &ok)
 
virtual Int_t GetDataTagIndex (TString &str, const PStringVector *fLabels)
 
virtual TString GenerateOutputFileName (const TString fileName, const TString extension, Bool_t &ok)
 
virtual TString GetFileName (const TString extension, Bool_t &ok)
 
virtual TString FileNameFromTemplate (TString &fileNameTemplate, Int_t run, TString &year, Bool_t &ok)
 
virtual bool DateToISO8601 (std::string inDate, std::string &iso8601Date)
 
virtual void SplitTimeDate (TString timeDate, TString &time, TString &date, Bool_t &ok)
 
virtual TString GetMonth (Int_t month)
 
virtual TString GetYear (Int_t month)
 

Private Attributes

PMsrHandlerfMsrInfo
 pointer to the msr-file handler More...
 
PAny2ManyInfofAny2ManyInfo
 pointer to the any2many data structure More...
 
PStringVector fDataPath
 vector containing all the search paths where to look for data files More...
 
Bool_t fAllDataAvailable
 flag indicating if all data sets could be read More...
 
TString fFileFormat
 keeps the file format if explicitly given More...
 
TString fRunName
 current run name More...
 
TString fRunPathName
 current path file name More...
 
PRawRunDataList fData
 keeping all the raw data More...
 

Detailed Description

Handler class needed to read/handle raw data files.

Definition at line 41 of file PRunDataHandler.h.

Constructor & Destructor Documentation

◆ PRunDataHandler() [1/8]

PRunDataHandler::PRunDataHandler ( )

Empty Constructor

Definition at line 93 of file PRunDataHandler.cpp.

References Init().

◆ PRunDataHandler() [2/8]

PRunDataHandler::PRunDataHandler ( TString  fileName,
const TString  fileFormat 
)

Constructor which just reads a single muSR data file.

Parameters
fileName
fileFormat

Definition at line 107 of file PRunDataHandler.cpp.

References FileExistsCheck(), and Init().

◆ PRunDataHandler() [3/8]

PRunDataHandler::PRunDataHandler ( TString  fileName,
const TString  fileFormat,
const PStringVector  dataPath 
)

Constructor which just reads a single muSR data file.

Parameters
fileName
fileFormat
dataPath

Definition at line 124 of file PRunDataHandler.cpp.

References FileExistsCheck(), and Init().

◆ PRunDataHandler() [4/8]

PRunDataHandler::PRunDataHandler ( TString  fileName,
const TString  fileFormat,
const TString  dataPath,
PRawRunData runData 
)

Constructor which just writes a single muSR data file.

Parameters
fileName
fileFormat
dataPath
runData

Definition at line 142 of file PRunDataHandler.cpp.

References Init().

◆ PRunDataHandler() [5/8]

PRunDataHandler::PRunDataHandler ( PAny2ManyInfo any2ManyInfo)

Constructor, reading the data histogramm files.

Parameters
msrInfopointer to the msr-file handler

Definition at line 155 of file PRunDataHandler.cpp.

References Init(), and PHR_INIT_ANY2MANY.

◆ PRunDataHandler() [6/8]

PRunDataHandler::PRunDataHandler ( PAny2ManyInfo any2ManyInfo,
const PStringVector  dataPath 
)

Constructor, reading the data histogramm files.

Parameters
any2ManyInfopointer to the PAny2ManyInfo structure needed to convert data
dataPathcontains all data search paths.

Definition at line 169 of file PRunDataHandler.cpp.

References Init(), and PHR_INIT_ANY2MANY.

◆ PRunDataHandler() [7/8]

PRunDataHandler::PRunDataHandler ( PMsrHandler msrInfo)

Constructor, reading the data histogramm files.

Parameters
msrInfopointer to the msr-file handler

Definition at line 183 of file PRunDataHandler.cpp.

References Init(), and PHR_INIT_MSR.

◆ PRunDataHandler() [8/8]

PRunDataHandler::PRunDataHandler ( PMsrHandler msrInfo,
const PStringVector  dataPath 
)

Constructor, reading the data histogramm files, and keeping a copy of potential search paths.

Parameters
msrInfopointer to the msr-file handler
dataPathvector containing search paths where to find raw data files.

Definition at line 198 of file PRunDataHandler.cpp.

References Init(), and PHR_INIT_MSR.

◆ ~PRunDataHandler()

PRunDataHandler::~PRunDataHandler ( )
virtual

Destructor.

Definition at line 210 of file PRunDataHandler.cpp.

References fData, and fDataPath.

Member Function Documentation

◆ ConvertData()

void PRunDataHandler::ConvertData ( )
virtual

Read data and convert it. This routine is used by any2many.

Definition at line 321 of file PRunDataHandler.cpp.

References fAllDataAvailable, and ReadWriteFilesList().

◆ DateToISO8601()

bool PRunDataHandler::DateToISO8601 ( std::string  inDate,
std::string &  iso8601Date 
)
privatevirtual

If possible converts a inDate, into a ISO8601 standard date.

return: true if conversion was successfull otherwise false.

Parameters
inDateinput date which should be converted to an ISO 8601 date.
iso8601Dateon success the converted iso8601Date, otherwise an empty string

Definition at line 6394 of file PRunDataHandler.cpp.

Referenced by ReadPsiBinFile().

◆ FileAlreadyRead()

Bool_t PRunDataHandler::FileAlreadyRead ( TString  runName)
privatevirtual

Checks if a file has been already read in order to prevent multiple reading of data files.

return:

  • true if the file has been read before,
  • otherwise false.
Parameters
runNamerun name to be check if the corresponding file is already read.

Definition at line 922 of file PRunDataHandler.cpp.

References fData.

Referenced by ReadFilesMsr().

◆ FileExistsCheck() [1/3]

Bool_t PRunDataHandler::FileExistsCheck ( PMsrRunBlock runInfo,
const UInt_t  idx 
)
privatevirtual

Checks if a given data file exists.

return:

  • true if data file exists,
  • otherwise false.
Parameters
runInforeference to the msr-run-structure
idxindex of the run (needed for ADDRUN feature).

Definition at line 1049 of file PRunDataHandler.cpp.

References fDataPath, fMsrInfo, fRunPathName, PMsrRunBlock::GetBeamline(), PMsrRunBlock::GetFileFormat(), PMsrRunBlock::GetInstitute(), PMsrHandler::GetMsrFileDirectoryPath(), PMsrRunBlock::GetRunName(), PMsrRunBlock::SetBeamline(), PMsrRunBlock::SetFileFormat(), PMsrRunBlock::SetInstitute(), and TestFileName().

Referenced by PRunDataHandler(), ReadFilesMsr(), and ReadWriteFilesList().

◆ FileExistsCheck() [2/3]

Bool_t PRunDataHandler::FileExistsCheck ( const Bool_t  fileName,
const Int_t  idx 
)
privatevirtual

Checks if a given data file exists. Used for the any2many program.

return:

  • true if data file exists,
  • otherwise false.
Parameters
fileNameflag showing if a file name shall be handled or a run number
idxindex of the run. idx == -1 means that a single input data file name is given.

Definition at line 1258 of file PRunDataHandler.cpp.

References fAny2ManyInfo, fDataPath, FileNameFromTemplate(), fRunPathName, PAny2ManyInfo::inFileName, PAny2ManyInfo::inTemplate, PAny2ManyInfo::outTemplate, PAny2ManyInfo::runList, and PAny2ManyInfo::year.

◆ FileExistsCheck() [3/3]

Bool_t PRunDataHandler::FileExistsCheck ( const TString  fileName)
privatevirtual

Checks if a given data file exists. Used for the any2many program.

return:

  • true if data file exists,
  • otherwise false.
Parameters
fileNamefile name

Definition at line 1354 of file PRunDataHandler.cpp.

References fDataPath, and fRunPathName.

◆ FileNameFromTemplate()

TString PRunDataHandler::FileNameFromTemplate ( TString &  fileNameTemplate,
Int_t  run,
TString &  year,
Bool_t &  ok 
)
privatevirtual

Will, based on the fileNameTemplate construct a file name. The file name template has a run tag and a year tag. The run tag has the form [rrrr], whereas the number of 'r' defines the length of this string part. If the run number is shorter, leading zeros will be filled, e.g. [rrrrrr] and run==123 will lead to '000123'. The same is true for the year tag [yy], except that the length must agree. For example: fileNameTemplate = d[yyyy]/deltat_tdc_gps_[rrrr].bin, run = 123, year = 2009 will result in 'd2009/deltat_tdc_gps_0123.bin'.

return:

  • constructed file name from template, run number, and year
  • empty string
Parameters
templatetemplate string
runrun number
yearyear
oktrue if operation went smooth, otherwise false

Definition at line 6305 of file PRunDataHandler.cpp.

Referenced by FileExistsCheck(), and ReadWriteFilesList().

◆ GenerateOutputFileName()

TString PRunDataHandler::GenerateOutputFileName ( const TString  fileName,
const TString  extension,
Bool_t &  ok 
)
privatevirtual

Generates the output file name (any2many). It also makes sure that the generated output file name does not coincidentally is identical to an already existing file.

return:

  • constructed file name
  • empty string
Parameters
fileName
extensionif the file name to be constructed
okflag which is 'true' if the file name could be constructed, 'false' otherwise

Definition at line 6198 of file PRunDataHandler.cpp.

References PAny2ManyInfo::compressionTag, fAny2ManyInfo, GetFileName(), PAny2ManyInfo::outPath, PAny2ManyInfo::outPathFileName, and PAny2ManyInfo::useStandardOutput.

Referenced by WriteAsciiFile(), WriteMudFile(), WriteMusrRootFile(), WriteNexusFile(), WritePsiBinFile(), WriteRootFile(), and WriteWkmFile().

◆ GetDataTagIndex()

Int_t PRunDataHandler::GetDataTagIndex ( TString &  str,
const PStringVector dataTags 
)
privatevirtual

Checks if str is in a list of data tags

return:

  • if found returns the data tag index (from the dataTags vector),
  • otherwise -1
Parameters
strdata tag string (see description of nonMusr db-data)
dataTagsvector of all data tags

Definition at line 6166 of file PRunDataHandler.cpp.

Referenced by ReadDBFile().

◆ GetFileName()

TString PRunDataHandler::GetFileName ( const TString  extension,
Bool_t &  ok 
)
privatevirtual

Construct the file name based on the any2many request.

return:

  • constructed file name
  • empty string
Parameters
extensionif the file name to be constructed
okflag which is 'true' if the file name could be constructed, 'false' otherwise

Definition at line 6254 of file PRunDataHandler.cpp.

References fAny2ManyInfo, fRunPathName, PAny2ManyInfo::inFormat, PAny2ManyInfo::outFormat, PAny2ManyInfo::outPath, and PAny2ManyInfo::rebin.

Referenced by GenerateOutputFileName().

◆ GetMonth()

TString PRunDataHandler::GetMonth ( Int_t  month)
privatevirtual

given the month as number, convert it to a 3 character month. If month is out of range (i.e. not between 1 and 12) a '???' will be returned.

Parameters
monthas number

Definition at line 6451 of file PRunDataHandler.cpp.

Referenced by WritePsiBinFile().

◆ GetNoOfRunData()

virtual Int_t PRunDataHandler::GetNoOfRunData ( )
inlinevirtual

Definition at line 61 of file PRunDataHandler.h.

References fData.

◆ GetRunData() [1/2]

PRawRunData * PRunDataHandler::GetRunData ( const TString &  runName)
virtual

◆ GetRunData() [2/2]

PRawRunData * PRunDataHandler::GetRunData ( const UInt_t  idx = 0)
virtual

return data-set with index idx.

return:

  • if data are found: pointer to the data.
  • otherwise the null pointer will be returned.
Parameters
idxindex of the raw data set.

Definition at line 256 of file PRunDataHandler.cpp.

References fData.

◆ GetYear()

TString PRunDataHandler::GetYear ( Int_t  year)
privatevirtual

given the year as number, convert it to a 2 character year. If year is out of range '??' will be returned. This routine will break in the year 2100 or later ;-)

Parameters
yearas number

Definition at line 6509 of file PRunDataHandler.cpp.

Referenced by WritePsiBinFile().

◆ Init()

void PRunDataHandler::Init ( const Int_t  tag = 0)
privatevirtual

Common initializer.

Definition at line 433 of file PRunDataHandler.cpp.

References fAllDataAvailable, fAny2ManyInfo, fFileFormat, fMsrInfo, fRunName, fRunPathName, PHR_INIT_ALL, PHR_INIT_ANY2MANY, and PHR_INIT_MSR.

Referenced by PRunDataHandler().

◆ IsAllDataAvailable()

virtual Bool_t PRunDataHandler::IsAllDataAvailable ( ) const
inlinevirtual

Definition at line 58 of file PRunDataHandler.h.

References fAllDataAvailable.

◆ IsWhitespace()

Bool_t PRunDataHandler::IsWhitespace ( const Char_t *  str)
privatevirtual

Check if a string consists only of white spaces, i.e. spaces and/or ctrl-characters.

return:

  • true at successful reading,
  • otherwise false.
Parameters
strstring to be checked

Definition at line 6037 of file PRunDataHandler.cpp.

Referenced by ReadWkmFile().

◆ ReadAsciiFile()

Bool_t PRunDataHandler::ReadAsciiFile ( )
privatevirtual

Reads ascii files. Intended for the nonMuSR data.

The file format definition is: Comment lines start with a '#' or '' character. The file can start with some header info. The header is optional, as all its tags, but if present it has the following format:

* HEADER
* TITLE:  title
* X-AXIS-TITLE: x-axis title
* Y-AXIS-TITLE: y-axis title
* SETUP:  setup
* FIELD:  field
* TEMP:   temperature
* ENERGY: energy
* 

field is assumed to be given in (G), the temperature in (K), the energy in (keV)

The data are read column like and start with the data tag DATA, followed by the data columns, i.e.:

* DATA
* x, y [, error y]
* 

where spaces, column, are a tab are possible separations. If no error in y is present, the weighting in the fit will be equal.

return:

  • true at successful reading,
  • otherwise false.

Definition at line 3696 of file PRunDataHandler.cpp.

References PNonMusrRawRunData::AppendData(), PNonMusrRawRunData::AppendErrData(), PNonMusrRawRunData::AppendLabel(), fData, PRawRunData::fDataNonMusr, fRunName, fRunPathName, PMUSR_UNDEFINED, PRawRunData::SetEnergy(), PRawRunData::SetField(), PNonMusrRawRunData::SetFromAscii(), PNonMusrRawRunData::SetLabel(), PRawRunData::SetRunName(), PRawRunData::SetRunTitle(), PRawRunData::SetSetup(), PRawRunData::SetTemperature(), and PRawRunData::SetTransport().

Referenced by ReadFilesMsr().

◆ ReadData()

void PRunDataHandler::ReadData ( )
virtual

Read data. Used to read data, either msr-file triggered, or a single explicit data file should be read.

Definition at line 271 of file PRunDataHandler.cpp.

References fAllDataAvailable, fFileFormat, fMsrInfo, fRunPathName, ReadFilesMsr(), ReadMudFile(), ReadNexusFile(), ReadPsiBinFile(), ReadRootFile(), and ReadWkmFile().

◆ ReadDatFile()

Bool_t PRunDataHandler::ReadDatFile ( )
privatevirtual

Reads column like data sets as generated by msr2data with the option 'data'. This can be used for the 'non muSR fit' type.

return:

  • true at successful reading,
  • otherwise false.

Definition at line 4353 of file PRunDataHandler.cpp.

References PNonMusrRawRunData::AppendDataTag(), PNonMusrRawRunData::AppendLabel(), PNonMusrRawRunData::AppendSubData(), PNonMusrRawRunData::AppendSubErrData(), fData, PRawRunData::fDataNonMusr, fRunName, fRunPathName, PNonMusrRawRunData::GetData(), PNonMusrRawRunData::GetErrData(), PNonMusrRawRunData::SetFromAscii(), PRawRunData::SetRunName(), and PNonMusrRawRunData::SetSize().

Referenced by ReadFilesMsr().

◆ ReadDBFile()

Bool_t PRunDataHandler::ReadDBFile ( )
privatevirtual

Reads triumf db-files. Intended for the nonMuSR data.

The file format definition is: The following is a description of the features of the TRIUMF .db file format that are currently recognized by musrfit/musrview. The available commands include: title, abstract, comments, labels, and data.

* TITLE
*  The following line must contain the title.
*
*
* ABSTRACT
*  The abstract is read in starting with the following line until an empty line is reached.
*
* COMMENTS
*  The comments are read in starting with the following line until an empty line is reached.
*
*
* LABELS
*  One label must occupy each subsequent line until an empty line is reached. The number 
*  of labels should preferably match the number of variables in the data.
*
* DATA
*  On the same line as the DATA command, there must appear a comma-delimited list of variable 
*  names. These names should be kept short (some applications truncate to 4 characters). The 
*  numerical data is read in beginning with the following line until an empty line is reached.
*
*  In every line, there must appear exactly 3 comma-delimited fields for each specified name. 
*  The first field is the value, the second is the positive error, and the third is the negative 
*  error. If you leave the last field blank (the comma is still required), then the positive error 
*  will be interpreted as a symmetric error. If you include only the value, then the errors will be 
*  set to zero.
*
* To reiterate, if you provide a DATA command with 2 names, e.g. "DATA 1st, 2nd", then every subsequent 
* line must contain 2*3 - 1 = 5 commas. If you give 3 names, then there must be 3*3 - 1 = 8 commas.
* 
* Example 
* TITLE
*  Most Excellent Fake Data
*
* ABSTRACT
*  This data was collected over
*  many minutes of light work
*  that was required to make it up.
*
* COMMENTS
*  This data was generated using C++.
*  The file was formatted with Emacs.
*
* LABEL
*  Randomized Linear
*  Randomized Gaussian
*  Randomized Lorentzian
*  Run
*
* DATA line, gauss, lrntz, run
* -1.966, -0.168, -0.106,  0.048, 0.002, 0.005,  0.184, 0.010, 0.017, 1001, , , run 1001 title
* -1.895, -0.151, -0.128,  0.014, 0.001, 0.001,  0.259, 0.017, 0.015, 1002, , , run 1002 title
* -1.836, -0.127, -0.184,  0.013, 0.001, 0.001,  0.202, 0.017, 0.020, 1003, , , run 1003 title
* -1.739, -0.064, -0.166,  0.057, 0.003, 0.004,  0.237, 0.016, 0.018, 1004, , , run 1004 title
* -1.601, -0.062, -0.147,  0.104, 0.008, 0.006,  0.271, 0.012, 0.025, 1005, , , run 1005 title
*  .        .        .          .        .        .          .        .        .
*  .        .        .          .        .        .          .        .        .
*  .        .        .          .        .        .          .        .        .
* Alternatively, the data often utilizes the continuation character ('\') and is labelled like
* DATA line, gauss, lrntz
* linear = -1.966,  -0.168,  -0.106, \
* gaussn =  0.048,   0.002,   0.005, \
* lorntz =  0.184,   0.010,   0.017, \
* 1001,,, run 1001 title
* linear = -1.895,  -0.151,  -0.128, \
* gaussn =  0.014,   0.001,   0.001, \
* lorntz =  0.259,   0.017,   0.015, |
* 1002,,, run 1002 title
* linear = -1.836,  -0.127,  -0.184, \
* gaussn =  0.013,   0.001,   0.001, \
* lorntz =  0.202,   0.017,   0.020, |
* 1003,,, run 1003 title
*   .        .        .        .
*   .        .        .        .
*   .        .        .        .
* If there is a run line as in the above examples, it must be at the end of the data and given
* in this just slight odd manner (do not blame me, I haven't invented this format ;-) ).
* 

WARNING:For the row like data representation (the top DATA representation shown) it is essential that there are always at least one space inbetween commas (the reason is that I am too lazy to write my own tokenizer), e.g.

* -1.966, -0.168, ,  0.048, , ,  0.184, 0.010, 0.017, 1001, , , run 1001 title
* 

which is ok, but

* -1.966, -0.168,,  0.048,,,  0.184, 0.010, 0.017, 1001,,, run 1001 title
* 

will not work!

Some db-files do have a '\-e' or '\e' label just between the DATA tag line and the real data. This tag will just be ignored.

return:

  • true at successful reading,
  • otherwise false.

Definition at line 4007 of file PRunDataHandler.cpp.

References PNonMusrRawRunData::AppendData(), PNonMusrRawRunData::AppendDataTag(), PNonMusrRawRunData::AppendErrData(), PNonMusrRawRunData::AppendLabel(), PNonMusrRawRunData::AppendSubData(), PNonMusrRawRunData::AppendSubErrData(), fData, PRawRunData::fDataNonMusr, fRunName, fRunPathName, PNonMusrRawRunData::GetData(), GetDataTagIndex(), PNonMusrRawRunData::GetDataTags(), PNonMusrRawRunData::GetErrData(), PNonMusrRawRunData::GetLabels(), PNonMusrRawRunData::SetFromAscii(), PRawRunData::SetRunName(), and PRawRunData::SetRunTitle().

Referenced by ReadFilesMsr().

◆ ReadFilesMsr()

Bool_t PRunDataHandler::ReadFilesMsr ( )
privatevirtual

The main read file routine which is filtering what read sub-routine needs to be called. Called when the input is a msr-file.

return:

  • true if reading was successful,
  • false if reading failed.

Definition at line 457 of file PRunDataHandler.cpp.

References FileAlreadyRead(), FileExistsCheck(), fMsrInfo, fRunName, PMsrHandler::GetMsrRunList(), PRH_PPC_OFFSET, ReadAsciiFile(), ReadDatFile(), ReadDBFile(), ReadMduAsciiFile(), ReadMudFile(), ReadNexusFile(), ReadPsiBinFile(), ReadRootFile(), and ReadWkmFile().

Referenced by ReadData().

◆ ReadMduAsciiFile()

Bool_t PRunDataHandler::ReadMduAsciiFile ( )
privatevirtual

Reads the mdu ascii files (PSI). Needed to work around PSI-BIN limitations.

Lines starting with '#' or '' are considered as comment lines. The file has the following structure:

* HEADER
* TITLE: title-string
* SETUP: setup-string
* FIELD: val-string (G) or (T) (e.g. 123456 (G))
* TEMP: val-string (K)
* GROUPS: # of histograms written
* CHANNELS: # of bins per histogram written
* RESOLUTION: timeresolution (fs) or (ps) or (ns) or (us)
* 

followed by the data, which are written in column format, starting with the DATA tag, i.e.

* DATA
* 
* 

return:

  • true at successful reading,
  • otherwise false.

Definition at line 3383 of file PRunDataHandler.cpp.

References PRawRunDataSet::Clear(), fData, fRunName, fRunPathName, PRawRunDataSet::SetData(), PRawRunData::SetDataSet(), PRawRunData::SetField(), PRawRunDataSet::SetHistoNo(), PRawRunData::SetRunName(), PRawRunData::SetRunTitle(), PRawRunData::SetSetup(), PRawRunData::SetTemperature(), PRawRunData::SetTimeResolution(), and PRawRunDataSet::SetTimeZeroBinEstimated().

Referenced by ReadFilesMsr().

◆ ReadMudFile()

◆ ReadNexusFile()

◆ ReadPsiBinFile()

◆ ReadRootFile()

Bool_t PRunDataHandler::ReadRootFile ( )
privatevirtual

Reads both, the "old" LEM-data ROOT-files with TLemRunHeader, and the more general new MusrRoot file.

return:

  • true at successful reading,
  • otherwise false.

Definition at line 1420 of file PRunDataHandler.cpp.

References PRawRunDataSet::Clear(), PRawRunData::ClearTemperature(), fAny2ManyInfo, fData, fRunName, fRunPathName, TMusrRunPhysicalQuantity::GetError(), TMusrRunPhysicalQuantity::GetUnit(), TMusrRunPhysicalQuantity::GetValue(), PAny2ManyInfo::groupHistoList, MRH_UNDEFINED, POST_PILEUP_HISTO_OFFSET, PRH_LEM_ROOT, PRH_MUSR_ROOT, PRawRunData::SetBeamline(), PRawRunData::SetComment(), PRawRunData::SetCryoName(), PRawRunDataSet::SetData(), PRawRunData::SetDataSet(), PRawRunData::SetEnergy(), PRawRunData::SetField(), PRawRunData::SetFileName(), PRawRunDataSet::SetFirstGoodBin(), PRawRunData::SetGenerator(), PRawRunData::SetGenericValidatorUrl(), PRawRunDataSet::SetHistoNo(), PRawRunData::SetInstrument(), PRawRunData::SetLaboratory(), PRawRunDataSet::SetLastGoodBin(), PRawRunData::SetMagnetName(), PRawRunData::SetMuonBeamMomentum(), PRawRunData::SetMuonSource(), PRawRunData::SetMuonSpecies(), PRawRunData::SetMuonSpinAngle(), PRawRunDataSet::SetName(), PRawRunData::SetRedGreenOffset(), PRawRunData::SetRingAnode(), PRawRunData::SetRunName(), PRawRunData::SetRunNumber(), PRawRunData::SetRunTitle(), PRawRunData::SetSample(), PRawRunData::SetSetup(), PRawRunData::SetSpecificValidatorUrl(), PRawRunData::SetStartDate(), PRawRunData::SetStartDateTime(), PRawRunData::SetStartTime(), PRawRunData::SetStopDate(), PRawRunData::SetStopDateTime(), PRawRunData::SetStopTime(), PRawRunData::SetTemperature(), PRawRunData::SetTimeResolution(), PRawRunDataSet::SetTimeZeroBin(), PRawRunDataSet::SetTimeZeroBinEstimated(), PRawRunData::SetTransport(), and PRawRunData::SetVersion().

Referenced by ReadData(), ReadFilesMsr(), and ReadWriteFilesList().

◆ ReadWkmFile()

◆ ReadWriteFilesList()

Bool_t PRunDataHandler::ReadWriteFilesList ( )
privatevirtual

◆ SetRunData()

Bool_t PRunDataHandler::SetRunData ( PRawRunData data,
UInt_t  idx = 0 
)
virtual

Set a raw run data set.

Parameters
datapointer to the raw run data set
idxindex to where to write it.
Returns
true in case of success, false otherwise.

Definition at line 340 of file PRunDataHandler.cpp.

References fData.

◆ SplitTimeDate()

void PRunDataHandler::SplitTimeDate ( TString  timeData,
TString &  time,
TString &  date,
Bool_t &  ok 
)
privatevirtual

splits an ISO 8601 timeDate into seperate time and data. The flag ok shows if it was successfull.

Parameters
timeDataISO 8601 timeData
timepart of timeData
datepart of timeData
okflag showing if the splitting was successfull

Definition at line 6424 of file PRunDataHandler.cpp.

Referenced by ReadNexusFile().

◆ StripWhitespace()

Bool_t PRunDataHandler::StripWhitespace ( TString &  str)
privatevirtual

Strip white spaces from a string. The hope is that future TString implementations of ROOT will make this routine obsolate.

Parameters
strstring to be stripped. It will be modified directly on success.

return:

  • true at successful reading,
  • otherwise false.

Definition at line 5965 of file PRunDataHandler.cpp.

Referenced by ReadWkmFile().

◆ TestFileName()

void PRunDataHandler::TestFileName ( TString &  runName,
const TString &  ext 
)
privatevirtual

Tests if a file exists (with or without given extension). The given file-name string will be modified to show the found file name or an empty string if no file is found.

Parameters
runNamerun name with full path to be checked
extextension to be checked

Definition at line 943 of file PRunDataHandler.cpp.

Referenced by FileExistsCheck().

◆ ToDouble()

Double_t PRunDataHandler::ToDouble ( TString &  str,
Bool_t &  ok 
)
privatevirtual

Convert a string to a Double_t.

return:

  • returns the converted string
  • otherwise 0.0 with ok==false
Parameters
strstring to be converted
oktrue on success, otherwise false.

Definition at line 6066 of file PRunDataHandler.cpp.

References status.

Referenced by ReadWkmFile().

◆ ToInt()

Int_t PRunDataHandler::ToInt ( TString &  str,
Bool_t &  ok 
)
privatevirtual

Convert a string to an Int_t.

return:

  • returns the converted string
  • otherwise 0.0 with ok==false
Parameters
strstring to be converted
oktrue on success, otherwise false.

Definition at line 6116 of file PRunDataHandler.cpp.

References status.

Referenced by ReadWkmFile().

◆ WriteAsciiFile()

Bool_t PRunDataHandler::WriteAsciiFile ( TString  fln = "")
privatevirtual

Write the ascii-file format.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 5824 of file PRunDataHandler.cpp.

References PAny2ManyInfo::compressionTag, fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PRawRunDataSet::GetTimeZeroBin(), PMUSR_UNDEFINED, PAny2ManyInfo::rebin, and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList().

◆ WriteData()

Bool_t PRunDataHandler::WriteData ( TString  fileName = "")
virtual

◆ WriteMudFile()

Bool_t PRunDataHandler::WriteMudFile ( TString  fln = "")
privatevirtual

Write the mud-file format.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 5664 of file PRunDataHandler.cpp.

References PAny2ManyInfo::compressionTag, fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PRawRunDataSet::GetFirstGoodBin(), PRawRunDataSet::GetLastGoodBin(), PRawRunDataSet::GetName(), PRawRunDataSet::GetTimeZeroBin(), PAny2ManyInfo::rebin, and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList(), and WriteData().

◆ WriteMusrRootFile()

Bool_t PRunDataHandler::WriteMusrRootFile ( TString  fln = "")
privatevirtual

Write the MusrRoot file format. Only the required entries will be handled.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 4502 of file PRunDataHandler.cpp.

References PAny2ManyInfo::compressionTag, fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PRawRunDataSet::GetFirstGoodBin(), PRawRunDataSet::GetHistoNo(), PRawRunDataSet::GetLastGoodBin(), PRawRunDataSet::GetName(), PRawRunDataSet::GetTimeZeroBin(), MRH_UNDEFINED, PAny2ManyInfo::rebin, TMusrRunPhysicalQuantity::Set(), and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList(), and WriteData().

◆ WriteNexusFile()

Bool_t PRunDataHandler::WriteNexusFile ( TString  fln = "")
privatevirtual

Write the nexus-file format.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 4948 of file PRunDataHandler.cpp.

References fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PRawRunDataSet::GetFirstGoodBin(), PRawRunDataSet::GetLastGoodBin(), PRawRunDataSet::GetTimeZeroBin(), PAny2ManyInfo::idf, PAny2ManyInfo::outFormat, PAny2ManyInfo::rebin, and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList(), and WriteData().

◆ WritePsiBinFile()

Bool_t PRunDataHandler::WritePsiBinFile ( TString  fln = "")
privatevirtual

Write the psi-bin-file format.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 5424 of file PRunDataHandler.cpp.

References fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PRawRunDataSet::GetFirstGoodBin(), PRawRunDataSet::GetLastGoodBin(), GetMonth(), PRawRunDataSet::GetName(), PRawRunDataSet::GetTimeZeroBin(), GetYear(), PAny2ManyInfo::groupHistoList, PAny2ManyInfo::rebin, status, and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList(), and WriteData().

◆ WriteRootFile()

Bool_t PRunDataHandler::WriteRootFile ( TString  fln = "")
privatevirtual

Write the PSI LEM root-file format.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 4758 of file PRunDataHandler.cpp.

References PAny2ManyInfo::compressionTag, fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PRawRunDataSet::GetTimeZeroBin(), PAny2ManyInfo::rebin, and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList().

◆ WriteWkmFile()

Bool_t PRunDataHandler::WriteWkmFile ( TString  fln = "")
privatevirtual

Write the wkm-file format.

return:

  • true on successful writting,
  • otherwise false.
Parameters
flnfile name. If empty, the routine will try to construct one

Definition at line 5279 of file PRunDataHandler.cpp.

References PAny2ManyInfo::compressionTag, fAny2ManyInfo, fData, GenerateOutputFileName(), PRawRunDataSet::GetData(), PAny2ManyInfo::groupHistoList, PMUSR_UNDEFINED, PAny2ManyInfo::rebin, and PAny2ManyInfo::useStandardOutput.

Referenced by ReadWriteFilesList().

Member Data Documentation

◆ fAllDataAvailable

Bool_t PRunDataHandler::fAllDataAvailable
private

flag indicating if all data sets could be read

Definition at line 70 of file PRunDataHandler.h.

Referenced by ConvertData(), Init(), IsAllDataAvailable(), and ReadData().

◆ fAny2ManyInfo

◆ fData

◆ fDataPath

PStringVector PRunDataHandler::fDataPath
private

vector containing all the search paths where to look for data files

Definition at line 68 of file PRunDataHandler.h.

Referenced by FileExistsCheck(), and ~PRunDataHandler().

◆ fFileFormat

TString PRunDataHandler::fFileFormat
private

keeps the file format if explicitly given

Definition at line 71 of file PRunDataHandler.h.

Referenced by Init(), and ReadData().

◆ fMsrInfo

PMsrHandler* PRunDataHandler::fMsrInfo
private

pointer to the msr-file handler

Definition at line 66 of file PRunDataHandler.h.

Referenced by FileExistsCheck(), Init(), ReadData(), and ReadFilesMsr().

◆ fRunName

TString PRunDataHandler::fRunName
private

◆ fRunPathName

TString PRunDataHandler::fRunPathName
private

The documentation for this class was generated from the following files: