more work toward MusrRoot

This commit is contained in:
suter_a 2012-01-18 07:43:50 +00:00
parent 634077d772
commit 2243c8e7dc
10 changed files with 1133 additions and 901 deletions

View File

@ -4,7 +4,7 @@
# Author: Andreas Suter
# e-mail: andreas.suter@psi.ch
#
# $Id$
# $Id: Makefile 5052 2012-01-12 09:55:19Z suter_a $
#
#---------------------------------------------------

View File

@ -37,10 +37,19 @@
#include <TQObject.h>
#include <TObjString.h>
#include <TObjArray.h>
#include <TMap.h>
#include <TSAXParser.h>
#include <TFolder.h>
#define MRRH_UNDEFINED -9.99e99
#define MRH_UNDEFINED -9.99e99
#define MRH_DOUBLE_PREC 6
#define MRH_TSTRING 0
#define MRH_INT 1
#define MRH_DOUBLE 2
#define MRH_TMUSR_RUN_PHYSICAL_QUANTITY 3
#define MRH_TSTRING_VECTOR 4
#define MRH_INT_VECTOR 5
#define MRH_DOUBLE_VECTOR 6
typedef vector<Int_t> TIntVector;
typedef vector<Double_t> TDoubleVector;
@ -119,7 +128,10 @@ public:
virtual TString GetFileName() { return fFileName; }
virtual void GetHeaderInfo(TString path, TObjArray &content);
virtual Bool_t FillFolder(TFolder *folder);
virtual Bool_t ExtractAll(TFolder *folder);
virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path);
virtual void GetValue(TString pathName, TString &value, Bool_t &ok);
virtual void GetValue(TString pathName, Int_t &value, Bool_t &ok);
@ -129,20 +141,15 @@ public:
virtual void GetValue(TString pathName, TIntVector &value, Bool_t &ok);
virtual void GetValue(TString pathName, TDoubleVector &value, Bool_t &ok);
virtual TMap* GetMap() { return &fMap; }
virtual void SetFileName(TString fln) { fFileName = fln; }
virtual void SetMap(TMap* map);
virtual void Set(TString pathName, TString value, Bool_t addMap=true);
virtual void Set(TString pathName, Int_t value, Bool_t addMap=true);
virtual void Set(TString pathName, Double_t value, Bool_t addMap=true);
virtual void Set(TString pathName, TMusrRunPhysicalQuantity value, Bool_t addMap=true);
virtual void Set(TString pathName, TStringVector value, Bool_t addMap=true);
virtual void Set(TString pathName, TIntVector value, Bool_t addMap=true);
virtual void Set(TString pathName, TDoubleVector value, Bool_t addMap=true);
virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path);
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();
@ -158,15 +165,23 @@ private:
vector< TMusrRunObject<TIntVector> > fIntVectorObj;
vector< TMusrRunObject<TDoubleVector> > fDoubleVectorObj;
TStringVector fFolder;
vector< TString > fPathNameOrder; ///< keeps the path-name as they or set and hence its ordering
TMap fMap; ///< maps run header label to its root type, e.g. 'Run Number' -> 'Int_t' or 'Time Resolution' -> 'TMusrRunPhysicalQuantity'
virtual void Init();
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 Bool_t FolderPresent(TString &path);
virtual TString GetLabel(TString str);
virtual TString GetStrValue(TString str);
virtual TString GetType(TString str);
virtual Int_t ObjectPresent(vector<TObjArray*> &content, TString &path);
virtual TObjString GetHeaderString(UInt_t idx);
virtual void RemoveFirst(TString &str, const char splitter);
virtual TString GetFirst(TString &str, const char splitter);
virtual void AddSubTrees(TObjArray *content, TString pathName);
virtual void SetSubTreeObject(TObjArray *content, TObjString ostr, Int_t idx);
ClassDef(TMusrRunHeader, 1)
};

View File

