first crude implementation of psi-bin format base on Alex's class
This commit is contained in:
1873
src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp
vendored
Normal file
1873
src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
290
src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h
vendored
Normal file
290
src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
/**************************************************************************************
|
||||
|
||||
MuSR_td_PSI_bin.h
|
||||
|
||||
declaration file of the class 'MuSR_td_PSI_bin'
|
||||
|
||||
Main class to read td_bin PSI MuSR data.
|
||||
|
||||
***************************************************************************************
|
||||
|
||||
begin : Alex Amato, October 2005
|
||||
modfied: :
|
||||
copyright : (C) 2005 by
|
||||
email : alex.amato@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. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef MuSR_td_PSI_bin_H_
|
||||
#define MuSR_td_PSI_bin_H_
|
||||
|
||||
#include <iostream>
|
||||
using namespace std ;
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "tydefs.h"
|
||||
|
||||
class MuSR_td_PSI_bin {
|
||||
|
||||
public:
|
||||
MuSR_td_PSI_bin();
|
||||
~MuSR_td_PSI_bin();
|
||||
|
||||
private:
|
||||
// ------------------------------------start of the variables
|
||||
char format_id[3] ;
|
||||
|
||||
Int16 num_run ;
|
||||
|
||||
char sample[11] ;
|
||||
char temp[11] ;
|
||||
char field[11] ;
|
||||
char orient[11] ;
|
||||
char comment[63] ;
|
||||
|
||||
char date_start[10] ;
|
||||
char date_stop[10] ;
|
||||
char time_start[9] ;
|
||||
char time_stop[9] ;
|
||||
|
||||
Float32 bin_width ;
|
||||
Int16 tdc_resolution ;
|
||||
Int16 tdc_overflow ;
|
||||
|
||||
Int16 number_histo ;
|
||||
Int16 length_histo ;
|
||||
char labels_histo[16][5] ;
|
||||
|
||||
Int32 total_events ;
|
||||
Int32 events_per_histo[16] ;
|
||||
|
||||
Int16 integer_t0[16] ;
|
||||
Int16 first_good[16] ;
|
||||
Int16 last_good[16] ;
|
||||
Float32 real_t0[17] ;
|
||||
|
||||
Int32 scalers[18] ;
|
||||
char labels_scalers[18][5] ;
|
||||
|
||||
Float32 temper[4] ;
|
||||
Float32 temp_deviation[4] ;
|
||||
Float32 mon_low[4] ;
|
||||
Float32 mon_high[4] ;
|
||||
Int32 mon_num_events ;
|
||||
char mon_dev[13] ;
|
||||
|
||||
Int16 num_data_records_file ;
|
||||
Int16 length_data_records_bins ;
|
||||
Int16 num_data_records_histo ;
|
||||
|
||||
Int32 period_save ;
|
||||
Int32 period_mon ;
|
||||
Int32 **histo ;
|
||||
|
||||
public:
|
||||
|
||||
vector< vector<double> > histos_vector ; /*!< this public variables provides a direct access to the histograms
|
||||
*/
|
||||
|
||||
// ------------------------------------end of the variables
|
||||
|
||||
public:
|
||||
|
||||
int read(const char* fileName);
|
||||
|
||||
int *get_histo_array_int(int histo_num);
|
||||
double *get_histo_array(int histo_num , int binning) ;
|
||||
vector<double> get_histo_vector(int histo_num , int binning) ;
|
||||
vector<double> get_histo_vector_no0(int histo_num , int binning) ;
|
||||
|
||||
double *get_histo_fromt0_array(int histo_num ,
|
||||
int binning ,
|
||||
int offset = 0) ;
|
||||
|
||||
vector<double> get_histo_fromt0_vector(int histo_num ,
|
||||
int binning ,
|
||||
int offset = 0) ;
|
||||
|
||||
double *get_histo_goodBins_array(int histo_num , int binning) ;
|
||||
|
||||
vector<double> get_histo_goodBins_vector(int histo_num , int binning) ;
|
||||
|
||||
double *get_histo_fromt0_minus_bckgrd_array(int histo_num ,
|
||||
int lower_bckgdr ,
|
||||
int higher_bckgdr ,
|
||||
int binning ,
|
||||
int offset = 0) ;
|
||||
|
||||
vector<double> get_histo_fromt0_minus_bckgrd_vector(int histo_num ,
|
||||
int lower_bckgdr ,
|
||||
int higher_bckgdr ,
|
||||
int binning ,
|
||||
int offset = 0) ;
|
||||
|
||||
double *get_histo_goodBins_minus_bckgrd_array(int histo_num ,
|
||||
int lower_bckgrd ,
|
||||
int higher_bckgrd ,
|
||||
int binning) ;
|
||||
|
||||
vector<double> get_histo_goodBins_minus_bckgrd_vector(int histo_num ,
|
||||
int lower_bckgrd ,
|
||||
int higher_bckgrd ,
|
||||
int binning) ;
|
||||
|
||||
double *get_asymmetry_array(int histo_num_plus,
|
||||
int histo_num_minus,
|
||||
double alpha_param,
|
||||
int binning,
|
||||
int lower_bckgrd_plus,
|
||||
int higher_bckgrd_plus,
|
||||
int lower_bckgrd_minus,
|
||||
int higher_bckgrd_minus ,
|
||||
int offset = 0,
|
||||
double y_offset = 0.) ;
|
||||
|
||||
vector<double> get_asymmetry_vector(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus ,
|
||||
int offset = 0 ,
|
||||
double y_offset = 0.) ;
|
||||
|
||||
double *get_error_asymmetry_array(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus ,
|
||||
int offset = 0) ;
|
||||
|
||||
vector<double> get_error_asymmetry_vector(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus ,
|
||||
int offset = 0) ;
|
||||
|
||||
double *get_asymmetry_goodBins_array(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus) ;
|
||||
|
||||
vector<double> get_asymmetry_goodBins_vector(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus) ;
|
||||
|
||||
double *get_error_asymmetry_goodBins_array(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus) ;
|
||||
|
||||
vector<double> get_error_asymmetry_goodBins_vector(int histo_num_plus ,
|
||||
int histo_num_minus ,
|
||||
double alpha_param ,
|
||||
int binning ,
|
||||
int lower_bckgrd_plus ,
|
||||
int higher_bckgrd_plus ,
|
||||
int lower_bckgrd_minus ,
|
||||
int higher_bckgrd_minus) ;
|
||||
|
||||
|
||||
double get_binWidth_ps();
|
||||
double get_binWidth_ns();
|
||||
double get_binWidth_us();
|
||||
|
||||
int get_histoLength_bin();
|
||||
|
||||
int get_numberHisto_int();
|
||||
|
||||
string get_nameHisto(int i) ;
|
||||
vector<string> get_histoNames_vector();
|
||||
|
||||
long get_eventsHisto_long(int i);
|
||||
vector<long> get_eventsHisto_vector();
|
||||
|
||||
long get_totalEvents_long();
|
||||
|
||||
vector<long> get_scalers_vector() ;
|
||||
vector<string> get_scalersNames_vector() ;
|
||||
|
||||
int get_t0_int(int i) ;
|
||||
vector<int> get_t0_vector() ;
|
||||
double get_t0_double(int i) ;
|
||||
|
||||
int get_max_t0_int () ;
|
||||
int get_max_2_t0_int (int k, int j) ;
|
||||
int get_min_t0_int () ;
|
||||
int get_min_2_t0_int (int k, int j) ;
|
||||
|
||||
int get_firstGood_int(int i) ;
|
||||
vector<int> get_firstGood_vector() ;
|
||||
int put_firstGood_int(int i, int j) ;
|
||||
|
||||
int get_lastGood_int(int i) ;
|
||||
vector<int> get_lastGood_vector() ;
|
||||
int put_lastGood_int(int i, int j) ;
|
||||
|
||||
int get_max_lastGood_int () ;
|
||||
int get_max_2_lastGood_int (int k, int j) ;
|
||||
int get_min_lastGood_int () ;
|
||||
int get_min_2_lastGood_int (int k, int j) ;
|
||||
|
||||
int get_runNumber_int() ;
|
||||
int put_runNumber_int(int i) ;
|
||||
|
||||
string get_sample() ;
|
||||
string get_field() ;
|
||||
string get_orient() ;
|
||||
string get_temp() ;
|
||||
string get_comment() ;
|
||||
|
||||
vector<string> get_timeStart_vector() ;
|
||||
vector<string> get_timeStop_vector() ;
|
||||
|
||||
vector<double> get_devTemperatures_vector() ;
|
||||
vector<double> get_temperatures_vector() ;
|
||||
|
||||
private:
|
||||
|
||||
int max(int x, int y) ;
|
||||
int min(int x, int y) ;
|
||||
|
||||
} ;
|
||||
#endif
|
||||
283
src/external/MuSR_software/Class_MuSR_PSI/tydefs.h
vendored
Normal file
283
src/external/MuSR_software/Class_MuSR_PSI/tydefs.h
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
#ifndef __tydefs_h__
|
||||
#define __tydefs_h__
|
||||
|
||||
/*
|
||||
* +--------------------------------------------------------------+
|
||||
* | Paul Scherrer Institut |
|
||||
* | Computing Division |
|
||||
* | |
|
||||
* | This software may be used freely by non-profit organizations.|
|
||||
* | It may be copied provided that the name of P.S.I. and of the |
|
||||
* | author is included. Neither P.S.I. nor the author assume any |
|
||||
* | responsibility for the use of this software outside of P.S.I.|
|
||||
* +--------------------------------------------------------------+
|
||||
*
|
||||
* Project . . . . . . . . . . : Musr support software
|
||||
* Component/Facility . . . . . : Define basic data types and functions
|
||||
* File Name . . . . . . . . . : tydefs.h
|
||||
* Title . . . . . . . . . . . :
|
||||
* Abstract . . . . . . . . . . :
|
||||
*
|
||||
*
|
||||
* Author . . . . . . . . . . . : RA84
|
||||
* Date of creation . . . . . . : March 1998
|
||||
*
|
||||
* Date Name Modification
|
||||
* -----------------------------------------------------------------
|
||||
* 04-MAY-1998 RA84 Header indluded
|
||||
* 22-MAY-2002 RA95 && !defined(OS_OSF1) added for TRU64
|
||||
* 17-NOV-2005 RA36
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/* --- OpenVMS (DECC or VAXC),(AXP or VAX) --- */
|
||||
#ifdef _WIN32
|
||||
#define INT64_SUPPORT
|
||||
#endif
|
||||
|
||||
#if ((defined(__DECC) || defined(__VAXC)) && !defined(unix) && !defined(OS_OSF1))
|
||||
#if defined (__ALPHA)
|
||||
|
||||
#define MODEFS_CC_SYS "Compiled for VAXC or DECC OpenVMS ALPHA"
|
||||
|
||||
typedef int Int16;
|
||||
typedef unsigned int UInt16;
|
||||
typedef long int Int32;
|
||||
typedef unsigned long int UInt32;
|
||||
|
||||
typedef Int16 * Int16Ptr;
|
||||
typedef UInt16 * UInt16Ptr;
|
||||
typedef Int32 * Int32Ptr;
|
||||
typedef UInt32 * UInt32Ptr;
|
||||
|
||||
#ifdef INCLUDE_CHARDEFS
|
||||
typedef char Char;
|
||||
typedef char * CharPtr;
|
||||
typedef char * Str;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_BOOLDEF
|
||||
typedef unsigned char BoolEnum;
|
||||
#endif
|
||||
|
||||
#else /* !defined( __ALPHA) */
|
||||
|
||||
#define MODEFS_CC_SYS "Compiled for VAXC or DECC OpenVMS VAX"
|
||||
|
||||
typedef short int Int16;
|
||||
typedef unsigned short int UInt16;
|
||||
typedef int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
|
||||
typedef Int16 * Int16Ptr;
|
||||
typedef UInt16 * UInt16Ptr;
|
||||
typedef Int32 * Int32Ptr;
|
||||
typedef UInt32 * UInt32Ptr;
|
||||
|
||||
#ifdef INCLUDE_CHARDEFS
|
||||
typedef char Char;
|
||||
typedef char * CharPtr;
|
||||
typedef char * Str;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_BOOLDEF
|
||||
typedef unsigned char BoolEnum;
|
||||
#endif
|
||||
|
||||
#endif /* #else __ALPHA */
|
||||
|
||||
#define VMS_SUCCESS 1
|
||||
#define VMS_ERROR 2
|
||||
|
||||
|
||||
/* --- DEC UNIX or OFS/1 (AXP or else) --- */
|
||||
|
||||
#elif defined (__osf__)
|
||||
|
||||
#if defined (__alpha)
|
||||
#define MODEFS_CC_SYS "Compiled for (DEC) OSF/1 or UNIX Alpha"
|
||||
typedef short int Int16;
|
||||
typedef unsigned short int UInt16;
|
||||
typedef int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
|
||||
typedef Int16 * Int16Ptr;
|
||||
typedef UInt16 * UInt16Ptr;
|
||||
typedef Int32 * Int32Ptr;
|
||||
typedef UInt32 * UInt32Ptr;
|
||||
|
||||
#ifdef INCLUDE_CHARDEFS
|
||||
typedef char Char;
|
||||
typedef char * CharPtr;
|
||||
typedef char * Str;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_BOOLDEF
|
||||
typedef unsigned char BoolEnum;
|
||||
#endif
|
||||
|
||||
#else /* !defined ( __alpha) */
|
||||
|
||||
#define MODEFS_CC_SYS "Compiled for (DEC) OSF/1 or UNIX NON Alpha"
|
||||
|
||||
typedef int Int16;
|
||||
typedef unsigned int UInt16;
|
||||
typedef long int Int32;
|
||||
typedef unsigned long int UInt32;
|
||||
|
||||
typedef Int16 * Int16Ptr;
|
||||
typedef UInt16 * UInt16Ptr;
|
||||
typedef Int32 * Int32Ptr;
|
||||
typedef UInt32 * UInt32Ptr;
|
||||
|
||||
#ifdef INCLUDE_CHARDEFS
|
||||
typedef char Char;
|
||||
typedef char * CharPtr;
|
||||
typedef char * Str;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_BOOLDEF
|
||||
typedef unsigned char BoolEnum;
|
||||
#endif
|
||||
|
||||
#endif /* #else __alpha */
|
||||
|
||||
|
||||
/* --- other operating system --- */
|
||||
|
||||
#else /* other operating system */
|
||||
|
||||
//#ifdef _WIN32
|
||||
#if (defined(_WIN32) || defined(__linux__))
|
||||
#define MODEFS_CC_SYS "Compiled for Microsoft Windows 32-bit or Linux operating system"
|
||||
|
||||
typedef short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
|
||||
typedef Int16 * Int16Ptr;
|
||||
typedef UInt16 * UInt16Ptr;
|
||||
typedef Int32 * Int32Ptr;
|
||||
typedef UInt32 * UInt32Ptr;
|
||||
|
||||
#ifdef INT64_SUPPORT
|
||||
#define INT64_SUPPORTED
|
||||
typedef __int64 Int64;
|
||||
typedef unsigned __int64 UInt64;
|
||||
typedef Int64 * Int64Ptr;
|
||||
typedef UInt64 * UInt64Ptr;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_CHARDEFS
|
||||
typedef char Char;
|
||||
typedef char * CharPtr;
|
||||
typedef char * Str;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_BOOLDEF
|
||||
typedef unsigned char BoolEnum;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define MODEFS_CC_SYS "Compiled for other (#else) operating system"
|
||||
|
||||
typedef int Int16;
|
||||
typedef unsigned int UInt16;
|
||||
typedef long int Int32;
|
||||
typedef unsigned long int UInt32;
|
||||
|
||||
typedef Int16 * Int16Ptr;
|
||||
typedef UInt16 * UInt16Ptr;
|
||||
typedef Int32 * Int32Ptr;
|
||||
typedef UInt32 * UInt32Ptr;
|
||||
|
||||
#ifdef INT64_SUPPORT
|
||||
#define INT64_SUPPORTED
|
||||
//typedef long int Int64;
|
||||
//typedef unsigned long int UInt64;
|
||||
typedef Int64 * Int64Ptr;
|
||||
typedef UInt64 * UInt64Ptr;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_CHARDEFS
|
||||
typedef char Char;
|
||||
typedef char * CharPtr;
|
||||
typedef char * Str;
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_BOOLDEF
|
||||
typedef unsigned char BoolEnum;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* not operating system specific (does not have to be portable) */
|
||||
|
||||
typedef float Float;
|
||||
typedef double Double;
|
||||
typedef float Float32;
|
||||
typedef double Float64;
|
||||
|
||||
#ifdef FLOAT128_SUPPORT
|
||||
#define FLOAT128_SUPPORTED
|
||||
typedef double Float128;
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#define MAXUINT16 0xffff
|
||||
#define MAXUINT32 0xffffffff
|
||||
#ifdef INT64_SUPPORT
|
||||
#define MAXUINT64 0xffffffffffffffff
|
||||
#endif
|
||||
|
||||
#define MAXINT16 0x7fff
|
||||
#define MININT16 (-MAXINT16)
|
||||
#define MAXINT32 0x7fffffff
|
||||
#define MININT32 (-MAXINT32)
|
||||
#ifdef INT64_SUPPORT
|
||||
#define MAXINT64 0x7fffffffffffffff
|
||||
#define MININT64 (-MAXINT64)
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#define BOOL_TRUE 1
|
||||
#define BOOL_FALSE 0
|
||||
|
||||
#define ERRORRET -1
|
||||
#define MOSUCCESS 0
|
||||
#define MOERROR 1
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#define MOMESSAGEMAX 255
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#define SPRINTF sprintf
|
||||
#define PRINTF printf
|
||||
#define SSCANF sscanf
|
||||
#define STRLEN strlen
|
||||
#define STRCMP strcmp
|
||||
#define STRCPY strcpy
|
||||
#define STRCAT strcat
|
||||
#define STRNCPY strncpy
|
||||
#define STRNCMP strncmp
|
||||
#define ATOL atol
|
||||
#define MEMCPY memcpy
|
||||
#define MALLOCF malloc
|
||||
#define FREEF free
|
||||
#define FOPENR fopen
|
||||
#define FCLOSER fclose
|
||||
#define FWRITER fwrite
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#endif /* __modefs_h__ */
|
||||
Reference in New Issue
Block a user