2024-02-13 18:24:56 -05:00
|
|
|
#ifndef Transfer_h
|
|
|
|
#define Transfer_h
|
|
|
|
|
|
|
|
#include "utility"
|
|
|
|
|
|
|
|
#include "ClassIsotope.h"
|
|
|
|
#include "../Armory/AnalysisLib.h"
|
|
|
|
#include "../Armory/ClassReactionConfig.h"
|
|
|
|
|
|
|
|
#include "TLorentzVector.h"
|
|
|
|
#include "TMath.h"
|
2024-04-03 16:10:26 -04:00
|
|
|
#include "TF1.h"
|
2024-07-05 19:26:51 -04:00
|
|
|
#include "TMacro.h"
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
//=======================================================
|
|
|
|
//#######################################################
|
|
|
|
// Class for Transfer Reaction
|
|
|
|
// reaction notation A(a,b)B
|
|
|
|
// A = incident particle
|
|
|
|
// a = target
|
|
|
|
// b = light scattered particle
|
|
|
|
// B = heavy scattered particle
|
|
|
|
//=======================================================
|
|
|
|
class TransferReaction {
|
|
|
|
public:
|
2024-02-14 16:30:13 -05:00
|
|
|
TransferReaction(){Inititization();};
|
2024-04-03 16:10:26 -04:00
|
|
|
TransferReaction(ReactionConfig config, unsigned short ID = 0);
|
2024-03-15 16:14:50 -04:00
|
|
|
TransferReaction(std::string configFile, unsigned short ID = 0);
|
2024-07-05 19:26:51 -04:00
|
|
|
TransferReaction(TMacro configMarco, unsigned short ID = 0);
|
2024-02-19 18:31:27 -05:00
|
|
|
TransferReaction(int beamA, int beamZ,
|
|
|
|
int targetA, int targetZ,
|
|
|
|
int recoilA, int recoilZ, float beamEnergy_AMeV);
|
2024-02-14 16:30:13 -05:00
|
|
|
|
2024-02-13 18:24:56 -05:00
|
|
|
~TransferReaction();
|
|
|
|
|
2024-04-03 16:10:26 -04:00
|
|
|
void SetA(int A, int Z, double Ex = 0);
|
2024-02-13 18:24:56 -05:00
|
|
|
void Seta(int A, int Z);
|
|
|
|
void Setb(int A, int Z);
|
|
|
|
void SetB(int A, int Z);
|
|
|
|
void SetIncidentEnergyAngle(double KEA, double theta, double phi);
|
|
|
|
|
2024-07-28 20:52:35 -04:00
|
|
|
void SetReactionFromReactionConfigClass(ReactionConfig reactConfigClassObject, unsigned short ID = 0);
|
2024-02-19 18:31:27 -05:00
|
|
|
void SetReactionFromFile(std::string configFile, unsigned short ID = 0);
|
2024-07-05 19:26:51 -04:00
|
|
|
void SetReactionFromTMacro(TMacro configMacro, unsigned short ID = 0);
|
2024-02-13 18:24:56 -05:00
|
|
|
void SetReactionSimple(int beamA, int beamZ,
|
|
|
|
int targetA, int targetZ,
|
|
|
|
int recoilA, int recoilZ, float beamEnergy_AMeV);
|
|
|
|
|
|
|
|
void SetExA(double Ex);
|
|
|
|
void SetExB(double Ex);
|
2024-02-19 18:31:27 -05:00
|
|
|
|
2024-02-20 16:38:40 -05:00
|
|
|
TString GetReactionName() const;
|
2024-02-13 18:24:56 -05:00
|
|
|
TString GetReactionName_Latex();
|
|
|
|
|
2024-04-03 16:10:26 -04:00
|
|
|
ReactionConfig GetRectionConfig() { return config;}
|
|
|
|
Recoil GetRecoil() { return recoil;}
|
|
|
|
ExcitedEnergies * GetExList() { return &exList;}
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
double GetMass_A() const {return mA + ExA;}
|
|
|
|
double GetMass_a() const {return ma;}
|
|
|
|
double GetMass_b() const {return mb;}
|
|
|
|
double GetMass_B() const {return mB + ExB;}
|
|
|
|
|
|
|
|
double GetCMTotalKE() {return Etot - mA - ma;}
|
|
|
|
double GetQValue() {return mA + ExA + ma - mb - mB - ExB;}
|
|
|
|
double GetMaxExB() {return Etot - mb - mB;}
|
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
TLorentzVector GetPA() const {return PA;}
|
|
|
|
TLorentzVector GetPa() const {return Pa;}
|
|
|
|
TLorentzVector GetPb() const {return Pb;}
|
|
|
|
TLorentzVector GetPB() const {return PB;}
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-02-15 16:36:45 -05:00
|
|
|
void PrintFourVectors() const;
|
2024-02-20 16:38:40 -05:00
|
|
|
void PrintReaction(bool withEx = true) const;
|
2024-02-14 16:30:13 -05:00
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
double CalkCM(double ExB); //momentum at CM frame
|
2024-02-13 18:24:56 -05:00
|
|
|
void CalReactionConstant();
|
2024-02-19 18:31:27 -05:00
|
|
|
std::pair<double, double> CalExThetaCM(double e, double z, double Bfield, double a);
|
2024-02-13 18:24:56 -05:00
|
|
|
void Event(double thetaCM_rad, double phiCM_rad);
|
|
|
|
|
|
|
|
double GetMomentumbCM() {return p;}
|
|
|
|
double GetReactionBeta() {return beta;}
|
|
|
|
double GetReactionGamma() {return gamma;}
|
|
|
|
double GetCMTotalEnergy() {return Etot;}
|
2024-02-19 18:31:27 -05:00
|
|
|
double GetEZSlope(double BField) {return 299.792458 * recoil.lightZ * abs(BField) / TMath::TwoPi() * beta / 1000.;} // MeV/mm
|
2024-04-03 16:10:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
void CreateExDistribution();
|
|
|
|
int GetRandomExID(){
|
|
|
|
if( exDistribution ) {
|
|
|
|
return exDistribution->GetRandom();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
double GetRandomEx(){
|
|
|
|
if( exDistribution ) {
|
|
|
|
int exID = exDistribution->GetRandom();
|
|
|
|
return exList.ExList[exID].Ex;
|
|
|
|
}
|
|
|
|
return TMath::QuietNaN();
|
|
|
|
}
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
ExcitedEnergies exList;
|
2024-02-15 16:36:45 -05:00
|
|
|
Recoil recoil;
|
2024-02-15 14:09:29 -05:00
|
|
|
ReactionConfig config;
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-03-15 16:14:50 -04:00
|
|
|
std::string nameA, namea, nameb, nameB;
|
2024-02-13 18:24:56 -05:00
|
|
|
double thetaIN, phiIN;
|
|
|
|
double mA, ma, mb, mB;
|
|
|
|
|
|
|
|
double TA, T; // TA = KE of A pre u, T = total energy
|
|
|
|
double ExA, ExB;
|
|
|
|
|
|
|
|
bool isReady;
|
|
|
|
bool isBSet;
|
|
|
|
|
|
|
|
double k; // CM Boost momentum
|
|
|
|
double beta, gamma; //CM boost beta
|
|
|
|
double Etot;
|
|
|
|
double p; // CM frame momentum of b, B
|
2024-02-19 18:31:27 -05:00
|
|
|
double slope; // slope of the
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
TLorentzVector PA, Pa, Pb, PB;
|
|
|
|
|
|
|
|
TString format(TString name);
|
2024-02-14 16:30:13 -05:00
|
|
|
|
|
|
|
void Inititization();
|
2024-04-03 16:10:26 -04:00
|
|
|
|
|
|
|
TF1 * exDistribution;
|
|
|
|
|
|
|
|
static double exDistFunc(Double_t *x, Double_t * par){
|
|
|
|
return par[(int) x[0]];
|
|
|
|
}
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2024-04-03 16:10:26 -04:00
|
|
|
TransferReaction::TransferReaction(ReactionConfig config, unsigned short ID){
|
|
|
|
Inititization();
|
|
|
|
|
|
|
|
SetA(config.beamA, config.beamZ);
|
|
|
|
Seta(config.targetA, config.targetZ);
|
|
|
|
|
|
|
|
SetExA(config.beamEx);
|
|
|
|
|
|
|
|
recoil = config.recoil[ID];
|
|
|
|
exList = config.exList[ID];
|
|
|
|
|
|
|
|
Setb(recoil.lightA, recoil.lightZ);
|
|
|
|
SetB(recoil.heavyA, recoil.heavyZ);
|
|
|
|
SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
|
|
|
|
|
|
|
|
CalReactionConstant();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-03-15 16:14:50 -04:00
|
|
|
TransferReaction::TransferReaction(std::string configFile, unsigned short ID){
|
2024-02-19 18:31:27 -05:00
|
|
|
Inititization();
|
|
|
|
SetReactionFromFile(configFile, ID);
|
|
|
|
}
|
|
|
|
|
2024-07-05 19:26:51 -04:00
|
|
|
TransferReaction::TransferReaction(TMacro configMarco, unsigned short ID){
|
|
|
|
Inititization();
|
|
|
|
SetReactionFromTMacro(configMarco, ID);
|
|
|
|
}
|
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
TransferReaction::TransferReaction(int beamA, int beamZ,
|
2024-04-03 17:15:24 -04:00
|
|
|
int targetA, int targetZ,
|
|
|
|
int recoilA, int recoilZ,
|
|
|
|
float beamEnergy_AMeV){
|
2024-02-19 18:31:27 -05:00
|
|
|
Inititization();
|
|
|
|
SetReactionSimple(beamA, beamZ,
|
|
|
|
targetA, targetZ,
|
2024-04-03 17:15:24 -04:00
|
|
|
recoilA, recoilZ,
|
|
|
|
beamEnergy_AMeV);
|
2024-02-19 18:31:27 -05:00
|
|
|
}
|
|
|
|
|
2024-02-14 16:30:13 -05:00
|
|
|
void TransferReaction::Inititization(){
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
thetaIN = 0.;
|
|
|
|
phiIN = 0.;
|
|
|
|
SetA(12, 6, 0);
|
|
|
|
Seta(2,1);
|
|
|
|
Setb(1,1);
|
|
|
|
SetB(13,6);
|
|
|
|
TA = 6;
|
2024-02-15 14:09:29 -05:00
|
|
|
T = TA * config.beamA;
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-04-03 16:10:26 -04:00
|
|
|
exDistribution = nullptr;
|
|
|
|
|
2024-02-13 18:24:56 -05:00
|
|
|
ExA = 0;
|
|
|
|
ExB = 0;
|
|
|
|
|
|
|
|
CalReactionConstant();
|
|
|
|
|
|
|
|
TLorentzVector temp (0,0,0,0);
|
|
|
|
PA = temp;
|
|
|
|
Pa = temp;
|
|
|
|
Pb = temp;
|
|
|
|
PB = temp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TransferReaction::~TransferReaction(){
|
2024-04-03 16:10:26 -04:00
|
|
|
delete exDistribution;
|
2024-02-13 18:24:56 -05:00
|
|
|
}
|
|
|
|
|
2024-04-03 16:10:26 -04:00
|
|
|
void TransferReaction::SetA(int A, int Z, double Ex){
|
2024-02-13 18:24:56 -05:00
|
|
|
Isotope temp (A, Z);
|
|
|
|
mA = temp.Mass;
|
2024-02-15 14:09:29 -05:00
|
|
|
config.beamA = A;
|
|
|
|
config.beamZ = Z;
|
2024-02-13 18:24:56 -05:00
|
|
|
ExA = Ex;
|
|
|
|
nameA = temp.Name;
|
|
|
|
isReady = false;
|
|
|
|
isBSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TransferReaction::Seta(int A, int Z){
|
|
|
|
Isotope temp (A, Z);
|
|
|
|
ma = temp.Mass;
|
2024-02-15 14:09:29 -05:00
|
|
|
config.targetA = A;
|
|
|
|
config.targetZ = Z;
|
2024-02-13 18:24:56 -05:00
|
|
|
namea = temp.Name;
|
|
|
|
isReady = false;
|
|
|
|
isBSet = false;
|
|
|
|
}
|
|
|
|
void TransferReaction::Setb(int A, int Z){
|
|
|
|
Isotope temp (A, Z);
|
|
|
|
mb = temp.Mass;
|
2024-02-15 16:36:45 -05:00
|
|
|
recoil.lightA = A;
|
|
|
|
recoil.lightZ = Z;
|
2024-02-13 18:24:56 -05:00
|
|
|
nameb = temp.Name;
|
|
|
|
isReady = false;
|
|
|
|
isBSet = false;
|
|
|
|
}
|
|
|
|
void TransferReaction::SetB(int A, int Z){
|
|
|
|
Isotope temp (A, Z);
|
|
|
|
mB = temp.Mass;
|
2024-02-15 16:36:45 -05:00
|
|
|
recoil.heavyA = A;
|
|
|
|
recoil.heavyZ = Z;
|
2024-02-13 18:24:56 -05:00
|
|
|
nameB = temp.Name;
|
|
|
|
isReady = false;
|
|
|
|
isBSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TransferReaction::SetIncidentEnergyAngle(double KEA, double theta, double phi){
|
|
|
|
this->TA = KEA;
|
2024-02-15 14:09:29 -05:00
|
|
|
this->T = TA * config.beamA;
|
2024-02-13 18:24:56 -05:00
|
|
|
this->thetaIN = theta;
|
|
|
|
this->phiIN = phi;
|
|
|
|
isReady = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TransferReaction::SetReactionSimple(int beamA, int beamZ,
|
2024-04-03 17:15:24 -04:00
|
|
|
int targetA, int targetZ,
|
|
|
|
int recoilA, int recoilZ,
|
|
|
|
float beamEnergy_AMeV){
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-02-15 14:09:29 -05:00
|
|
|
config.SetReactionSimple(beamA, beamZ,
|
2024-02-13 18:24:56 -05:00
|
|
|
targetA, targetZ,
|
2024-04-03 17:15:24 -04:00
|
|
|
recoilA, recoilZ, beamEnergy_AMeV);
|
2024-02-15 16:36:45 -05:00
|
|
|
|
|
|
|
recoil = config.recoil[0];
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-02-15 14:09:29 -05:00
|
|
|
SetA(config.beamA, config.beamZ);
|
|
|
|
Seta(config.targetA, config.targetZ);
|
2024-02-15 16:36:45 -05:00
|
|
|
Setb(recoil.lightA, recoil.lightZ);
|
|
|
|
SetB(recoil.heavyA, recoil.heavyZ);
|
2024-02-15 14:09:29 -05:00
|
|
|
SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
CalReactionConstant();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void TransferReaction::SetExA(double Ex){
|
|
|
|
this->ExA = Ex;
|
|
|
|
isReady = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TransferReaction::SetExB(double Ex){
|
|
|
|
this->ExB = Ex;
|
|
|
|
isReady = false;
|
|
|
|
}
|
|
|
|
|
2024-07-28 20:52:35 -04:00
|
|
|
void TransferReaction::SetReactionFromReactionConfigClass(ReactionConfig reactConfigClassObject, unsigned short ID){
|
|
|
|
|
|
|
|
config = reactConfigClassObject;
|
|
|
|
SetA(config.beamA, config.beamZ);
|
|
|
|
Seta(config.targetA, config.targetZ);
|
|
|
|
|
|
|
|
SetExA(config.beamEx);
|
|
|
|
|
|
|
|
if( ID > config.recoil.size() ){
|
|
|
|
printf("Reaction Config only has %zu recoil settings. input is %u. Abort.\n", config.recoil.size(), ID);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
recoil = config.recoil[ID];
|
|
|
|
exList = config.exList[ID];
|
|
|
|
|
|
|
|
Setb(recoil.lightA, recoil.lightZ);
|
|
|
|
SetB(recoil.heavyA, recoil.heavyZ);
|
|
|
|
SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
|
|
|
|
|
|
|
|
CalReactionConstant();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-03-15 16:14:50 -04:00
|
|
|
void TransferReaction::SetReactionFromFile(std::string configFile, unsigned short ID){
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-02-15 14:09:29 -05:00
|
|
|
if( config.LoadReactionConfig(configFile) ){
|
2024-02-13 18:24:56 -05:00
|
|
|
|
2024-02-15 14:09:29 -05:00
|
|
|
SetA(config.beamA, config.beamZ);
|
|
|
|
Seta(config.targetA, config.targetZ);
|
2024-02-15 16:36:45 -05:00
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
SetExA(config.beamEx);
|
|
|
|
|
2024-04-03 17:15:24 -04:00
|
|
|
if( ID > config.recoil.size() ){
|
|
|
|
printf("Reaction Config only has %zu recoil settings. input is %u. Abort.\n", config.recoil.size(), ID);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-02-15 16:36:45 -05:00
|
|
|
recoil = config.recoil[ID];
|
2024-02-19 18:31:27 -05:00
|
|
|
exList = config.exList[ID];
|
2024-02-15 16:36:45 -05:00
|
|
|
|
|
|
|
Setb(recoil.lightA, recoil.lightZ);
|
|
|
|
SetB(recoil.heavyA, recoil.heavyZ);
|
2024-02-15 14:09:29 -05:00
|
|
|
SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
CalReactionConstant();
|
|
|
|
|
|
|
|
}else{
|
2024-02-15 14:09:29 -05:00
|
|
|
printf("cannot read file %s.\n", configFile.c_str());
|
2024-02-13 18:24:56 -05:00
|
|
|
isReady = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-07-05 19:26:51 -04:00
|
|
|
void TransferReaction::SetReactionFromTMacro(TMacro configMacro, unsigned short ID){
|
|
|
|
|
|
|
|
if( config.LoadReactionConfig(&configMacro) ){
|
|
|
|
|
|
|
|
SetA(config.beamA, config.beamZ);
|
|
|
|
Seta(config.targetA, config.targetZ);
|
|
|
|
|
|
|
|
SetExA(config.beamEx);
|
|
|
|
|
|
|
|
if( ID > config.recoil.size() ){
|
|
|
|
printf("Reaction Config only has %zu recoil settings. input is %u. Abort.\n", config.recoil.size(), ID);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
recoil = config.recoil[ID];
|
|
|
|
exList = config.exList[ID];
|
|
|
|
|
|
|
|
Setb(recoil.lightA, recoil.lightZ);
|
|
|
|
SetB(recoil.heavyA, recoil.heavyZ);
|
|
|
|
SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
|
|
|
|
|
|
|
|
CalReactionConstant();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
printf("cannot read TMacro %s.\n", configMacro.GetName());
|
|
|
|
isReady = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-02-20 16:38:40 -05:00
|
|
|
TString TransferReaction::GetReactionName() const{
|
2024-02-13 18:24:56 -05:00
|
|
|
TString rName;
|
|
|
|
rName.Form("%s(%s,%s)%s", nameA.c_str(), namea.c_str(), nameb.c_str(), nameB.c_str());
|
|
|
|
return rName;
|
|
|
|
}
|
|
|
|
|
|
|
|
TString TransferReaction::format(TString name){
|
|
|
|
if( name.IsAlpha() ) return name;
|
|
|
|
int len = name.Length();
|
|
|
|
TString temp = name;
|
|
|
|
TString temp2 = name;
|
|
|
|
if( temp.Remove(0, len-2).IsAlpha()){
|
|
|
|
temp2.Remove(len-2);
|
|
|
|
}else{
|
|
|
|
temp = name;
|
|
|
|
temp.Remove(0, len-1);
|
|
|
|
temp2.Remove(len-1);
|
|
|
|
}
|
|
|
|
return "^{"+temp2+"}"+temp;
|
|
|
|
}
|
2024-02-20 16:38:40 -05:00
|
|
|
|
2024-02-13 18:24:56 -05:00
|
|
|
TString TransferReaction::GetReactionName_Latex(){
|
|
|
|
TString rName;
|
2024-02-19 18:31:27 -05:00
|
|
|
rName.Form("%s(%s,%s)%s @ %.2f MeV/u", format(nameA).Data(), format(namea).Data(), format(nameb).Data(), format(nameB).Data(), config.beamEnergy);
|
2024-02-13 18:24:56 -05:00
|
|
|
return rName;
|
|
|
|
}
|
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
double TransferReaction::CalkCM(double ExB){
|
|
|
|
if( !isBSet || !isReady) return TMath::QuietNaN();
|
|
|
|
return TMath::Sqrt( (Etot*Etot - TMath::Power(mb + mB + ExB,2)) * (Etot*Etot - TMath::Power(mb - mB - ExB,2)) ) / 2 / Etot;
|
|
|
|
}
|
|
|
|
|
2024-02-13 18:24:56 -05:00
|
|
|
void TransferReaction::CalReactionConstant(){
|
|
|
|
if( !isBSet){
|
2024-02-15 16:36:45 -05:00
|
|
|
recoil.heavyA = config.beamA + config.targetA - recoil.lightA;
|
|
|
|
recoil.heavyZ = config.beamZ + config.targetZ - recoil.lightZ;
|
|
|
|
Isotope temp (recoil.heavyA, recoil.heavyZ);
|
2024-02-13 18:24:56 -05:00
|
|
|
mB = temp.Mass;
|
|
|
|
isBSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = TMath::Sqrt(TMath::Power(mA + ExA + T, 2) - (mA + ExA) * (mA + ExA));
|
|
|
|
beta = k / (mA + ExA + ma + T);
|
|
|
|
gamma = 1 / TMath::Sqrt(1- beta * beta);
|
|
|
|
Etot = TMath::Sqrt(TMath::Power(mA + ExA + ma + T,2) - k * k);
|
|
|
|
|
|
|
|
PA.SetXYZM(0, 0, k, mA + ExA);
|
|
|
|
PA.RotateY(thetaIN);
|
2024-02-19 18:31:27 -05:00
|
|
|
PA.RotateZ(phiIN);
|
2024-02-13 18:24:56 -05:00
|
|
|
Pa.SetXYZM(0,0,0,ma);
|
2024-02-15 16:36:45 -05:00
|
|
|
|
|
|
|
PA.SetUniqueID(config.beamZ);
|
|
|
|
Pa.SetUniqueID(config.targetZ);
|
|
|
|
Pb.SetUniqueID(recoil.lightZ);
|
|
|
|
PB.SetUniqueID(recoil.heavyZ);
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
isReady = true;
|
2024-02-19 18:31:27 -05:00
|
|
|
p = CalkCM(ExB);
|
|
|
|
|
2024-02-13 18:24:56 -05:00
|
|
|
}
|
|
|
|
|
2024-02-15 16:36:45 -05:00
|
|
|
void TransferReaction::PrintFourVectors() const {
|
2024-02-14 16:30:13 -05:00
|
|
|
|
|
|
|
printf("A : %10.2f %10.2f %10.2f %10.2f\n", PA.E(), PA.Px(), PA.Py(), PA.Pz());
|
|
|
|
printf("a : %10.2f %10.2f %10.2f %10.2f\n", Pa.E(), Pa.Px(), Pa.Py(), Pa.Pz());
|
|
|
|
printf("b : %10.2f %10.2f %10.2f %10.2f\n", Pb.E(), Pb.Px(), Pb.Py(), Pb.Pz());
|
|
|
|
printf("B : %10.2f %10.2f %10.2f %10.2f\n", PB.E(), PB.Px(), PB.Py(), PB.Pz());
|
|
|
|
printf("-------------------------------------------------------\n");
|
|
|
|
printf("B : %10.2f %10.2f %10.2f %10.2f\n",
|
|
|
|
PA.E() + Pa.E() - Pb.E() - PB.E(),
|
|
|
|
PA.Px() + Pa.Px() - Pb.Px() - PB.Px(),
|
|
|
|
PA.Py() + Pa.Py() - Pb.Py() - PB.Py(),
|
|
|
|
PA.Pz() + Pa.Pz() - Pb.Pz() - PB.Pz());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-02-20 16:38:40 -05:00
|
|
|
void TransferReaction::PrintReaction(bool withEx) const {
|
2024-02-15 16:36:45 -05:00
|
|
|
|
2024-02-20 16:38:40 -05:00
|
|
|
printf("=====================================================\n");
|
|
|
|
printf("\e[1m\e[33m %s \e[0m\n", GetReactionName().Data());
|
2024-02-15 16:36:45 -05:00
|
|
|
printf("=====================================================\n");
|
|
|
|
printf("------------------------------ Beam\n");
|
|
|
|
printf(" beam : A = %3d, Z = %2d, Ex = %.2f MeV\n", config.beamA, config.beamZ, config.beamEx);
|
|
|
|
printf(" beam Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", config.beamEnergy, config.beamEnergySigma, config.beamEnergySigma/config.beamEnergy);
|
2024-02-19 18:31:27 -05:00
|
|
|
printf(" Angle : %.2f +- %.2f mrad\n", config.beamTheta, config.beamThetaSigma);
|
2024-02-15 16:36:45 -05:00
|
|
|
printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", config.beamX, config.beamY);
|
|
|
|
|
|
|
|
printf("------------------------------ Target\n");
|
|
|
|
printf(" target : A = %3d, Z = %2d \n", config.targetA, config.targetZ);
|
|
|
|
|
|
|
|
printf("------------------------------ Recoil\n");
|
|
|
|
printf(" light : A = %3d, Z = %2d \n", recoil.lightA, recoil.lightZ);
|
|
|
|
printf(" heavy : A = %3d, Z = %2d \n", recoil.heavyA, recoil.heavyZ);
|
2024-02-20 16:38:40 -05:00
|
|
|
printf("=====================================================\n");
|
2024-02-15 16:36:45 -05:00
|
|
|
|
2024-02-20 16:38:40 -05:00
|
|
|
if( withEx ) {
|
|
|
|
exList.Print();
|
|
|
|
printf("=====================================================\n");
|
|
|
|
}
|
2024-02-15 16:36:45 -05:00
|
|
|
}
|
|
|
|
|
2024-02-13 18:24:56 -05:00
|
|
|
void TransferReaction::Event(double thetaCM_rad, double phiCM_rad){
|
|
|
|
|
2024-02-19 18:31:27 -05:00
|
|
|
if( !isReady ) CalReactionConstant();
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
//---- to CM frame
|
|
|
|
TLorentzVector Pc = PA + Pa;
|
|
|
|
TVector3 b = Pc.BoostVector();
|
|
|
|
|
|
|
|
TVector3 vb(0,0,0);
|
|
|
|
|
|
|
|
if( b.Mag() > 0 ){
|
|
|
|
TVector3 v0 (0,0,0);
|
|
|
|
TVector3 nb = v0 - b;
|
|
|
|
|
|
|
|
TLorentzVector PAc = PA;
|
|
|
|
PAc.Boost(nb);
|
|
|
|
TVector3 vA = PAc.Vect();
|
|
|
|
|
|
|
|
TLorentzVector Pac = Pa;
|
|
|
|
Pac.Boost(nb);
|
|
|
|
TVector3 va = Pac.Vect();
|
|
|
|
|
|
|
|
//--- construct vb
|
|
|
|
vb = va;
|
|
|
|
vb.SetMag(p);
|
|
|
|
|
|
|
|
TVector3 ub = vb.Orthogonal();
|
|
|
|
vb.Rotate(thetaCM_rad, ub);
|
|
|
|
vb.Rotate(phiCM_rad + TMath::PiOver2(), va); // somehow, the calculation turn the vector 90 degree.
|
|
|
|
//vb.Rotate(phiCM , va); // somehow, the calculation turn the vector 90 degree.
|
|
|
|
}
|
|
|
|
|
|
|
|
//--- from Pb
|
|
|
|
TLorentzVector Pbc;
|
|
|
|
Pbc.SetVectM(vb, mb);
|
|
|
|
|
|
|
|
//--- from PB
|
|
|
|
TLorentzVector PBc;
|
|
|
|
//PBc.SetVectM(vB, mB + ExB);
|
|
|
|
PBc.SetVectM(-vb, mB + ExB);
|
|
|
|
|
|
|
|
//---- to Lab Frame
|
|
|
|
Pb = Pbc; Pb.Boost(b);
|
|
|
|
PB = PBc; PB.Boost(b);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::pair<double, double> TransferReaction::CalExThetaCM(double e, double z, double Bfield, double perpDist){
|
|
|
|
|
|
|
|
double Ex = TMath::QuietNaN();
|
|
|
|
double thetaCM = TMath::QuietNaN();
|
|
|
|
|
|
|
|
double mass = mb;
|
|
|
|
double massB = mB;
|
|
|
|
double y = e + mass;
|
2024-02-15 16:36:45 -05:00
|
|
|
double slope = 299.792458 * recoil.lightZ * abs(Bfield) / TMath::TwoPi() * beta / 1000.; // MeV/mm;
|
2024-02-13 18:24:56 -05:00
|
|
|
double alpha = slope/beta;
|
|
|
|
double G = alpha * gamma * beta * perpDist ;
|
|
|
|
double Z = alpha * gamma * beta * z;
|
|
|
|
double H = TMath::Sqrt(TMath::Power(gamma * beta,2) * (y*y - mass * mass) ) ;
|
|
|
|
double Et = Etot;
|
|
|
|
|
|
|
|
if( TMath::Abs(Z) < H ) {
|
|
|
|
//using Newton's method to solve 0 == H * sin(phi) - G * tan(phi) - Z = f(phi)
|
|
|
|
double tolerrence = 0.001;
|
|
|
|
double phi = 0; //initial phi = 0 -> ensure the solution has f'(phi) > 0
|
|
|
|
double nPhi = 0; // new phi
|
|
|
|
|
|
|
|
int iter = 0;
|
|
|
|
do{
|
|
|
|
phi = nPhi;
|
|
|
|
nPhi = phi - (H * TMath::Sin(phi) - G * TMath::Tan(phi) - Z) / (H * TMath::Cos(phi) - G /TMath::Power( TMath::Cos(phi), 2));
|
|
|
|
iter ++;
|
|
|
|
if( iter > 10 || TMath::Abs(nPhi) > TMath::PiOver2()) break;
|
|
|
|
}while( TMath::Abs(phi - nPhi ) > tolerrence);
|
|
|
|
|
|
|
|
phi = nPhi;
|
|
|
|
|
|
|
|
// check f'(phi) > 0
|
|
|
|
double Df = H * TMath::Cos(phi) - G / TMath::Power( TMath::Cos(phi),2);
|
|
|
|
if( Df > 0 && TMath::Abs(phi) < TMath::PiOver2() ){
|
|
|
|
double K = H * TMath::Sin(phi);
|
|
|
|
double x = TMath::ACos( mass / ( y * gamma - K));
|
|
|
|
double k = mass * TMath::Tan(x); // momentum of particel b or B in CM frame
|
|
|
|
double EB = TMath::Sqrt(mass*mass + Et*Et - 2*Et*TMath::Sqrt(k*k + mass * mass));
|
|
|
|
Ex = EB - massB;
|
|
|
|
|
|
|
|
double hahaha1 = gamma* TMath::Sqrt(mass * mass + k * k) - y;
|
|
|
|
double hahaha2 = gamma* beta * k;
|
|
|
|
thetaCM = TMath::ACos(hahaha1/hahaha2) * TMath::RadToDeg();
|
|
|
|
|
|
|
|
//double pt = k * TMath::Sin(thetaCM * TMath::DegToRad());
|
|
|
|
//double pp = gamma*beta*TMath::Sqrt(mass*mass + k*k) - gamma * k * TMath::Cos(thetaCM * TMath::DegToRad());
|
|
|
|
//thetaLab = TMath::ATan(pt/pp) * TMath::RadToDeg();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
Ex = TMath::QuietNaN();
|
|
|
|
thetaCM = TMath::QuietNaN();
|
|
|
|
//thetaLab = TMath::QuietNaN();
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
Ex = TMath::QuietNaN();
|
|
|
|
thetaCM = TMath::QuietNaN();
|
|
|
|
//thetaLab = TMath::QuietNaN();
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::make_pair(Ex, thetaCM);
|
|
|
|
}
|
|
|
|
|
2024-04-03 16:10:26 -04:00
|
|
|
void TransferReaction::CreateExDistribution(){
|
|
|
|
|
|
|
|
int numEx = exList.ExList.size();
|
|
|
|
|
|
|
|
exDistribution = new TF1("exDistribution", TransferReaction::exDistFunc, 0, numEx, numEx);
|
|
|
|
for(int q = 0; q < numEx; q++){
|
|
|
|
exDistribution->SetParameter(q, exList.ExList[q].xsec*exList.ExList[q].SF);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-02-13 18:24:56 -05:00
|
|
|
|
|
|
|
#endif
|