diff --git a/geant4/PQt_musrSim/QmuSRSim.pl b/geant4/PQt_musrSim/QmuSRSim.pl index ebaf8cf..913e942 100644 --- a/geant4/PQt_musrSim/QmuSRSim.pl +++ b/geant4/PQt_musrSim/QmuSRSim.pl @@ -1,6 +1,6 @@ # Form implementation generated from reading ui file 'QmuSRSim.ui' # -# Created: Fri Apr 27 23:28:06 2012 +# Created: Wed May 2 16:04:06 2012 # by: The PerlQt User Interface Compiler (puic) # # WARNING! All changes made in this file will be lost! @@ -35,6 +35,11 @@ use Qt::slots CheckSim => [], plotBeamSpot => []; use Qt::attributes qw( + textLabel1 + MAC + textLabel1_2 + NMuon + Start Tabs SpinRotator frame5 @@ -93,20 +98,18 @@ use Qt::attributes qw( L3_2 BFIELD_2 tab150778240 - ROOTSYS - Geant4Button - musrSim - textLabel2_2_4 Geant4 + TEMPL musrSimButton - textLabel2_2_6 + musrSim textLabel2_2 + textLabel2_2_6 + Geant4Button + textLabel2_2_4_2 ROOTSYSButton - textLabel1 - MAC - textLabel1_2 - NMuon - Start + TEMPLButton + ROOTSYS + textLabel2_2_4 MenuBar fileMenu Plot @@ -17887,6 +17890,29 @@ sub NEW setCentralWidget(Qt::Widget(this, "qt_central_widget")); my $QmuSRSimLayout = Qt::GridLayout(centralWidget(), 1, 1, 11, 6, '$QmuSRSimLayout'); + my $layout14 = Qt::HBoxLayout(undef, 0, 6, '$layout14'); + + textLabel1 = Qt::Label(centralWidget(), "textLabel1"); + $layout14->addWidget(textLabel1); + + MAC = Qt::LineEdit(centralWidget(), "MAC"); + $layout14->addWidget(MAC); + + textLabel1_2 = Qt::Label(centralWidget(), "textLabel1_2"); + $layout14->addWidget(textLabel1_2); + + NMuon = Qt::LineEdit(centralWidget(), "NMuon"); + $layout14->addWidget(NMuon); + + Start = Qt::PushButton(centralWidget(), "Start"); + Start->setSizePolicy( Qt::SizePolicy(1, 0, 0, 1, Start->sizePolicy()->hasHeightForWidth()) ); + Start->setMinimumSize( Qt::Size(0, 25) ); + $layout14->addWidget(Start); + my $spacer = Qt::SpacerItem(330, 20, &Qt::SizePolicy::Expanding, &Qt::SizePolicy::Minimum); + $layout14->addItem($spacer); + + $QmuSRSimLayout->addLayout($layout14, 1, 0); + Tabs = Qt::TabWidget(centralWidget(), "Tabs"); Tabs->setEnabled( 1 ); Tabs->setBackgroundOrigin( &Qt::TabWidget::WidgetOrigin() ); @@ -17940,22 +17966,22 @@ sub NEW my $LayoutWidget_3 = Qt::Widget(frame5, '$LayoutWidget_3'); $LayoutWidget_3->setGeometry( Qt::Rect(453, 230, 90, 26) ); - my $layout14 = Qt::HBoxLayout($LayoutWidget_3, 0, 0, '$layout14'); + my $layout14_2 = Qt::HBoxLayout($LayoutWidget_3, 0, 0, '$layout14_2'); textLabel2_2_2 = Qt::Label($LayoutWidget_3, "textLabel2_2_2"); textLabel2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() ); textLabel2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) ); textLabel2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) ); - $layout14->addWidget(textLabel2_2_2); + $layout14_2->addWidget(textLabel2_2_2); TL = Qt::LineEdit($LayoutWidget_3, "TL"); - $layout14->addWidget(TL); + $layout14_2->addWidget(TL); textLabel2_2_2_2_3_2_2_2_2 = Qt::Label($LayoutWidget_3, "textLabel2_2_2_2_3_2_2_2_2"); textLabel2_2_2_2_3_2_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() ); textLabel2_2_2_2_3_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) ); textLabel2_2_2_2_3_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) ); - $layout14->addWidget(textLabel2_2_2_2_3_2_2_2_2); + $layout14_2->addWidget(textLabel2_2_2_2_3_2_2_2_2); my $LayoutWidget_4 = Qt::Widget(frame5, '$LayoutWidget_4'); $LayoutWidget_4->setGeometry( Qt::Rect(313, 230, 110, 26) ); @@ -18283,71 +18309,60 @@ sub NEW tab150778240 = Qt::Widget(Tabs, "tab150778240"); my $LayoutWidget_10 = Qt::Widget(tab150778240, '$LayoutWidget_10'); - $LayoutWidget_10->setGeometry( Qt::Rect(12, 11, 770, 140) ); - my $layout12 = Qt::GridLayout($LayoutWidget_10, 1, 1, 11, 6, '$layout12'); - - ROOTSYS = Qt::LineEdit($LayoutWidget_10, "ROOTSYS"); - - $layout12->addWidget(ROOTSYS, 2, 1); - - Geant4Button = Qt::PushButton($LayoutWidget_10, "Geant4Button"); - - $layout12->addWidget(Geant4Button, 1, 2); - - musrSim = Qt::LineEdit($LayoutWidget_10, "musrSim"); - - $layout12->addWidget(musrSim, 0, 1); - - textLabel2_2_4 = Qt::Label($LayoutWidget_10, "textLabel2_2_4"); - - $layout12->addWidget(textLabel2_2_4, 2, 0); + $LayoutWidget_10->setGeometry( Qt::Rect(14, 32, 770, 180) ); + my $layout19 = Qt::GridLayout($LayoutWidget_10, 1, 1, 11, 6, '$layout19'); Geant4 = Qt::LineEdit($LayoutWidget_10, "Geant4"); - $layout12->addWidget(Geant4, 1, 1); + $layout19->addWidget(Geant4, 1, 1); + + TEMPL = Qt::LineEdit($LayoutWidget_10, "TEMPL"); + + $layout19->addWidget(TEMPL, 3, 1); musrSimButton = Qt::PushButton($LayoutWidget_10, "musrSimButton"); - $layout12->addWidget(musrSimButton, 0, 2); + $layout19->addWidget(musrSimButton, 0, 2); - textLabel2_2_6 = Qt::Label($LayoutWidget_10, "textLabel2_2_6"); + musrSim = Qt::LineEdit($LayoutWidget_10, "musrSim"); - $layout12->addWidget(textLabel2_2_6, 1, 0); + $layout19->addWidget(musrSim, 0, 1); textLabel2_2 = Qt::Label($LayoutWidget_10, "textLabel2_2"); - $layout12->addWidget(textLabel2_2, 0, 0); + $layout19->addWidget(textLabel2_2, 0, 0); + + textLabel2_2_6 = Qt::Label($LayoutWidget_10, "textLabel2_2_6"); + + $layout19->addWidget(textLabel2_2_6, 1, 0); + + Geant4Button = Qt::PushButton($LayoutWidget_10, "Geant4Button"); + + $layout19->addWidget(Geant4Button, 1, 2); + + textLabel2_2_4_2 = Qt::Label($LayoutWidget_10, "textLabel2_2_4_2"); + + $layout19->addWidget(textLabel2_2_4_2, 3, 0); ROOTSYSButton = Qt::PushButton($LayoutWidget_10, "ROOTSYSButton"); - $layout12->addWidget(ROOTSYSButton, 2, 2); + $layout19->addWidget(ROOTSYSButton, 2, 2); + + TEMPLButton = Qt::PushButton($LayoutWidget_10, "TEMPLButton"); + + $layout19->addWidget(TEMPLButton, 3, 2); + + ROOTSYS = Qt::LineEdit($LayoutWidget_10, "ROOTSYS"); + + $layout19->addWidget(ROOTSYS, 2, 1); + + textLabel2_2_4 = Qt::Label($LayoutWidget_10, "textLabel2_2_4"); + + $layout19->addWidget(textLabel2_2_4, 2, 0); Tabs->insertTab( tab150778240, "" ); $QmuSRSimLayout->addWidget(Tabs, 0, 0); - my $layout14_2 = Qt::HBoxLayout(undef, 0, 6, '$layout14_2'); - - textLabel1 = Qt::Label(centralWidget(), "textLabel1"); - $layout14_2->addWidget(textLabel1); - - MAC = Qt::LineEdit(centralWidget(), "MAC"); - $layout14_2->addWidget(MAC); - - textLabel1_2 = Qt::Label(centralWidget(), "textLabel1_2"); - $layout14_2->addWidget(textLabel1_2); - - NMuon = Qt::LineEdit(centralWidget(), "NMuon"); - $layout14_2->addWidget(NMuon); - - Start = Qt::PushButton(centralWidget(), "Start"); - Start->setSizePolicy( Qt::SizePolicy(1, 0, 0, 1, Start->sizePolicy()->hasHeightForWidth()) ); - Start->setMinimumSize( Qt::Size(0, 25) ); - $layout14_2->addWidget(Start); - my $spacer = Qt::SpacerItem(330, 20, &Qt::SizePolicy::Expanding, &Qt::SizePolicy::Minimum); - $layout14_2->addItem($spacer); - - $QmuSRSimLayout->addLayout($layout14_2, 1, 0); - fileNewAction= Qt::Action(this, "fileNewAction"); fileNewAction->setIconSet( Qt::IconSet($image2) ); fileOpenAction= Qt::Action(this, "fileOpenAction"); @@ -18431,6 +18446,7 @@ sub NEW Qt::Object::connect(musrSimButton, SIGNAL "clicked()", this, SLOT "GetPATH()"); Qt::Object::connect(Geant4Button, SIGNAL "clicked()", this, SLOT "GetPATH()"); Qt::Object::connect(plotBeamSpot_Action, SIGNAL "activated()", this, SLOT "plotBeamSpot()"); + Qt::Object::connect(TEMPLButton, SIGNAL "clicked()", this, SLOT "GetPATH()"); setTabOrder(ENERGY, L1); setTabOrder(L1, SR_B); @@ -18466,6 +18482,11 @@ sub NEW sub languageChange { setCaption(trUtf8("QmuSRSim") ); + textLabel1->setText( trUtf8("MAC File Number") ); + MAC->setText( trUtf8("1000") ); + textLabel1_2->setText( trUtf8("Number of Muons") ); + NMuon->setText( trUtf8("1000") ); + Start->setText( trUtf8("Start") ); textLabel2_3_2_2_2->setText( trUtf8("Energy") ); ENERGY->setText( trUtf8("15.0") ); textLabel2_3_2_2_2_2->setText( trUtf8("keV") ); @@ -18520,21 +18541,19 @@ sub languageChange L3_2->setText( trUtf8("8.35") ); BFIELD_2->setText( trUtf8("0") ); Tabs->changeTab( Old, trUtf8("Old") ); - ROOTSYS->setText( undef ); - Geant4Button->setText( trUtf8("Browse") ); - musrSim->setText( trUtf8("/home/l_salman/LEM/simulation/geant4/musrSim/") ); - textLabel2_2_4->setText( trUtf8("ROOTSYS Path") ); Geant4->setText( trUtf8("/usr/local/geant4/4.9.3") ); + TEMPL->setText( undef ); musrSimButton->setText( trUtf8("Browse") ); - textLabel2_2_6->setText( trUtf8("Geant4 Path") ); + musrSim->setText( trUtf8("/home/l_salman/LEM/simulation/geant4/musrSim/") ); textLabel2_2->setText( trUtf8("musrSim Path") ); + textLabel2_2_6->setText( trUtf8("Geant4 Path") ); + Geant4Button->setText( trUtf8("Browse") ); + textLabel2_2_4_2->setText( trUtf8("Template File") ); ROOTSYSButton->setText( trUtf8("Browse") ); + TEMPLButton->setText( trUtf8("Browse") ); + ROOTSYS->setText( undef ); + textLabel2_2_4->setText( trUtf8("ROOTSYS Path") ); Tabs->changeTab( tab150778240, trUtf8("Options") ); - textLabel1->setText( trUtf8("MAC File Number") ); - MAC->setText( trUtf8("1000") ); - textLabel1_2->setText( trUtf8("Number of Muons") ); - NMuon->setText( trUtf8("1000") ); - Start->setText( trUtf8("Start") ); fileNewAction->setText( trUtf8("New") ); fileNewAction->setMenuText( trUtf8("&New") ); fileNewAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+N") ) ); @@ -18757,7 +18776,7 @@ sub CreateAllInput my %All=(); my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E","ENERGY","NMuon", "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2","ENERGY_2", - "MAC","musrSim","Geant4","ROOTSYS"); + "MAC","musrSim","Geant4","ROOTSYS","TEMPL"); foreach my $Param (@AllParams) { my $Child = child($Param); my $Value = $Child->text; @@ -18799,8 +18818,8 @@ sub StartCalc my $Page = Tabs->currentPageIndex; my %ToReplace=(); my @SpaceHolder=(); -# my $FName="SRBeamLine.mac"; - my $FName="SRBeamLine_Bend.mac"; + my $FName= $All{"TEMPL"}; + # 0 for spin rotator and 1 for current. if ($Page == 0) { %ToReplace= ( @@ -18818,8 +18837,8 @@ sub StartCalc "ENERGY"=>"ENERGY", "MIRRFIELD"=>"MIRRFIELD" ); -# Use the following template - $FName="SRBeamLine_Bend.mac"; +# Use the default template + if ($FName eq "") {$FName="SRBeamLine_Bend.mac";} } elsif ($Page == 1) { %ToReplace= ( "L1_2"=>"L1VOLTAGE", @@ -18834,8 +18853,8 @@ sub StartCalc "ENERGY_2"=>"ENERGY", "MIRRFIELD_2"=>"MIRRFIELD" ); -# Use the following template - $FName="CBeamLine.mac"; +# Use the default template + if ($FName eq "") {$FName="CBeamLine.mac";} } open(MACF,"$FName"); @@ -18874,9 +18893,20 @@ sub GetPATH my $name = $sender->name(); $name =~ s/Button//g; + my $RETVAL = ""; + if ($name eq "TEMPL") { +# Get template file name + $RETVAL = Qt::FileDialog::getOpenFileName( + "./", + "MAC file (*.mac)", + this, + "Select template file dialog", + "Choose a template file"); + } else { # Get the requested path - my $RETVAL = Qt::FileDialog::getExistingDirectory("./",this,"get existing directory","Choose a directory",1); -# Now submit the path into the lineEdit + $RETVAL = Qt::FileDialog::getExistingDirectory("./",this,"get existing directory","Choose a directory",1); + } +# Now submit the path or file name into the lineEdit if ($RETVAL ne "") { child($name)->setText($RETVAL); } diff --git a/geant4/PQt_musrSim/QmuSRSim.ui b/geant4/PQt_musrSim/QmuSRSim.ui index eef25a7..7a70360 100644 --- a/geant4/PQt_musrSim/QmuSRSim.ui +++ b/geant4/PQt_musrSim/QmuSRSim.ui @@ -27,6 +27,87 @@ unnamed + + + layout14 + + + + unnamed + + + + textLabel1 + + + MAC File Number + + + + + MAC + + + 1000 + + + + + textLabel1_2 + + + Number of Muons + + + + + NMuon + + + 1000 + + + + + Start + + + + 1 + 0 + 0 + 1 + + + + + 0 + 25 + + + + Start + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 330 + 20 + + + + + Tabs @@ -1608,31 +1689,39 @@ - layout12 + layout19 - 12 - 11 + 14 + 32 770 - 140 + 180 unnamed - + - ROOTSYS + Geant4 + + + /usr/local/geant4/4.9.3 + + + + + TEMPL - + - Geant4Button + musrSimButton Browse @@ -1646,28 +1735,12 @@ /home/l_salman/LEM/simulation/geant4/musrSim/ - + - textLabel2_2_4 + textLabel2_2 - ROOTSYS Path - - - - - Geant4 - - - /usr/local/geant4/4.9.3 - - - - - musrSimButton - - - Browse + musrSim Path @@ -1678,12 +1751,20 @@ Geant4 Path - + - textLabel2_2 + Geant4Button - musrSim Path + Browse + + + + + textLabel2_2_4_2 + + + Template File @@ -1694,91 +1775,34 @@ Browse + + + TEMPLButton + + + Browse + + + + + ROOTSYS + + + + + + + + textLabel2_2_4 + + + ROOTSYS Path + + - - - layout14 - - - - unnamed - - - - textLabel1 - - - MAC File Number - - - - - MAC - - - 1000 - - - - - textLabel1_2 - - - Number of Muons - - - - - NMuon - - - 1000 - - - - - Start - - - - 1 - 0 - 0 - 1 - - - - - 0 - 25 - - - - Start - - - - - spacer3 - - - Horizontal - - - Expanding - - - - 330 - 20 - - - - - @@ -2233,6 +2257,12 @@ QmuSRSim plotBeamSpot() + + TEMPLButton + clicked() + QmuSRSim + GetPATH() + ENERGY diff --git a/geant4/PQt_musrSim/QmuSRSim.ui.h b/geant4/PQt_musrSim/QmuSRSim.ui.h index 9e242a9..6806fc0 100644 --- a/geant4/PQt_musrSim/QmuSRSim.ui.h +++ b/geant4/PQt_musrSim/QmuSRSim.ui.h @@ -181,7 +181,7 @@ void QmuSRSim::CreateAllInput() my %All=(); my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E","ENERGY","NMuon", "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2","ENERGY_2", - "MAC","musrSim","Geant4","ROOTSYS"); + "MAC","musrSim","Geant4","ROOTSYS","TEMPL"); foreach my $Param (@AllParams) { my $Child = child($Param); my $Value = $Child->text; @@ -223,8 +223,8 @@ void QmuSRSim::StartCalc() my $Page = Tabs->currentPageIndex; my %ToReplace=(); my @SpaceHolder=(); -# my $FName="SRBeamLine.mac"; - my $FName="SRBeamLine_Bend.mac"; + my $FName= $All{"TEMPL"}; + # 0 for spin rotator and 1 for current. if ($Page == 0) { %ToReplace= ( @@ -242,8 +242,8 @@ void QmuSRSim::StartCalc() "ENERGY"=>"ENERGY", "MIRRFIELD"=>"MIRRFIELD" ); -# Use the following template - $FName="SRBeamLine_Bend.mac"; +# Use the default template + if ($FName eq "") {$FName="SRBeamLine_Bend.mac";} } elsif ($Page == 1) { %ToReplace= ( "L1_2"=>"L1VOLTAGE", @@ -258,8 +258,8 @@ void QmuSRSim::StartCalc() "ENERGY_2"=>"ENERGY", "MIRRFIELD_2"=>"MIRRFIELD" ); -# Use the following template - $FName="CBeamLine.mac"; +# Use the default template + if ($FName eq "") {$FName="CBeamLine.mac";} } open(MACF,"$FName"); @@ -298,9 +298,20 @@ void QmuSRSim::GetPATH() my $name = $sender->name(); $name =~ s/Button//g; + my $RETVAL = ""; + if ($name eq "TEMPL") { +# Get template file name + $RETVAL = Qt::FileDialog::getOpenFileName( + "./", + "MAC file (*.mac)", + this, + "Select template file dialog", + "Choose a template file"); + } else { # Get the requested path - my $RETVAL = Qt::FileDialog::getExistingDirectory("./",this,"get existing directory","Choose a directory",1); -# Now submit the path into the lineEdit + $RETVAL = Qt::FileDialog::getExistingDirectory("./",this,"get existing directory","Choose a directory",1); + } +# Now submit the path or file name into the lineEdit if ($RETVAL ne "") { child($name)->setText($RETVAL); }