fix alpha simulation and FindThetaCM
This commit is contained in:
parent
b0b37ce950
commit
364530f73c
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,4 +24,5 @@ Cleopatra/Isotope
|
||||||
Cleopatra/IsotopeShort
|
Cleopatra/IsotopeShort
|
||||||
Cleopatra/PlotSimulation
|
Cleopatra/PlotSimulation
|
||||||
Cleopatra/PlotTGraphTObjArray
|
Cleopatra/PlotTGraphTObjArray
|
||||||
|
Cleopatra/SimAlpha
|
||||||
Cleopatra/Transfer
|
Cleopatra/Transfer
|
|
@ -77,6 +77,7 @@ class HELIOS{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
HELIOS();
|
HELIOS();
|
||||||
|
HELIOS(std::string filename, unsigned short ID);
|
||||||
~HELIOS();
|
~HELIOS();
|
||||||
|
|
||||||
void SetCoincidentWithRecoil(bool TorF){ this->isCoincidentWithRecoil = TorF;}
|
void SetCoincidentWithRecoil(bool TorF){ this->isCoincidentWithRecoil = TorF;}
|
||||||
|
@ -166,11 +167,25 @@ private:
|
||||||
|
|
||||||
const double c = 299.792458; //mm/ns
|
const double c = 299.792458; //mm/ns
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HELIOS::HELIOS(){
|
HELIOS::HELIOS(){
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
HELIOS::HELIOS(std::string filename, unsigned short ID){
|
||||||
|
Clear();
|
||||||
|
SetDetectorGeometry(filename, ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
HELIOS::~HELIOS(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HELIOS::Clear(){
|
||||||
|
|
||||||
orbitb.Clear();
|
orbitb.Clear();
|
||||||
orbitB.Clear();
|
orbitB.Clear();
|
||||||
|
|
||||||
|
@ -191,11 +206,6 @@ HELIOS::HELIOS(){
|
||||||
overrideDetDistance = false;
|
overrideDetDistance = false;
|
||||||
overrideFirstPos = false;
|
overrideFirstPos = false;
|
||||||
isCoincidentWithRecoil = false;
|
isCoincidentWithRecoil = false;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
HELIOS::~HELIOS(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HELIOS::OverrideMagneticField(double BField){
|
void HELIOS::OverrideMagneticField(double BField){
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void SetExA(double Ex);
|
void SetExA(double Ex);
|
||||||
void SetExB(double Ex);
|
void SetExB(double Ex);
|
||||||
|
|
||||||
TString GetReactionName();
|
TString GetReactionName() const;
|
||||||
TString GetReactionName_Latex();
|
TString GetReactionName_Latex();
|
||||||
|
|
||||||
ReactionConfig GetRectionConfig() { return config;}
|
ReactionConfig GetRectionConfig() { return config;}
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
TLorentzVector GetPB() const {return PB;}
|
TLorentzVector GetPB() const {return PB;}
|
||||||
|
|
||||||
void PrintFourVectors() const;
|
void PrintFourVectors() const;
|
||||||
void PrintReaction() const;
|
void PrintReaction(bool withEx = true) const;
|
||||||
|
|
||||||
double CalkCM(double ExB); //momentum at CM frame
|
double CalkCM(double ExB); //momentum at CM frame
|
||||||
void CalReactionConstant();
|
void CalReactionConstant();
|
||||||
|
@ -252,7 +252,7 @@ void TransferReaction::SetReactionFromFile(string configFile, unsigned short ID)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TString TransferReaction::GetReactionName(){
|
TString TransferReaction::GetReactionName() const{
|
||||||
TString rName;
|
TString rName;
|
||||||
rName.Form("%s(%s,%s)%s", nameA.c_str(), namea.c_str(), nameb.c_str(), nameB.c_str());
|
rName.Form("%s(%s,%s)%s", nameA.c_str(), namea.c_str(), nameb.c_str(), nameB.c_str());
|
||||||
return rName;
|
return rName;
|
||||||
|
@ -272,6 +272,7 @@ TString TransferReaction::format(TString name){
|
||||||
}
|
}
|
||||||
return "^{"+temp2+"}"+temp;
|
return "^{"+temp2+"}"+temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString TransferReaction::GetReactionName_Latex(){
|
TString TransferReaction::GetReactionName_Latex(){
|
||||||
TString rName;
|
TString rName;
|
||||||
rName.Form("%s(%s,%s)%s @ %.2f MeV/u", format(nameA).Data(), format(namea).Data(), format(nameb).Data(), format(nameB).Data(), config.beamEnergy);
|
rName.Form("%s(%s,%s)%s @ %.2f MeV/u", format(nameA).Data(), format(namea).Data(), format(nameb).Data(), format(nameB).Data(), config.beamEnergy);
|
||||||
|
@ -327,8 +328,10 @@ void TransferReaction::PrintFourVectors() const {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferReaction::PrintReaction() const {
|
void TransferReaction::PrintReaction(bool withEx) const {
|
||||||
|
|
||||||
|
printf("=====================================================\n");
|
||||||
|
printf("\e[1m\e[33m %s \e[0m\n", GetReactionName().Data());
|
||||||
printf("=====================================================\n");
|
printf("=====================================================\n");
|
||||||
printf("------------------------------ Beam\n");
|
printf("------------------------------ Beam\n");
|
||||||
printf(" beam : A = %3d, Z = %2d, Ex = %.2f MeV\n", config.beamA, config.beamZ, config.beamEx);
|
printf(" beam : A = %3d, Z = %2d, Ex = %.2f MeV\n", config.beamA, config.beamZ, config.beamEx);
|
||||||
|
@ -342,10 +345,12 @@ void TransferReaction::PrintReaction() const {
|
||||||
printf("------------------------------ Recoil\n");
|
printf("------------------------------ Recoil\n");
|
||||||
printf(" light : A = %3d, Z = %2d \n", recoil.lightA, recoil.lightZ);
|
printf(" light : A = %3d, Z = %2d \n", recoil.lightA, recoil.lightZ);
|
||||||
printf(" heavy : A = %3d, Z = %2d \n", recoil.heavyA, recoil.heavyZ);
|
printf(" heavy : A = %3d, Z = %2d \n", recoil.heavyA, recoil.heavyZ);
|
||||||
printf("=====================================================\n");
|
printf("=====================================================\n");
|
||||||
exList.Print();
|
|
||||||
printf("=====================================================\n");
|
|
||||||
|
|
||||||
|
if( withEx ) {
|
||||||
|
exList.Print();
|
||||||
|
printf("=====================================================\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferReaction::Event(double thetaCM_rad, double phiCM_rad){
|
void TransferReaction::Event(double thetaCM_rad, double phiCM_rad){
|
||||||
|
@ -395,7 +400,6 @@ void TransferReaction::Event(double thetaCM_rad, double phiCM_rad){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::pair<double, double> TransferReaction::CalExThetaCM(double e, double z, double Bfield, double perpDist){
|
std::pair<double, double> TransferReaction::CalExThetaCM(double e, double z, double Bfield, double perpDist){
|
||||||
|
|
||||||
double Ex = TMath::QuietNaN();
|
double Ex = TMath::QuietNaN();
|
||||||
|
|
|
@ -22,12 +22,13 @@ int main(int argc, char *argv[]){
|
||||||
printf("=== Find ThetaCM convrage for each detector at Ex ====\n");
|
printf("=== Find ThetaCM convrage for each detector at Ex ====\n");
|
||||||
printf("=================================================================\n");
|
printf("=================================================================\n");
|
||||||
|
|
||||||
if(argc < 2 || argc > 6) {
|
if(argc < 2 || argc > 7) {
|
||||||
printf("Usage: ./FindThetaCM Ex\n");
|
printf("Usage: ./FindThetaCM Ex\n");
|
||||||
printf("Usage: ./FindThetaCM Ex nDiv\n");
|
printf("Usage: ./FindThetaCM Ex nDiv\n");
|
||||||
printf("Usage: ./FindThetaCM Ex nDiv X-Ratio\n");
|
printf("Usage: ./FindThetaCM Ex nDiv X-Ratio\n");
|
||||||
printf("Usage: ./FindThetaCM Ex nDiv X-Ratio reactionTxt detGeoTxt\n");
|
printf("Usage: ./FindThetaCM Ex nDiv X-Ratio reactionTxt detGeoTxt ID\n");
|
||||||
exit(0);
|
printf(" * default is the first settings from reaction and detGeo.\n");
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Ex = 0;
|
double Ex = 0;
|
||||||
|
@ -35,24 +36,21 @@ int main(int argc, char *argv[]){
|
||||||
int nDiv = 1;
|
int nDiv = 1;
|
||||||
string reactionTxt = "reactionConfig.txt";
|
string reactionTxt = "reactionConfig.txt";
|
||||||
string detGeoTxt = "detectorGeo.txt";
|
string detGeoTxt = "detectorGeo.txt";
|
||||||
|
int ID = 0;
|
||||||
if ( argc >= 2 ){
|
|
||||||
Ex = atof(argv[1]);
|
if ( argc >= 2 ) Ex = atof(argv[1]);
|
||||||
}
|
if ( argc >= 3 ) nDiv = atoi(argv[2]);
|
||||||
if ( argc >= 3 ){
|
if ( argc >= 4 ) xRatio = atof(argv[3]);
|
||||||
nDiv = atoi(argv[2]);
|
if ( argc >= 5 ) reactionTxt = argv[4];
|
||||||
}
|
if ( argc >= 6 ) detGeoTxt = argv[5];
|
||||||
if ( argc >= 4 ){
|
if ( argc >= 6 ) ID = atoi(argv[6]);
|
||||||
xRatio = atof(argv[3]);
|
|
||||||
}
|
if( nDiv < 1 ) {
|
||||||
if ( argc >= 5 ){
|
printf(" nDiv must be >= 1 \n");
|
||||||
reactionTxt = argv[4];
|
return -1;
|
||||||
}
|
|
||||||
if ( argc >= 6 ){
|
|
||||||
detGeoTxt = argv[5];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FindThetaCM(Ex, nDiv, xRatio, reactionTxt, detGeoTxt);
|
FindThetaCM(Ex, nDiv, xRatio, reactionTxt, detGeoTxt, ID);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,188 +20,124 @@
|
||||||
#include "../Cleopatra/ClassTransfer.h"
|
#include "../Cleopatra/ClassTransfer.h"
|
||||||
|
|
||||||
void FindThetaCM(double Ex, int nDivision=1, double XRATION = 0.95,
|
void FindThetaCM(double Ex, int nDivision=1, double XRATION = 0.95,
|
||||||
std::string basicConfig="reactionConfig.txt",
|
std::string reactionConfigFileName="reactionConfig.txt",
|
||||||
std::string detGeoFileName = "detectorGeo.txt", unsigned short ID = 0){
|
std::string detGeoFileName = "detectorGeo.txt", unsigned short ID = 0){
|
||||||
|
|
||||||
//---- reaction
|
|
||||||
int AA, zA; //beam
|
|
||||||
int Aa, za; //target
|
|
||||||
int Ab, zb; //recoil-1
|
|
||||||
double ExA;
|
|
||||||
|
|
||||||
//---- beam
|
///========================================================= load files
|
||||||
double KEAmean, KEAsigma; // MeV/u , assume Guassian
|
|
||||||
double thetaMean, thetaSigma; // mrad , assume Guassian due to small angle
|
|
||||||
double xBeam, yBeam; // mm
|
|
||||||
|
|
||||||
/**///========================================================= load files
|
TransferReaction reaction(reactionConfigFileName, ID);
|
||||||
ReactionConfig reConfig;
|
reaction.SetExB(Ex);
|
||||||
DetGeo detGeo;
|
reaction.CalReactionConstant();
|
||||||
if( reConfig.LoadReactionConfig(basicConfig) ){
|
reaction.PrintReaction(false);
|
||||||
|
ReactionConfig reConfig = reaction.GetRectionConfig();
|
||||||
|
Recoil recoil = reaction.GetRecoil();
|
||||||
|
|
||||||
KEAmean = reConfig.beamEnergy;
|
HELIOS helios(detGeoFileName, ID);
|
||||||
KEAsigma = reConfig.beamEnergySigma;
|
helios.PrintGeometry();
|
||||||
|
DetGeo detGeo = helios.GetDetectorGeometry();
|
||||||
|
Array array = helios.GetArrayGeometry();
|
||||||
|
|
||||||
|
//calculate a TGraph for thetaCM vs z
|
||||||
|
const int nData = 170;
|
||||||
|
double px[nData];
|
||||||
|
double py[nData];
|
||||||
|
|
||||||
|
double mb = reaction.GetMass_b();
|
||||||
|
double kCM = reaction.GetMomentumbCM();
|
||||||
|
double q = TMath::Sqrt(mb*mb + kCM * kCM );
|
||||||
|
double beta = reaction.GetReactionBeta() ;
|
||||||
|
double BField = detGeo.Bfield;
|
||||||
|
double slope = reaction.GetEZSlope(BField);
|
||||||
|
double gamma = reaction.GetReactionGamma();
|
||||||
|
double perpDist = array.detPerpDist;
|
||||||
|
|
||||||
thetaMean = reConfig.beamTheta;
|
for(int i = 0; i < nData; i++){
|
||||||
thetaSigma = reConfig.beamThetaSigma;
|
double thetacm = (i + 5.) * TMath::DegToRad();
|
||||||
|
double temp = TMath::TwoPi() * slope / beta / kCM * perpDist / TMath::Sin(thetacm);
|
||||||
|
px[i] = beta /slope * (gamma * beta * q - gamma * kCM * TMath::Cos(thetacm)) * (1 - TMath::ASin(temp)/TMath::TwoPi());
|
||||||
|
py[i] = thetacm * TMath::RadToDeg();
|
||||||
|
}
|
||||||
|
|
||||||
xBeam = reConfig.beamX;
|
//find minimum z position
|
||||||
yBeam = reConfig.beamY;
|
TGraph * xt = new TGraph(100, py, px);
|
||||||
|
xt->SetName("xt");
|
||||||
|
///double zMin0 = xt->Eval(0);
|
||||||
|
///printf("z for thetaCM = 0 : %f mm \n", zMin0);
|
||||||
|
|
||||||
|
///xt->Draw("AC*");
|
||||||
|
|
||||||
|
/// find the minimum z position and the corresponding theta
|
||||||
|
double zMin0 = 99999999;
|
||||||
|
double tMin0 = 99999999;
|
||||||
|
for( double ttt = 3 ; ttt < 20 ; ttt += 0.1 ){
|
||||||
|
double zzz = xt->Eval(ttt);
|
||||||
|
if( zzz < zMin0 ) {
|
||||||
|
zMin0 = zzz;
|
||||||
|
tMin0 = ttt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf(" z min %f mm at thetaCM %f deg \n", zMin0, tMin0);
|
||||||
|
|
||||||
AA = reConfig.beamA; zA = reConfig.beamZ;
|
TGraph * tx = new TGraph(nData, px, py);
|
||||||
Aa = reConfig.targetA; za = reConfig.targetZ;
|
tx->SetName(Form("tx"));
|
||||||
Ab = reConfig.recoil[ID].lightA; zb = reConfig.recoil[ID].lightZ;
|
tx->SetLineColor(4);
|
||||||
|
|
||||||
ExA = reConfig.beamEx;
|
//Remove nan data
|
||||||
|
for( int i = tx->GetN() -1 ; i >= 0 ; i--){
|
||||||
}else{
|
if( TMath::IsNaN(tx->GetPointX(i)) ) tx->RemovePoint(i);
|
||||||
printf("cannot load %s \n", basicConfig.c_str());
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> pos;
|
// tx->Draw("AC");
|
||||||
double a = 11.5;
|
|
||||||
double length = 50.5;
|
///========================================================= result
|
||||||
double firstPos = 0;
|
|
||||||
int iDet = 6;
|
|
||||||
int jDet = 4;
|
|
||||||
double BField = 0;
|
|
||||||
|
|
||||||
//=============================================================
|
|
||||||
//=============================================================
|
|
||||||
//=============================================================
|
|
||||||
//===== Set Reaction
|
|
||||||
TransferReaction reaction;
|
|
||||||
int AB = AA+Aa-Ab, zB = zA+za-zb;
|
|
||||||
reaction.SetA(AA,zA);
|
|
||||||
reaction.Seta(Aa,za);
|
|
||||||
reaction.Setb(Ab,zb);
|
|
||||||
reaction.SetB(AB,zB);
|
|
||||||
reaction.SetIncidentEnergyAngle(KEAmean, 0, 0);
|
|
||||||
reaction.SetExB(Ex);
|
|
||||||
reaction.SetExA(ExA);
|
|
||||||
reaction.CalReactionConstant();
|
|
||||||
|
|
||||||
printf("===================================================\n");
|
|
||||||
printf("=========== %27s ===========\n", reaction.GetReactionName().Data());
|
|
||||||
printf("===================================================\n");
|
|
||||||
printf("----- loading reaction from : %s. \n", basicConfig.c_str());
|
|
||||||
printf(" Ex A: %7.3f MeV\n", ExA);
|
|
||||||
printf(" KE: %7.4f \n", KEAmean);
|
|
||||||
printf(" theta: %7.4f \n", thetaMean);
|
|
||||||
printf("offset(x,y): %7.4f, %7.4f mm \n", xBeam, yBeam);
|
|
||||||
printf(" Q-value: %7.4f MeV \n", reaction.GetQValue() );
|
|
||||||
printf(" Max Ex: %7.4f MeV \n", reaction.GetMaxExB() );
|
|
||||||
printf("===================================================\n");
|
|
||||||
|
|
||||||
|
|
||||||
printf("----- loading detector geometery : %s.", detGeoFileName.c_str());
|
|
||||||
if(detGeo.LoadDetectorGeo(detGeoFileName) ){
|
|
||||||
pos = detGeo.array[ID].detPos;
|
|
||||||
a = detGeo.array[ID].detPerpDist;
|
|
||||||
length = detGeo.array[ID].detLength;
|
|
||||||
firstPos = detGeo.array[ID].firstPos;
|
|
||||||
iDet = detGeo.array[ID].nDet;
|
|
||||||
jDet = detGeo.array[ID].mDet;
|
|
||||||
BField = detGeo.Bfield;
|
|
||||||
|
|
||||||
printf("... done.\n");
|
|
||||||
|
|
||||||
}else{
|
|
||||||
printf("... fail\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int iDet = array.nDet;
|
||||||
|
double length = array.detLength;
|
||||||
|
vector<double> midPos;
|
||||||
|
|
||||||
vector<double> midPos;
|
for(int i = 0; i < iDet; i++){
|
||||||
|
if( array.firstPos > 0 ){
|
||||||
for(int i = 0; i < iDet; i++){
|
midPos.push_back(array.detPos[i]+length/2.);
|
||||||
if( firstPos > 0 ){
|
}else{
|
||||||
midPos.push_back(pos[i]+length/2.);
|
midPos.push_back(array.detPos[i]-length/2.);
|
||||||
}else{
|
}
|
||||||
midPos.push_back(pos[i]-length/2.);
|
// printf("%2d | %f \n", i, midPos.back());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//calculate a TGraph for thetaCM vs z
|
|
||||||
double px[100];
|
|
||||||
double py[100];
|
|
||||||
|
|
||||||
double mb = reaction.GetMass_b();
|
|
||||||
double kCM = reaction.GetMomentumbCM();
|
|
||||||
double q = TMath::Sqrt(mb*mb + kCM * kCM );
|
|
||||||
double beta = reaction.GetReactionBeta() ;
|
|
||||||
double slope = 299.792458 * zb * abs(BField) / TMath::TwoPi() * beta / 1000.; // MeV/mm
|
|
||||||
double gamma = reaction.GetReactionGamma();
|
|
||||||
for(int i = 0; i < 100; i++){
|
|
||||||
double thetacm = (i + 5.) * TMath::DegToRad();
|
|
||||||
double temp = TMath::TwoPi() * slope / beta / kCM * a / TMath::Sin(thetacm);
|
|
||||||
px[i] = beta /slope * (gamma * beta * q - gamma * kCM * TMath::Cos(thetacm)) * (1 - TMath::ASin(temp)/TMath::TwoPi());
|
|
||||||
py[i] = thetacm * TMath::RadToDeg();
|
|
||||||
}
|
|
||||||
|
|
||||||
//find minimum z position
|
printf("==== ThetaCM in degree =================\n");
|
||||||
TGraph * xt = new TGraph(100, py, px);
|
printf(" x-ratio : %f, number of division : %d \n", XRATION, nDivision);
|
||||||
xt->SetName("xt");
|
printf("\n");
|
||||||
///double zMin0 = xt->Eval(0);
|
for( int j = 0; j < nDivision + 1; j++) printf("%5.2f ", -XRATION + 2*XRATION/nDivision*j);
|
||||||
///printf("z for thetaCM = 0 : %f mm \n", zMin0);
|
printf(" <<-- in X \n");
|
||||||
|
for( int j = 0; j < nDivision + 1; j++) printf("%5s ", " | ");
|
||||||
///xt->Draw("AC*");
|
printf("\n");
|
||||||
|
for( int j = 0; j < nDivision + 1; j++) printf("%5.2f ", length/2 -length*XRATION/2 + length*XRATION/nDivision*j);
|
||||||
/// find the minimum z position and the corresponding theta
|
printf(" <<-- in mm \n\n");
|
||||||
double zMin0 = 0;
|
printf("========================= Ex : %6.4f MeV\n", Ex);
|
||||||
double tMin0 = 0;
|
printf(" %6s - %6s | %6s, %6s, %6s\n", "Min", "Max", "Mean", "Dt", "sin(x)dx * 180/pi");
|
||||||
for( double ttt = 3 ; ttt < 20 ; ttt += 0.1 ){
|
printf("-------------------------------------------------\n");
|
||||||
double zzz = xt->Eval(ttt);
|
for( int i = 0; i < iDet; i++){
|
||||||
if( zzz < zMin0 ) {
|
double zMin = midPos[i]-length*XRATION/2.;
|
||||||
zMin0 = zzz;
|
double zMax = midPos[i]+length*XRATION/2.;
|
||||||
tMin0 = ttt;
|
double zLength = zMax - zMin;
|
||||||
}
|
double zStep = zLength/(nDivision);
|
||||||
}
|
for( int j = 0 ; j < nDivision ; j++){
|
||||||
printf(" z min %f mm at thetaCM %f deg \n", zMin0, tMin0);
|
|
||||||
|
|
||||||
|
|
||||||
TGraph * tx = new TGraph(100, px, py);
|
|
||||||
tx->SetName(Form("tx"));
|
|
||||||
tx->SetLineColor(4);
|
|
||||||
|
|
||||||
//tx->Draw("AC*");
|
|
||||||
|
|
||||||
/**///========================================================= result
|
|
||||||
|
|
||||||
printf("==== ThetaCM in degree =================\n");
|
double tMin = (zMin + j*zStep > zMin0) ? tx->Eval(zMin + j*zStep) : TMath::QuietNaN();
|
||||||
printf("========================= x-ratio : %f, number of division : %d \n", XRATION, nDivision);
|
double tMax = (zMin + (j+1)*zStep > zMin0) ? tx->Eval(zMin + (j+1)*zStep) : TMath::QuietNaN();
|
||||||
printf("\n");
|
|
||||||
for( int j = 0; j < nDivision + 1; j++) printf("%5.2f ", -XRATION + 2*XRATION/nDivision*j);
|
double tMean = (tMax + tMin)/2.;
|
||||||
printf(" <<-- in X \n");
|
double dt = (tMax - tMin);
|
||||||
for( int j = 0; j < nDivision + 1; j++) printf("%5s ", " | ");
|
|
||||||
printf("\n");
|
double sintdt = TMath::Sin(tMean * TMath::DegToRad()) * dt ;
|
||||||
for( int j = 0; j < nDivision + 1; j++) printf("%5.2f ", length/2 -length*XRATION/2 + length*XRATION/nDivision*j);
|
|
||||||
printf(" <<-- in cm \n\n");
|
|
||||||
printf("========================= Ex : %6.4f MeV\n", Ex);
|
|
||||||
printf(" %6s - %6s | %6s, %6s, %6s\n", "Min", "Max", "Mean", "Dt", "sin(x)dx * 180/pi");
|
|
||||||
printf("-------------------------------------------------\n");
|
|
||||||
for( int i = 0; i < iDet; i++){
|
|
||||||
double zMin = midPos[i]-length*XRATION/2.;
|
|
||||||
double zMax = midPos[i]+length*XRATION/2.;
|
|
||||||
double zLength = zMax - zMin;
|
|
||||||
double zStep = zLength/(nDivision);
|
|
||||||
for( int j = 0 ; j < nDivision ; j++){
|
|
||||||
|
|
||||||
double tMin = (zMin + j*zStep > zMin0) ? tx->Eval(zMin + j*zStep) : TMath::QuietNaN();
|
|
||||||
double tMax = (zMin + (j+1)*zStep > zMin0) ? tx->Eval(zMin + (j+1)*zStep) : TMath::QuietNaN();
|
|
||||||
|
|
||||||
double tMean = (tMax + tMin)/2.;
|
|
||||||
double dt = (tMax - tMin);
|
|
||||||
|
|
||||||
double sintdt = TMath::Sin(tMean * TMath::DegToRad()) * dt ;
|
|
||||||
|
|
||||||
|
|
||||||
printf(" det-%d[%d]: %6.2f - %6.2f | %6.2f, %6.2f, %6.4f\n", i, j, tMin, tMax, tMean, dt, sintdt);
|
printf(" det-%d[%d]: %6.2f - %6.2f | %6.2f, %6.2f, %6.4f\n", i, j, tMin, tMax, tMean, dt, sintdt);
|
||||||
|
|
||||||
}
|
}
|
||||||
if( nDivision > 0 ) printf("--------------\n");
|
if( nDivision > 0 ) printf("--------------\n");
|
||||||
}
|
}
|
||||||
printf("================================================= \n");
|
printf("================================================= \n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "ClassHelios.h"
|
#include "../Cleopatra/ClassHelios.h"
|
||||||
#include "TROOT.h"
|
#include "TROOT.h"
|
||||||
#include "TBenchmark.h"
|
#include "TBenchmark.h"
|
||||||
#include "TLorentzVector.h"
|
#include "TLorentzVector.h"
|
||||||
|
@ -18,155 +18,164 @@
|
||||||
|
|
||||||
const double ma = 3727.3792; // alpha mass
|
const double ma = 3727.3792; // alpha mass
|
||||||
|
|
||||||
void alpha(){
|
void alpha( int numEvent = 100000){
|
||||||
|
|
||||||
//================================================= User Setting
|
//================================================= User Setting
|
||||||
const int numEnergy = 4;
|
std::string heliosDetGeoFile = "detectorGeo.txt";
|
||||||
double energy [numEnergy] = {3.18, 5.16, 5.49, 5.81};
|
int geoID = 0;
|
||||||
|
|
||||||
|
//std::vector<double> energy = {3.18, 5.16, 5.49, 5.81};
|
||||||
|
std::vector<double> energy = {5.34, 5.42, 5.68, 6.05, 6.23, 6.77, 8.78}; //228Th
|
||||||
|
|
||||||
|
//---- Over-ride HELIOS detector geometry
|
||||||
|
// double BField = 2.5; // T
|
||||||
|
// double BFieldTheta = 0.; // direction of B-field
|
||||||
|
// bool isCoincidentWithRecoil = false;
|
||||||
|
// double eSigma = 0.040 ; // detector energy sigma MeV
|
||||||
|
// double zSigma = 0.500 ; // detector position sigma mm
|
||||||
|
|
||||||
|
//---- save root file name
|
||||||
|
TString saveFileName = "SimAlpha.root";
|
||||||
|
|
||||||
|
//=============================================================
|
||||||
|
//=============================================================
|
||||||
|
|
||||||
|
printf("===================================================\n");
|
||||||
|
printf("============= Alpha source in HELIOS ============\n");
|
||||||
|
printf("===================================================\n");
|
||||||
|
|
||||||
|
int numEnergy = energy.size();
|
||||||
|
printf("========= Alpha Enegry : \n");
|
||||||
|
for( int i = 0; i < numEnergy ; i++){
|
||||||
|
printf("%2d | %6.2f MeV\n", i, energy[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//======== Set HELIOS
|
||||||
|
printf("############################################## HELIOS configuration\n");
|
||||||
|
HELIOS helios;
|
||||||
|
// helios.OverrideMagneticFieldDirection(BFieldTheta);
|
||||||
|
// helios.OverrideFirstPos(-700);
|
||||||
|
//helios.OverrideDetectorDistance(5);
|
||||||
|
// bool sethelios = helios.SetDetectorGeometry(heliosDetGeoFile, geoID);
|
||||||
|
// if( !sethelios){
|
||||||
|
// helios.OverrideMagneticField(BField);
|
||||||
|
// printf("======== B-field : %5.2f T, Theta : %6.2f deg\n", BField, BFieldTheta);
|
||||||
|
// }
|
||||||
|
// helios.SetCoincidentWithRecoil(isCoincidentWithRecoil);
|
||||||
|
// printf("========== energy resol.: %f MeV\n", eSigma);
|
||||||
|
// printf("=========== pos-Z resol.: %f mm \n", zSigma);
|
||||||
|
helios.SetDetectorGeometry(heliosDetGeoFile, geoID);
|
||||||
|
helios.PrintGeometry();
|
||||||
|
|
||||||
|
//====================== build tree
|
||||||
|
TFile * saveFile = new TFile(saveFileName, "recreate");
|
||||||
|
TTree * tree = new TTree("tree", "tree");
|
||||||
|
|
||||||
|
double theta, phi, T;
|
||||||
|
|
||||||
|
int hit; // the output of Helios.CalHit
|
||||||
|
double e, z, x, t;
|
||||||
|
int loop, detID;
|
||||||
|
double dphi, rho; //rad of rotation, and radius
|
||||||
|
int energyID;
|
||||||
|
double xHit, yHit;
|
||||||
|
|
||||||
int numEvent = 1000000;
|
tree->Branch("hit", &hit, "hit/I");
|
||||||
|
tree->Branch("theta", &theta, "theta/D");
|
||||||
//---- HELIOS detector geometry
|
tree->Branch("phi", &phi, "phi/D");
|
||||||
//string heliosDetGeoFile = "detectorGeo.txt";
|
tree->Branch("T", &T, "T/D");
|
||||||
string heliosDetGeoFile = "";
|
tree->Branch("energy", &energy, "energy/D");
|
||||||
double BField = 2.5; // T
|
tree->Branch("energyID", &energyID, "energyID/I");
|
||||||
double BFieldTheta = 0.; // direction of B-field
|
|
||||||
bool isCoincidentWithRecoil = false;
|
tree->Branch("e", &e, "e/D");
|
||||||
double eSigma = 0.040 ; // detector energy sigma MeV
|
tree->Branch("z", &z, "z/D");
|
||||||
double zSigma = 0.500 ; // detector position sigma mm
|
tree->Branch("t", &t, "t/D");
|
||||||
|
tree->Branch("detID", &detID, "detID/I");
|
||||||
//---- save root file name
|
tree->Branch("loop", &loop, "loop/I");
|
||||||
TString saveFileName = "alpha.root";
|
tree->Branch("dphi", &dphi, "dphi/D");
|
||||||
|
tree->Branch("rho", &rho, "rho/D");
|
||||||
//=============================================================
|
tree->Branch("xHit", &xHit, "xHit/D");
|
||||||
//=============================================================
|
tree->Branch("yHit", &yHit, "yHit/D");
|
||||||
|
|
||||||
printf("===================================================\n");
|
//========timer
|
||||||
printf("============= Alpha source in HELIOS ============\n");
|
TBenchmark clock;
|
||||||
printf("===================================================\n");
|
bool shown ;
|
||||||
|
clock.Reset();
|
||||||
printf("========= Alpha Enegry : \n");
|
clock.Start("timer");
|
||||||
for( int i = 0; i < numEnergy ; i++){
|
shown = false;
|
||||||
printf("%2d | %6.2f MeV\n", i, energy[i]);
|
printf("############################################## generating %d events \n", numEvent);
|
||||||
}
|
|
||||||
|
//====================================================== calculate
|
||||||
|
int count = 0;
|
||||||
//======== Set HELIOS
|
TLorentzVector P;
|
||||||
printf("############################################## HELIOS configuration\n");
|
TVector3 v;
|
||||||
HELIOS helios;
|
for( int i = 0; i < numEvent; i++){
|
||||||
helios.OverrideMagneticFieldDirection(BFieldTheta);
|
//==== generate alpha
|
||||||
helios.OverrideFirstPos(-700);
|
theta = TMath::ACos(2 * gRandom->Rndm() - 1) ;
|
||||||
//helios.OverrideDetectorDistance(5);
|
phi = TMath::TwoPi() * gRandom->Rndm();
|
||||||
bool sethelios = helios.SetDetectorGeometry(heliosDetGeoFile);
|
|
||||||
if( !sethelios){
|
energyID = gRandom->Integer(numEnergy);
|
||||||
helios.OverrideMagneticField(BField);
|
T = energy[energyID];
|
||||||
printf("======== B-field : %5.2f T, Theta : %6.2f deg\n", BField, BFieldTheta);
|
|
||||||
}
|
double p = TMath::Sqrt( ( ma + T )*(ma + T) - ma* ma);
|
||||||
helios.SetCoincidentWithRecoil(isCoincidentWithRecoil);
|
|
||||||
printf("========== energy resol.: %f MeV\n", eSigma);
|
v.SetMagThetaPhi(p, theta, phi);
|
||||||
printf("=========== pos-Z resol.: %f mm \n", zSigma);
|
|
||||||
|
P.SetVectM(v, ma);
|
||||||
//====================== build tree
|
P.SetUniqueID(2); //alpha particle has charge 2
|
||||||
TFile * saveFile = new TFile(saveFileName, "recreate");
|
|
||||||
TTree * tree = new TTree("tree", "tree");
|
//################################### tree branches
|
||||||
|
|
||||||
double theta, phi, T;
|
//==== Helios
|
||||||
|
helios.CalArrayHit(P);
|
||||||
int hit; // the output of Helios.CalHit
|
hit = helios.CheckDetAcceptance();
|
||||||
double e, z, x, t;
|
|
||||||
int loop, detID;
|
e = helios.GetEnergy() + gRandom->Gaus(0, helios.GetDetectorGeometry().array[geoID].eSigma);
|
||||||
double dphi, rho; //rad of rotation, and radius
|
|
||||||
int energyID;
|
|
||||||
double xHit, yHit;
|
|
||||||
|
|
||||||
tree->Branch("hit", &hit, "hit/I");
|
trajectory orb = helios.GetTrajectory_b();
|
||||||
tree->Branch("theta", &theta, "theta/D");
|
|
||||||
tree->Branch("phi", &phi, "phi/D");
|
z = orb.z + gRandom->Gaus(0, helios.GetDetectorGeometry().array[geoID].zSigma);
|
||||||
tree->Branch("T", &T, "T/D");
|
t = orb.t;
|
||||||
tree->Branch("energy", &energy, "energy/D");
|
loop = orb.effLoop;
|
||||||
tree->Branch("energyID", &energyID, "energyID/I");
|
detID = orb.detID;
|
||||||
|
dphi = orb.phi;
|
||||||
tree->Branch("e", &e, "e/D");
|
rho = orb.rho;
|
||||||
tree->Branch("x", &x, "x/D");
|
xHit = orb.x;
|
||||||
tree->Branch("z", &z, "z/D");
|
yHit = orb.y;
|
||||||
tree->Branch("t", &t, "t/D");
|
|
||||||
tree->Branch("detID", &detID, "detID/I");
|
if( hit == 1) {
|
||||||
tree->Branch("loop", &loop, "loop/I");
|
count ++;
|
||||||
tree->Branch("dphi", &dphi, "dphi/D");
|
}
|
||||||
tree->Branch("rho", &rho, "rho/D");
|
|
||||||
tree->Branch("xHit", &xHit, "xHit/D");
|
tree->Fill();
|
||||||
tree->Branch("yHit", &yHit, "yHit/D");
|
|
||||||
|
//#################################################################### Timer
|
||||||
//========timer
|
clock.Stop("timer");
|
||||||
TBenchmark clock;
|
Double_t time = clock.GetRealTime("timer");
|
||||||
bool shown ;
|
clock.Start("timer");
|
||||||
clock.Reset();
|
|
||||||
clock.Start("timer");
|
if ( !shown ) {
|
||||||
shown = false;
|
if (fmod(time, 10) < 1 ){
|
||||||
printf("############################################## generating %d events \n", numEvent);
|
printf( "%10d[%2d%%]| %8.2f sec | expect: %5.1f min \n", i, TMath::Nint((i+1)*100./numEvent), time , numEvent*time/(i+1)/60);
|
||||||
|
shown = 1;
|
||||||
//====================================================== calculate
|
|
||||||
int count = 0;
|
|
||||||
TLorentzVector P;
|
|
||||||
TVector3 v;
|
|
||||||
for( int i = 0; i < numEvent; i++){
|
|
||||||
//==== generate alpha
|
|
||||||
theta = TMath::ACos(2 * gRandom->Rndm() - 1) ;
|
|
||||||
phi = TMath::TwoPi() * gRandom->Rndm();
|
|
||||||
|
|
||||||
energyID = gRandom->Integer(numEnergy);
|
|
||||||
T = energy[energyID];
|
|
||||||
|
|
||||||
double p = TMath::Sqrt( ( ma + T )*(ma + T) - ma* ma);
|
|
||||||
|
|
||||||
v.SetMagThetaPhi(p, theta, phi);
|
|
||||||
|
|
||||||
P.SetVectM(v, ma);
|
|
||||||
|
|
||||||
//################################### tree branches
|
|
||||||
|
|
||||||
//==== Helios
|
|
||||||
hit = helios.CalHit(P, 2, P, 2);
|
|
||||||
|
|
||||||
e = helios.GetEnergy() + gRandom->Gaus(0, eSigma);
|
|
||||||
z = helios.GetZ() ;
|
|
||||||
x = helios.GetX() + gRandom->Gaus(0, zSigma);
|
|
||||||
t = helios.GetTime();
|
|
||||||
loop = helios.GetLoop();
|
|
||||||
detID = helios.GetDetID();
|
|
||||||
dphi = helios.GetdPhi();
|
|
||||||
rho = helios.GetRho();
|
|
||||||
xHit = helios.GetXPos(z);
|
|
||||||
yHit = helios.GetYPos(z);
|
|
||||||
z += gRandom->Gaus(0, zSigma);
|
|
||||||
|
|
||||||
|
|
||||||
if( hit == 1) {
|
|
||||||
count ++;
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
tree->Fill();
|
if (fmod(time, 10) > 9 ){
|
||||||
|
shown = 0;
|
||||||
//#################################################################### Timer
|
|
||||||
clock.Stop("timer");
|
|
||||||
Double_t time = clock.GetRealTime("timer");
|
|
||||||
clock.Start("timer");
|
|
||||||
|
|
||||||
if ( !shown ) {
|
|
||||||
if (fmod(time, 10) < 1 ){
|
|
||||||
printf( "%10d[%2d%%]| %8.2f sec | expect: %5.1f min \n", i, TMath::Nint((i+1)*100./numEvent), time , numEvent*time/(i+1)/60);
|
|
||||||
shown = 1;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if (fmod(time, 10) > 9 ){
|
|
||||||
shown = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
saveFile->Write();
|
|
||||||
saveFile->Close();
|
saveFile->Write();
|
||||||
|
saveFile->Close();
|
||||||
printf("=============== done. saved as %s. count(hit==1) : %d\n", saveFileName.Data(), count);
|
|
||||||
gROOT->ProcessLine(".q");
|
printf("=============== done. saved as %s. count(hit==1) : %d\n", saveFileName.Data(), count);
|
||||||
|
gROOT->ProcessLine(".q");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
alpha();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
CC=g++
|
CC=g++
|
||||||
|
|
||||||
ALL = Isotope InFileCreator ExtractXSec ExtractXSecFromText PlotTGraphTObjArray Cleopatra FindThetaCM Transfer
|
ALL = Isotope InFileCreator ExtractXSec ExtractXSecFromText PlotTGraphTObjArray Cleopatra FindThetaCM Transfer SimAlpha
|
||||||
|
|
||||||
all: $(ALL)
|
all: $(ALL)
|
||||||
|
|
||||||
|
@ -22,11 +22,14 @@ PlotTGraphTObjArray: PlotTGraphTObjArray.C PlotTGraphTObjArray.h
|
||||||
Cleopatra: Cleopatra.C
|
Cleopatra: Cleopatra.C
|
||||||
$(CC) Cleopatra.C -o Cleopatra `root-config --cflags --glibs`
|
$(CC) Cleopatra.C -o Cleopatra `root-config --cflags --glibs`
|
||||||
|
|
||||||
FindThetaCM: FindThetaCM.C FindThetaCM.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
|
Transfer: Transfer.C Transfer.h ../Cleopatra/ClassTransfer.h ../Cleopatra/ClassHelios.h ../Cleopatra/ClassIsotope.h ../Cleopatra/constant.h
|
||||||
$(CC) Transfer.C -o Transfer `root-config --cflags --glibs`
|
$(CC) Transfer.C -o Transfer `root-config --cflags --glibs`
|
||||||
|
|
||||||
|
SimAlpha: alpha.C ../Cleopatra/ClassHelios.h
|
||||||
|
$(CC) alpha.C -o SimAlpha `root-config --cflags --glibs`
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f $(ALL)
|
/bin/rm -f $(ALL)
|
Loading…
Reference in New Issue
Block a user