musrfit 1.10.0
TMusrRunHeader Class Reference

#include <TMusrRunHeader.h>

Inheritance diagram for TMusrRunHeader:
Collaboration diagram for TMusrRunHeader:

Public Member Functions

 TMusrRunHeader (bool quiet=false)
 
 TMusrRunHeader (const char *fileName, bool quiet=false)
 
virtual ~TMusrRunHeader ()
 
virtual TString GetFileName ()
 
virtual Bool_t FillFolder (TFolder *folder)
 
virtual Bool_t FillDirectory (TDirectory *dir)
 
virtual Bool_t ExtractAll (TFolder *folder)
 
virtual Bool_t ExtractAll (TDirectory *dir)
 
virtual Bool_t ExtractHeaderInformationData (TObjString *headerData, TString path)
 
virtual Bool_t ExtractHeaderInformation (TObjArray *headerInfo, TString path)
 
virtual TString GetTypeOfPath (TString pathName)
 
virtual void Get (TString pathName, TString &value, Bool_t &ok)
 
virtual void Get (TString pathName, Int_t &value, Bool_t &ok)
 
virtual void Get (TString pathName, Double_t &value, Bool_t &ok)
 
virtual void Get (TString pathName, TMusrRunPhysicalQuantity &value, Bool_t &ok)
 
virtual void Get (TString pathName, TStringVector &value, Bool_t &ok)
 
virtual void Get (TString pathName, TIntVector &value, Bool_t &ok)
 
virtual void Get (TString pathName, TDoubleVector &value, Bool_t &ok)
 
virtual void SetFileName (TString fln)
 
virtual void Set (TString pathName, TString value)
 
virtual void Set (TString pathName, Int_t value)
 
virtual void Set (TString pathName, Double_t value)
 
virtual void Set (TString pathName, TMusrRunPhysicalQuantity value)
 
virtual void Set (TString pathName, TStringVector value)
 
virtual void Set (TString pathName, TIntVector value)
 
virtual void Set (TString pathName, TDoubleVector value)
 
virtual void DumpHeader ()
 

Private Member Functions

virtual void Init (TString str="n/a")
 
virtual void CleanUp ()
 
virtual UInt_t GetDecimalPlace (Double_t val)
 
virtual UInt_t GetLeastSignificantDigit (Double_t val) const
 
virtual void SplitPathName (TString pathName, TString &path, TString &name)
 
virtual TString GetLabel (TString str)
 
virtual TString GetStrValue (TString str)
 
virtual TString GetType (TString str)
 
virtual bool UpdateFolder (TObject *treeObj, TString path)
 
virtual bool UpdateDirTree (TDirectory *topdir)
 
virtual TObject * FindObject (TObject *treeObj, TString path)
 
virtual TObjString GetHeaderString (UInt_t idx)
 
virtual bool RemoveFirst (TString &str, const char splitter)
 
virtual TString GetFirst (TString &str, const char splitter)
 

Private Attributes

bool fQuiet
 
TString fFileName
 
TString fVersion
 
std::vector< TMusrRunObject< TString > > fStringObj
 
std::vector< TMusrRunObject< Int_t > > fIntObj
 
std::vector< TMusrRunObject< Double_t > > fDoubleObj
 
std::vector< TMusrRunObject< TMusrRunPhysicalQuantity > > fMusrRunPhysQuantityObj
 
std::vector< TMusrRunObject< TStringVector > > fStringVectorObj
 
std::vector< TMusrRunObject< TIntVector > > fIntVectorObj
 
std::vector< TMusrRunObject< TDoubleVector > > fDoubleVectorObj
 
std::vector< TString > fPathNameOrder
 keeps the path-name as they were created in ordered to keep ordering
 

Detailed Description

Definition at line 123 of file TMusrRunHeader.h.

Constructor & Destructor Documentation

◆ TMusrRunHeader() [1/2]

TMusrRunHeader::TMusrRunHeader ( bool quiet = false)

◆ TMusrRunHeader() [2/2]

TMusrRunHeader::TMusrRunHeader ( const char * fileName,
bool quiet = false )

Constructor.

Parameters
fileNamefile name of the MusrRoot file.
quietif set to true, warnings will be omited. Default is false.

Definition at line 232 of file TMusrRunHeader.cpp.

References fQuiet, and Init().

◆ ~TMusrRunHeader()

