Add plotting feature for beam spot and rotation angle.
This commit is contained in:
@ -181,13 +181,30 @@ 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","SaveData","ROOTSYS");
|
||||
"MAC","musrSim","Geant4","ROOTSYS");
|
||||
foreach my $Param (@AllParams) {
|
||||
my $Child = child($Param);
|
||||
my $Value = $Child->text;
|
||||
$All{$Param}=$Value;
|
||||
# print "$Param=".$All{$Param}."\n";
|
||||
}
|
||||
|
||||
# Convert SR B field from current to field
|
||||
# SR B Field 8A=0.032238 T
|
||||
$All{"SR_B"}=$All{"SR_B"}*0.032238/8;
|
||||
# SR plate voltage to difference between plates
|
||||
$All{"SR_E"}=$All{"SR_E"}*2;
|
||||
|
||||
# Dont forget mirror, depending on muon energy
|
||||
$All{"MIRRFIELD"}=$All{"ENERGY"}/20;
|
||||
$All{"MIRRFIELD_2"}=$All{"ENERGY_2"}/20;
|
||||
|
||||
# Check if ROOTSYS option is set
|
||||
if ($All{"ROOTSYS"} eq "") {
|
||||
$All{"ROOTSYS"}=$ENV{"ROOTSYS"};
|
||||
ROOTSYS->setText($All{"ROOTSYS"});
|
||||
}
|
||||
|
||||
# Return Hash with all important values
|
||||
return %All;
|
||||
}
|
||||
@ -206,7 +223,8 @@ void QmuSRSim::StartCalc()
|
||||
my $Page = Tabs->currentPageIndex;
|
||||
my %ToReplace=();
|
||||
my @SpaceHolder=();
|
||||
my $FName="SRBeamLine.mac";
|
||||
# my $FName="SRBeamLine.mac";
|
||||
my $FName="SRBeamLine_Bend.mac";
|
||||
# 0 for spin rotator and 1 for current.
|
||||
if ($Page == 0) {
|
||||
%ToReplace= (
|
||||
@ -221,10 +239,11 @@ void QmuSRSim::StartCalc()
|
||||
"SR_B"=>"SR_BFIELD",
|
||||
"SR_E"=>"SR_EFIELD",
|
||||
"NMuon"=>"NMuon",
|
||||
"ENERGY"=>"ENERGY"
|
||||
"ENERGY"=>"ENERGY",
|
||||
"MIRRFIELD"=>"MIRRFIELD"
|
||||
);
|
||||
# Use the following template
|
||||
$FName="SRBeamLine.mac";
|
||||
$FName="SRBeamLine_Bend.mac";
|
||||
} elsif ($Page == 1) {
|
||||
%ToReplace= (
|
||||
"L1_2"=>"L1VOLTAGE",
|
||||
@ -236,7 +255,8 @@ void QmuSRSim::StartCalc()
|
||||
"RA_R_2"=>"RA_RVOL",
|
||||
"RA_L_2"=>"RA_LVOL",
|
||||
"NMuon"=>"NMuon",
|
||||
"ENERGY_2"=>"ENERGY"
|
||||
"ENERGY_2"=>"ENERGY",
|
||||
"MIRRFIELD_2"=>"MIRRFIELD"
|
||||
);
|
||||
# Use the following template
|
||||
$FName="CBeamLine.mac";
|
||||
@ -294,7 +314,6 @@ void QmuSRSim::CheckSim()
|
||||
|
||||
my $musrSimPATH= musrSim->text();
|
||||
my $Geant4PATH= Geant4->text();
|
||||
my $SaveDataPATH= SaveData->text();
|
||||
my $ROOTSYSPATH=ROOTSYS->text();
|
||||
my $MAC=MAC->text();
|
||||
|
||||
@ -308,10 +327,6 @@ void QmuSRSim::CheckSim()
|
||||
$answtext=$answtext."Geant4 'env.sh' file does not exist!\n";
|
||||
}
|
||||
}
|
||||
unless (-d $SaveDataPATH) {
|
||||
$answ=0;
|
||||
$answtext=$answtext."Save Data Path is wrong!\n";
|
||||
}
|
||||
unless (-d $ROOTSYSPATH) {
|
||||
$answ=0;
|
||||
$answtext=$answtext."ROOTSYS Path is wrong!\n";
|
||||
@ -329,3 +344,25 @@ void QmuSRSim::CheckSim()
|
||||
}
|
||||
return $answ;
|
||||
}
|
||||
|
||||
|
||||
void QmuSRSim::plotBeamSpot()
|
||||
{
|
||||
my $musrSimPATH= musrSim->text();
|
||||
my $file=Qt::FileDialog::getOpenFileName(
|
||||
"$musrSimPATH/run/data",
|
||||
"musrSim root file (*.root)",
|
||||
this,
|
||||
"open root file dialog",
|
||||
"Choose a root data file");
|
||||
|
||||
if ($file ne "" ) {
|
||||
# my $TrimPath = $ENV{'PERLLIB'};
|
||||
# Now that we have the file name send it to root macro for plotting.
|
||||
my $cmd='root -n -l plotBeamSpot.C\(\"'.$file.'\"\)&';
|
||||
print $cmd."\n";
|
||||
my $pid=system($cmd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user