1
0
Fork 0
mirror of https://github.com/gwm17/Mask.git synced 2024-11-22 18:28:51 -05:00

Added deadlayer considerations to SabreEfficiency, fleshed out cross products

This commit is contained in:
Gordon McCann 2021-03-10 15:00:35 -05:00
parent f511eec983
commit f80eb25144
9 changed files with 71 additions and 33 deletions

View File

@ -18,6 +18,8 @@ struct NucData {
double p = -1; double p = -1;
double theta = -1; double theta = -1;
double phi = -1; double phi = -1;
int Z = -1;
int A = -1;
}; };
class Kinematics { class Kinematics {

View File

@ -83,6 +83,7 @@ public:
inline double GetPhiCentral() { return m_phiCentral; }; inline double GetPhiCentral() { return m_phiCentral; };
inline double GetTiltAngle() { return m_tilt; }; inline double GetTiltAngle() { return m_tilt; };
inline Mask::Vec3 GetTranslation() { return m_translation; }; inline Mask::Vec3 GetTranslation() { return m_translation; };
inline Mask::Vec3 GetNormTilted() { return TransformToTiltedFrame(m_norm_flat); };
private: private:
@ -163,6 +164,7 @@ private:
Mask::YRotation m_YRot; Mask::YRotation m_YRot;
Mask::ZRotation m_ZRot; Mask::ZRotation m_ZRot;
double m_deltaR_flat, m_deltaR_flat_ring, m_deltaPhi_flat_wedge; double m_deltaR_flat, m_deltaR_flat_ring, m_deltaPhi_flat_wedge;
Mask::Vec3 m_norm_flat;
std::vector<std::vector<Mask::Vec3>> m_ringCoords_flat, m_wedgeCoords_flat; std::vector<std::vector<Mask::Vec3>> m_ringCoords_flat, m_wedgeCoords_flat;
std::vector<std::vector<Mask::Vec3>> m_ringCoords_tilt, m_wedgeCoords_tilt; std::vector<std::vector<Mask::Vec3>> m_ringCoords_tilt, m_wedgeCoords_tilt;

View File

@ -2,6 +2,7 @@
#define SABREEFFICIENCY_H #define SABREEFFICIENCY_H
#include "SabreDetector.h" #include "SabreDetector.h"
#include "Target.h"
class SabreEfficiency { class SabreEfficiency {
public: public:
@ -19,6 +20,7 @@ private:
std::vector<SabreDetector> detectors; std::vector<SabreDetector> detectors;
std::vector<double> ringxs, ringys, ringzs; std::vector<double> ringxs, ringys, ringzs;
std::vector<double> wedgexs, wedgeys, wedgezs; std::vector<double> wedgexs, wedgeys, wedgezs;
Target deadlayer;
//Sabre constants //Sabre constants
@ -34,8 +36,9 @@ private:
const double PHI3 = 18.0; const double PHI3 = 18.0;
const double PHI4 = 90.0; const double PHI4 = 90.0;
const double DEG2RAD = M_PI/180.0; const double DEG2RAD = M_PI/180.0;
static constexpr double DEADLAYER_THIN = 50 * 1e-7 * 2.3296 * 1e6; // ug/cm^2 (50 nm thick * density)
const double ENERGY_THRESHOLD = 0.1; //in MeV const double ENERGY_THRESHOLD = 0.2; //in MeV
}; };

View File

@ -1,31 +1,26 @@
----------Data Information---------- ----------Data Information----------
OutputFile: /media/gordon/b6414c35-ec1f-4fc1-83bc-a6b68ca4325a/gwm17/test_newkine.root OutputFile: /data1/gwm17/test_dead.root
SaveTree: yes SaveTree: yes
SavePlots: yes SavePlots: yes
----------Reaction Information---------- ----------Reaction Information----------
ReactionType: 0 ReactionType: 2
Z A (order is target, projectile, ejectile, break1, break3) Z A (order is target, projectile, ejectile, break1, break3)
5 9 6 12
0 0 2 3
1 2
1 1 1 1
----------Target Information---------- ----------Target Information----------
Name: test_targ Name: test_targ
Layers: 2 Layers: 1
~Layer1 ~Layer1
Thickness(ug/cm^2): 0 Thickness(ug/cm^2): 40
Z A Stoich Z A Stoich
6 12 1 6 12 1
0 0
~ ~
~Layer2
Thickness(ug/cm^2): 0
Z A Stoich
5 9 1
0
~
----------Sampling Information---------- ----------Sampling Information----------
NumberOfSamples: 1000000 NumberOfSamples: 1000000
BeamMeanEnergy(MeV): 24 BeamEnergySigma(MeV): 0.001 BeamMeanEnergy(MeV): 24 BeamEnergySigma(MeV): 0.001
EjectileThetaMin(deg): 20.0 EjectileThetaMax(deg): 20.0 EjectileThetaMin(deg): 3.0 EjectileThetaMax(deg): 3.0
ResidualExMean(MeV): 16.8 ResidualExSigma(MeV): 0.038 ResidualExMean(MeV): 2.364 ResidualExSigma(MeV): 0.0317
-------------------------------------- --------------------------------------

View File

@ -138,6 +138,8 @@ NucData Kinematics::ConvertNucleus(const Nucleus& nuc) {
datum.theta = nuc.GetTheta(); datum.theta = nuc.GetTheta();
datum.phi = nuc.GetPhi(); datum.phi = nuc.GetPhi();
datum.Ex = nuc.GetExcitationEnergy(); datum.Ex = nuc.GetExcitationEnergy();
datum.Z = nuc.GetZ();
datum.A = nuc.GetA();
return datum; return datum;
} }

View File

@ -52,7 +52,7 @@
#include "SabreDetector.h" #include "SabreDetector.h"
SabreDetector::SabreDetector() : SabreDetector::SabreDetector() :
m_Router(0.1351), m_Rinner(0.0326), m_deltaPhi_flat(54.4*deg2rad), m_phiCentral(0.0), m_tilt(0.0), m_translation(0.,0.,0.) m_Router(0.1351), m_Rinner(0.0326), m_deltaPhi_flat(54.4*deg2rad), m_phiCentral(0.0), m_tilt(0.0), m_translation(0.,0.,0.), m_norm_flat(0,0,1.0)
{ {
m_YRot.SetAngle(m_tilt); m_YRot.SetAngle(m_tilt);
m_ZRot.SetAngle(m_phiCentral); m_ZRot.SetAngle(m_phiCentral);
@ -78,7 +78,7 @@ m_Router(0.1351), m_Rinner(0.0326), m_deltaPhi_flat(54.4*deg2rad), m_phiCentral(
} }
SabreDetector::SabreDetector(double Rin, double Rout, double deltaPhi_flat, double phiCentral, double tiltFromVert, double zdist, double xdist, double ydist) : SabreDetector::SabreDetector(double Rin, double Rout, double deltaPhi_flat, double phiCentral, double tiltFromVert, double zdist, double xdist, double ydist) :
m_Router(Rout), m_Rinner(Rin), m_deltaPhi_flat(deltaPhi_flat), m_phiCentral(phiCentral), m_tilt(tiltFromVert), m_translation(xdist, ydist, zdist) m_Router(Rout), m_Rinner(Rin), m_deltaPhi_flat(deltaPhi_flat), m_phiCentral(phiCentral), m_tilt(tiltFromVert), m_translation(xdist, ydist, zdist), m_norm_flat(0,0,1.0)
{ {
m_YRot.SetAngle(m_tilt); m_YRot.SetAngle(m_tilt);
m_ZRot.SetAngle(m_phiCentral); m_ZRot.SetAngle(m_phiCentral);

View File

@ -1,5 +1,6 @@
#include "SabreEfficiency.h" #include "SabreEfficiency.h"
#include "Kinematics.h" #include "Kinematics.h"
#include <fstream>
#include <iostream> #include <iostream>
#include <TFile.h> #include <TFile.h>
#include <TTree.h> #include <TTree.h>
@ -9,7 +10,7 @@
#include <TCanvas.h> #include <TCanvas.h>
SabreEfficiency::SabreEfficiency() : SabreEfficiency::SabreEfficiency() :
m_rxn_type(-1) m_rxn_type(-1), deadlayer(DEADLAYER_THIN)
{ {
detectors.reserve(5); detectors.reserve(5);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI0*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG); detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI0*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
@ -40,6 +41,10 @@ SabreEfficiency::SabreEfficiency() :
} }
} }
} }
std::vector<int> dead_z = {14};
std::vector<int> dead_a = {28};
std::vector<int> dead_stoich = {1};
deadlayer.SetElements(dead_z, dead_a, dead_stoich);
} }
SabreEfficiency::~SabreEfficiency() {} SabreEfficiency::~SabreEfficiency() {}
@ -184,11 +189,15 @@ void SabreEfficiency::Run2Step(const char* file) {
std::vector<double> b1_phis, b2_phis; std::vector<double> b1_phis, b2_phis;
std::vector<double> b1_kes, b2_kes; std::vector<double> b1_kes, b2_kes;
double avg_ke_per_pixel[640] = {0};
int hits_per_pixel[640] = {0};
//Progress tracking //Progress tracking
int percent5 = nevents*0.05; int percent5 = nevents*0.05;
int count = 0; int count = 0;
int npercent = 0; int npercent = 0;
Mask::Vec3 coords;
for(int i=0; i<tree->GetEntries(); i++) { for(int i=0; i<tree->GetEntries(); i++) {
if(++count == percent5) {//Show progress every 5% if(++count == percent5) {//Show progress every 5%
npercent++; npercent++;
@ -199,8 +208,19 @@ void SabreEfficiency::Run2Step(const char* file) {
tree->GetEntry(i); tree->GetEntry(i);
if(break1->KE >= ENERGY_THRESHOLD) { if(break1->KE >= ENERGY_THRESHOLD) {
for(auto& det : detectors) { for(int j=0; j<5; j++) {
if(det.GetTrajectoryCoordinates(break1->theta, break1->phi).GetX() != 0) { auto& det = detectors[j];
auto chan = det.GetTrajectoryRingWedge(break1->theta, break1->phi);
if(chan.first != -1 && chan.second != -1) {
coords = det.GetTrajectoryCoordinates(break1->theta, break1->phi);
double thetaIncident = std::acos(coords.Dot(det.GetNormTilted())/(coords.GetR()));
double eloss = deadlayer.getEnergyLossTotal(break1->Z, break1->A, break1->KE, M_PI - thetaIncident);
if((break1->KE - eloss) <= ENERGY_THRESHOLD) break;
int pixel = (chan.first + 16*chan.second) + 128*j; //calc pixel
avg_ke_per_pixel[pixel] += (break1->KE - eloss);
hits_per_pixel[pixel]++;
b1_thetas.push_back(break1->theta); b1_thetas.push_back(break1->theta);
b1_phis.push_back(break1->phi); b1_phis.push_back(break1->phi);
b1_kes.push_back(break1->KE); b1_kes.push_back(break1->KE);
@ -227,6 +247,14 @@ void SabreEfficiency::Run2Step(const char* file) {
TParameter<double> break1_eff("Light Breakup Efficiency", b1eff); TParameter<double> break1_eff("Light Breakup Efficiency", b1eff);
TParameter<double> break2_eff("Heavy Breakup Efficiency", b2eff); TParameter<double> break2_eff("Heavy Breakup Efficiency", b2eff);
std::ofstream output("/data1/gwm17/test_dead_pixels.txt");
output<<"Average particle kinetic energy (MeV) per pixel (pixel = (ringch + wedgech*16) + 128*detID)"<<std::endl;
for(int i=0; i<640; i++) {
if(hits_per_pixel[i] == 0) output<<i<<" "<<0.0<<std::endl;
else output<<i<<" "<<((double) (avg_ke_per_pixel[i]/hits_per_pixel[i]))<<std::endl;
}
output.close();
input->cd(); input->cd();
break1_eff.Write(); break1_eff.Write();
break2_eff.Write(); break2_eff.Write();

View File

@ -40,25 +40,29 @@ bool Target::ContainsElement(int z, int a) {
/*Calculates energy loss for travelling all the way through the target*/ /*Calculates energy loss for travelling all the way through the target*/
double Target::getEnergyLossTotal(int zp, int ap, double startEnergy, double theta) { double Target::getEnergyLossTotal(int zp, int ap, double startEnergy, double theta) {
if(theta == PI/2.) return startEnergy; if(theta == PI/2.) return startEnergy;
else return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta))); else if(theta > PI/2.) theta = PI - theta;
return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta)));
} }
/*Calculates energy loss for travelling halfway through the target*/ /*Calculates energy loss for travelling halfway through the target*/
double Target::getEnergyLossHalf(int zp, int ap, double startEnergy, double theta) { double Target::getEnergyLossHalf(int zp, int ap, double startEnergy, double theta) {
if(theta == PI/2.) return startEnergy; if(theta == PI/2.) return startEnergy;
else return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/(2.0*fabs(cos(theta)))); else if(theta > PI/2.) theta = PI - theta;
return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/(2.0*fabs(cos(theta))));
} }
/*Calculates reverse energy loss for travelling all the way through the target*/ /*Calculates reverse energy loss for travelling all the way through the target*/
double Target::getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double theta) { double Target::getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double theta) {
if(theta == PI/2.) return finalEnergy; if(theta == PI/2.) return finalEnergy;
else return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta))); else if(theta > PI/2.) theta = PI - theta;
return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta)));
} }
/*Calculates reverse energy loss for travelling half way through the target*/ /*Calculates reverse energy loss for travelling half way through the target*/
double Target::getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double theta) { double Target::getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double theta) {
if(theta == PI/2.) return finalEnergy; if(theta == PI/2.) return finalEnergy;
else return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/(2.0*fabs(cos(theta)))); else if(theta > PI/2.) theta = PI - theta;
return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/(2.0*fabs(cos(theta))));
} }
/*Getter functions*/ /*Getter functions*/

View File

@ -38,9 +38,11 @@ double Vec3::Dot(const Vec3& rhs) const {
return GetX()*rhs.GetX() + GetY()*rhs.GetY() + GetZ()*rhs.GetZ(); return GetX()*rhs.GetX() + GetY()*rhs.GetY() + GetZ()*rhs.GetZ();
} }
//Unimplemented
Vec3 Vec3::Cross(const Vec3& rhs) const { Vec3 Vec3::Cross(const Vec3& rhs) const {
return Vec3(0.,0.,0.); double x = GetY()*rhs.GetZ() - GetZ()*rhs.GetY();
double y = GetZ()*rhs.GetX() - GetX()*rhs.GetZ();
double z = GetX()*rhs.GetY() - GetY()*rhs.GetX();
return Vec3(x,y,z);
} }
}; };