TMusrRunHeader::~TMusrRunHeader ( )
virtual

Destructor.

Definition at line 305 of file TMusrRunHeader.cpp.

References CleanUp().

Member Function Documentation

◆ CleanUp()

void TMusrRunHeader::CleanUp ( )
privatevirtual

◆ DumpHeader()

◆ ExtractAll() [1/2]

Bool_t TMusrRunHeader::ExtractAll ( TDirectory * dir)
virtual

Reads all data from an open ROOT-file structure and feeds all the necessary internal data objects.

Parameters
dirTDirectory object. The top one will be 'RunHeader'.
Returns
true on success.

Definition at line 960 of file TMusrRunHeader.cpp.

References CleanUp(), ExtractAll(), and ExtractHeaderInformationData().

◆ ExtractAll() [2/2]

Bool_t TMusrRunHeader::ExtractAll ( TFolder * folder)
virtual

Reads all data from an open ROOT-file structure and feeds all the necessary internal data objects.

Parameters
foldertop folder 'RunHeader'.
Returns
true on success

Definition at line 934 of file TMusrRunHeader.cpp.

References CleanUp(), and ExtractHeaderInformation().

Referenced by ExtractAll().

◆ ExtractHeaderInformation()

Bool_t TMusrRunHeader::ExtractHeaderInformation ( TObjArray * headerInfo,
TString requestedPath )
virtual

TFolder releated routine needed to recursively decode the header information.

Parameters
headerInfoheader info object. It is either a TObjArray or a data object.
requestedPathcorresponding TFolder/TDiretory path.
Returns
true on success

Definition at line 1207 of file TMusrRunHeader.cpp.

References ExtractHeaderInformation(), and ExtractHeaderInformationData().

Referenced by ExtractAll(), and ExtractHeaderInformation().

◆ ExtractHeaderInformationData()

Bool_t TMusrRunHeader::ExtractHeaderInformationData ( TObjString * headerData,
TString requestedPath )
virtual

Extract the header information data and fills the corresponing objects.

Parameters
headerDataencoded header data.
requestedPathcorresponding TFolder/TDiretory path.
Returns
true on success

Definition at line 999 of file TMusrRunHeader.cpp.

References GetLabel(), GetStrValue(), GetType(), Set(), TMusrRunPhysicalQuantity::SetDemand(), TMusrRunPhysicalQuantity::SetDescription(), TMusrRunPhysicalQuantity::SetError(), TMusrRunPhysicalQuantity::SetLabel(), TMusrRunPhysicalQuantity::SetUnit(), and TMusrRunPhysicalQuantity::SetValue().

Referenced by ExtractAll(), and ExtractHeaderInformation().

◆ FillDirectory()

Bool_t TMusrRunHeader::FillDirectory ( TDirectory * dir)
virtual

Fills the RunHeader directory. This is needed to write it to a ROOT file. It walks through all information and attaches it to the directory or replaces it, if it is already present.

Parameters
dirto be filled
Returns
true in success

Definition at line 413 of file TMusrRunHeader.cpp.

References fPathNameOrder, GetFirst(), GetHeaderString(), and UpdateDirTree().

◆ FillFolder()

Bool_t TMusrRunHeader::FillFolder ( TFolder * folder)
virtual

Fills the RunHeader folder. This is needed to write it to a ROOT file. It walks through all information and attaches it to the folder or replaces it, if it is already present.

Parameters
folderto be filled
Returns
true on success

Definition at line 341 of file TMusrRunHeader.cpp.

References FindObject(), fPathNameOrder, GetFirst(), GetHeaderString(), and UpdateFolder().

Referenced by main().

◆ FindObject()

TObject * TMusrRunHeader::FindObject ( TObject * treeObj,
TString path )
privatevirtual

Check if 'path' is present in 'treeObj'

Parameters
treeObjto be searched
pathsearched for within 'treeObj'
Returns
pointer to the 'path' object if present, otherwise return nullptr

Definition at line 1714 of file TMusrRunHeader.cpp.

References FindObject(), GetFirst(), and RemoveFirst().

Referenced by FillFolder(), and FindObject().

◆ Get() [1/7]

void TMusrRunHeader::Get ( TString pathName,
Double_t & value,
Bool_t & ok )
virtual

Get Double_t 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Time Zero Bin
valueDouble_t return value
okflag telling if the Double_t value was found

