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:
parent
f511eec983
commit
f80eb25144
|
@ -18,6 +18,8 @@ struct NucData {
|
|||
double p = -1;
|
||||
double theta = -1;
|
||||
double phi = -1;
|
||||
int Z = -1;
|
||||
int A = -1;
|
||||
};
|
||||
|
||||
class Kinematics {
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
inline double GetPhiCentral() { return m_phiCentral; };
|
||||
inline double GetTiltAngle() { return m_tilt; };
|
||||
inline Mask::Vec3 GetTranslation() { return m_translation; };
|
||||
inline Mask::Vec3 GetNormTilted() { return TransformToTiltedFrame(m_norm_flat); };
|
||||
|
||||
|
||||
private:
|
||||
|
@ -163,6 +164,7 @@ private:
|
|||
Mask::YRotation m_YRot;
|
||||
Mask::ZRotation m_ZRot;
|
||||
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_tilt, m_wedgeCoords_tilt;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define SABREEFFICIENCY_H
|
||||
|
||||
#include "SabreDetector.h"
|
||||
#include "Target.h"
|
||||
|
||||
class SabreEfficiency {
|
||||
public:
|
||||
|
@ -19,6 +20,7 @@ private:
|
|||
std::vector<SabreDetector> detectors;
|
||||
std::vector<double> ringxs, ringys, ringzs;
|
||||
std::vector<double> wedgexs, wedgeys, wedgezs;
|
||||
Target deadlayer;
|
||||
|
||||
|
||||
//Sabre constants
|
||||
|
@ -34,8 +36,9 @@ private:
|
|||
const double PHI3 = 18.0;
|
||||
const double PHI4 = 90.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
|
||||
|
||||
};
|
||||
|
||||
|
|
23
input.txt
23
input.txt
|
@ -1,31 +1,26 @@
|
|||
----------Data Information----------
|
||||
OutputFile: /media/gordon/b6414c35-ec1f-4fc1-83bc-a6b68ca4325a/gwm17/test_newkine.root
|
||||
OutputFile: /data1/gwm17/test_dead.root
|
||||
SaveTree: yes
|
||||
SavePlots: yes
|
||||
----------Reaction Information----------
|
||||
ReactionType: 0
|
||||
ReactionType: 2
|
||||
Z A (order is target, projectile, ejectile, break1, break3)
|
||||
5 9
|
||||
0 0
|
||||
6 12
|
||||
2 3
|
||||
1 2
|
||||
1 1
|
||||
----------Target Information----------
|
||||
Name: test_targ
|
||||
Layers: 2
|
||||
Layers: 1
|
||||
~Layer1
|
||||
Thickness(ug/cm^2): 0
|
||||
Thickness(ug/cm^2): 40
|
||||
Z A Stoich
|
||||
6 12 1
|
||||
0
|
||||
~
|
||||
~Layer2
|
||||
Thickness(ug/cm^2): 0
|
||||
Z A Stoich
|
||||
5 9 1
|
||||
0
|
||||
~
|
||||
----------Sampling Information----------
|
||||
NumberOfSamples: 1000000
|
||||
BeamMeanEnergy(MeV): 24 BeamEnergySigma(MeV): 0.001
|
||||
EjectileThetaMin(deg): 20.0 EjectileThetaMax(deg): 20.0
|
||||
ResidualExMean(MeV): 16.8 ResidualExSigma(MeV): 0.038
|
||||
EjectileThetaMin(deg): 3.0 EjectileThetaMax(deg): 3.0
|
||||
ResidualExMean(MeV): 2.364 ResidualExSigma(MeV): 0.0317
|
||||
--------------------------------------
|
||||
|
|
|
@ -138,6 +138,8 @@ NucData Kinematics::ConvertNucleus(const Nucleus& nuc) {
|
|||
datum.theta = nuc.GetTheta();
|
||||
datum.phi = nuc.GetPhi();
|
||||
datum.Ex = nuc.GetExcitationEnergy();
|
||||
datum.Z = nuc.GetZ();
|
||||
datum.A = nuc.GetA();
|
||||
return datum;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "SabreDetector.h"
|
||||
|
||||
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_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) :
|
||||
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_ZRot.SetAngle(m_phiCentral);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "SabreEfficiency.h"
|
||||
#include "Kinematics.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <TFile.h>
|
||||
#include <TTree.h>
|
||||
|
@ -9,7 +10,7 @@
|
|||
#include <TCanvas.h>
|
||||
|
||||
SabreEfficiency::SabreEfficiency() :
|
||||
m_rxn_type(-1)
|
||||
m_rxn_type(-1), deadlayer(DEADLAYER_THIN)
|
||||
{
|
||||
detectors.reserve(5);
|
||||
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() {}
|
||||
|
@ -184,11 +189,15 @@ void SabreEfficiency::Run2Step(const char* file) {
|
|||
std::vector<double> b1_phis, b2_phis;
|
||||
std::vector<double> b1_kes, b2_kes;
|
||||
|
||||
double avg_ke_per_pixel[640] = {0};
|
||||
int hits_per_pixel[640] = {0};
|
||||
|
||||
//Progress tracking
|
||||
int percent5 = nevents*0.05;
|
||||
int count = 0;
|
||||
int npercent = 0;
|
||||
|
||||
Mask::Vec3 coords;
|
||||
for(int i=0; i<tree->GetEntries(); i++) {
|
||||
if(++count == percent5) {//Show progress every 5%
|
||||
npercent++;
|
||||
|
@ -199,8 +208,19 @@ void SabreEfficiency::Run2Step(const char* file) {
|
|||
tree->GetEntry(i);
|
||||
|
||||
if(break1->KE >= ENERGY_THRESHOLD) {
|
||||
for(auto& det : detectors) {
|
||||
if(det.GetTrajectoryCoordinates(break1->theta, break1->phi).GetX() != 0) {
|
||||
for(int j=0; j<5; j++) {
|
||||
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_phis.push_back(break1->phi);
|
||||
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> 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();
|
||||
break1_eff.Write();
|
||||
break2_eff.Write();
|
||||
|
|
|
@ -40,25 +40,29 @@ bool Target::ContainsElement(int z, int a) {
|
|||
/*Calculates energy loss for travelling all the way through the target*/
|
||||
double Target::getEnergyLossTotal(int zp, int ap, double startEnergy, double theta) {
|
||||
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*/
|
||||
double Target::getEnergyLossHalf(int zp, int ap, double startEnergy, double theta) {
|
||||
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*/
|
||||
double Target::getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double theta) {
|
||||
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*/
|
||||
double Target::getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double theta) {
|
||||
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*/
|
||||
|
|
|
@ -38,9 +38,11 @@ double Vec3::Dot(const Vec3& rhs) const {
|
|||
return GetX()*rhs.GetX() + GetY()*rhs.GetY() + GetZ()*rhs.GetZ();
|
||||
}
|
||||
|
||||
//Unimplemented
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user