6TKinematics::TKinematics(
double eBeam,
const char* beam,
const char* targ,
const char* ejec,
const char* reco,
const char* name)
9 auto* projectile =
new TNucleus(beam);
14 name = Form(
"%s(%s,%s)%s", targ, beam, ejec, reco);
16 if((ejec ==
nullptr) || (reco ==
nullptr)) {
18 ejectile = projectile;
29 for(
int i = 0; i < 4; i++) {
62 for(
int i = 0; i < 4; i++) {
80 for(
int i = 0; i < 4; i++) {
90TKinematics::TKinematics(
const char* beam,
const char* targ,
const char* ejec,
const char* reco,
double eBeam,
double ex3,
const char* name)
93 auto* projectile =
new TNucleus(beam);
98 name = Form(
"%s(%s,%s)%s", targ, beam, ejec, reco);
100 if((ejec ==
nullptr) || (reco ==
nullptr)) {
102 ejectile = projectile;
113 for(
int i = 0; i < 4; i++) {
125 if(part < 2 || part > 3) {
126 std::cout <<
ALERTTEXT <<
"WARNING: the function Evslab should use nuclei after the reaction (part 2 or part 3)" <<
RESET_COLOR << std::endl;
130 std::vector<double> energy;
131 std::vector<double> angle;
133 double deg2rad =
PI / 180.0;
134 double rad2deg = 180.0 /
PI;
136 int steps = (
static_cast<int>(thmax + 1) -
static_cast<int>(thmin)) /
137 static_cast<int>(size);
140 double lastangle = 0.0;
141 for(
int i = 0; i < steps; i++) {
142 Final((thmin + i * size) * deg2rad, 2);
143 double tmpangle =
GetThetalab(part) * (1 / deg2rad);
144 double tmpeng =
GetTlab(part) * 1000;
145 if(tmpangle < lastangle) {
146 std::cout <<
ALERTTEXT <<
"WARNING: the abscissa(theta) is no longer increasing; Drawing spline will fail." <<
RESET_COLOR << std::endl;
147 std::cout <<
ALERTTEXT <<
" try Evslab_graph to see what this looks like. " <<
RESET_COLOR << std::endl;
150 lastangle = tmpangle;
151 if(tmpangle < 1 || tmpangle > (
GetMaxAngle(
fVcm[part]) * rad2deg) - 1) {
154 if(tmpeng > 1e15 || tmpeng < 0.0) {
158 angle.push_back(
GetThetalab(part) * (1 / deg2rad));
159 energy.push_back(
GetTlab(part) * 1000);
162 TGraph graph(
static_cast<Int_t
>(angle.size()), angle.data(), energy.data());
163 auto* spline =
new TSpline3(
"ETh_lab", &graph);
169 if(part < 2 || part > 3) {
170 std::cout <<
ALERTTEXT <<
"WARNING: the function Evslab+graph should use nuclei after the reaction (part 2 or part 3)" <<
RESET_COLOR << std::endl;
174 std::vector<double> energy;
175 std::vector<double> angle;
177 double rad2deg = 180.0 /
PI;
178 double deg2rad =
PI / 180.0;
180 int steps = (
static_cast<int>(thmax + 1) -
static_cast<int>(thmin)) /
181 static_cast<int>(size);
184 for(
int i = 0; i < steps; i++) {
185 Final((thmin + i * size) * deg2rad, 2);
186 double tmpangle =
GetThetalab(part) * (1 / deg2rad);
187 double tmpeng =
GetTlab(part) * 1000;
188 if(tmpangle < 1 || tmpangle > (
GetMaxAngle(
fVcm[part]) * rad2deg) - 1) {
191 if(tmpeng > 1e15 || tmpeng < 0.0) {
195 angle.push_back(
GetThetalab(part) * (1 / deg2rad));
196 energy.push_back(
GetTlab(part) * 1000);
199 return new TGraph(
static_cast<Int_t
>(angle.size()), angle.data(), energy.data());
204 auto* energy =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
205 auto* angle =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
207 double deg2rad =
PI / 180.;
208 for(
int i = 0; i < ((thmax - thmin) / size); i++) {
209 Final((thmin + i * size) * deg2rad, 2);
214 auto* graph =
new TGraph(number, angle, energy);
215 auto* spline =
new TSpline3(
"ETh_cm", graph);
225 TLorentzVector ejectile;
228 ejectile.SetVect(-recoil.Vect());
241 TLorentzVector recoil;
243 double TotalEnergy =
fM[2] + KinE;
245 position.SetMag(sqrt(pow(TotalEnergy, 2) - pow(TotalEnergy - KinE, 2)));
246 recoil.SetXYZT(position.X(), position.Y(), position.Z(), TotalEnergy);
254 double val1 = (
fM[0] +
fM[1]) * (
fM[0] +
fM[1]) +
fM[2] *
fM[2] + 2 *
fM[1] *
fT[0];
256 double val3 =
fM[2] + KinE -
fBeta_cm * sqrt(KinE * KinE + 2 *
fM[2] * KinE) * TMath::Cos(theta);
258 return sqrt(val1 - val2 * val3) -
fM[3];
264 double ProjectileMass =
fM[0];
265 double TargetMass =
fM[1];
267 double ts = pow(TargetMass, 2);
268 double ps = pow(ProjectileMass, 2);
269 double cs = pow(cos(LabAngle), 2);
270 double es = pow(LabEnergy, 2);
271 double te = TargetMass * LabEnergy;
273 return (-8 * ProjectileMass - 4 * TargetMass + LabEnergy / cs - 2 * LabEnergy * tan(LabAngle) +
275 LabEnergy * (LabEnergy / cs * pow(cos(LabAngle) - sin(LabAngle), 4) +
276 8 * TargetMass * (3 + sin(2 * LabAngle)))) /
278 sqrt((24 * ts * LabEnergy * cs + 32 *
ps * TargetMass * pow(cos(LabAngle), 4) +
279 2 * TargetMass * es * pow(cos(LabAngle) - sin(LabAngle), 4) +
280 16 * ts * LabEnergy * pow(cos(LabAngle), 3) * sin(LabAngle) -
281 8 *
ps * LabEnergy * cs * (sin(2 * LabAngle) - 1) +
282 2 *
ps * cos(3 * LabAngle) * sqrt(2 * (4 * ts + 12 * te + es) + (8 * ts - 2 * es) * cos(2 * LabAngle) + LabEnergy * (LabEnergy / cs + 8 * TargetMass * sin(2 * LabAngle) - 4 * LabEnergy * tan(LabAngle))) +
283 2 * cos(LabAngle) * (3 *
ps + te - te * sin(2 * LabAngle)) *
284 sqrt(2 * (4 * ts + 12 * te + es) + (8 * ts - 2 * es) * cos(2 * LabAngle) +
286 (LabEnergy / cs + 8 * TargetMass * sin(2 * LabAngle) - 4 * LabEnergy * tan(LabAngle)))) /
287 (pow(cos(LabAngle), 4) * TargetMass))) /
299 fP[0] = sqrt(
fT[0] *
fT[0] + 2 *
fT[0] *
fM[0]);
367 Final(angle_lab, part);
379 }
else if(part == 3) {
383 std::cout <<
" error in TKinematics::SetAngles(" << angle <<
", " << part <<
") " << std::endl;
384 std::cout <<
" part must be 2 or 3 " << std::endl;
403 return sqrt(
fM[0] *
fM[0] +
fM[1] *
fM[1] + 2. *
fM[1] * (
fM[0] + eBeam));
423 return atan2(sqrt(1 / (x * x - 1)),
fGamma_cm);
438 double tan_lab = tan(angle_lab);
443 return acos((-x * gtan + sqrt(1 + gtan * (1 - x * x))) / (1 + gtan));
445 return acos((-x * gtan - sqrt(1 + gtan * (1 - x * x))) / (1 + gtan));
450 double tan_lab = tan(angle_lab);
455 return acos((-x * gtan + sqrt(1 + gtan * (1 - x * x))) / (1 + gtan));
457 return acos((-x * gtan - sqrt(1 + gtan * (1 - x * x))) / (1 + gtan));
462 double v_in_cm =
fVcm[part];
466 double theta_lab =
PI - TMath::ATan2(sin(theta_cm), gamma_of_cm * (cos(theta_cm) - beta_of_cm / v_in_cm));
491 return atan2(sin(angle_cm),
fGamma_cm * (cos(angle_cm) + x));
496 auto* cm =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
497 auto* lab =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
499 for(
int i = 0; i < ((thmax - thmin) / size); i++) {
502 if(lab[nr] > 0.01 && lab[nr] < 179.99) {
506 auto* graph =
new TGraph(nr, cm, lab);
507 auto* spline =
new TSpline3(
"Th_cmvslab", graph);
516 auto* cm =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
517 auto* lab =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
519 for(
int i = 0; i < ((thmax - thmin) / size); i++) {
522 if(lab[nr] > 0.01 && lab[nr] < 179.99) {
526 auto* graph =
new TGraph(nr, lab, cm);
527 auto* spline =
new TSpline3(
"Th_cmvslab", graph);
536 auto* cm =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
537 auto* lab =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
539 for(
auto i =
static_cast<int>((thmax - thmin) / size); i > 0; i--) {
542 if(lab[nr] > 0.01 && lab[nr] < 179.99) {
546 auto* graph =
new TGraph(nr, lab, cm);
547 auto* spline =
new TSpline3(
"Th_cmvslabinverse", graph);
558 double wurzel = 1. + gam2 * gam2 + 2. * gam2 * cos(
PI - angle_cm);
559 wurzel = sqrt(wurzel);
560 return sigma_cm * (1 /
fGamma_cm * wurzel * wurzel * wurzel / (1 + gam2 * cos(
PI - angle_cm)));
567 double wurzel = 1. + gam2 * gam2 + 2. * gam2 * cos(
PI - angle_cm);
568 wurzel = sqrt(wurzel);
569 return sigma_lab / (1 /
fGamma_cm * wurzel * wurzel * wurzel / (1 + gam2 * cos(
PI - angle_cm)));
576 double w = 1. + g * g + 2. * g * cos(
PI - angle);
579 sqrt(pow(sigma * g * sin(
PI - angle) * (-2 + g * g - g * cos(
PI - angle)) / w * err, 2) +
580 pow((1 + g * cos(
PI - angle)) * errsigma, 2));
600 double b = sin(angle_cm / 2.) * sin(angle_cm / 2.);
602 return a * a / b * 0.0025;
607 auto* cross =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
608 auto* angle =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
610 for(
int i = 0; i < ((thmax - thmin) / size); i++) {
611 angle[i] = thmin + i * size;
612 if(angle[i] > 179.99 || angle[i] < 0.01) {
618 auto* graph =
new TGraph(number, angle, cross);
619 auto* spline =
new TSpline3(
"sigmaTh_cm", graph);
628 auto* cross =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
629 auto* angle =
new double[
static_cast<int>((thmax - thmin) / size) + 1];
631 for(
int i = 0; i < ((thmax - thmin) / size); i++) {
632 if(part == 3 || part == 2) {
633 angle[i] = thmin + i * size;
635 std::cout <<
"error " << std::endl;
638 if(angle[i] > 179.99 || angle[i] < 0.01) {
646 angle[i] = 180 - angle[i];
650 auto* graph =
new TGraph(number, angle, cross);
651 auto* spline =
new TSpline3(
"sigmaTh_lab", graph);
660 return sqrt(e * e - m * m);
664 return sqrt(t * t + 2. * t * m);
676 return sqrt(t * t + 2 * t * m) / (t + m);
double Angle_cm2lab(double vcm, double angle_cm) const
double Sigma_lab2cm(double angle_cm, double sigma_lab) const
double GetCmEnergy() const
double GetThetacm(int i) const
double GetExcEnergy(TLorentzVector recoil)
double NormalkinEnergy() const
void AngleErr_lab2cm(double angle, double &err) const
double GetMaxAngle(double vcm) const
TSpline3 * Ruthvslab(double thmin, double thmax, double size, int part) const
double Angle_lab2cminverse(double vcm, double angle_lab, bool upper=true) const
TSpline3 * labvscm(double thmin, double thmax, double size, int part=2) const
TSpline3 * cmvslab(double thmin, double thmax, double size, int part=2) const
TSpline3 * Evscm(double thmin, double thmax, double size, int part=2)
bool CheckMaxAngle(double angle, int part) const
TKinematics(double eBeam, const char *beam, const char *targ, const char *ejec=nullptr, const char *reco=nullptr, const char *name="")
double Sigma_cm2lab(double angle_cm, double sigma_cm) const
double Pcm_em(double, double) const
void Transform2cm(double &angle, double &sigma) const
double P_tm(double, double) const
double betacm_tm(double, double) const
double V_pe(double, double) const
double Rutherford(double angle_cm) const
void SigmaErr_lab2cm(double angle, double err, double &sigma, double &errsigma) const
double GetBeamEnergy(double LabAngle, double LabEnergy) const
double Steffen_cm2labinverse(double theta_cm, int part=2) const
TSpline3 * Ruthvscm(double thmin, double thmax, double size) const
TGraph * Evslab_graph(double thmin, double thmax, double size, int part=2)
TSpline3 * Steffen_labvscminverse(double thmin, double thmax, double size, int part=2) const
void SetAngles(double angle, int part, bool upper=false)
TSpline3 * Evslab(double thmin, double thmax, double size, int part=2)
void Final(double angle, int part)
double E_final(int) const
double GetTlab(int i) const
double E_tm(double, double) const
double Steffen_lab2cminverse(double theta_lab)
double T_final(int) const
double ELab(double angle_lab, int part)
double GetThetalab(int i) const
double T_em(double, double) const
double Angle_lab2cm(double vcm, double angle_lab) const
int GetZ() const
Gets the Z (# of protons) of the nucleus.
double GetMass() const
Gets the mass of the nucleus (in MeV)