Definition at line 584 of file TMusrRunHeader.cpp.

References fDoubleObj.

◆ Get() [2/7]

void TMusrRunHeader::Get ( TString pathName,
Int_t & value,
Bool_t & ok )
virtual

Get Int_t 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Number
valueInt_t return value
okflag telling if the Int_t value was found

Definition at line 562 of file TMusrRunHeader.cpp.

References fIntObj.

◆ Get() [3/7]

void TMusrRunHeader::Get ( TString pathName,
TDoubleVector & value,
Bool_t & ok )
virtual

Get TDoubleVector 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Title
valueTDoubleVector return value
okflag telling if the TDoubleVector value was found

Definition at line 672 of file TMusrRunHeader.cpp.

References fDoubleVectorObj.

◆ Get() [4/7]

void TMusrRunHeader::Get ( TString pathName,
TIntVector & value,
Bool_t & ok )
virtual

Get TIntVector 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Title
valueTIntVector return value
okflag telling if the TIntVector value was found

Definition at line 650 of file TMusrRunHeader.cpp.

References fIntVectorObj.

◆ Get() [5/7]

void TMusrRunHeader::Get ( TString pathName,
TMusrRunPhysicalQuantity & value,
Bool_t & ok )
virtual

Get TMusrRunPhysicalQuantity 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Title
valueTMusrRunPhysicalQuantity return value
okflag telling if the TMusrRunPhysicalQuantity value was found

Definition at line 606 of file TMusrRunHeader.cpp.

References fMusrRunPhysQuantityObj.

◆ Get() [6/7]

void TMusrRunHeader::Get ( TString pathName,
TString & value,
Bool_t & ok )
virtual

Get TString 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Title
valueTString return value
okflag telling if the TString value was found

Definition at line 540 of file TMusrRunHeader.cpp.

References fStringObj.

◆ Get() [7/7]

void TMusrRunHeader::Get ( TString pathName,
TStringVector & value,
Bool_t & ok )
virtual

Get TStringVector 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Title
valueTStringVector return value
okflag telling if the TStringVector value was found

Definition at line 628 of file TMusrRunHeader.cpp.

References fStringVectorObj.

◆ GetDecimalPlace()

UInt_t TMusrRunHeader::GetDecimalPlace ( Double_t val)
privatevirtual

Check decimal place of val. If val > 1.0, the function will return 0, otherwise the first decimal place found will be returned.

Parameters
valvalue from which the first significant digit shall be determined
Returns
If val > 1.0, the function will return 0, otherwise the first decimal place found will be returned.

Definition at line 1407 of file TMusrRunHeader.cpp.

Referenced by DumpHeader(), and GetHeaderString().

◆ GetFileName()

virtual TString TMusrRunHeader::GetFileName ( )
inlinevirtual

Definition at line 130 of file TMusrRunHeader.h.

References fFileName.

◆ GetFirst()

TString TMusrRunHeader::GetFirst ( TString & str,
const char splitter )
privatevirtual

Assuming a string built like 'this/is/a/string:with:diffrent:splitters'. Using as splitter '/', this routine would return 'this', it means get from str everything up to the first occurance of splitter. If splitter would be ':' in this example, the return string would be 'this/is/a/string'.

If splitter is not present in str the original str is returned.

Parameters
str
splitter
Returns
first part of up to the splitter in struct

Definition at line 1932 of file TMusrRunHeader.cpp.

Referenced by FillDirectory(), FillFolder(), FindObject(), and UpdateFolder().

◆ GetHeaderString()

TObjString TMusrRunHeader::GetHeaderString ( UInt_t idx)
privatevirtual

◆ GetLabel()

TString TMusrRunHeader::GetLabel ( TString str)
privatevirtual

extracts form the run header line, as written to the MusrROOT file, the run header label, e.g. Run Number.

Parameters
strrunHeader string as written to the MusrROOT file.
Returns
run header label extracted from the encoded runHeader string

Definition at line 1488 of file TMusrRunHeader.cpp.

References fQuiet.

Referenced by ExtractHeaderInformationData().

◆ GetLeastSignificantDigit()

UInt_t TMusrRunHeader::GetLeastSignificantDigit ( Double_t val) const
privatevirtual

returns the number of significant digits

