/**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** ** If you want to add, delete, or rename functions or slots, use ** Qt Designer to update this file, preserving your code. ** ** You should not define a constructor or destructor in this file. ** Instead, write your code in functions called init() and destroy(). ** These will automatically be called by the form's constructor and ** destructor. *****************************************************************************/ void QmuSRSim::fileNew() { } void QmuSRSim::fileOpen() { } void QmuSRSim::fileSave() { } void QmuSRSim::fileSaveAs() { } void QmuSRSim::filePrint() { } void QmuSRSim::fileExit() { } void QmuSRSim::editUndo() { } void QmuSRSim::editRedo() { } void QmuSRSim::editCut() { } void QmuSRSim::editCopy() { } void QmuSRSim::editPaste() { } void QmuSRSim::editFind() { } void QmuSRSim::helpIndex() { } void QmuSRSim::helpContents() { } void QmuSRSim::helpAbout() { my $AboutText=" This is a GUI that uses the muSRSim binary, to simulate the LEM muon beam properties. This software 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 3 of the License, or (at your option) any later version. This software 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 MuSRFitGUI. If not, see . Copyright 2011 by Zaher Salman and the LEM Group. "; my $AboutWindow = Qt::MessageBox::information( this, "About QmuSRSim GUI",$AboutText); } void QmuSRSim::CreateAllInput() { my %All=(); my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E","ENERGY", "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2","ENERGY_2"); foreach my $Param (@AllParams) { my $Child = child($Param); my $Value = $Child->text; $All{$Param}=$Value; # print "$Param=".$All{$Param}."\n"; } # Return Hash with all important values return %All; } void QmuSRSim::StartCalc() { my %All=CreateAllInput(); my $Page = Tabs->currentPageIndex; my %ToReplace=(); my @SpaceHolder=(); my $FName="SRBeamLine.mac"; # 0 for spin rotator and 1 for current. if ($Page == 0) { %ToReplace= ( "L1"=>"L1VOLTAGE", "L3"=>"L3VOLTAGE", "TL"=>"TLVOLTAGE", "BFIELD"=>"SAM_BFIELD", "RA_T"=>"RA_TVOL", "RA_B"=>"RA_BVOL", "RA_R"=>"RA_RVOL", "RA_L"=>"RA_LVOL", "SR_B"=>"SR_BFIELD", "SR_E"=>"SR_EFIELD", "ENERGY"=>"ENERGY" ); # Use the following template $FName="SRBeamLine.mac"; } elsif ($Page == 1) { %ToReplace= ( "L1_2"=>"L1VOLTAGE", "L2_2"=>"L2VOLTAGE", "L3_2"=>"L3VOLTAGE", "BFIELD_2"=>"SAM_BFIELD", "RA_T_2"=>"RA_TVOL", "RA_B_2"=>"RA_BVOL", "RA_R_2"=>"RA_RVOL", "RA_L_2"=>"RA_LVOL", "ENERGY_2"=>"ENERGY" ); # Use the following template $FName="CBeamLine.mac"; } open(MACF,"$FName"); my @lines=; close(MACF); for my $key (keys %ToReplace) { # Need to check values of replace parameters... map(s/$ToReplace{$key}/$All{$key}/, @lines); print "Replacing \t".$ToReplace{$key}."\t by \t".$All{$key}."\n"; } open(NEWMACF,">1000.mac"); print (NEWMACF "@lines"); close(NEWMACF); }