update Simulation_Helper.C

This commit is contained in:
Ryan Tang 2024-02-20 19:46:29 -05:00
parent 7a5107998a
commit 11248d361d
2 changed files with 56 additions and 99 deletions

View File

@ -105,8 +105,8 @@ void Check_Simulation(TString filename = "transfer.root",
TFile * file = new TFile(filename, "read"); TFile * file = new TFile(filename, "read");
TTree * tree = (TTree*) file->Get("tree"); TTree * tree = (TTree*) file->Get("tree");
TObjArray * fxList = (TObjArray *) file->FindObjectAny("EZCure"); TObjArray * fxList = (TObjArray *) file->FindObjectAny("EZCurve");
TObjArray * txList = (TObjArray *) file->FindObjectAny("EZ_thetaCM"); TObjArray * txList = (TObjArray *) file->FindObjectAny("thetaCM_Z");
gStyle->SetOptStat(""); gStyle->SetOptStat("");
gStyle->SetStatY(0.9); gStyle->SetStatY(0.9);

View File

@ -35,6 +35,7 @@ TString isoFileName;
class MyMainFrame { class MyMainFrame {
RQ_OBJECT("MyMainFrame") RQ_OBJECT("MyMainFrame")
private: private:
TGMainFrame *fMain; TGMainFrame *fMain;
@ -61,8 +62,6 @@ private:
TGTextEntry * txtName ; TGTextEntry * txtName ;
TGTextEntry * txtEx ; TGTextEntry * txtEx ;
bool isUse2ndArray;
public: public:
MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h); MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h);
virtual ~MyMainFrame(); virtual ~MyMainFrame();
@ -71,7 +70,6 @@ public:
void GetData(); void GetData();
bool IsFileExist(TString filename); bool IsFileExist(TString filename);
void CheckIsUse2ndArray();
}; };
@ -145,13 +143,6 @@ MyMainFrame::MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h) {
openRec->Connect("Clicked()","MyMainFrame",this, "OpenFile(=1)"); openRec->Connect("Clicked()","MyMainFrame",this, "OpenFile(=1)");
simFrame->AddFrame(openRec,new TGLayoutHints(kLHintsRight, 5,5,3,4)); simFrame->AddFrame(openRec,new TGLayoutHints(kLHintsRight, 5,5,3,4));
TGTextButton *openEx = new TGTextButton(simFrame, "Ex List");
openEx->SetWidth(150);
openEx->SetHeight(20);
openEx->ChangeOptions( openEx->GetOptions() | kFixedSize );
openEx->Connect("Clicked()","MyMainFrame",this, "OpenFile(=2)");
simFrame->AddFrame(openEx,new TGLayoutHints(kLHintsRight, 5,5,3,4));
withDWBA = new TGCheckButton(simFrame, "Sim with DWBA\n+DWBA.root\n+DWBA.Ex.txt"); withDWBA = new TGCheckButton(simFrame, "Sim with DWBA\n+DWBA.root\n+DWBA.Ex.txt");
withDWBA->SetWidth(140); withDWBA->SetWidth(140);
withDWBA->ChangeOptions(kFixedSize ); withDWBA->ChangeOptions(kFixedSize );
@ -355,13 +346,6 @@ bool MyMainFrame::IsFileExist(TString filename){
return file.is_open(); return file.is_open();
} }
void MyMainFrame::CheckIsUse2ndArray(){
DetGeo detGeo;
detGeo.LoadDetectorGeo("../working/detectorGeo.txt", false);
isUse2ndArray = detGeo.use2ndArray;
}
void MyMainFrame::OpenFile(int ID){ void MyMainFrame::OpenFile(int ID){
@ -371,22 +355,12 @@ void MyMainFrame::OpenFile(int ID){
if ( ID == 0 ) fileName = "../working/detectorGeo.txt"; if ( ID == 0 ) fileName = "../working/detectorGeo.txt";
CheckIsUse2ndArray();
if( isUse2ndArray){
if ( ID == 1 ) fileName = "../working/reactionConfig2.txt";
if ( ID == 2 ) fileName = "../working/Ex2.txt";
if ( ID == 3 ) fileName = "../working/DWBA2";
if ( ID == 5 ) fileName = "../working/DWBA2.in";
if ( ID == 6 ) fileName = "../working/DWBA2.out";
if ( ID == 7 ) fileName = "../working/DWBA2.Xsec.txt";
}else{
if ( ID == 1 ) fileName = "../working/reactionConfig.txt"; if ( ID == 1 ) fileName = "../working/reactionConfig.txt";
if ( ID == 2 ) fileName = "../working/Ex.txt";
if ( ID == 3 ) fileName = "../working/DWBA"; if ( ID == 3 ) fileName = "../working/DWBA";
if ( ID == 5 ) fileName = "../working/DWBA.in"; if ( ID == 5 ) fileName = "../working/DWBA.in";
if ( ID == 6 ) fileName = "../working/DWBA.out"; if ( ID == 6 ) fileName = "../working/DWBA.out";
if ( ID == 7 ) fileName = "../working/DWBA.Xsec.txt"; if ( ID == 7 ) fileName = "../working/DWBA.Xsec.txt";
}
if ( ID == 4 ) fileName = "../working/Check_Simulation_Config.txt"; if ( ID == 4 ) fileName = "../working/Check_Simulation_Config.txt";
if ( ID == 8 ) fileName = isoFileName; if ( ID == 8 ) fileName = isoFileName;
@ -440,8 +414,6 @@ void MyMainFrame::Command(int ID) {
editor->SaveFile(fileName); editor->SaveFile(fileName);
CheckIsUse2ndArray();
if( ID == 0 ){ if( ID == 0 ){
if( isInFile->GetState()) { if( isInFile->GetState()) {
@ -495,50 +467,35 @@ void MyMainFrame::Command(int ID) {
string basicConfig = "reactionConfig.txt"; string basicConfig = "reactionConfig.txt";
string heliosDetGeoFile = "detectorGeo.txt"; string heliosDetGeoFile = "detectorGeo.txt";
string excitationFile = "Ex.txt"; //when no file, only ground state
TString ptolemyRoot = ""; // when no file, use isotropic distribution of thetaCM TString ptolemyRoot = ""; // when no file, use isotropic distribution of thetaCM
TString saveFileName = "transfer.root"; TString saveFileName = "transfer.root";
TString filename = "reaction.dat"; //when no file, no output
if( withDWBA->GetState() ) { if( withDWBA->GetState() ) {
ptolemyRoot = "DWBA1.root"; ptolemyRoot = "DWBA.root";
excitationFile = "DWBA1.Ex.txt";
} }
if( isUse2ndArray ){ basicConfig = "reactionConfig.txt";
basicConfig = "reactionConfig2.txt";
heliosDetGeoFile = "detectorGeo.txt"; heliosDetGeoFile = "detectorGeo.txt";
excitationFile = "Ex2.txt"; //when no file, only ground state
ptolemyRoot = ""; // when no file, use isotropic distribution of thetaCM ptolemyRoot = ""; // when no file, use isotropic distribution of thetaCM
saveFileName = "transfer2.root"; saveFileName = "transfer.root";
filename = "reaction2.dat"; //when no file, no output
if( withDWBA->GetState() ) { if( withDWBA->GetState() ) {
ptolemyRoot = "DWBA2.root"; ptolemyRoot = "DWBA.root";
excitationFile = "DWBA2.Ex.txt";
}
} }
statusLabel->SetText("Running simulation......."); statusLabel->SetText("Running simulation.......");
Transfer( basicConfig, heliosDetGeoFile, excitationFile, ptolemyRoot, saveFileName, filename); Transfer( basicConfig, heliosDetGeoFile, 0, ptolemyRoot, saveFileName);
statusLabel->SetText("Plotting simulation......."); statusLabel->SetText("Plotting simulation.......");
if( isUse2ndArray ){ Check_Simulation("transfer.root");
Check_Simulation("transfer2.root");
}else{
Check_Simulation("transfer1.root");
}
statusLabel->SetText("Plotted Simulation result"); statusLabel->SetText("Plotted Simulation result");
} }
if( ID == 2 ){ if( ID == 2 ){
if( isUse2ndArray ){
Check_Simulation("transfer2.root");
}else{
Check_Simulation("transfer.root"); Check_Simulation("transfer.root");
}
statusLabel->SetText(" Run Simulation first."); statusLabel->SetText(" Run Simulation first.");
} }