@ -0,0 +1,144 @@
/***************************************************************************
musrRoot_runHeader_test.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <TROOT.h>
#include <TFile.h>
#include <TFolder.h>
#include "TMusrRunHeader.h"
void musrRoot_runHeader_test_syntax()
{
cout << endl << "usage: musrRoot_runHeader_test <fileName>";
cout << endl << " <fileName> is the file name including the extention root, e.g. test.root";
cout << endl << endl;
}
int main(int argc, char *argv[])
{
if (argc != 2) {
musrRoot_runHeader_test_syntax();
return 1;
}
// read the file and extract the header info
TFile *f = new TFile(argv[1], "READ", "musrRoot_runHeader_test");
if (f->IsZombie()) {
delete f;
return -1;
}
TFolder *runHeader = 0;
f->GetObject("RunHeader", runHeader);
if (runHeader == 0) {
cerr << endl << ">> **ERROR** Couldn't get top folder RunHeader";
f->Close();
return -1;
}
// MusrRoot Run Header object
TMusrRunHeader *header = new TMusrRunHeader(argv[1]);
header->ExtractAll(runHeader);
f->Close();
delete f;
header->DumpHeader();
// get some information from the read file
cout << endl << "++++++++++++++++++++++++++++";
cout << endl << ">> get header infos " << argv[1];
cout << endl << "++++++++++++++++++++++++++++" << endl;
TString str("");
TStringVector strVec;
Int_t ival;
TDoubleVector dvec;
TMusrRunPhysicalQuantity prop;
Bool_t ok;
header->GetValue("RunInfo/Run Title", str, ok);
if (ok)
cout << endl << "Run Title: " << str.Data();
else
cout << endl << "**ERROR** Couldn't obtain the 'Run Title'.";
header->GetValue("RunInfo/Run Number", ival, ok);
if (ok)
cout << endl << "Run Number: " << ival;
else
cout << endl << "**ERROR** Couldn't obtain the 'Run Number'.";
header->GetValue("RunInfo/Histo Names", strVec, ok);
if (ok) {
cout << endl << "Histo Names: ";
for (UInt_t i=0; i<strVec.size()-1; i++) {
cout << strVec[i].Data() << ", ";
}
cout << strVec[strVec.size()-1].Data();
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Histo Names'.";
}
header->GetValue("RunInfo/Time Zero Bin", dvec, ok);
if (ok) {
cout << endl << "Time Zero Bin: ";
for (UInt_t i=0; i<dvec.size()-1; i++) {
cout << dvec[i] << ", ";
}
cout << dvec[dvec.size()-1];
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Time Zero Bin'.";
}
header->GetValue("RunInfo/Sample Temperature", prop, ok);
if (ok) {
cout << endl << "Sample Temperature: " << prop.GetValue() << " +- " << prop.GetError() << " " << prop.GetUnit().Data() << "; SP: " << prop.GetDemand() << "; " << prop.GetDescription().Data();
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Sample Temperature'.";
}
header->GetValue("Detectors/Detector000/Name", str, ok);
if (ok) {
cout << endl << "Detectors/Detector000: Name=" << str;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/Name'.";
}
cout << endl << endl;
delete header;
return 0;
}

View File

@ -38,6 +38,15 @@ using namespace std;
#include "TMusrRunHeader.h"
void closeFile(TFile *f)
{
if (f == 0)
return;
f->Close();
delete f;
}
void read_musrRoot_runHeader_syntax()
{
cout << endl << "usage: read_musrRoot_runHeader <fileName>";
@ -63,63 +72,25 @@ int main(int argc, char *argv[])
f->GetObject("RunHeader", runHeader);
if (runHeader == 0) {
cerr << endl << ">> **ERROR** Couldn't get top folder RunHeader";
f->Close();
closeFile(f);
return -1;
}
TObjArray *oarray = 0;
TMusrRunHeader *header = new TMusrRunHeader(argv[1]);
// first read map!!
TMap *map = (TMap*) runHeader->FindObjectAny("__map");
if (map == 0) {
cerr << endl << ">> **ERROR** couldn't find required __map :-(" << endl;
f->Close();
if (!header->ExtractAll(runHeader)) {
cerr << endl << ">> **ERROR** couldn't extract all RunHeader information :-(" << endl << endl;
closeFile(f);
return -1;
}
header->SetMap(map);
// get RunHeader
oarray = (TObjArray*) runHeader->FindObjectAny("RunInfo");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get RunInfo" << endl;
}
if (!header->ExtractHeaderInformation(oarray, "RunInfo")) return -1;
// get SampleEnv
oarray = (TObjArray*) runHeader->FindObjectAny("SampleEnv");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get SampleEnv" << endl;
}
if (!header->ExtractHeaderInformation(oarray, "SampleEnv")) return -1;
// get MagFieldEnv
oarray = (TObjArray*) runHeader->FindObjectAny("MagFieldEnv");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get MagFieldEnv" << endl;
}
if (!header->ExtractHeaderInformation(oarray, "MagFieldEnv")) return -1;
// get Beamline
oarray = (TObjArray*) runHeader->FindObjectAny("Beamline");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get Beamline" << endl;
}
if (!header->ExtractHeaderInformation(oarray, "Beamline")) return -1;
// get Scaler
oarray = (TObjArray*) runHeader->FindObjectAny("Scaler");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get Scaler" << endl;
}
if (!header->ExtractHeaderInformation(oarray, "Scaler")) return -1;
f->Close();
delete f;
header->DumpHeader();
delete header;
cout << endl << endl;
return 0;

View File

@ -112,13 +112,14 @@ int main(int argc, char *argv[])
prop.Set("Time Resolution", 0.1953125, "ns", "TDC 9999");
header->Set("RunInfo/Time Resolution", prop);
TIntVector t0;
for (UInt_t i=0; i<4; i++) t0.push_back(215+(Int_t)(5.0*(Double_t)rand()/(Double_t)RAND_MAX));
TDoubleVector t0;
TIntVector ivec;
for (UInt_t i=0; i<4; i++) t0.push_back(215.0+5.0*(Double_t)rand()/(Double_t)RAND_MAX);
header->Set("RunInfo/Time Zero Bin", t0);
for (UInt_t i=0; i<4; i++) t0[i] += 12;
header->Set("RunInfo/First Good Bin", t0);
for (UInt_t i=0; i<4; i++) t0[i] = 8191;
header->Set("RunInfo/Last Good Bin", t0);
for (UInt_t i=0; i<4; i++) ivec.push_back((Int_t)t0[i] + 12);
header->Set("RunInfo/First Good Bin", ivec);
for (UInt_t i=0; i<4; i++) ivec[i] = 8191;
header->Set("RunInfo/Last Good Bin", ivec);
TIntVector readGreenOffset;
readGreenOffset.push_back(0);
@ -146,40 +147,54 @@ int main(int argc, char *argv[])
header->Set("RunInfo/Dummy Test", dummyTest);
// sample environment
header->Set("SampleEnv/Cryo", "Konti-1");
header->Set("SampleEnv/Insert", "X123");
header->Set("SampleEnv/Orientation", "c-axis perp spin, perp field. spin perp field");
header->Set("SampleEnvironmentInfo/Cryo", "Konti-1");
header->Set("SampleEnvironmentInfo/Insert", "X123");
header->Set("SampleEnvironmentInfo/Orientation", "c-axis perp spin, perp field. spin perp field");
prop.Set("CF2", 3.2, 3.22, 0.04, "K");
header->Set("SampleEnv/CF2", prop);
header->Set("SampleEnvironmentInfo/CF2", prop);
prop.Set("CF3", MRRH_UNDEFINED, 3.27, 0.09, "K", "strange temperature");
header->Set("SampleEnv/CF3", prop);
prop.Set("CF3", MRH_UNDEFINED, 3.27, 0.09, "K", "strange temperature");
header->Set("SampleEnvironmentInfo/CF3", prop);
prop.Set("CF4", 3.25, 3.28, "K");
header->Set("SampleEnv/CF4", prop);
header->Set("SampleEnvironmentInfo/CF4", prop);
prop.Set("CF5", 3.26, 3.29, "K", "another strange temperature");
header->Set("SampleEnv/CF5", prop);
header->Set("SampleEnvironmentInfo/CF5", prop);
prop.Set("Dummy Prop", -2.0, -2.001, 0.002, "SI-unit");
header->Set("SampleEnv/Dummy Prop", prop);
header->Set("SampleEnvironmentInfo/Dummy Prop", prop);
// magnetic field environment
header->Set("MagFieldEnv/Name", "Bpar");
header->Set("MagneticFieldEnvironmentInfo/Name", "Bpar");
prop.Set("Current", 1.34, "A");
header->Set("MagFieldEnv/Current", prop);
header->Set("MagneticFieldEnvironmentInfo/Current", prop);
// detector forward
header->Set("Detectors/Detector000/Name", "forward");
header->Set("Detectors/Detector000/Histo Number", 0);
header->Set("Detectors/Detector000/Histo Length", 8192);
// detector backward
header->Set("Detectors/Detector001/Name", "backward");
header->Set("Detectors/Detector001/Histo Number", 0);
header->Set("Detectors/Detector001/Histo Length", 8192);
// beamline
header->Set("Beamline/WSX61a", "DAC = 3289, ADC = 0.800");
header->Set("BeamlineInfo/WSX61a", "DAC = 3289, ADC = 0.800");
TIntVector dummyInt;
for (UInt_t i=0; i<3; i++) dummyInt.push_back(i+1000);
header->Set("Beamline/Dummy Int", dummyInt);
header->Set("BeamlineInfo/Dummy Int", dummyInt);
// scaler
header->Set("Scaler/Ip", 12332123);
header->Set("ScalerInfo/Ip", 12332123);
// funny sub/sub/../sub-structure
header->Set("aa/bb/cc/dd/ee/ff/name", "funny");
header->Set("aa/bb/cc/dd/ee/ff/gg/xyz", 123);
TFile *f = new TFile(argv[1], "RECREATE", "write_musrRoot_runHeader");
if (f->IsZombie()) {
@ -191,35 +206,15 @@ int main(int argc, char *argv[])
TFolder *runHeader = gROOT->GetRootFolder()->AddFolder("RunHeader", "MusrRoot Run Header Info");
gROOT->GetListOfBrowsables()->Add(runHeader, "RunHeader");
TObjArray runInfo;
header->GetHeaderInfo("RunInfo", runInfo);
runHeader->Add(&runInfo);
TObjArray sampleEnv;
header->GetHeaderInfo("SampleEnv", sampleEnv);
runHeader->Add(&sampleEnv);
TObjArray magFieldEnv;
header->GetHeaderInfo("MagFieldEnv", magFieldEnv);
runHeader->Add(&magFieldEnv);
TObjArray beamline;
header->GetHeaderInfo("Beamline", beamline);
runHeader->Add(&beamline);
TObjArray scaler;
header->GetHeaderInfo("Scaler", scaler);
runHeader->Add(&scaler);
TMap *map = header->GetMap();
runHeader->Add(map);
runHeader->Write();
if (header->FillFolder(runHeader)) {
runHeader->Write();
}
f->Close();
// clean up
delete f;
f = 0;
delete header;
return 0;
}

View File

@ -1,303 +0,0 @@
/***************************************************************************
musrRoot_runHeader_test.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <TROOT.h>
#include <TFile.h>
#include <TFolder.h>
#include "TMusrRunHeader.h"
void musrRoot_runHeader_test_syntax()
{
cout << endl << "usage: musrRoot_runHeader_test <fileName>";
cout << endl << " <fileName> is the file name including the extention root, e.g. test.root";
cout << endl << endl;
}
int main(int argc, char *argv[])
{
if (argc != 2) {
musrRoot_runHeader_test_syntax();
return 1;
}
// MusrRoot Run Header object
TMusrRunHeader *header = new TMusrRunHeader(argv[1]);
TMusrRunPhysicalQuantity prop;
// run info
header->Set("RunInfo/Version", "$Id$");
header->Set("RunInfo/Generator", "any2many");
header->Set("RunInfo/File Name", "thisIsAFileName");
header->Set("RunInfo/Run Title", "here comes the run title");
header->Set("RunInfo/Run Number", 576);
header->Set("RunInfo/Run Number", 577);
header->Set("RunInfo/Run Start Time", "2011-04-19 14:25:22");
header->Set("RunInfo/Run Stop Time", "2011-04-19 19:13:47");
prop.Set("Time Resolution", 0.1953125, "ns", "TDC 9999");
header->Set("RunInfo/Time Resolution", prop);
prop.Set("Sample Temperature", 3.2, 3.21, 0.05, "K", "CF1");
header->Set("RunInfo/Sample Temperature", prop);
prop.Set("Muon Beam Momentum", MRRH_UNDEFINED, 28.1, MRRH_UNDEFINED, "MeV/c");
header->Set("RunInfo/Muon Beam Momentum", prop);
TStringVector detectorName;
detectorName.push_back("left_down");
detectorName.push_back("left_up");
detectorName.push_back("top_down");
detectorName.push_back("top_up");
detectorName.push_back("right_down");
detectorName.push_back("right_up");
detectorName.push_back("bottom_down");
detectorName.push_back("bottom_up");
header->Set("RunInfo/Histo Names", detectorName);
TDoubleVector t0;
for (UInt_t i=0; i<8; i++) t0.push_back(3419.0);
header->Set("RunInfo/Time Zero Bin", t0);
TStringVector dummyTest;
dummyTest.push_back("dummy1");
dummyTest.push_back("dummy2");
dummyTest.push_back("dummy3");
header->Set("RunInfo/Dummy Test", dummyTest);
// sample environment
header->Set("SampleEnv/Cryo", "Konti-1");
prop.Set("CF2", 3.2, 3.22, 0.04, "K");
header->Set("SampleEnv/CF2", prop);
prop.Set("CF3", MRRH_UNDEFINED, 3.27, 0.09, "K", "strange temperature");
header->Set("SampleEnv/CF3", prop);
prop.Set("CF4", 3.25, 3.28, "K");
header->Set("SampleEnv/CF4", prop);
prop.Set("CF5", 3.26, 3.29, "K", "another strange temperature");
header->Set("SampleEnv/CF5", prop);
prop.Set("Dummy Prop", -2.0, -2.001, 0.002, "SI-unit");
header->Set("SampleEnv/Dummy Prop", prop);
// magnetic field environment
header->Set("MagFieldEnv/Name", "Bpar");
prop.Set("Current", 1.34, "A");
header->Set("MagFieldEnv/Current", prop);
// beamline
header->Set("Beamline/WSX61a", "DAC = 3289, ADC = 0.800");
TIntVector dummyInt;
for (UInt_t i=0; i<3; i++) dummyInt.push_back(i+1000);
header->Set("Beamline/Dummy Int", dummyInt);
// scaler
header->Set("Scaler/Ip", 12332123);
TFile *f = new TFile(argv[1], "RECREATE", "musrRoot_runHeader_test");
if (f->IsZombie()) {
delete f;
return -1;
}
// root file header related things
TFolder *runHeader = gROOT->GetRootFolder()->AddFolder("RunHeader", "MusrRoot Run Header Info");
gROOT->GetListOfBrowsables()->Add(runHeader, "RunHeader");
TObjArray runInfo;
header->GetHeaderInfo("RunInfo", runInfo);
runHeader->Add(&runInfo);
TObjArray sampleEnv;
header->GetHeaderInfo("SampleEnv", sampleEnv);
runHeader->Add(&sampleEnv);
TObjArray magFieldEnv;
header->GetHeaderInfo("MagFieldEnv", magFieldEnv);
runHeader->Add(&magFieldEnv);
TObjArray beamline;
header->GetHeaderInfo("Beamline", beamline);
runHeader->Add(&beamline);
TObjArray scaler;
header->GetHeaderInfo("Scaler", scaler);
runHeader->Add(&scaler);
TMap *map = header->GetMap();
runHeader->Add(map);
runHeader->Write();
f->Close();
delete f;
f = 0;
header->DumpHeader();
delete header;
header = 0;
cout << endl << "++++++++++++++++++++++++++++";
cout << endl << ">> read back " << argv[1];
cout << endl << "++++++++++++++++++++++++++++" << endl;
// read the file back and extract the header info
f = new TFile(argv[1], "READ", "musrRoot_runHeader_test");
if (f->IsZombie()) {
delete f;
return -1;
}
runHeader = 0;
f->GetObject("RunHeader", runHeader);
if (runHeader == 0) {
cerr << endl << ">> **ERROR** Couldn't get top folder RunHeader";
f->Close();
return -1;
}
TObjArray *oarray = 0;
header = new TMusrRunHeader(argv[1]);
map = (TMap*) runHeader->FindObjectAny("__map");
if (map == 0) {
cerr << endl << ">> **ERROR** couldn't find required __map :-(" << endl;
f->Close();
return -1;
}
header->SetMap(map);
// get RunHeader
oarray = (TObjArray*) runHeader->FindObjectAny("RunInfo");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get RunInfo" << endl;
}
header->ExtractHeaderInformation(oarray, "RunInfo");
// get SampleEnv
oarray = (TObjArray*) runHeader->FindObjectAny("SampleEnv");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get SampleEnv" << endl;
}
header->ExtractHeaderInformation(oarray, "SampleEnv");
// get MagFieldEnv
oarray = (TObjArray*) runHeader->FindObjectAny("MagFieldEnv");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get MagFieldEnv" << endl;
}
header->ExtractHeaderInformation(oarray, "MagFieldEnv");
// get Beamline
oarray = (TObjArray*) runHeader->FindObjectAny("Beamline");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get Beamline" << endl;
}
header->ExtractHeaderInformation(oarray, "Beamline");
// get Scaler
oarray = (TObjArray*) runHeader->FindObjectAny("Scaler");
if (oarray == 0) {
cerr << endl << ">> **ERROR** Couldn't get Scaler" << endl;
}
header->ExtractHeaderInformation(oarray, "Scaler");
f->Close();
delete f;
header->DumpHeader();
// get some information from the read file
cout << endl << "++++++++++++++++++++++++++++";
cout << endl << ">> get header infos " << argv[1];
cout << endl << "++++++++++++++++++++++++++++" << endl;
TString str("");
TStringVector strVec;
Int_t ival;
TDoubleVector dvec;
TMusrRunPhysicalQuantity prop1;
Bool_t ok;
header->GetValue("RunInfo/Run Title", str, ok);
if (ok)
cout << endl << "Run Title: " << str.Data();
else
cout << endl << "**ERROR** Couldn't obtain the 'Run Title'.";
header->GetValue("RunInfo/Run Number", ival, ok);
if (ok)
cout << endl << "Run Number: " << ival;
else
cout << endl << "**ERROR** Couldn't obtain the 'Run Number'.";
header->GetValue("RunInfo/Histo Names", strVec, ok);
if (ok) {
cout << endl << "Histo Names: ";
for (UInt_t i=0; i<strVec.size()-1; i++) {
cout << strVec[i].Data() << ", ";
}
cout << strVec[strVec.size()-1].Data();
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Histo Names'.";
}
header->GetValue("RunInfo/Time Zero Bin", dvec, ok);
if (ok) {
cout << endl << "Time Zero Bin: ";
for (UInt_t i=0; i<dvec.size()-1; i++) {
cout << dvec[i] << ", ";
}
cout << dvec[dvec.size()-1];
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Time Zero Bin'.";
}
header->GetValue("RunInfo/Sample Temperature", prop1, ok);
if (ok) {
cout << endl << "Sample Temperature: " << prop1.GetValue() << " +- " << prop1.GetError() << " " << prop1.GetUnit().Data() << "; SP: " << prop1.GetDemand() << "; " << prop1.GetDescription().Data();
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Sample Temperature'.";
}
cout << endl << endl;
return 0;
}