#include "AnasenEfficiency.h" #include "Kinematics.h" #include #include AnasenEfficiency::AnasenEfficiency() : DetectorEfficiency(), det_silicon(si_thickness) { for(int i=0; i det_z = {14}; std::vector det_a = {28}; std::vector det_stoich = {1}; det_silicon.SetElements(det_z, det_a, det_stoich); } AnasenEfficiency::~AnasenEfficiency() {} void AnasenEfficiency::DrawDetectorSystem(const std::string& filename) { std::ofstream output(filename); std::vector x, y, z; std::vector cx, cy, cz; Mask::Vec3 coords; for(int i=0; i r1_points; std::vector r2_points; std::vector fqqq_points; std::vector bqqq_points; for(int i=0; i M_PI/2.0) thetaIncident = M_PI - thetaIncident; //e_dep = det_silicon.getEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); observation.energy_deposited = det_silicon.GetEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); observation.det_name = "R1"; //return std::make_pair(true, e_dep); return observation; } } //return std::make_pair(false, 0.0); return observation; } DetectorResult AnasenEfficiency::IsRing2(Mask::Nucleus& nucleus) { DetectorResult observation; //Mask::Vec3 coords; double thetaIncident, eloss, e_dep; for(auto& sx3 : m_Ring2) { auto result = sx3.GetChannelRatio(nucleus.GetTheta(), nucleus.GetPhi()); if(result.first != -1) { //coords = sx3.GetHitCoordinates(result.first, result.second); observation.detectFlag = true; observation.direction = sx3.GetHitCoordinates(result.first, result.second); thetaIncident = std::acos(observation.direction.Dot(sx3.GetNormRotated())/observation.direction.GetR()); if(thetaIncident > M_PI/2.0) thetaIncident = M_PI - thetaIncident; //e_dep = det_silicon.getEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); observation.energy_deposited = det_silicon.GetEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); observation.det_name = "R2"; //return std::make_pair(true, e_dep); return observation; } } return observation; } DetectorResult AnasenEfficiency::IsQQQ(Mask::Nucleus& nucleus) { DetectorResult observation; //Mask::Vec3 coords; double thetaIncident, eloss, e_dep; for(auto& qqq : m_forwardQQQs) { auto result = qqq.GetTrajectoryRingWedge(nucleus.GetTheta(), nucleus.GetPhi()); if(result.first != -1) { //coords = qqq.GetHitCoordinates(result.first, result.second); observation.detectFlag = true; observation.direction = qqq.GetHitCoordinates(result.first, result.second); thetaIncident = std::acos(observation.direction.Dot(qqq.GetNorm())/observation.direction.GetR()); if(thetaIncident > M_PI/2.0) thetaIncident = M_PI - thetaIncident; //e_dep = det_silicon.getEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); observation.energy_deposited = det_silicon.GetEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); //return std::make_pair(true, e_dep); observation.det_name = "FQQQ"; return observation; } } for(auto& qqq : m_backwardQQQs) { auto result = qqq.GetTrajectoryRingWedge(nucleus.GetTheta(), nucleus.GetPhi()); if(result.first != -1) { //coords = qqq.GetHitCoordinates(result.first, result.second); observation.detectFlag = true; observation.direction = qqq.GetHitCoordinates(result.first, result.second); thetaIncident = std::acos(observation.direction.Dot(qqq.GetNorm())/observation.direction.GetR()); if(thetaIncident > M_PI/2.0) thetaIncident = M_PI - thetaIncident; //e_dep = det_silicon.getEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); observation.energy_deposited = det_silicon.GetEnergyLossTotal(nucleus.GetZ(), nucleus.GetA(), nucleus.GetKE(), thetaIncident); //return std::make_pair(true, e_dep); observation.det_name = "BQQQ"; return observation; } } //return std::make_pair(false, 0.0); return observation; } DetectorResult AnasenEfficiency::IsAnasen(Mask::Nucleus& nucleus) { DetectorResult result; if(nucleus.GetKE() <= threshold) return result; if(!result.detectFlag) { result = IsRing1(nucleus); } if(!result.detectFlag) { result = IsRing2(nucleus); } if(!result.detectFlag) { result = IsQQQ(nucleus); } return result; } void AnasenEfficiency::CountCoincidences(const Mask::MaskFileData& data, std::vector& counts, int rxn_type) { if (rxn_type == 0 && data.detect_flag[1] && data.detect_flag[2]) { counts[0]++; } else if (rxn_type == 1 && data.detect_flag[2] && data.detect_flag[3]) { counts[0]++; } else if(rxn_type == 2) { if(data.detect_flag[2] && data.detect_flag[4]) { counts[0]++; } if(data.detect_flag[2] && data.detect_flag[5]) { counts[1]++; } if(data.detect_flag[4] && data.detect_flag[5]) { counts[2]++; } if(data.detect_flag[2] && data.detect_flag[4] && data.detect_flag[5]) { counts[3]++; } } else if(rxn_type == 3) { if(data.detect_flag[2] && data.detect_flag[4]) { counts[0]++; } if(data.detect_flag[2] && data.detect_flag[6]) { counts[1]++; } if(data.detect_flag[2] && data.detect_flag[7]) { counts[2]++; } if(data.detect_flag[4] && data.detect_flag[6]) { counts[3]++; } if(data.detect_flag[4] && data.detect_flag[7]) { counts[4]++; } if(data.detect_flag[6] && data.detect_flag[7]) { counts[5]++; } if(data.detect_flag[2] && data.detect_flag[4] && data.detect_flag[6]) { counts[6]++; } if(data.detect_flag[2] && data.detect_flag[4] && data.detect_flag[7]) { counts[7]++; } if(data.detect_flag[2] && data.detect_flag[6] && data.detect_flag[7]) { counts[8]++; } if(data.detect_flag[4] && data.detect_flag[6] && data.detect_flag[7]) { counts[9]++; } if(data.detect_flag[2] && data.detect_flag[4] && data.detect_flag[6] && data.detect_flag[7]) { counts[10]++; } } } void AnasenEfficiency::CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) { std::cout<<"----------ANASEN Efficiency Calculation----------"< counts; std::vector coinc_counts; switch(header.rxn_type) { case 0: counts.resize(3, 0); coinc_counts.resize(1, 0); break; case 1: counts.resize(4, 0); coinc_counts.resize(1, 0); break; case 2: counts.resize(6, 0); coinc_counts.resize(4, 0); break; case 3: counts.resize(8, 0); coinc_counts.resize(11, 0); break; default: { std::cerr<<"Bad reaction type at AnasenEfficiency::CalculateEfficiency (given value: "<