Parameters
valvalue from which the lowest significant digit shall be determined
Returns
returns the number of significant digits

Definition at line 1434 of file TMusrRunHeader.cpp.

Referenced by DumpHeader(), and GetHeaderString().

◆ GetStrValue()

TString TMusrRunHeader::GetStrValue ( TString str)
privatevirtual

extracts form the run header line, as written to the MusrROOT file, the run header str value, e.g. 557 (for Run Number).

Parameters
strrunHeader string as written to the MusrROOT file.
Returns
string value extracted from the encoded runHeader string

Definition at line 1522 of file TMusrRunHeader.cpp.

References fQuiet.

Referenced by ExtractHeaderInformationData().

◆ GetType()

TString TMusrRunHeader::GetType ( TString str)
privatevirtual

extracts form the run header line, as written to the MusrROOT file, the encoded type and retruns it.

Parameters
strrunHeader string with encoded type
Returns
type value extracted from the encoded runHeader string. If not found it will have the value 'n/a'.

Definition at line 1556 of file TMusrRunHeader.cpp.

References fQuiet, MRH_DOUBLE, MRH_DOUBLE_VECTOR, MRH_INT, MRH_INT_VECTOR, MRH_TMUSR_RUN_PHYSICAL_QUANTITY, MRH_TSTRING, and MRH_TSTRING_VECTOR.

Referenced by ExtractHeaderInformationData().

◆ GetTypeOfPath()

TString TMusrRunHeader::GetTypeOfPath ( TString pathName)
virtual

Get type of path-name, e.g. RunInfo/Sample Name.

Parameters
pathNamepath-name for which the type is requested
Returns
the type, or 'undef' if path-name is not found.

Definition at line 478 of file TMusrRunHeader.cpp.

References fDoubleObj, fDoubleVectorObj, fIntObj, fIntVectorObj, fMusrRunPhysQuantityObj, fStringObj, and fStringVectorObj.

◆ Init()

void TMusrRunHeader::Init ( TString fileName = "n/a")
privatevirtual

Initializer

Parameters
fileNamefile name of the caller.

Definition at line 246 of file TMusrRunHeader.cpp.

References fFileName, fVersion, Set(), and TMusrRunPhysicalQuantity::Set().

Referenced by TMusrRunHeader().

◆ RemoveFirst()

bool TMusrRunHeader::RemoveFirst ( TString & str,
const char splitter )
privatevirtual

Removes the first junk of a string up to 'splitter'. If 'splitter' is NOT present in the string, the string stays untouched and the routine returns false.

Parameters
strstring to be truncated
splitterthe start of the string up to the splitter character removed
Returns
true on success

Definition at line 1905 of file TMusrRunHeader.cpp.

Referenced by FindObject(), and UpdateFolder().

◆ Set() [1/7]

void TMusrRunHeader::Set ( TString pathName,
Double_t value )
virtual

Set Double_t 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/DoubleValue
valueof the entry

Definition at line 761 of file TMusrRunHeader.cpp.

References fDoubleObj, fPathNameOrder, and fQuiet.

◆ Set() [2/7]

void TMusrRunHeader::Set ( TString pathName,
Int_t value )
virtual

Set Int_t 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run number
valueof the entry

Definition at line 727 of file TMusrRunHeader.cpp.

References fIntObj, fPathNameOrder, and fQuiet.

◆ Set() [3/7]

void TMusrRunHeader::Set ( TString pathName,
TDoubleVector value )
virtual

Set TDoubleVector 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Time Zero Bin
valueof the entry

Definition at line 897 of file TMusrRunHeader.cpp.

References fDoubleVectorObj, fPathNameOrder, and fQuiet.

◆ Set() [4/7]

void TMusrRunHeader::Set ( TString pathName,
TIntVector value )
virtual

Set TIntVector 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Time Zero Bin
valueof the entry

Definition at line 863 of file TMusrRunHeader.cpp.

References fIntVectorObj, fPathNameOrder, and fQuiet.

◆ Set() [5/7]

void TMusrRunHeader::Set ( TString pathName,
TMusrRunPhysicalQuantity value )
virtual

Set TMusrRunPhysicalQuantity 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Muon Beam Momentum
valueof the entry

Definition at line 795 of file TMusrRunHeader.cpp.

References fMusrRunPhysQuantityObj, fPathNameOrder, and fQuiet.

