musrfit  1.9.2
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 ExtractAll (TFolder *folder)
 
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 ()
 
virtual void DrawHeader ()
 

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 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 More...
 

Detailed Description

Definition at line 122 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 231 of file TMusrRunHeader.cpp.

References fQuiet, and Init().

◆ ~TMusrRunHeader()

TMusrRunHeader::~TMusrRunHeader ( )
virtual

Destructor.

Definition at line 304 of file TMusrRunHeader.cpp.

References CleanUp().

Member Function Documentation

◆ CleanUp()

void TMusrRunHeader::CleanUp ( )
privatevirtual

Clean up internal stuff.

Definition at line 315 of file TMusrRunHeader.cpp.

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

Referenced by ExtractAll(), and ~TMusrRunHeader().

◆ DrawHeader()

void TMusrRunHeader::DrawHeader ( )
virtual

Definition at line 1256 of file TMusrRunHeader.cpp.

◆ DumpHeader()

◆ ExtractAll()

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
folder

Definition at line 862 of file TMusrRunHeader.cpp.

References CleanUp(), and ExtractHeaderInformation().

◆ ExtractHeaderInformation()

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

◆ 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

Definition at line 338 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'

return:

  • pointer to the 'path' object if present
  • otherwise return 0
Parameters
treeObjto be searched
pathsearched for within 'treeObj'

Definition at line 1541 of file TMusrRunHeader.cpp.

References GetFirst(), and RemoveFirst().

Referenced by FillFolder().

◆ Get() [1/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 470 of file TMusrRunHeader.cpp.

References fStringObj.

◆ 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 492 of file TMusrRunHeader.cpp.

References fIntObj.

◆ Get() [3/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 514 of file TMusrRunHeader.cpp.

References fDoubleObj.

◆ Get() [4/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 536 of file TMusrRunHeader.cpp.

References fMusrRunPhysQuantityObj.

◆ Get() [5/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 558 of file TMusrRunHeader.cpp.

References fStringVectorObj.

◆ Get() [6/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 580 of file TMusrRunHeader.cpp.

References fIntVectorObj.

◆ Get() [7/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 602 of file TMusrRunHeader.cpp.

References fDoubleVectorObj.

◆ 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

Definition at line 1282 of file TMusrRunHeader.cpp.

Referenced by DumpHeader(), and GetHeaderString().

◆ GetFileName()

virtual TString TMusrRunHeader::GetFileName ( )
inlinevirtual

Definition at line 129 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.

return: first part of up to the splitter in struct

Parameters
str
splitter

Definition at line 1752 of file TMusrRunHeader.cpp.

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

◆ GetHeaderString()

◆ 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.

Definition at line 1359 of file TMusrRunHeader.cpp.

References fQuiet.

Referenced by ExtractHeaderInformation().

◆ 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

Definition at line 1307 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.

Definition at line 1391 of file TMusrRunHeader.cpp.

References fQuiet.

Referenced by ExtractHeaderInformation().

◆ 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

Definition at line 1423 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 ExtractHeaderInformation().

◆ 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 408 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 245 of file TMusrRunHeader.cpp.

References fFileName, fVersion, TMusrRunPhysicalQuantity::Set(), and 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

Definition at line 1725 of file TMusrRunHeader.cpp.

Referenced by FindObject(), and UpdateFolder().

◆ Set() [1/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 623 of file TMusrRunHeader.cpp.

References fPathNameOrder, fQuiet, and fStringObj.

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

◆ 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 657 of file TMusrRunHeader.cpp.

References fIntObj, fPathNameOrder, and fQuiet.

◆ Set() [3/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 691 of file TMusrRunHeader.cpp.

References fDoubleObj, fPathNameOrder, and fQuiet.

◆ Set() [4/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 725 of file TMusrRunHeader.cpp.

References fMusrRunPhysQuantityObj, fPathNameOrder, and fQuiet.

◆ Set() [5/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 759 of file TMusrRunHeader.cpp.

References fPathNameOrder, fQuiet, and fStringVectorObj.

◆ Set() [6/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 793 of file TMusrRunHeader.cpp.

References fIntVectorObj, fPathNameOrder, and fQuiet.

◆ Set() [7/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 827 of file TMusrRunHeader.cpp.

References fDoubleVectorObj, fPathNameOrder, and fQuiet.

◆ SetFileName()

virtual void TMusrRunHeader::SetFileName ( TString  fln)
inlinevirtual

Definition at line 146 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 1338 of file TMusrRunHeader.cpp.

Referenced by DumpHeader(), and GetHeaderString().

◆ UpdateFolder()

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

Update folder structure

return:

  • true if everything is all right
  • false otherwise
Parameters
treeObjto be updated
pathto be added within 'treeObj'

Definition at line 1493 of file TMusrRunHeader.cpp.

References GetFirst(), and RemoveFirst().

Referenced by FillFolder().

Member Data Documentation

◆ fDoubleObj

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

Definition at line 166 of file TMusrRunHeader.h.

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

◆ fDoubleVectorObj

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

Definition at line 170 of file TMusrRunHeader.h.

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

◆ fFileName

TString TMusrRunHeader::fFileName
private

Definition at line 161 of file TMusrRunHeader.h.

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

◆ fIntObj

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

Definition at line 165 of file TMusrRunHeader.h.

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

◆ fIntVectorObj

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

Definition at line 169 of file TMusrRunHeader.h.

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

◆ fMusrRunPhysQuantityObj

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

Definition at line 167 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 172 of file TMusrRunHeader.h.

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

◆ fQuiet

bool TMusrRunHeader::fQuiet
private

Definition at line 160 of file TMusrRunHeader.h.

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

◆ fStringObj

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

Definition at line 164 of file TMusrRunHeader.h.

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

◆ fStringVectorObj

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

Definition at line 168 of file TMusrRunHeader.h.

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

◆ fVersion

TString TMusrRunHeader::fVersion
private

Definition at line 162 of file TMusrRunHeader.h.

Referenced by Init().


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