From 02334c8319e9c7ec1f1457a3b62d7ab972076de6 Mon Sep 17 00:00:00 2001 From: Zaher Salman Date: Tue, 22 Sep 2009 11:33:02 +0000 Subject: [PATCH] Added ExtractInfo for LEM and Bulk files. --- src/external/MuSRFitGUI/MSR.pm | 107 +++++++++++++++++++++++++++++ src/external/MuSRFitGUI/MuSRFit.pl | 34 ++++----- src/external/MuSRFitGUI/MuSRFit.ui | 8 +-- 3 files changed, 128 insertions(+), 21 deletions(-) diff --git a/src/external/MuSRFitGUI/MSR.pm b/src/external/MuSRFitGUI/MSR.pm index fcd79d0b..41f78a02 100755 --- a/src/external/MuSRFitGUI/MSR.pm +++ b/src/external/MuSRFitGUI/MSR.pm @@ -17,6 +17,29 @@ my %BeamLines = ( "LEM", "MUE4", "GPS", "PIM3", "LTF", "PIM3", "Dolly", "PIE1", my %Def_Format = ( "LEM", "ROOT-NPP", "GPS", "PSI-BIN", "LTF", "PSI-BIN", "Dolly", "PSI-BIN" , "GPD", "PSI-BIN"); +# Additional information to extract run properties from database +# For LEM use summary files +$SUMM_DIR="/afs/psi.ch/project/nemu/data/summ/"; +# For Bulok use list files +%DBDIR=("LEM","/afs/psi.ch/project/nemu/data/log/", + "GPS","/afs/psi.ch/project/bulkmusr/olddata/list/", + "Dolly","/afs/psi.ch/project/bulkmusr/olddata/list/", + "GPD","/afs/psi.ch/project/bulkmusr/olddata/list/", + "ALC","/afs/psi.ch/project/bulkmusr/olddata/list/", + "LTF","/afs/psi.ch/project/bulkmusr/olddata/list/"); + +# Information available since +%MinYears=("LEM","2001", + "GPS","1993", + "Dolly","1998", + "GPD","1993", + "ALC","1993", + "LTF","1995"); + +# And to deal with old names of bulk muons +%AltArea=("GPS","PIM3","LTF","PIM3","ALC","PIE3","Dolly","PIE1","GPD","MUE1"); + + # Additions to paremeters' names my $erradd = "d"; my $minadd = "_min"; @@ -1497,4 +1520,88 @@ sub RUNFileNameMan { return $RUN_Line; } +######################## +# ExtractInfoLEM +######################## +# Uset to extract information from summary files +sub ExtractInfoLEM { + my ($RUN,$YEAR,$Arg) = @_; + my $Summ_File_Name = "lem" . substr( $YEAR, 2 ) . "_" . $RUN . ".summ"; + my $SummFile = "$SUMM_DIR/$YEAR/$Summ_File_Name"; + + open( SFILE,q{<}, "$SummFile" ); + my @lines = ; + close(SFILE); + + if ( $Arg eq "TITLE" ) { + $RTRN_Val = $lines[3]; + $RTRN_Val =~ s/\n//g; + } + elsif ( $Arg eq "Temp" ) { + foreach my $line (@lines) { + if ( $line =~ /Mean Sample_CF1/ ) { + ( my $tmp, my $T ) = split( /=/, $line ); + ( $T, $tmp ) = split( /\(/, $T ); + $RTRN_Val = $T; + } + } + + } + elsif ( $Arg eq "Field" ) { + foreach my $line (@lines) { + if ( $line =~ /Mean B field/ ) { + ( $tmp, my $B ) = split( /=/, $line ); + ( $B, $tmp ) = split( /\(/, $B ); + $RTRN_Val = $B; + } + } + } + elsif ( $Arg eq "Energy" ) { + foreach my $line (@lines) { + if ( $line =~ /implantation energy/ ) { + ( my $tmp1, my $tmp2, my $E ) = split( /=/, $line ); + ( $E, $tmp ) = split( /keV/, $E ); + $RTRN_Val = $E; + } + } + + } + # $RTRN_Val =~ s/[\.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]//g; + return $RTRN_Val; +} + +# Uset to extract information from log files +sub ExtractInfoBulk { + my ($RUN,$AREA,$YEAR,$Arg) = @_; + if ($RUN < 10) { $RUN = "000".$RUN; } + elsif ($RUN < 100) { $RUN = "00".$RUN; } + elsif ($RUN < 1000) { $RUN = "0".$RUN; } + +# Information may be found in these file + my $DBFILE=$DBDIR{$AREA}.$YEAR."/*.runs"; + my @Lines =`cat $DBFILE`; + +# Select intries with the right area + my $area=lc $AREA; + my @Lines1 = grep { /$area/ } @Lines; + my @Lines2 = grep { /$AltArea{$AREA}/ } @Lines; + @Lines=(@Lines1,@Lines2); +# Select intries with the right run number + @Lines = grep { /$RUN/ } @Lines; + @Words=split(/\s+/,$Lines[0]); + + if ( $Arg eq "TITLE" ) { + $RTRN_Val = substr($Lines[0],104); + } + elsif ( $Arg eq "Temp" ) { + $RTRN_Val = $Words[6]; + } + elsif ( $Arg eq "Field" ) { + $RTRN_Val = $Words[7]; + } + + return $RTRN_Val; +} + + 1; diff --git a/src/external/MuSRFitGUI/MuSRFit.pl b/src/external/MuSRFitGUI/MuSRFit.pl index 3ac20a54..5efd34da 100755 --- a/src/external/MuSRFitGUI/MuSRFit.pl +++ b/src/external/MuSRFitGUI/MuSRFit.pl @@ -1,6 +1,6 @@ # Form implementation generated from reading ui file 'MuSRFit.ui' # -# Created: Tue Sep 22 10:33:24 2009 +# Created: Tue Sep 22 11:42:50 2009 # by: The PerlQt User Interface Compiler (puic) # # WARNING! All changes made in this file will be lost! @@ -185,8 +185,8 @@ use Qt::attributes qw( Edit Options helpMenu - toolBar - Toolbar + FileToolBar + ActionsToolBar fileNewAction fileOpenAction fileSaveAction @@ -2502,20 +2502,20 @@ sub NEW T0->setIconSet( Qt::IconSet($image19) ); - toolBar = Qt::ToolBar("", this, &DockTop); + FileToolBar = Qt::ToolBar("", this, &DockTop); - fileOpenAction->addTo(toolBar); - fileExitAction->addTo(toolBar); - fileChangeDirAction->addTo(toolBar); - fileSaveAction->addTo(toolBar); - filePrintAction->addTo(toolBar); - Toolbar = Qt::ToolBar("", this, &DockTop); + fileOpenAction->addTo(FileToolBar); + fileExitAction->addTo(FileToolBar); + fileChangeDirAction->addTo(FileToolBar); + fileSaveAction->addTo(FileToolBar); + filePrintAction->addTo(FileToolBar); + ActionsToolBar = Qt::ToolBar("", this, &DockTop); - Fit->addTo(Toolbar); - Plot->addTo(Toolbar); - T0->addTo(Toolbar); - parametersExport_AsAction->addTo(Toolbar); - parametersAppend_ToAction->addTo(Toolbar); + Fit->addTo(ActionsToolBar); + Plot->addTo(ActionsToolBar); + T0->addTo(ActionsToolBar); + parametersExport_AsAction->addTo(ActionsToolBar); + parametersAppend_ToAction->addTo(ActionsToolBar); MenuBar= Qt::MenuBar( this, "MenuBar"); @@ -2945,8 +2945,8 @@ sub languageChange Plot->setAccel( Qt::KeySequence( trUtf8("Ctrl+P") ) ); T0->setText( trUtf8("Show t0 and Bg Bins") ); T0->setAccel( Qt::KeySequence( trUtf8("Ctrl+T") ) ); - toolBar->setLabel( trUtf8("Tools") ); - Toolbar->setLabel( trUtf8("Toolbar") ); + FileToolBar->setLabel( trUtf8("File Menu") ); + ActionsToolBar->setLabel( trUtf8("Actions Menu") ); MenuBar->findItem( 2 )->setText( trUtf8("&File") ); MenuBar->findItem( 3 )->setText( trUtf8("Actions") ); MenuBar->findItem( 4 )->setText( trUtf8("Parameters") ); diff --git a/src/external/MuSRFitGUI/MuSRFit.ui b/src/external/MuSRFitGUI/MuSRFit.ui index d7a755ba..11d84054 100755 --- a/src/external/MuSRFitGUI/MuSRFit.ui +++ b/src/external/MuSRFitGUI/MuSRFit.ui @@ -3712,10 +3712,10 @@ - toolBar + FileToolBar - Tools + File Menu @@ -3725,10 +3725,10 @@ - Toolbar + ActionsToolBar - Toolbar + Actions Menu