first implementation of MusrRoot. Cleaner handling of Red/Green mode data. General cleanup
This commit is contained in:
40
src/external/MusrRoot/Makefile.am
vendored
Normal file
40
src/external/MusrRoot/Makefile.am
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
## $Id$
|
||||
|
||||
h_sources = \
|
||||
TMusrRunHeader.h
|
||||
|
||||
h_linkdef = \
|
||||
TMusrRunHeaderLinkDef.h
|
||||
|
||||
dict_h_sources = \
|
||||
TMusrRunHeaderDict.h
|
||||
|
||||
cpp_sources = \
|
||||
TMusrRunHeader.cpp
|
||||
|
||||
dict_cpp_sources = \
|
||||
TMusrRunHeaderDict.cpp
|
||||
|
||||
include_HEADERS = $(h_sources)
|
||||
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
|
||||
|
||||
INCLUDES = -I. $(ROOT_CFLAGS)
|
||||
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
|
||||
|
||||
BUILT_SOURCES = $(dict_cpp_sources) $(dist_h_sources)
|
||||
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
|
||||
CLEANFILES = *Dict.cpp *Dict.h *~ core
|
||||
|
||||
%Dict.cpp %Dict.h: %.h %LinkDef.h
|
||||
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^
|
||||
|
||||
lib_LTLIBRARIES = libTMusrRunHeader.la
|
||||
|
||||
libTMusrRunHeader_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
|
||||
libTMusrRunHeader_la_LIBADD = $(ROOT_LIBS)
|
||||
libTMusrRunHeader_la_LDFLAGS = -version-info $(MUSR_ROOT_LIBRARY_VERSION) -release $(MUSR_ROOT_RELEASE) $(AM_LDFLAGS)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = TMusrRunHeader.pc
|
||||
|
||||
196
src/external/MusrRoot/MusrRoot.xsd
vendored
Normal file
196
src/external/MusrRoot/MusrRoot.xsd
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
This XSD document describes the muSR file structure for CERN/ROOT based files.
|
||||
In the following it will be called MusrRoot.
|
||||
It is currently the default standard for writting muSR data files at the
|
||||
Paul Scherrer Institute.
|
||||
|
||||
Author: Andreas Suter, andreas.suter@psi.ch
|
||||
$Id: MusrRoot.xsd 5092 2012-03-13 07:47:00Z nemu $
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:element name="MusrRoot" type="musrRoot"/>
|
||||
|
||||
<xs:complexType name="musrRoot">
|
||||
<xs:sequence>
|
||||
<xs:element ref="histos"/>
|
||||
<xs:element name="RunHeader" type="runHeaderFolder"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="histos">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
The histos folder is containing potentially various subfolders.
|
||||
At least two subfolders, called DecayAnaModule, and SlowControlAnaModule,
|
||||
which holds the muSR decay histograms, must be present.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="DecayAnaModule" type="decayHistoData"/>
|
||||
<xs:element name="SCAnaModule" type="slowControlHistoData"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:complexType name="decayHistoData">
|
||||
<xs:sequence>
|
||||
<xs:element name="DecayHistoEntry" type="decayHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="decayHistoEntry">
|
||||
<xs:sequence>
|
||||
<xs:element name="HistoName" type="histoName"/>
|
||||
<xs:element name="HistoType" type="histoType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="histoName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="hDecay([0-9]){3,}"/> <!-- this means hDecayXXX, where XXX are 3 digits -->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="histoType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TH1F"></xs:pattern>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="slowControlHistoData">
|
||||
<xs:sequence>
|
||||
<xs:element name="SlowControlHistoEntry" type="slowControlHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="slowControlHistoEntry">
|
||||
<xs:sequence>
|
||||
<xs:element name="SlowControlName" type="xs:string"/>
|
||||
<xs:element name="SlowControlType" type="slowControlType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="slowControlType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TH1F"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="runHeaderFolder">
|
||||
<xs:sequence>
|
||||
<xs:element name="RunInfo" type="runInfo"/>
|
||||
<xs:element name="DetectorInfo" type="detectorInfo"/>
|
||||
<xs:element name="SampleEnvironmentInfo" type="sampleEnvironmentInfo"/>
|
||||
<xs:element name="MagneticFieldEnvironmentInfo" type="magneticFieldEnvironmentInfo"/>
|
||||
<xs:element name="BeamlineInfo" type="beamlineInfo"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="runInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Version" type="TString"/>
|
||||
<xs:element name="Generic_Validator_URL" type="TString"/>
|
||||
<xs:element name="Specific_Validator_URL" type="TString"/>
|
||||
<xs:element name="Generator" type="TString"/>
|
||||
<xs:element name="File_Name" type="TString"/>
|
||||
<xs:element name="Run_Title" type="TString"/>
|
||||
<xs:element name="Run_Number" type="Int_t"/>
|
||||
<xs:element name="Run_Start_Time" type="TString"/>
|
||||
<xs:element name="Run_Stop_Time" type="TString"/>
|
||||
<xs:element name="Run_Duration" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Laboratory" type="TString"/>
|
||||
<xs:element name="Area" type="TString"/>
|
||||
<xs:element name="Instrument" type="TString"/>
|
||||
<xs:element name="Muon_Beam_Momentum" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Muon_Species" type="TString"/>
|
||||
<xs:element name="Muon_Source" type="TString"/>
|
||||
<xs:element name="Setup" type="TString"/>
|
||||
<xs:element name="Comment" type="TString"/>
|
||||
<xs:element name="Sample_Name" type="TString"/>
|
||||
<xs:element name="Sample_Temperature" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Sample_Magnetic_Field" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="No_of_Histos" type="Int_t"/>
|
||||
<xs:element name="Time_Resolution" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="RedGreen_Offsets" type="TIntVector"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="Int_t">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="Int_t"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="Double_t">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="Double_t"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="TString">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TString"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="TMusrRunPhysicalQuantity">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TMusrRunPhysicalQuantity"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="TIntVector">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TIntVector"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="sampleEnvironmentInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Cryo" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="magneticFieldEnvironmentInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Magnet_Name" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="detectorInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Detector" type="detector" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="detector">
|
||||
<xs:sequence>
|
||||
<xs:element name="Name" type="TString"/>
|
||||
<xs:element name="Histo_Number" type="Int_t"/>
|
||||
<xs:element name="Histo_Length" type="Int_t"/>
|
||||
<xs:element name="Time_Zero_Bin" type="Double_t"/>
|
||||
<xs:element name="First_Good_Bin" type="Int_t"/>
|
||||
<xs:element name="Last_Good_Bin" type="Int_t"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="beamlineInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Name" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
222
src/external/MusrRoot/MusrRootLEM.xsd
vendored
Normal file
222
src/external/MusrRoot/MusrRootLEM.xsd
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
This XSD document describes the muSR file structure of CERN/ROOT based files for LEM.
|
||||
In the following it will be called MusrRootLEM.
|
||||
It is an extension of MusrRoot.xsd and describes the additional LEM specific entries.
|
||||
|
||||
Author: Andreas Suter, andreas.suter@psi.ch
|
||||
$Id: MusrRootLEM.xsd 5092 2012-03-13 07:47:00Z nemu $
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:element name="MusrRoot" type="musrRoot"/>
|
||||
|
||||
<xs:complexType name="musrRoot">
|
||||
<xs:sequence>
|
||||
<xs:element ref="histos"/>
|
||||
<xs:element name="RunHeader" type="runHeaderFolder"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="histos">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
The histos folder is containing potentially various subfolders.
|
||||
At least two subfolders, called DecayAnaModule, and SlowControlAnaModule,
|
||||
which holds the muSR decay histograms, must be present.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="DecayAnaModule" type="decayHistoData"/>
|
||||
<xs:element name="SCAnaModule" type="slowControlHistoData"/>
|
||||
<xs:element name="TOFAnaModule" type="histoData"/>
|
||||
<xs:element name="PileUpAnaModule" type="histoData"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:complexType name="decayHistoData">
|
||||
<xs:sequence>
|
||||
<xs:element name="DecayHistoEntry" type="decayHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="decayHistoEntry">
|
||||
<xs:sequence>
|
||||
<xs:element name="HistoName" type="histoName"/>
|
||||
<xs:element name="HistoType" type="histoType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="histoName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="hDecay([0-9]){3,}"/> <!-- this means hDecayXXX, where XXX are 3 digits or more -->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="histoType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TH1F"></xs:pattern>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="slowControlHistoData">
|
||||
<xs:sequence>
|
||||
<xs:element name="SlowControlHistoEntry" type="slowControlHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="slowControlHistoEntry">
|
||||
<xs:sequence>
|
||||
<xs:element name="SlowControlName" type="xs:string"/>
|
||||
<xs:element name="SlowControlType" type="slowControlType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="slowControlType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TH1F"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="runHeaderFolder">
|
||||
<xs:sequence>
|
||||
<xs:element name="RunInfo" type="runInfo"/>
|
||||
<xs:element name="DetectorInfo" type="detectorInfo"/>
|
||||
<xs:element name="SampleEnvironmentInfo" type="sampleEnvironmentInfo"/>
|
||||
<xs:element name="MagneticFieldEnvironmentInfo" type="magneticFieldEnvironmentInfo"/>
|
||||
<xs:element name="BeamlineInfo" type="beamlineInfo"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="runInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Version" type="TString"/>
|
||||
<xs:element name="Generic_Validator_URL" type="TString"/>
|
||||
<xs:element name="Specific_Validator_URL" type="TString"/>
|
||||
<xs:element name="Generator" type="TString"/>
|
||||
<xs:element name="File_Name" type="TString"/>
|
||||
<xs:element name="Run_Title" type="TString"/>
|
||||
<xs:element name="Run_Number" type="Int_t"/>
|
||||
<xs:element name="Run_Start_Time" type="TString"/>
|
||||
<xs:element name="Run_Stop_Time" type="TString"/>
|
||||
<xs:element name="Run_Duration" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Laboratory" type="TString"/>
|
||||
<xs:element name="Area" type="TString"/>
|
||||
<xs:element name="Instrument" type="TString"/>
|
||||
<xs:element name="Muon_Beam_Momentum" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Muon_Species" type="TString"/>
|
||||
<xs:element name="Muon_Source" type="TString"/>
|
||||
<xs:element name="Setup" type="TString"/>
|
||||
<xs:element name="Comment" type="TString"/>
|
||||
<xs:element name="Sample_Name" type="TString"/>
|
||||
<xs:element name="Sample_Temperature" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Sample_Magnetic_Field" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="No_of_Histos" type="Int_t"/>
|
||||
<xs:element name="Time_Resolution" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="RedGreen_Offsets" type="TIntVector"/>
|
||||
<xs:element name="Moderator" type="TString"/>
|
||||
<xs:element name="Moderator_HV" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Sample_HV" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Implantation_Energy" type="TMusrRunPhysicalQuantity"/>
|
||||
<xs:element name="Cuts" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="Int_t">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="Int_t"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="Double_t">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="Double_t"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="TString">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TString"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="TMusrRunPhysicalQuantity">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TMusrRunPhysicalQuantity"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="TIntVector">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TIntVector"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="sampleEnvironmentInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Cryo" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="magneticFieldEnvironmentInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Magnet_Name" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="detectorInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Detector" type="detector" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="detector">
|
||||
<xs:sequence>
|
||||
<xs:element name="Name" type="TString"/>
|
||||
<xs:element name="Histo_Number" type="Int_t"/>
|
||||
<xs:element name="Histo_Length" type="Int_t"/>
|
||||
<xs:element name="Time_Zero_Bin" type="Double_t"/>
|
||||
<xs:element name="First_Good_Bin" type="Int_t"/>
|
||||
<xs:element name="Last_Good_Bin" type="Int_t"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="beamlineInfo">
|
||||
<xs:sequence>
|
||||
<xs:element name="Name" type="TString"/>
|
||||
<xs:element name="Beamline_Settings" type="TString"/>
|
||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="histoData">
|
||||
<xs:sequence>
|
||||
<xs:element name="Entry" type="histoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="histoEntry">
|
||||
<xs:sequence>
|
||||
<xs:element name="Name" type="xs:string"/>
|
||||
<xs:element name="Type" type="rootHistoType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="rootHistoType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="TH([1-2])F"/> <!-- this means TH1F or TH2F -->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
1691
src/external/MusrRoot/TMusrRunHeader.cpp
vendored
Normal file
1691
src/external/MusrRoot/TMusrRunHeader.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
196
src/external/MusrRoot/TMusrRunHeader.h
vendored
Normal file
196
src/external/MusrRoot/TMusrRunHeader.h
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
/***************************************************************************
|
||||
|
||||
TMusrRunHeader.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id: TMusrRunHeader.h 5092 2012-03-13 07:47:00Z nemu $
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TMUSRRUNHEADER_H
|
||||
#define TMUSRRUNHEADER_H
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include <TDatime.h>
|
||||
#include <TObject.h>
|
||||
#include <TQObject.h>
|
||||
#include <TObjString.h>
|
||||
#include <TObjArray.h>
|
||||
#include <TFolder.h>
|
||||
|
||||
#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;
|
||||
typedef vector<TString> TStringVector;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <class T> class TMusrRunObject : public TObject
|
||||
{
|
||||
public:
|
||||
TMusrRunObject() { fPathName = "n/a"; fType = "n/a"; }
|
||||
TMusrRunObject(TString pathName, TString type, T value) : fPathName(pathName), fType(type), fValue(value) {}
|
||||
virtual ~TMusrRunObject() {}
|
||||
|
||||
virtual TString GetPathName() { return fPathName; }
|
||||
virtual TString GetType() { return fType; }
|
||||
virtual T GetValue() { return fValue; }
|
||||
|
||||
virtual void SetPathName(TString pathName) { fPathName = pathName; }
|
||||
virtual void SetType(TString type) { fType = type; }
|
||||
virtual void SetValue(T value) { fValue = value; }
|
||||
|
||||
private:
|
||||
TString fPathName; ///< path name of the variable, e.g. 'RunInfo/Run Number'
|
||||
TString fType; ///< type of value, e.g. TString, or Int_t, etc.
|
||||
T fValue; ///< value itself
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
class TMusrRunPhysicalQuantity : public TObject
|
||||
{
|
||||
public:
|
||||
TMusrRunPhysicalQuantity();
|
||||
TMusrRunPhysicalQuantity(TString label, Double_t demand, Double_t value, Double_t error, TString unit, TString description = TString("n/a"));
|
||||
TMusrRunPhysicalQuantity(TString label, Double_t demand, Double_t value, TString unit, TString description = TString("n/a"));
|
||||
TMusrRunPhysicalQuantity(TString label, Double_t value, TString unit, TString description = TString("n/a"));
|
||||
virtual ~TMusrRunPhysicalQuantity() {}
|
||||
|
||||
virtual TString GetLabel() const { return fLabel; }
|
||||
virtual Double_t GetDemand() const { return fDemand; }
|
||||
virtual Double_t GetValue() const { return fValue; }
|
||||
virtual Double_t GetError() const { return fError; }
|
||||
virtual TString GetUnit() const { return fUnit; }
|
||||
virtual TString GetDescription() const { return fDescription; }
|
||||
|
||||
virtual void Set(TString label, Double_t demand, Double_t value, Double_t error, TString unit, TString description = TString("n/a"));
|
||||
virtual void Set(TString label, Double_t demand, Double_t value, TString unit, TString description = TString("n/a"));
|
||||
virtual void Set(TString label, Double_t value, TString unit, TString description = TString("n/a"));
|
||||
virtual void SetLabel(TString &label) { fLabel = label; }
|
||||
virtual void SetLabel(const char *label) { fLabel = label; }
|
||||
virtual void SetDemand(Double_t val) { fDemand = val; }
|
||||
virtual void SetValue(Double_t val) { fValue = val; }
|
||||
virtual void SetError(Double_t err) { fError = err; }
|
||||
virtual void SetUnit(TString &unit) { fUnit = unit; }
|
||||
virtual void SetUnit(const char *unit) { fUnit = unit; }
|
||||
virtual void SetDescription(TString &str) { fDescription = str; }
|
||||
virtual void SetDescription(const char *str) { fDescription = str; }
|
||||
|
||||
private:
|
||||
TString fLabel; ///< property label, like ’Sample Temperature’ etc.
|
||||
Double_t fDemand; ///< demand value of the physical quantity, e.g. temperature setpoint
|
||||
Double_t fValue; ///< measured value of the physical quantity
|
||||
Double_t fError; ///< estimated error (standard deviation) of the measured value
|
||||
TString fUnit; ///< unit of the physical quantity
|
||||
TString fDescription; ///< a more detailed description of the physical quantity
|
||||
|
||||
ClassDef(TMusrRunPhysicalQuantity, 1)
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
class TMusrRunHeader : public TObject
|
||||
{
|
||||
public:
|
||||
TMusrRunHeader(bool quite=false);
|
||||
TMusrRunHeader(const char *fileName, bool quite=false);
|
||||
virtual ~TMusrRunHeader();
|
||||
|
||||
virtual TString GetFileName() { return fFileName; }
|
||||
|
||||
virtual Bool_t FillFolder(TFolder *folder);
|
||||
|
||||
virtual Bool_t ExtractAll(TFolder *folder);
|
||||
virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path);
|
||||
|
||||
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) { fFileName = 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:
|
||||
bool fQuite;
|
||||
TString fFileName;
|
||||
TString fVersion;
|
||||
|
||||
vector< TMusrRunObject<TString> > fStringObj;
|
||||
vector< TMusrRunObject<Int_t> > fIntObj;
|
||||
vector< TMusrRunObject<Double_t> > fDoubleObj;
|
||||
vector< TMusrRunObject<TMusrRunPhysicalQuantity> > fMusrRunPhysQuantityObj;
|
||||
vector< TMusrRunObject<TStringVector> > fStringVectorObj;
|
||||
vector< TMusrRunObject<TIntVector> > fIntVectorObj;
|
||||
vector< TMusrRunObject<TDoubleVector> > fDoubleVectorObj;
|
||||
|
||||
vector< TString > fPathNameOrder; ///< keeps the path-name as they were created in ordered to keep ordering
|
||||
|
||||
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);
|
||||
|
||||
ClassDef(TMusrRunHeader, 1)
|
||||
};
|
||||
|
||||
#endif // TMUSRRUNHEADER_H
|
||||
10
src/external/MusrRoot/TMusrRunHeader.pc.in
vendored
Normal file
10
src/external/MusrRoot/TMusrRunHeader.pc.in
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: TMusrRunHeader
|
||||
Description: C++ shared library providing the MusrRoot Run Header class
|
||||
Version: @MUSR_ROOT_VERSION@
|
||||
Libs: -L${libdir} -l@MUSR_ROOT_LIBRARY_NAME@
|
||||
Cflags: -I${includedir}
|
||||
41
src/external/MusrRoot/TMusrRunHeaderLinkDef.h
vendored
Normal file
41
src/external/MusrRoot/TMusrRunHeaderLinkDef.h
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
|
||||
TMusrRunHeaderLinkDef.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id: TMusrRunHeaderLinkDef.h 5054 2012-01-18 07:43:50Z suter_a $
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __CINT__
|
||||
|
||||
#pragma link off all globals;
|
||||
#pragma link off all classes;
|
||||
#pragma link off all functions;
|
||||
|
||||
#pragma link C++ class TMusrRunPhysicalQuantity+;
|
||||
#pragma link C++ class TMusrRunHeader+;
|
||||
|
||||
#endif
|
||||
318
src/external/MusrRoot/root2xml.C
vendored
Normal file
318
src/external/MusrRoot/root2xml.C
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
// quick and dirty ROOT -> XML converter for MusrRoot
|
||||
// needs to be rewritten as proper program.
|
||||
//
|
||||
// Andreas Suter
|
||||
//
|
||||
// $Id: root2xml.C 5092 2012-03-13 07:47:00Z nemu $
|
||||
|
||||
vector<string> xml_data;
|
||||
|
||||
enum EFolderTag {eUnkown, eDecayAnaModule, eSlowControlAnaModule};
|
||||
enum ERunHeaderTag {eUnkown, eRunInfo, eSampleEnvironmentInfo, eMagneticFieldEnvironmentInfo, eBeamlineInfo, eScalerInfo};
|
||||
EFolderTag folderTag = eUnkown;
|
||||
ERunHeaderTag runHeaderTag = eUnkown;
|
||||
|
||||
void root2xml(const char *filename, const char *xmlFilename)
|
||||
{
|
||||
TFile f(filename);
|
||||
|
||||
if (f.IsZombie()) {
|
||||
cout << endl << "**ERROR** couldn't open file " << filename << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
xml_data.clear();
|
||||
|
||||
xml_data.push_back("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
xml_data.push_back("<MusrRoot xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"file:MusrRoot.xsd\">");
|
||||
|
||||
TIter next = f.GetListOfKeys();
|
||||
TKey *key;
|
||||
TFolder *folder;
|
||||
TString str, tag;
|
||||
|
||||
UInt_t offset = 2;
|
||||
|
||||
while (key = (TKey*) next()) {
|
||||
cout << endl << "name: " << key->GetName() << ", class name: " << key->GetClassName();
|
||||
str = key->GetClassName();
|
||||
if (str == "TFolder") {
|
||||
folder = (TFolder*)key->ReadObj();
|
||||
checkClass(folder, str, offset);
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
f.Close();
|
||||
|
||||
xml_data.push_back("</MusrRoot>");
|
||||
|
||||
// the sort_histo_folders is needed since XML-Schema is not flexible enough to handle
|
||||
// histos -|
|
||||
// |- DecayAnaModule
|
||||
// ... (any other analyzer module sub-folder
|
||||
// |- SCAnaModule
|
||||
// Hence SCAnaModule has artificially moved up, just to follow DecayAnaModule
|
||||
sort_histo_folders();
|
||||
|
||||
ofstream fout(xmlFilename);
|
||||
|
||||
for (UInt_t i=0; i<xml_data.size(); i++)
|
||||
fout << xml_data[i] << endl;
|
||||
fout.close();
|
||||
}
|
||||
|
||||
void sort_histo_folders()
|
||||
{
|
||||
vector<string> temp_xml_data;
|
||||
|
||||
// first make a copy of the original xml_data
|
||||
for (unsigned int i=0; i<xml_data.size(); i++)
|
||||
temp_xml_data.push_back(xml_data[i]);
|
||||
|
||||
// remove SCAnaModule from temp_xml_data
|
||||
unsigned int start = 0, end = 0;
|
||||
for (unsigned int i=0; i<temp_xml_data.size(); i++) {
|
||||
if (temp_xml_data[i].find("<SCAnaModule>") != string::npos)
|
||||
start = i;
|
||||
if (temp_xml_data[i].find("</SCAnaModule>") != string::npos)
|
||||
end = i+1;
|
||||
}
|
||||
if ((start > 0) && (end > 0))
|
||||
temp_xml_data.erase(temp_xml_data.begin()+start, temp_xml_data.begin()+end);
|
||||
else // no SCAnaModule present, hence nothing to be done
|
||||
return;
|
||||
|
||||
// insert SCAnaModule just after DecayAnaModule
|
||||
// 1st find end of DecayAnaModule
|
||||
unsigned int pos = 0;
|
||||
for (unsigned int i=0; i<temp_xml_data.size(); i++) {
|
||||
if (temp_xml_data[i].find("</DecayAnaModule>") != string::npos) {
|
||||
pos = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == 0) // something is wrong, hence to not do anything
|
||||
return;
|
||||
temp_xml_data.insert(temp_xml_data.begin()+pos, xml_data.begin()+start, xml_data.begin()+end);
|
||||
|
||||
// copy temp_xml_data back into xml_data
|
||||
xml_data.clear();
|
||||
for (unsigned int i=0; i<temp_xml_data.size(); i++)
|
||||
xml_data.push_back(temp_xml_data[i]);
|
||||
|
||||
// clean up
|
||||
temp_xml_data.clear();
|
||||
}
|
||||
|
||||
void dumpFolder(TFolder *folder, UInt_t offset)
|
||||
{
|
||||
TString offsetStr="";
|
||||
for (UInt_t i=0; i<offset; i++)
|
||||
offsetStr += " ";
|
||||
|
||||
TIter next = folder->GetListOfFolders();
|
||||
TObject *obj;
|
||||
TString str;
|
||||
while (obj = (TObject*) next()) {
|
||||
cout << endl << offsetStr << "name: " << obj->GetName() << ", class name: " << obj->ClassName();
|
||||
str = obj->ClassName();
|
||||
checkClass(obj, str, offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void dumpObjArray(TObjArray *obj, UInt_t offset)
|
||||
{
|
||||
TString offsetStr="";
|
||||
for (UInt_t i=0; i<offset; i++)
|
||||
offsetStr += " ";
|
||||
|
||||
TObjString *tstr;
|
||||
TString str, xmlStr, type, label, xmlLabel;
|
||||
|
||||
// check if the obj name is anything like DetectorXXX, where XXX is a number
|
||||
xmlLabel = TString(obj->GetName());
|
||||
if (xmlLabel.BeginsWith("Detector")) {
|
||||
xmlLabel.Remove(0, 8); // remove 'Detector'
|
||||
if (xmlLabel.IsDigit())
|
||||
xmlLabel = "Detector";
|
||||
else
|
||||
xmlLabel = TString(obj->GetName());
|
||||
}
|
||||
|
||||
cout << endl << offsetStr << obj->GetName() << " (# " << obj->GetEntries() << ")";
|
||||
|
||||
xmlStr = offsetStr + "<" + xmlLabel + ">";
|
||||
xml_data.push_back(xmlStr.Data());
|
||||
|
||||
for (UInt_t i=0; i<obj->GetEntries(); i++) {
|
||||
// check if entry is a TObjArray
|
||||
type = obj->At(i)->ClassName();
|
||||
if (type == "TObjArray") {
|
||||
dumpObjArray((TObjArray*)(obj->At(i)), offset+2);
|
||||
} else { // not a TObjArray
|
||||
tstr = (TObjString*) obj->At(i);
|
||||
str = tstr->GetString();
|
||||
str.Remove(TString::kTrailing, '\n');
|
||||
|
||||
getType(str, type);
|
||||
getLabel(str, label);
|
||||
|
||||
cout << endl << offsetStr << i << ": " << str;
|
||||
|
||||
xmlStr = offsetStr + " " + "<" + label + ">" + type + "</" + label + ">" ;
|
||||
xml_data.push_back(xmlStr.Data());
|
||||
}
|
||||
}
|
||||
|
||||
xmlStr = offsetStr + "</" + xmlLabel + ">";
|
||||
xml_data.push_back(xmlStr.Data());
|
||||
}
|
||||
|
||||
void dumpEntry(TObject *obj, UInt_t offset)
|
||||
{
|
||||
TString offsetStr="";
|
||||
for (UInt_t i=0; i<offset; i++)
|
||||
offsetStr += " ";
|
||||
|
||||
TString nameTag(""), typeTag("");
|
||||
switch (folderTag) {
|
||||
case eDecayAnaModule:
|
||||
nameTag = "HistoName";
|
||||
typeTag = "HistoType";
|
||||
break;
|
||||
case eSlowControlAnaModule:
|
||||
nameTag = "SlowControlName";
|
||||
typeTag = "SlowControlType";
|
||||
break;
|
||||
case eUnkown:
|
||||
default:
|
||||
nameTag = "Name";
|
||||
typeTag = "Type";
|
||||
break;
|
||||
}
|
||||
|
||||
TString str;
|
||||
|
||||
str = offsetStr + "<" + nameTag + ">";
|
||||
str += obj->GetName();
|
||||
str += "</" + nameTag + ">";
|
||||
xml_data.push_back(str.Data());
|
||||
|
||||
str = offsetStr + "<" + typeTag + ">";
|
||||
str += obj->ClassName();
|
||||
str += "</" + typeTag + ">";
|
||||
xml_data.push_back(str.Data());
|
||||
}
|
||||
|
||||
void checkClass(TObject *obj, TString str, UInt_t offset)
|
||||
{
|
||||
TString offsetStr="";
|
||||
for (UInt_t i=0; i<offset; i++)
|
||||
offsetStr += " ";
|
||||
|
||||
if (str == "TFolder") {
|
||||
TString xmlTagName(TString(obj->GetName()));
|
||||
|
||||
// set folder tag
|
||||
if (!xmlTagName.CompareTo("DecayAnaModule"))
|
||||
folderTag = eDecayAnaModule;
|
||||
else if (!xmlTagName.CompareTo("SCAnaModule"))
|
||||
folderTag = eSlowControlAnaModule;
|
||||
else if (!xmlTagName.CompareTo("SCAnaModule"))
|
||||
folderTag = eSlowControlAnaModule;
|
||||
else
|
||||
folderTag = eUnkown;
|
||||
|
||||
offset += 2;
|
||||
str = offsetStr + "<" + xmlTagName + ">";
|
||||
xml_data.push_back(str.Data());
|
||||
|
||||
dumpFolder((TFolder*)obj, offset);
|
||||
|
||||
str = offsetStr + "</" + xmlTagName + ">";
|
||||
xml_data.push_back(str.Data());
|
||||
} else if (str == "TObjArray") {
|
||||
offset += 2;
|
||||
dumpObjArray((TObjArray*)obj, offset);
|
||||
} else {
|
||||
// filter out the proper entry tag
|
||||
TString entryTag("");
|
||||
switch (folderTag) {
|
||||
case eDecayAnaModule:
|
||||
entryTag = TString("DecayHistoEntry");
|
||||
break;
|
||||
case eSlowControlAnaModule:
|
||||
entryTag = TString("SlowControlHistoEntry");
|
||||
break;
|
||||
case eUnkown:
|
||||
default:
|
||||
entryTag = TString("Entry");
|
||||
break;
|
||||
}
|
||||
|
||||
offset += 2;
|
||||
str = offsetStr + "<" + entryTag + ">";
|
||||
xml_data.push_back(str.Data());
|
||||
dumpEntry((TObjArray*)obj, offset);
|
||||
str = offsetStr + "</" + entryTag + ">";
|
||||
xml_data.push_back(str.Data());
|
||||
}
|
||||
}
|
||||
|
||||
void getType(TString entry, TString &type)
|
||||
{
|
||||
if (entry.Contains("-@0")) {
|
||||
type = "TString";
|
||||
} else if (entry.Contains("-@1")) {
|
||||
type = "Int_t";
|
||||
} else if (entry.Contains("-@2")) {
|
||||
type = "Double_t";
|
||||
} else if (entry.Contains("-@3")) {
|
||||
type = "TMusrRunPhysicalQuantity";
|
||||
} else if (entry.Contains("-@4")) {
|
||||
type = "TStringVector";
|
||||
} else if (entry.Contains("-@5")) {
|
||||
type = "TIntVector";
|
||||
} else if (entry.Contains("-@6")) {
|
||||
type = "TDoubleVector";
|
||||
} else {
|
||||
type = "TString";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void getLabel(TString entry, TString &label)
|
||||
{
|
||||
label="no_idea";
|
||||
|
||||
Ssiz_t start = entry.First('-');
|
||||
Ssiz_t end = entry.First(':');
|
||||
|
||||
if ((start == -1) || (end == -1))
|
||||
return;
|
||||
|
||||
if (end - start < 2)
|
||||
return;
|
||||
|
||||
// check that '-@' is present in the string, otherwise it is NOT a known label
|
||||
Ssiz_t pos = entry.First('@');
|
||||
if (pos < 1)
|
||||
return;
|
||||
if (entry(pos-1) != '-')
|
||||
return;
|
||||
|
||||
// cut out value
|
||||
label = entry;
|
||||
label.Remove(0, start+2);
|
||||
label.Remove(end-start-2, label.Length());
|
||||
|
||||
label.ReplaceAll(' ', '_'); // replace spaces through underscores
|
||||
label.ReplaceAll('(', '_'); // replace '(' through underscores
|
||||
label.ReplaceAll(')', '_'); // replace ')' through underscores
|
||||
label.ReplaceAll('[', '_'); // replace '[' through underscores
|
||||
label.ReplaceAll(']', '_'); // replace ']' through underscores
|
||||
label.ReplaceAll('{', '_'); // replace '[' through underscores
|
||||
label.ReplaceAll('}', '_'); // replace ']' through underscores
|
||||
}
|
||||
8
src/external/nexus/PNeXus.cpp
vendored
8
src/external/nexus/PNeXus.cpp
vendored
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2011 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -565,7 +565,7 @@ int PNeXusData1::GetT0(unsigned int idx)
|
||||
if (idx >= fT0.size())
|
||||
return -1;
|
||||
|
||||
return fT0[idx];
|
||||
return (int)fT0[idx];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
@@ -581,7 +581,7 @@ int PNeXusData1::GetFirstGoodBin(unsigned int idx)
|
||||
if (idx >= fFirstGoodBin.size())
|
||||
return -1;
|
||||
|
||||
return fFirstGoodBin[idx];
|
||||
return (int)fFirstGoodBin[idx];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
@@ -597,7 +597,7 @@ int PNeXusData1::GetLastGoodBin(unsigned int idx)
|
||||
if (idx >= fLastGoodBin.size())
|
||||
return -1;
|
||||
|
||||
return fLastGoodBin[idx];
|
||||
return (int)fLastGoodBin[idx];
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
src/external/nexus/PNeXus.h
vendored
2
src/external/nexus/PNeXus.h
vendored
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2011 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
763
src/external/scripts/msr2data
vendored
763
src/external/scripts/msr2data
vendored
@@ -1,763 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -x /usr/bin/awk ]; then
|
||||
echo ">> msr2data: Please make sure you have installed awk!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$#" -lt 2 ] ; then
|
||||
|
||||
cat <<EOFHELP
|
||||
|
||||
"musrfit-msr to db/dat converter"
|
||||
|
||||
USAGE: msr2data FIRSTRUN# LASTRUN# EXTENSION [noheader | nosummary | fit-TEMPLATERUN# | -oOUTPUT_FILE | -k | -t | data ]
|
||||
OR
|
||||
msr2data \[SPACE SEPARATED LIST OF RUNS\] EXTENSION [noheader | nosummary | fit-TEMPLATERUN# | -oOUTPUT_FILE | -k | -t | data ]
|
||||
OR
|
||||
msr2data RUNLISTFILE EXTENSION [noheader | nosummary | fit-TEMPLATERUN# | -oOUTPUT_FILE | -k | -t | data ]
|
||||
|
||||
This small script converts subsequent musrfit msr output files into one db- or column-ASCII-file using bash/awk.
|
||||
|
||||
Example 1:
|
||||
msr2data 1423 1425 _tf_h13
|
||||
generates the db-file "out.db" (or whatever filename you additionally specify with the -o option) from 1423_tf_h13.msr, 1424_tf_h13.msr, and 1425_tf_h13.msr .
|
||||
|
||||
Example 2:
|
||||
msr2data [1487 1435] _tf_h13
|
||||
generates the db-file "out.db" (or whatever filename you additionally specify with the -o option) from 1487_tf_h13.msr and 1435_tf_h13.msr .
|
||||
|
||||
Example 3:
|
||||
msr2data runs.txt _tf_h13
|
||||
generates the db-file "out.db" (or whatever filename you additionally specify with the -o option) from all runs listed in the ASCII-file
|
||||
"runs.txt" in the working directory. In the file it's also possible to include external parameters which should be put in the resulting db-file.
|
||||
The structure of the "runs.txt" is the following:
|
||||
|
||||
RUN VAR1 VAR2 VAR3 ...
|
||||
2716 200 27.1 46.2 ...
|
||||
2787 205 27.1 46.3 ...
|
||||
2260 210 27.2 45.9 ...
|
||||
...
|
||||
|
||||
The first line specifies the db-parameter names and labels and has to be present!
|
||||
|
||||
The output files in all examples above also include the db header.
|
||||
In the case you are dealing with LEM-data AND have locally mounted the /mnt/data/nemu directory some available parameters like the
|
||||
temperature or transport settings will be taken from the summary files and added to the db-file.
|
||||
You can suppress the reading of the summary files with the option "nosummary".
|
||||
|
||||
If you want to generate a file without the header information just run the script with the option "noheader".
|
||||
|
||||
If you additionally want to fit some data using musrfit specify the option "fit-TEMPLATERUN#".
|
||||
In this case either a msr-file or a mlog-file have to be present for the specified template run.
|
||||
The subsequent input files will be created.
|
||||
If you add a "!" to the fit option, e.g. "fit-199!" the specified template will serve as template for ALL runs, not only for the first one.
|
||||
|
||||
Example 4:
|
||||
msr2data 200 220 _tf_h13 -oABC.db fit-199
|
||||
|
||||
This will fit the runs 200 to 220 using musrfit. The file 199_tf_h13.msr (or if that is not available: 199_tf_h13.mlog) is used as
|
||||
template for the first musrfit input file. The results of the fits will be written to ABC.db.
|
||||
|
||||
For keeping the MINUIT2 output files after calling musrfit, i.e. invoke musrfit with the option "--keep-mn2-output" just pass the option "-k" to msr2data. If you pass this option to msr2data but do not fit any data, the option will just be ignored.
|
||||
|
||||
If musrfit should add the title present in the first data file mentioned in a RUN block to the title line of the mlog output file, pass the option "-t" to msr2data. Then musrfit is called with the option "--title-from-data-file". If you pass this option to msr2data but do not fit any data, the option will just be ignored.
|
||||
|
||||
If your musrfit output files do not have an extension as specified above like "200.msr" you have to call the script as in the following example.
|
||||
|
||||
Example 5:
|
||||
msr2data 200 220 "" -oABC.db fit-199
|
||||
|
||||
As an alternative to the db-format as output-format of the script it is possible to choose an ASCII file with simple data columns by invoking the script with the option "data". All features described above are available also for that case!
|
||||
|
||||
CAUTION:
|
||||
The "indexing number" of the .msr has to be at the begin of the filename.
|
||||
Furthermore the data files that were fitted have to have the name "XXX_RUN#[_YYY]", where XXX,YYY are strings without whitespaces ("/" is OK).
|
||||
|
||||
If you want to use the fitting feature, musrfit has to be installed either on the PATH or in the working directory.
|
||||
|
||||
Those of you who do not like scripting without functions better do not look at the code. Still it is more or less straight forward.
|
||||
|
||||
EOFHELP
|
||||
|
||||
else
|
||||
|
||||
export PATH=./:$PATH
|
||||
export LC_NUMERIC=en_US.UTF-8
|
||||
|
||||
SUMMDIR="/mnt/data/nemu/summ"
|
||||
|
||||
# In case a list of runs is given by [...]
|
||||
if [ "${1:0:1}" == "[" ]; then
|
||||
RUNARRAY=($@)
|
||||
|
||||
if [ "$1" == "[" ]; then
|
||||
RUNARRAY[0]=""
|
||||
else
|
||||
RUNARRAY[0]=${RUNARRAY[0]#"["}
|
||||
fi
|
||||
tLen=${#RUNARRAY[@]}
|
||||
for (( i=0; i<${tLen}; i++ ))
|
||||
do
|
||||
if [ "$1" == "[" ]; then
|
||||
RUNARRAY[$i]=${RUNARRAY[ (( i + 1 )) ]}
|
||||
fi
|
||||
if [ "${RUNARRAY[$i]:(-1)}" == "]" ]; then
|
||||
if [ "${RUNARRAY[$i]}" == "]" ]; then
|
||||
RUNARRAY[$i]=""
|
||||
LASTRUN=$(( i - 1 )) # RUNARRAY-index of the last run
|
||||
else
|
||||
RUNARRAY[$i]=${RUNARRAY[$i]%"]"}
|
||||
LASTRUN=$i # RUNARRAY-index of the last run
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# search for the parameter including the "]"
|
||||
for (( i=1; i<="$#"; i++ ))
|
||||
do
|
||||
RIGHTBRACKET=$( eval echo \${$i} )
|
||||
if [ "${RIGHTBRACKET:(-1)}" == "]" ]; then
|
||||
RIGHTBRACKET=$i
|
||||
break
|
||||
else
|
||||
RIGHTBRACKET=0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$RIGHTBRACKET" -eq 0 ]; then
|
||||
echo
|
||||
echo ">> msr2data: Syntax error - you used the list specification without closing bracket (])! Quitting now."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EXTENSION=$( eval echo \${$((RIGHTBRACKET + 1))} )
|
||||
FIRST_OPT_PAR=$((RIGHTBRACKET + 2))
|
||||
LAST_OPT_PAR=$#
|
||||
RUNLIST_USED=0
|
||||
NUM_OF_IND_VAR=1 # 1 for the run number
|
||||
|
||||
else
|
||||
ISDIGIT1=$( echo $1 | awk '{ if (( $1 + 0 ) == $1 ) {print 1} else {print 0}}' ) # check if the first parameter is a number or not
|
||||
ISDIGIT2=$( echo $2 | awk '{ if (( $1 + 0 ) == $1 ) {print 1} else {print 0}}' ) # check if the second parameter is a number or not
|
||||
if [ "$ISDIGIT1" -eq 1 ] && [ "$ISDIGIT2" -eq 1 ]; then # start and end-runs are given
|
||||
if [ "$1" -le "$2" ]; then # runs are given with increasing run numbers
|
||||
for (( j=0; j<=$2-$1; j++ ))
|
||||
do
|
||||
RUNARRAY[$j]=$(( $1 + $j ))
|
||||
done
|
||||
LASTRUN=$(( $2 - $1 )) # RUNARRAY-index of the last run
|
||||
else # runs are given with decreasing run numbers
|
||||
for (( j=0; j<=$1-$2; j++ ))
|
||||
do
|
||||
RUNARRAY[$j]=$(( $1 - $j ))
|
||||
done
|
||||
LASTRUN=$(( $1 - $2 )) # RUNARRAY-index of the last run
|
||||
fi
|
||||
|
||||
EXTENSION=$3
|
||||
|
||||
FIRST_OPT_PAR=4
|
||||
LAST_OPT_PAR=$#
|
||||
RUNLIST_USED=0
|
||||
NUM_OF_IND_VAR=1 # 1 for the run number
|
||||
|
||||
elif [ "$ISDIGIT1" -eq 1 ] && [ "$ISDIGIT2" -eq 0 ]; then # only one run number is given
|
||||
RUNARRAY[0]=$1
|
||||
|
||||
LASTRUN=0 # RUNARRAY-index of the last run
|
||||
EXTENSION=$2
|
||||
|
||||
FIRST_OPT_PAR=3
|
||||
LAST_OPT_PAR=$#
|
||||
RUNLIST_USED=0
|
||||
NUM_OF_IND_VAR=1 # 1 for the run number
|
||||
|
||||
else # assume a runlist-file with "independent variables" is given
|
||||
if [ ! -r $1 ]; then
|
||||
echo
|
||||
echo ">> msr2data: The specified runlist file $1 is not present... Bye bye!"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
numberOfReadInLines=0
|
||||
numberOfComments=0
|
||||
|
||||
exec 3< $1 # open file for reading in the runlist-file the first time and get the runnumbers to be processed
|
||||
while read -u 3 -a runList
|
||||
do
|
||||
if [ "$numberOfReadInLines" -eq 0 ]; then
|
||||
NUM_OF_IND_VAR=${#runList[@]}
|
||||
elif [ "${runList[0]:0:1}" == "#" ] || [ "${runList[0]}" == "" ]; then
|
||||
((numberOfComments++))
|
||||
else
|
||||
RUNARRAY[(( numberOfReadInLines - numberOfComments - 1 ))]=${runList[0]}
|
||||
fi
|
||||
((numberOfReadInLines++))
|
||||
done
|
||||
exec 3<&- # close file
|
||||
|
||||
LASTRUN=$(( ${#RUNARRAY[@]} - 1 )) # RUNARRAY-index of the last run
|
||||
EXTENSION=$2
|
||||
|
||||
FIRST_OPT_PAR=3
|
||||
LAST_OPT_PAR=$#
|
||||
RUNLIST_USED=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if fitting should be done
|
||||
TEMP=""
|
||||
for PAR in "$@"
|
||||
do
|
||||
if [ "${PAR:0:3}" == "fit" ]; then
|
||||
TEMP=${PAR:4}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# define which file (msr or mlog) contains the musrfit-output
|
||||
INPUTEXT=mlog
|
||||
OUTPUTEXT=msr
|
||||
|
||||
if [ "$TEMP" != "" ]; then # runs should be fitted using musrfit
|
||||
|
||||
SETBATCH=0 # check if the TEMPLATE file should ALWAYS be the template or only for the first run
|
||||
if [ "${TEMP:(-1)}" == "!" ]; then
|
||||
SETBATCH=1
|
||||
TEMP=${TEMP%"!"}
|
||||
fi
|
||||
|
||||
# Check for musrfit on the PATH and if found continue with searching the fit-template
|
||||
PATHTOMUSRFIT=$(echo `which musrfit`)
|
||||
if [ "$PATHTOMUSRFIT" == "" ]; then
|
||||
echo
|
||||
echo ">> msr2data: No musrfit executable was found on the PATH or in the current directory!"
|
||||
echo ">> msr2data: Please install musrfit first!"
|
||||
echo
|
||||
exit 1
|
||||
else
|
||||
if [ -r $TEMP$EXTENSION.$OUTPUTEXT ]; then
|
||||
TEMPLATE=$TEMP$EXTENSION.$OUTPUTEXT
|
||||
elif [ -r $TEMP$EXTENSION.$INPUTEXT ]; then
|
||||
TEMPLATE=$TEMP$EXTENSION.$INPUTEXT
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
for (( q=0; q<=LASTRUN; q++ )) # loop over all RUNARRAY entries - the actual data-processing
|
||||
do
|
||||
COUNT=${RUNARRAY[$q]}
|
||||
NEXTCOUNT=${RUNARRAY[ (( q + 1 )) ]}
|
||||
NEXTINPUT=$NEXTCOUNT$EXTENSION.msr
|
||||
FIRSTINPUT=${RUNARRAY[0]}$EXTENSION.msr
|
||||
|
||||
if [ "$TEMP" != "" ]; then # if fitting should be done
|
||||
if [ "$TEMPLATE" == "" ]; then
|
||||
echo
|
||||
echo ">> msr2data: The specified musrfit template files $TEMP$EXTENSION.$OUTPUTEXT and $TEMP$EXTENSION.$INPUTEXT do not exist!"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if it's the first run to be fitted, take the template and substitute the runnumber to match the first run
|
||||
if [ "$q" -eq 0 ] && [ "$TEMPLATE" != "$FIRSTINPUT" ]; then
|
||||
awk -v count=$TEMP -v nextcount=${RUNARRAY[0]} -v nextinput=$FIRSTINPUT '{
|
||||
if(NR==1) print nextcount > nextinput
|
||||
else if($1 == "RUN") {
|
||||
if (substr(count,1,1) != "_"){ count = sprintf("_%04u", count); nextcount = sprintf("_%04u", nextcount);}
|
||||
if ($2 !~ count){
|
||||
print " "
|
||||
print ">> msr2data: ATTENTION The run-numbers in the filename and the RUN-block of the template file do not match!"
|
||||
print ">> msr2data: The run-number substitution is most likely going wrong!"
|
||||
print " "
|
||||
}
|
||||
sub(count, nextcount, $0);
|
||||
print $0 >> nextinput
|
||||
}
|
||||
else print $0 >> nextinput
|
||||
}' $TEMPLATE
|
||||
fi
|
||||
|
||||
MUSRFITPARAM=""
|
||||
for PAR in "$@"
|
||||
do
|
||||
if [ "$PAR" == "-k" ]; then
|
||||
MUSRFITPARAM="$MUSRFITPARAM -k"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for PAR in "$@"
|
||||
do
|
||||
if [ "$PAR" == "-t" ]; then
|
||||
MUSRFITPARAM="$MUSRFITPARAM -t"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo ">> msr2data: musrfit $COUNT$EXTENSION.msr $MUSRFITPARAM"
|
||||
echo
|
||||
musrfit $COUNT$EXTENSION.msr $MUSRFITPARAM # the fit
|
||||
|
||||
if [ "$q" -ne "$LASTRUN" ]; then # create the next musrfit input file if not the last specified run was fitted already
|
||||
if [ "$SETBATCH" -eq 1 ]; then # check if the TEMPLATE should be ALWAYS used or only the first time and use the according file
|
||||
COUNTX=$TEMP
|
||||
TEMPLATEX=$TEMPLATE
|
||||
else
|
||||
COUNTX=$COUNT
|
||||
TEMPLATEX=$COUNT$EXTENSION.$OUTPUTEXT
|
||||
fi
|
||||
if [ "$TEMPLATEX" != "$NEXTINPUT" ]; then
|
||||
awk -v count=$COUNTX -v nextcount=$NEXTCOUNT -v nextinput=$NEXTINPUT '{
|
||||
if(NR==1) print nextcount > nextinput
|
||||
else if($1 == "RUN") {
|
||||
if (substr(count,1,1) != "_"){ count = sprintf("_%04u", count); nextcount = sprintf("_%04u", nextcount);}
|
||||
if ($2 !~ count){
|
||||
print " "
|
||||
print ">> msr2data: ATTENTION The run-numbers in the filename and the RUN-block of the file do not match!"
|
||||
print ">> msr2data: The run-number substitution is most likely going wrong!"
|
||||
print " "
|
||||
}
|
||||
sub(count, nextcount, $0);
|
||||
print $0 >> nextinput
|
||||
}
|
||||
else print $0 >> nextinput
|
||||
}' $TEMPLATEX
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -r $COUNT$EXTENSION.$OUTPUTEXT ]; then
|
||||
echo
|
||||
echo ">> msr2data: The specified musrfit output file $COUNT$EXTENSION.$OUTPUTEXT does not exist!"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if the "nosummary"-option is not set and the summary files are present, get some information from there
|
||||
NOSUMMARY=0
|
||||
for PAR in "$@"
|
||||
do
|
||||
if [ "$PAR" == "nosummary" ]; then
|
||||
NOSUMMARY=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$NOSUMMARY" -eq 0 ]; then
|
||||
|
||||
if [ -d $SUMMDIR ]; then
|
||||
# extract runnumber from mlog/msr-file
|
||||
RUNNUMBER=$( awk '{
|
||||
if(NR==1) X=0
|
||||
if($1 ~ /^RUN/ && X==0) {
|
||||
split($2, runNumber, "_")
|
||||
if(runNumber[1] ~ /lem/ && runNumber[2] != "his") {print runNumber[2] }
|
||||
if(runNumber[1] ~ /lem/ && runNumber[2] == "his") {print substr(runNumber[3],1,4) }
|
||||
X=1
|
||||
}
|
||||
}' $COUNT$EXTENSION.$OUTPUTEXT )
|
||||
|
||||
# extract runyear from mlog/msr-file in case of LEM-data
|
||||
RUNYEAR=$( awk '{
|
||||
if(NR==1) X=0
|
||||
if($1 ~ /^RUN/ && X==0) {
|
||||
split($2, runNumber, "_")
|
||||
if(runNumber[1] ~ /lem/) {print substr(runNumber[1],length(runNumber[1])-1)}
|
||||
else print "XX"
|
||||
X=1
|
||||
}
|
||||
}' $COUNT$EXTENSION.$OUTPUTEXT )
|
||||
|
||||
if [ "$RUNYEAR" != "XX" ]; then # in case of LEM-data search the summary-file
|
||||
SUMMFILE=$SUMMDIR/20$RUNYEAR/lem$RUNYEAR\_$RUNNUMBER.summ
|
||||
TITLE=$( awk '{ if(NR==4) print $0 }' $SUMMFILE )
|
||||
ENERGY=$( awk '{ if($0 ~ /implantation energy/) print $(NF-1)}' $SUMMFILE )
|
||||
TEMPERATURE=$( awk '{ if($1 == "Sample_CF1") print $(NF-1)}' $SUMMFILE )
|
||||
RALRAR=$( awk '{ if($5 == "RA-L") RAL=$7; if($1 == "RA-R") { RAR=$3; print RAL-RAR; nextfile } }' $SUMMFILE )
|
||||
RATRAB=$( awk '{ if($5 == "RA-T") RAT=$7; if($1 == "RA-B") { RAB=$3; print RAT-RAB; nextfile } }' $SUMMFILE )
|
||||
TRANSPORT=$( awk '{ if($1 == "Moderator") print $3}' $SUMMFILE )
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine the script-output file format, default: db
|
||||
FORMAT=db
|
||||
OUTFILE="out.db"
|
||||
|
||||
for PAR in "$@"
|
||||
do
|
||||
if [ "$PAR" == "data" ]; then
|
||||
FORMAT=dat
|
||||
OUTFILE="out.dat"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for (( l="$FIRST_OPT_PAR"; l<="$LAST_OPT_PAR"; l++ ))
|
||||
do
|
||||
CUR_PAR=$( eval echo \${$l} )
|
||||
NEXT_PAR=$( eval echo \${$((l+1))} )
|
||||
if [ "${CUR_PAR:0:2}" == "-o" ]; then
|
||||
if [ "$CUR_PAR" == "-o" ]; then
|
||||
if [ "$l" -ne "$LAST_OPT_PAR" ] && [ "$NEXT_PAR" != "noheader" ] && [ "$NEXT_PAR" != "nosummary" ] \
|
||||
&& [ "${NEXT_PAR:0:3}" != "fit" ] && [ "$NEXT_PAR" != "-k" ] && [ "$NEXT_PAR" != "-t" ]; then
|
||||
OUTFILE=$NEXT_PAR
|
||||
break
|
||||
else
|
||||
echo
|
||||
echo ">> msr2data: You did not specify an output file! The default one ($OUTFILE) will be used."
|
||||
echo
|
||||
fi
|
||||
else
|
||||
OUTFILE=${CUR_PAR:2}
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# determine, if the header should be written to the output file, default: YES
|
||||
NOHEADER=0
|
||||
for PAR in "$@"
|
||||
do
|
||||
if [ "$PAR" == "noheader" ]; then
|
||||
NOHEADER=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# put together all data to db- or column-format and write it to the file
|
||||
awk -v outfile=$OUTFILE -v noheader=$NOHEADER -v runList=$RUNLIST_USED -v numIndVar=$NUM_OF_IND_VAR -v format=$FORMAT '{
|
||||
|
||||
if(tolower(outfile) == "none")
|
||||
exit 0
|
||||
|
||||
FS = " "
|
||||
OFS = " "
|
||||
|
||||
if(NR==1){title=$0; X=0; Y=0; i=1}
|
||||
|
||||
if(NR>1){
|
||||
if(X == 0){
|
||||
if($1 == i){
|
||||
parArray[i] = $2
|
||||
dataArray[i] = $3
|
||||
if($4 ~ /^-/)
|
||||
negErrArray[i] = substr($4, 2)
|
||||
else
|
||||
negErrArray[i] = $4
|
||||
if($5 ~ /none/)
|
||||
posErrArray[i] = $4
|
||||
else
|
||||
posErrArray[i] = $5
|
||||
i++
|
||||
}
|
||||
if($1 ~ /^THEORY/) X=1
|
||||
}
|
||||
}
|
||||
|
||||
if($1 ~ /^RUN/ && X==1){ split($2, runNumber, "_"); X=2 }
|
||||
|
||||
if(($1 ~ /^chisq/ || $1 ~ /^maxLH/) && X==2){
|
||||
if($1 ~ /^maxLH/){
|
||||
parArray[i] = "maxLH"
|
||||
parArray[i+2] = "maxLHred"
|
||||
} else {
|
||||
parArray[i] = "CHISQ"
|
||||
parArray[i+2] = "CHISQred"
|
||||
}
|
||||
parArray[i+1] = "NDF"
|
||||
parArray[i+3] = "RUN"
|
||||
|
||||
sub(/,/, "", $3); sub(/,/, "", $6);
|
||||
|
||||
dataArray[i] = $3
|
||||
dataArray[i+1] = $6
|
||||
dataArray[i+2] = $9
|
||||
|
||||
for (j in runNumber) {
|
||||
if ( runNumber[j] ~ /^0/ ) {
|
||||
sub(/0+/, "", runNumber[j])
|
||||
}
|
||||
if (int(runNumber[j]) == runNumber[j]) {
|
||||
dataArray[i+3] = runNumber[j]
|
||||
break
|
||||
}
|
||||
else dataArray[i+3] = "0000"
|
||||
}
|
||||
|
||||
negErrArray[i] = "0"
|
||||
negErrArray[i+1] = "0"
|
||||
negErrArray[i+2] = "0"
|
||||
negErrArray[i+3] = "0"
|
||||
|
||||
posErrArray[i] = "0"
|
||||
posErrArray[i+1] = "0"
|
||||
posErrArray[i+2] = "0"
|
||||
posErrArray[i+3] = "0"
|
||||
|
||||
# Read in the runlist-variable names
|
||||
if(runList == 1){
|
||||
getline line < "'"$1"'"
|
||||
split(line, indVar, " ")
|
||||
}
|
||||
|
||||
# Output to db-file in the case, the LEM summary file is accessible and the option "nosummary" is not set
|
||||
|
||||
if(format != "dat") {
|
||||
if("'"$TEMPERATURE"'" != "") {
|
||||
|
||||
# Write the db-header
|
||||
if("'"$q"'" == 0 && noheader != 1){
|
||||
|
||||
print "TITLE" >> outfile
|
||||
print ">>>Put your title here<<<\n" >> outfile
|
||||
print "Abstract" >> outfile
|
||||
print ">>>Put your abstract here<<<\n" >> outfile
|
||||
print "LABELS" >> outfile
|
||||
print "T (K)" >> outfile
|
||||
print "Tr (kV)" >> outfile
|
||||
print "E (keV)" >> outfile
|
||||
print "RAL-RAR (kV)" >> outfile
|
||||
print "RAT-RAB (kV)" >> outfile
|
||||
|
||||
if(runList == 1){
|
||||
for(k=2;k<=numIndVar;k++){print indVar[k] >> outfile}
|
||||
}
|
||||
|
||||
for(k=1;k<i+4;k++){
|
||||
print parArray[k] >> outfile
|
||||
}
|
||||
|
||||
$1 = "Data"
|
||||
$2 = "T"
|
||||
$3 = "Tr"
|
||||
$4 = "E"
|
||||
$5 = "RALRAR"
|
||||
$6 = "RATRAB"
|
||||
|
||||
for(k=1;k<numIndVar;k++){
|
||||
$(k+6)=indVar[k+1]
|
||||
}
|
||||
|
||||
for(k=1;k<i+4;k++){
|
||||
$(k+6+numIndVar-1)=parArray[k]
|
||||
}
|
||||
|
||||
print "\n" $0 >> outfile
|
||||
print "\\-e" >> outfile
|
||||
}
|
||||
|
||||
# Write the data-block
|
||||
print "T = " "'"$TEMPERATURE"'" ",,,\\" >> outfile
|
||||
print "Tr = " "'"$TRANSPORT"'" ",,,\\" >> outfile
|
||||
if ("'"$ENERGY"'" != "") print "E = " "'"$ENERGY"'" ",,,\\" >> outfile
|
||||
else print "E = -999,,,\\" >> outfile
|
||||
if ("'"$RALRAR"'" != "") print "RALRAR = " "'"$RALRAR"'" ",,,\\" >> outfile
|
||||
else print "RALRAR = -999,,,\\" >> outfile
|
||||
if ("'"$RATRAB"'" != "") print "RATRAB = " "'"$RATRAB"'" ",,,\\" >> outfile
|
||||
else print "RATRAB = -999,,,\\" >> outfile
|
||||
|
||||
if(runList == 1) { # process the "independent variables" from the file
|
||||
while((getline line < "'"$1"'") > 0){
|
||||
split(line, indVarValue, " ")
|
||||
if (indVarValue[1] == "'"$COUNT"'"){
|
||||
for(k=2;k<=numIndVar;k++){print indVar[k] " = " indVarValue[k] ",,,\\" >> outfile}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(l=1;l<i+3;l++){
|
||||
print parArray[l] " = " dataArray[l] ", " posErrArray[l] ", " negErrArray[l] ",\\" >> outfile
|
||||
}
|
||||
|
||||
print dataArray[i+3] ",,, " "'"$TITLE"'" >> outfile
|
||||
|
||||
if("'"$q"'" == "'"$LASTRUN"'") print "\n" >> outfile
|
||||
}
|
||||
|
||||
# If we do not have the information from the summary file or "nosummary" is set
|
||||
else {
|
||||
if("'"$q"'" == 0 && noheader != 1){
|
||||
|
||||
print "TITLE" >> outfile
|
||||
print ">>>Put your title here<<<\n" >> outfile
|
||||
print "Abstract" >> outfile
|
||||
print ">>>Put your abstract here<<<\n" >> outfile
|
||||
print "LABELS" >> outfile
|
||||
|
||||
if(runList == 1){
|
||||
for(k=2;k<=numIndVar;k++){print indVar[k] >> outfile}
|
||||
}
|
||||
|
||||
for(k=1;k<i+4;k++){
|
||||
print parArray[k] >> outfile
|
||||
}
|
||||
|
||||
$1 = "Data"
|
||||
|
||||
for(k=1;k<numIndVar;k++){
|
||||
$(k+1)=indVar[k+1]
|
||||
}
|
||||
|
||||
for(k=1;k<i+4;k++){
|
||||
$(k+1+numIndVar-1)=parArray[k]
|
||||
}
|
||||
|
||||
print "\n" $0 >> outfile
|
||||
print "\\-e" >> outfile
|
||||
}
|
||||
|
||||
if(runList == 1) {
|
||||
while((getline line < "'"$1"'") > 0){
|
||||
split(line, indVarValue, " ")
|
||||
if (indVarValue[1] == "'"$COUNT"'"){
|
||||
for(k=2;k<=numIndVar;k++){print indVar[k] " = " indVarValue[k] ",,,\\" >> outfile}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(l=1;l<i+3;l++){
|
||||
print parArray[l] " = " dataArray[l] ", " posErrArray[l] ", " negErrArray[l] ",\\" >> outfile
|
||||
}
|
||||
|
||||
print dataArray[i+3] ",,, " title >> outfile
|
||||
|
||||
if("'"$q"'" == "'"$LASTRUN"'") print "\n" >> outfile
|
||||
}
|
||||
}
|
||||
|
||||
# output to a data-file with simple column-structure
|
||||
# first if the LEM-summary files are present and "nosummary" has not been set
|
||||
else {
|
||||
if("'"$TEMPERATURE"'" != "") {
|
||||
|
||||
# Write the dat-header
|
||||
if("'"$q"'" == 0 && noheader != 1){
|
||||
|
||||
$1 = "T"
|
||||
$2 = "Tr"
|
||||
$3 = "E"
|
||||
$4 = "RALRAR"
|
||||
$5 = "RATRAB"
|
||||
|
||||
for(k=1;k<numIndVar;k++){
|
||||
$(k+5)=indVar[k+1]
|
||||
}
|
||||
|
||||
for(k=1;k<i;k++){ # musrfit parameters
|
||||
$(3*k-2+5+numIndVar-1)=parArray[k]
|
||||
$(3*k-2+5+numIndVar)="PosErr"
|
||||
$(3*k-2+5+numIndVar+1)="NegErr"
|
||||
}
|
||||
|
||||
for(k=0;k<4;k++){ # CHI2, NDF, CHI2red, RUN (without errors)
|
||||
$(3*i-2+5+numIndVar-1+k)=parArray[i+k]
|
||||
}
|
||||
|
||||
print $0 >> outfile
|
||||
}
|
||||
|
||||
# Write the data-block
|
||||
$1 = "'"$TEMPERATURE"'"
|
||||
$2 = "'"$TRANSPORT"'"
|
||||
if ("'"$ENERGY"'" != "") { $3 = "'"$ENERGY"'" } else { $3 = "-999" }
|
||||
if ("'"$RALRAR"'" != "") { $4 = "'"$RALRAR"'" } else { $4 = "-999" }
|
||||
if ("'"$RATRAB"'" != "") { $5 = "'"$RATRAB"'" } else { $5 = "-999" }
|
||||
|
||||
if(runList == 1) { # process the "independent variables" from the file
|
||||
while((getline line < "'"$1"'") > 0){
|
||||
split(line, indVarValue, " ")
|
||||
if (indVarValue[1] == "'"$COUNT"'"){
|
||||
for(k=2;k<=numIndVar;k++){ $(k+4) = indVarValue[k] }
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(l=1;l<i;l++){ # musrfit parameters
|
||||
$(3*l-2+5+numIndVar-1)=dataArray[l]
|
||||
$(3*l-2+5+numIndVar)=posErrArray[l]
|
||||
$(3*l-2+5+numIndVar+1)=negErrArray[l]
|
||||
}
|
||||
|
||||
for(l=0;l<4;l++){ # CHI2, NDF, CHI2red, RUN (without errors)
|
||||
$(3*i-2+5+numIndVar-1+l)=dataArray[i+l]
|
||||
}
|
||||
|
||||
print $0 >> outfile
|
||||
|
||||
if("'"$q"'" == "'"$LASTRUN"'") print "\n" >> outfile
|
||||
}
|
||||
|
||||
# If we do not have the information from the summary file or "nosummary" is set
|
||||
# Writing to column-data file
|
||||
else {
|
||||
if("'"$q"'" == 0 && noheader != 1){
|
||||
|
||||
for(k=1;k<numIndVar;k++){
|
||||
$(k)=indVar[k+1]
|
||||
}
|
||||
|
||||
for(k=1;k<i;k++){ # musrfit parameters
|
||||
$(3*k-2+numIndVar-1)=parArray[k]
|
||||
$(3*k-2+numIndVar)="PosErr"
|
||||
$(3*k-2+numIndVar+1)="NegErr"
|
||||
}
|
||||
|
||||
for(k=0;k<4;k++){ # CHI2, NDF, CHI2red, RUN (without errors)
|
||||
$(3*i-2+numIndVar-1+k)=parArray[i+k]
|
||||
}
|
||||
|
||||
print $0 >> outfile
|
||||
}
|
||||
|
||||
# Write the data-block
|
||||
|
||||
if(runList == 1) { # process the "independent variables" from the file
|
||||
while((getline line < "'"$1"'") > 0){
|
||||
split(line, indVarValue, " ")
|
||||
if (indVarValue[1] == "'"$COUNT"'"){
|
||||
for(k=2;k<=numIndVar;k++){ $(k-1) = indVarValue[k] }
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(l=1;l<i;l++){ # musrfit parameters
|
||||
$(3*l-2+numIndVar-1)=dataArray[l]
|
||||
$(3*l-2+numIndVar)=posErrArray[l]
|
||||
$(3*l-2+numIndVar+1)=negErrArray[l]
|
||||
}
|
||||
|
||||
for(l=0;l<4;l++){ # CHI2, NDF, CHI2red, RUN (without errors)
|
||||
$(3*i-2+numIndVar-1+l)=dataArray[i+l]
|
||||
}
|
||||
|
||||
print $0 >> outfile
|
||||
|
||||
if("'"$q"'" == "'"$LASTRUN"'") print "\n" >> outfile
|
||||
|
||||
}
|
||||
}
|
||||
print " "
|
||||
print ">> msr2data: The parameter data of " ARGV[1] " have been appended to " outfile
|
||||
}
|
||||
if($0 ~ /*** FIT DID NOT CONVERGE ***/ && X==2){
|
||||
print " "
|
||||
print ">> msr2data: ATTENTION At least one of the performed fits has not been converged!"
|
||||
print ">> msr2data: The data of " ARGV[1] " has not been included in " outfile "!"
|
||||
print " "
|
||||
}
|
||||
}' $COUNT$EXTENSION.$OUTPUTEXT
|
||||
done
|
||||
echo
|
||||
echo ">> msr2data: done"
|
||||
echo
|
||||
fi
|
||||
Reference in New Issue
Block a user