◆ Set() [6/7]

void TMusrRunHeader::Set ( TString pathName,
TString value )
virtual

Set TString 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Run Title
valueof the entry

Definition at line 693 of file TMusrRunHeader.cpp.

References fPathNameOrder, fQuiet, and fStringObj.

Referenced by ExtractHeaderInformationData(), Init(), and main().

◆ Set() [7/7]

void TMusrRunHeader::Set ( TString pathName,
TStringVector value )
virtual

Set TStringVector 'value'.

Parameters
pathNamepath/name within the header, e.g. RunInfo/Histo names
valueof the entry

Definition at line 829 of file TMusrRunHeader.cpp.

References fPathNameOrder, fQuiet, and fStringVectorObj.

◆ SetFileName()

virtual void TMusrRunHeader::SetFileName ( TString fln)
inlinevirtual

Definition at line 150 of file TMusrRunHeader.h.

References fFileName.

◆ SplitPathName()

void TMusrRunHeader::SplitPathName ( TString pathName,
TString & path,
TString & name )
privatevirtual

splits a path name string into the path and the name.

Parameters
pathNamepath name to be split
pathof pathName
nameof pathName

Definition at line 1465 of file TMusrRunHeader.cpp.

Referenced by DumpHeader(), and GetHeaderString().

◆ UpdateDirTree()

bool TMusrRunHeader::UpdateDirTree ( TDirectory * topdir)
privatevirtual

Update directory tree for RunHeader

Parameters
dirtop directory pointer
Returns
true on success

Definition at line 1669 of file TMusrRunHeader.cpp.

References fPathNameOrder.

Referenced by FillDirectory().

◆ UpdateFolder()

bool TMusrRunHeader::UpdateFolder ( TObject * treeObj,
TString path )
privatevirtual

Update folder structure

Parameters
treeObjto be updated
pathto be added within 'treeObj'
Returns
true on success

Definition at line 1624 of file TMusrRunHeader.cpp.

References GetFirst(), RemoveFirst(), and UpdateFolder().

Referenced by FillFolder(), and UpdateFolder().

Member Data Documentation

◆ fDoubleObj

std::vector< TMusrRunObject<Double_t> > TMusrRunHeader::fDoubleObj
private

Definition at line 169 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fDoubleVectorObj

std::vector< TMusrRunObject<TDoubleVector> > TMusrRunHeader::fDoubleVectorObj
private

Definition at line 173 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fFileName

TString TMusrRunHeader::fFileName
private

Definition at line 164 of file TMusrRunHeader.h.

Referenced by DumpHeader(), GetFileName(), Init(), and SetFileName().

◆ fIntObj

std::vector< TMusrRunObject<Int_t> > TMusrRunHeader::fIntObj
private

Definition at line 168 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fIntVectorObj

std::vector< TMusrRunObject<TIntVector> > TMusrRunHeader::fIntVectorObj
private

Definition at line 172 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fMusrRunPhysQuantityObj

std::vector< TMusrRunObject<TMusrRunPhysicalQuantity> > TMusrRunHeader::fMusrRunPhysQuantityObj
private

Definition at line 170 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fPathNameOrder

std::vector< TString > TMusrRunHeader::fPathNameOrder
private

keeps the path-name as they were created in ordered to keep ordering

Definition at line 175 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), FillDirectory(), FillFolder(), GetHeaderString(), Set(), Set(), Set(), Set(), Set(), Set(), Set(), and UpdateDirTree().

◆ fQuiet

bool TMusrRunHeader::fQuiet
private

Definition at line 163 of file TMusrRunHeader.h.

Referenced by GetLabel(), GetStrValue(), GetType(), Set(), Set(), Set(), Set(), Set(), Set(), Set(), and TMusrRunHeader().

◆ fStringObj

std::vector< TMusrRunObject<TString> > TMusrRunHeader::fStringObj
private

Definition at line 167 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fStringVectorObj

std::vector< TMusrRunObject<TStringVector> > TMusrRunHeader::fStringVectorObj
private

Definition at line 171 of file TMusrRunHeader.h.

Referenced by CleanUp(), DumpHeader(), Get(), GetHeaderString(), GetTypeOfPath(), and Set().

◆ fVersion

TString TMusrRunHeader::fVersion
private

Definition at line 165 of file TMusrRunHeader.h.

Referenced by Init().


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