update the Check_Simulation.C

This commit is contained in:
Ryan Tang 2024-02-20 18:15:16 -05:00
parent 364530f73c
commit 7a5107998a
10 changed files with 572 additions and 603 deletions

2
.gitignore vendored
View File

@ -25,4 +25,4 @@ Cleopatra/IsotopeShort
Cleopatra/PlotSimulation Cleopatra/PlotSimulation
Cleopatra/PlotTGraphTObjArray Cleopatra/PlotTGraphTObjArray
Cleopatra/SimAlpha Cleopatra/SimAlpha
Cleopatra/Transfer Cleopatra/SimTransfer

View File

@ -95,7 +95,9 @@ public:
bool LoadDetectorGeo(TString fileName, bool verbose = true); bool LoadDetectorGeo(TString fileName, bool verbose = true);
bool LoadDetectorGeo(TMacro * macro, bool verbose = true); bool LoadDetectorGeo(TMacro * macro, bool verbose = true);
void Print( bool printAll = true) const; void PrintWithoutArray() ;
void Print( bool printAll = true) ;
private: private:
@ -203,24 +205,14 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
} }
inline void DetGeo::Print(bool printAll) const{ inline void DetGeo::PrintWithoutArray(){
printf("=====================================================\n"); printf("=====================================================\n");
printf(" B-field: %8.2f T, Theta : %6.2f deg \n", Bfield, BfieldTheta); printf(" B-field: %8.2f T, %s\n", Bfield, Bfield > 0 ? "out of plan" : "into plan");
if( BfieldTheta != 0.0 ) { printf(" B-field Theta : %6.2f deg \n", BfieldTheta);
printf(" +---- field angle != 0 is not supported!!! \n");
} if( BfieldTheta != 0.0 ) printf(" +---- field angle != 0 is not supported!!! \n");
printf(" Recoil detector pos: %8.2f mm, radius: %6.2f - %6.2f mm \n", recoilPos, recoilInnerRadius, recoilOuterRadius); printf(" Recoil detector pos: %8.2f mm, radius: %6.2f - %6.2f mm \n", recoilPos, recoilInnerRadius, recoilOuterRadius);
for( int i = 0; i < 2 ; i++){
if( printAll || array[i].enable ) {
printf("-----------------------------------%d-th Detector Position \n", i);
array[i].PrintArray();
}
}
if( elumPos1 != 0 || elumPos2 != 0 || recoilPos1 != 0 || recoilPos2 != 0){ if( elumPos1 != 0 || elumPos2 != 0 || recoilPos1 != 0 || recoilPos2 != 0){
printf("=================================== Auxillary/Imaginary Detectors\n"); printf("=================================== Auxillary/Imaginary Detectors\n");
} }
@ -229,6 +221,21 @@ inline void DetGeo::Print(bool printAll) const{
if( recoilPos1 != 0 ) printf(" Recoil 1 pos.: %f mm \n", recoilPos1); if( recoilPos1 != 0 ) printf(" Recoil 1 pos.: %f mm \n", recoilPos1);
if( recoilPos2 != 0 ) printf(" Recoil 2 pos.: %f mm \n", recoilPos2); if( recoilPos2 != 0 ) printf(" Recoil 2 pos.: %f mm \n", recoilPos2);
printf("=====================================================\n"); printf("=====================================================\n");
}
inline void DetGeo::Print(bool printAll){
PrintWithoutArray();
for( int i = 0; i < 2 ; i++){
if( printAll || array[i].enable ) {
printf("-----------------------------------%d-th Detector Position \n", i);
array[i].PrintArray();
}
}
printf("=====================================================\n");
} }

View File

@ -114,7 +114,7 @@ public:
bool LoadReactionConfig(TString fileName); bool LoadReactionConfig(TString fileName);
bool LoadReactionConfig(TMacro * macro); bool LoadReactionConfig(TMacro * macro);
void Print() const; void Print(int ID = -1, bool withEx = true) const;
private: private:
@ -237,7 +237,7 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
return true; return true;
} }
inline void ReactionConfig::Print() const{ inline void ReactionConfig::Print(int ID, bool withEx) const{
printf("=====================================================\n"); printf("=====================================================\n");
@ -261,8 +261,10 @@ inline void ReactionConfig::Print() const{
for( int i = 0; i < 2; i ++ ){ for( int i = 0; i < 2; i ++ ){
printf("------------------------------ Recoil-%d\n", i); printf("------------------------------ Recoil-%d\n", i);
recoil[i].Print(); if( ID == i || ID < 0 ){
exList[i].Print(); recoil[i].Print();
if( withEx ) exList[i].Print();
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -45,8 +45,7 @@ void Transfer(
TString ptolemyRoot = "DWBA.root", TString ptolemyRoot = "DWBA.root",
TString saveFileName = "transfer.root"){ TString saveFileName = "transfer.root"){
//############################################# Set Reaction //*############################################# Set Reaction
TransferReaction transfer; TransferReaction transfer;
HELIOS helios; HELIOS helios;
Decay decay; Decay decay;
@ -65,7 +64,7 @@ void Transfer(
printf("\e[32m#################################### Reaction & HELIOS configuration\e[0m\n"); printf("\e[32m#################################### Reaction & HELIOS configuration\e[0m\n");
transfer.PrintReaction(); transfer.PrintReaction(false);
if(transfer.GetRecoil().isDecay) { if(transfer.GetRecoil().isDecay) {
decay.SetMotherDaugther(transfer.GetRecoil()); decay.SetMotherDaugther(transfer.GetRecoil());
@ -118,19 +117,9 @@ void Transfer(
// msB.LoadStoppingPower(reactConfig.recoilHeavyStoppingPowerFile); // msB.LoadStoppingPower(reactConfig.recoilHeavyStoppingPowerFile);
// } // }
//*############################################# Decay of particle-B
// Decay decay[2];
// if(reactConfig.isDecay) {
// printf("\e[32m#################################### Decay\e[0m\n");
// decay.SetMotherDaugther(reactConfig.recoilHeavyA,
// reactConfig.recoilHeavyZ,
// reactConfig.heavyDecayA,
// reactConfig.heavyDecayZ);
// }
ExcitedEnergies exList = transfer.GetRectionConfig().exList[ID]; ExcitedEnergies exList = transfer.GetRectionConfig().exList[ID];
//############################################# Load DWBAroot for thetaCM distribution //*############################################# Load DWBAroot for thetaCM distribution
printf("\e[32m#################################### Load DWBA input : %s \e[0m\n", ptolemyRoot.Data()); printf("\e[32m#################################### Load DWBA input : %s \e[0m\n", ptolemyRoot.Data());
TF1 * dist = NULL; TF1 * dist = NULL;
TFile * distFile = new TFile(ptolemyRoot, "read"); TFile * distFile = new TFile(ptolemyRoot, "read");
@ -178,7 +167,7 @@ void Transfer(
} }
} }
//############################################# build tree //*############################################# build tree
printf("\e[32m#################################### building Tree in %s\e[0m\n", saveFileName.Data()); printf("\e[32m#################################### building Tree in %s\e[0m\n", saveFileName.Data());
TFile * saveFile = new TFile(saveFileName, "recreate"); TFile * saveFile = new TFile(saveFileName, "recreate");
TTree * tree = new TTree("tree", "tree"); TTree * tree = new TTree("tree", "tree");
@ -192,6 +181,9 @@ void Transfer(
if( distList != NULL ) distList->Write("DWBA", 1); if( distList != NULL ) distList->Write("DWBA", 1);
if( dwbaExList != NULL ) dwbaExList->Write("DWBA_ExList", 1); if( dwbaExList != NULL ) dwbaExList->Write("DWBA_ExList", 1);
TMacro idMacro;
idMacro.AddLine(Form("%d", ID));
idMacro.Write("detGeoID");
TMacro hitMeaning; TMacro hitMeaning;
hitMeaning.AddLine("======================= meaning of Hit\n"); hitMeaning.AddLine("======================= meaning of Hit\n");
@ -421,7 +413,7 @@ void Transfer(
double theta = reactConfig.beamTheta; double theta = reactConfig.beamTheta;
double phi = 0.0; double phi = 0.0;
//====================================================== calculate event //*====================================================== calculate event
int count = 0; int count = 0;
for( int i = 0; i < numEvent; i++){ for( int i = 0; i < numEvent; i++){
bool redoFlag = true; bool redoFlag = true;
@ -497,7 +489,6 @@ void Transfer(
int decayID = 0; int decayID = 0;
if( recoil.isDecay){ if( recoil.isDecay){
//decayID = decay.CalDecay(PB, Ex, 0, phiCM + TMath::Pi()/2.); // decay to ground state
decayID = decay.CalDecay(PB, Ex, 0, phiCM + TMath::Pi()/2); // decay to ground state decayID = decay.CalDecay(PB, Ex, 0, phiCM + TMath::Pi()/2); // decay to ground state
if( decayID == 1 ){ if( decayID == 1 ){
PB = decay.GetDaugther_D(); PB = decay.GetDaugther_D();
@ -661,3 +652,58 @@ void Transfer(
return; return;
} }
int main (int argc, char *argv[]) {
printf("=================================================================\n");
printf("========== Simulate Transfer reaction in HELIOS ==========\n");
printf("=================================================================\n");
if(argc == 2 || argc > 7) {
printf("Usage: ./Transfer [1] [2] [3] [4] [5] [6]\n");
printf(" default file name \n");
printf(" [1] reactionConfig.txt (input) reaction Setting \n");
printf(" [2] detectorGeo.txt (input) detector Setting \n");
printf(" [3] ID (input) detector & reaction ID (default = 0 ) \n");
printf(" [4] DWBA.root (input) thetaCM distribution from DWBA \n");
printf(" [5] transfer.root (output) rootFile name for output \n");
printf(" [6] plot (input) will it plot stuffs [1/0] \n");
printf("------------------------------------------------------\n");
return 0 ;
}
std::string basicConfig = "reactionConfig.txt";
std::string heliosDetGeoFile = "detectorGeo.txt";
int ID = 0;
TString ptolemyRoot = "DWBA.root"; // when no file, use isotropic distribution of thetaCM
TString saveFileName = "transfer.root";
bool isPlot = false;
if( argc >= 2) basicConfig = argv[1];
if( argc >= 3) heliosDetGeoFile = argv[2];
if( argc >= 4) ID = atoi(argv[3]);
if( argc >= 5) ptolemyRoot = argv[4];
if( argc >= 6) saveFileName = argv[5];
if( argc >= 7) isPlot = atoi(argv[7]);
Transfer( basicConfig, heliosDetGeoFile, ID, ptolemyRoot, saveFileName);
//run Armory/Check_Simulation
if( isPlot ){
ifstream file_in;
file_in.open("../Cleopatra/Check_Simulation.C", ios::in);
if( file_in){
printf("---- running ../Cleopatra/Check_Simulation.C on %s \n", saveFileName.Data());
TString cmd;
cmd.Form("root -l '../Cleopatra/Check_Simulation.C(\"%s\")'", saveFileName.Data());
system(cmd.Data());
}else{
printf("cannot find ../Cleopatra/Check_Simulation.C \n");
}
}
}

View File

@ -12,7 +12,7 @@
#include <RQ_OBJECT.h> #include <RQ_OBJECT.h>
#include "../Cleopatra/Transfer.h" #include "../Cleopatra/SimTransfer.C"
#include "../Cleopatra/InFileCreator.h" #include "../Cleopatra/InFileCreator.h"
#include "../Cleopatra/ExtractXSec.h" #include "../Cleopatra/ExtractXSec.h"
#include "../Cleopatra/PlotTGraphTObjArray.h" #include "../Cleopatra/PlotTGraphTObjArray.h"
@ -58,7 +58,6 @@ private:
TGComboBox * extractFlag; TGComboBox * extractFlag;
TGTextEntry * txtName ; TGTextEntry * txtName ;
TGTextEntry * txtEx ; TGTextEntry * txtEx ;

View File

@ -1,72 +0,0 @@
/***********************************************************************
*
* This is Transfer.C for simulation of transfer reaction.
*
* -----------------------------------------------------
* This program will call the root library and compile in g++
* compilation:
* g++ Transfer.C -o Transfer `root-config --cflags --glibs`
*
* ------------------------------------------------------
* created by Ryan (Tsz Leung) Tang, Feb-4, 2019
* email: goluckyryan@gmail.com
* ********************************************************************/
#include <fstream>
#include <stdlib.h>
#include "Transfer.h"
using namespace std;
int main (int argc, char *argv[]) {
printf("=================================================================\n");
printf("========== Simulate Transfer reaction in HELIOS ==========\n");
printf("=================================================================\n");
if(argc == 2 || argc > 7) {
printf("Usage: ./Transfer [1] [2] [3] [4] [5] [6]\n");
printf(" default file name \n");
printf(" [1] reactionConfig.txt (input) reaction Setting \n");
printf(" [2] detectorGeo.txt (input) detector Setting \n");
printf(" [3] ID (input) detector & reaction ID (default = 0 ) \n");
printf(" [4] DWBA.root (input) thetaCM distribution from DWBA \n");
printf(" [5] transfer.root (output) rootFile name for output \n");
printf(" [6] plot (input) will it plot stuffs [1/0] \n");
printf("------------------------------------------------------\n");
return 0 ;
}
string basicConfig = "reactionConfig.txt";
string heliosDetGeoFile = "detectorGeo.txt";
int ID = 0;
TString ptolemyRoot = "DWBA.root"; // when no file, use isotropic distribution of thetaCM
TString saveFileName = "transfer.root";
bool isPlot = false;
if( argc >= 2) basicConfig = argv[1];
if( argc >= 3) heliosDetGeoFile = argv[2];
if( argc >= 4) ID = atoi(argv[3]);
if( argc >= 5) ptolemyRoot = argv[4];
if( argc >= 6) saveFileName = argv[5];
if( argc >= 7) isPlot = atoi(argv[7]);
Transfer( basicConfig, heliosDetGeoFile, ID, ptolemyRoot, saveFileName);
//run Armory/Check_Simulation
if( isPlot ){
ifstream file_in;
file_in.open("../Cleopatra/Check_Simulation.C", ios::in);
if( file_in){
printf("---- running ../Cleopatra/Check_Simulation.C on %s \n", saveFileName.Data());
TString cmd;
cmd.Form("root -l '../Cleopatra/Check_Simulation.C(\"%s\")'", saveFileName.Data());
system(cmd.Data());
}else{
printf("cannot find ../Cleopatra/Check_Simulation.C \n");
}
}
}

View File

@ -1,6 +1,6 @@
CC=g++ CC=g++
ALL = Isotope InFileCreator ExtractXSec ExtractXSecFromText PlotTGraphTObjArray Cleopatra FindThetaCM Transfer SimAlpha ALL = Isotope InFileCreator ExtractXSec ExtractXSecFromText PlotTGraphTObjArray Cleopatra FindThetaCM SimTransfer SimAlpha
all: $(ALL) all: $(ALL)
@ -25,11 +25,11 @@ Cleopatra: Cleopatra.C
FindThetaCM: FindThetaCM.C FindThetaCM.h ../Cleopatra/ClassTransfer.h ../Cleopatra/ClassHelios.h ../Cleopatra/ClassIsotope.h ../Cleopatra/constant.h FindThetaCM: FindThetaCM.C FindThetaCM.h ../Cleopatra/ClassTransfer.h ../Cleopatra/ClassHelios.h ../Cleopatra/ClassIsotope.h ../Cleopatra/constant.h
$(CC) FindThetaCM.C -o FindThetaCM `root-config --cflags --glibs` $(CC) FindThetaCM.C -o FindThetaCM `root-config --cflags --glibs`
Transfer: Transfer.C Transfer.h ../Cleopatra/ClassTransfer.h ../Cleopatra/ClassHelios.h ../Cleopatra/ClassIsotope.h ../Cleopatra/constant.h SimTransfer: SimTransfer.C ../Cleopatra/ClassTransfer.h ../Cleopatra/ClassHelios.h ../Cleopatra/ClassIsotope.h ../Cleopatra/constant.h
$(CC) Transfer.C -o Transfer `root-config --cflags --glibs` $(CC) SimTransfer.C -o SimTransfer `root-config --cflags --glibs`
SimAlpha: alpha.C ../Cleopatra/ClassHelios.h SimAlpha: SimAlpha.C ../Cleopatra/ClassHelios.h
$(CC) alpha.C -o SimAlpha `root-config --cflags --glibs` $(CC) SimAlpha.C -o SimAlpha `root-config --cflags --glibs`
clean: clean:
/bin/rm -f $(ALL) /bin/rm -f $(ALL)