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

Fix typos in SX3 class. Change name of array classes to array rather than efficiency. Update cmake lists.

This commit is contained in:
Gordon McCann 2022-08-30 15:42:49 -04:00
parent bb67011bb5
commit 3565f7ae28
9 changed files with 66 additions and 65 deletions

View File

@ -1,4 +1,4 @@
#include "AnasenEfficiency.h"
#include "AnasenArray.h"
#include <fstream>
#include <iomanip>
#include <iostream>
@ -6,8 +6,8 @@
#include "TFile.h"
#include "TTree.h"
AnasenEfficiency::AnasenEfficiency() :
DetectorEfficiency(), m_detectorEloss({14}, {28}, {1}, s_detectorThickness)
AnasenArray::AnasenArray() :
DetectorArray(), m_detectorEloss({14}, {28}, {1}, s_detectorThickness)
{
for(int i=0; i<s_nSX3PerBarrel; i++)
{
@ -25,10 +25,10 @@ AnasenEfficiency::AnasenEfficiency() :
}
}
AnasenEfficiency::~AnasenEfficiency() {}
AnasenArray::~AnasenArray() {}
void AnasenEfficiency::DrawDetectorSystem(const std::string& filename)
void AnasenArray::DrawDetectorSystem(const std::string& filename)
{
std::ofstream output(filename);
@ -135,7 +135,7 @@ void AnasenEfficiency::DrawDetectorSystem(const std::string& filename)
output.close();
}
double AnasenEfficiency::RunConsistencyCheck()
double AnasenArray::RunConsistencyCheck()
{
std::vector<ROOT::Math::XYZPoint> r1_points;
std::vector<ROOT::Math::XYZPoint> r2_points;
@ -230,7 +230,7 @@ double AnasenEfficiency::RunConsistencyCheck()
}
DetectorResult AnasenEfficiency::IsRing1(Mask::Nucleus& nucleus)
DetectorResult AnasenArray::IsRing1(Mask::Nucleus& nucleus)
{
DetectorResult observation;
double thetaIncident;
@ -255,7 +255,7 @@ DetectorResult AnasenEfficiency::IsRing1(Mask::Nucleus& nucleus)
return observation;
}
DetectorResult AnasenEfficiency::IsRing2(Mask::Nucleus& nucleus)
DetectorResult AnasenArray::IsRing2(Mask::Nucleus& nucleus)
{
DetectorResult observation;
double thetaIncident;
@ -280,7 +280,7 @@ DetectorResult AnasenEfficiency::IsRing2(Mask::Nucleus& nucleus)
return observation;
}
DetectorResult AnasenEfficiency::IsQQQ(Mask::Nucleus& nucleus)
DetectorResult AnasenArray::IsQQQ(Mask::Nucleus& nucleus)
{
DetectorResult observation;
double thetaIncident;
@ -324,7 +324,7 @@ DetectorResult AnasenEfficiency::IsQQQ(Mask::Nucleus& nucleus)
return observation;
}
DetectorResult AnasenEfficiency::IsAnasen(Mask::Nucleus& nucleus)
DetectorResult AnasenArray::IsAnasen(Mask::Nucleus& nucleus)
{
DetectorResult result;
if(nucleus.GetKE() <= s_energyThreshold)
@ -339,7 +339,7 @@ DetectorResult AnasenEfficiency::IsAnasen(Mask::Nucleus& nucleus)
return result;
}
void AnasenEfficiency::CountCoincidences(const std::vector<Mask::Nucleus>& data, std::vector<int>& counts)
void AnasenArray::CountCoincidences(const std::vector<Mask::Nucleus>& data, std::vector<int>& counts)
{
if (data.size() == 3 && data[1].isDetected && data[2].isDetected)
{
@ -417,11 +417,11 @@ void AnasenEfficiency::CountCoincidences(const std::vector<Mask::Nucleus>& data,
}
}
void AnasenEfficiency::CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) {
void AnasenArray::CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) {
if(!dmap.IsValid())
{
std::cerr<<"Invalid Dead Channel Map at AnasenEfficiency::CalculateEfficiency()! If you want to run with all possible";
std::cerr<<"Invalid Dead Channel Map at AnasenArray::CalculateEfficiency()! If you want to run with all possible";
std::cerr<<"channels active, simply load an empty file."<<std::endl;
return;
}
@ -460,7 +460,7 @@ void AnasenEfficiency::CalculateEfficiency(const std::string& inputname, const s
case 8: coinc_counts.resize(11, 0); break;
default:
{
std::cerr<<"Bad reaction type at AnasenEfficiency::CalculateEfficiency (given value: "<<counts.size()<<"). Quiting..."<<std::endl;
std::cerr<<"Bad reaction type at AnasenArray::CalculateEfficiency (given value: "<<counts.size()<<"). Quiting..."<<std::endl;
input->Close();
output->Close();
stats.close();

View File

@ -1,23 +1,23 @@
#ifndef ANASEN_EFFICIENCY_H
#define ANASEN_EFFICIENCY_H
#ifndef ANASEN_ARRAY_H
#define ANASEN_ARRAY_H
#include <string>
#include "DetectorEfficiency.h"
#include "DetectorArray.h"
#include "SX3Detector.h"
#include "QQQDetector.h"
#include "Target.h"
#include "Nucleus.h"
#include "AnasenDeadChannelMap.h"
class AnasenEfficiency : public DetectorEfficiency
class AnasenArray : public DetectorArray
{
public:
AnasenEfficiency();
~AnasenEfficiency();
void CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) override;
void DrawDetectorSystem(const std::string& filename) override;
double RunConsistencyCheck() override;
AnasenArray();
~AnasenArray();
virtual void CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) override;
virtual void DrawDetectorSystem(const std::string& filename) override;
virtual double RunConsistencyCheck() override;
inline void SetDeadChannelMap(const std::string& filename) { dmap.LoadMapfile(filename); }
private:
@ -27,7 +27,8 @@ private:
DetectorResult IsAnasen(Mask::Nucleus& nucleus);
void CountCoincidences(const std::vector<Mask::Nucleus>& data, std::vector<int>& counts);
std::vector<StripDetector> m_Ring1, m_Ring2;
std::vector<SX3Detector> m_Ring1;
std::vector<SX3Detector> m_Ring2;
std::vector<QQQDetector> m_forwardQQQs;
std::vector<QQQDetector> m_backwardQQQs;

View File

@ -4,18 +4,18 @@ target_include_directories(Detectors PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_
target_sources(Detectors PUBLIC
AnasenDeadChannelMap.cpp
AnasenDeadChannelMap.h
AnasenEfficiency.cpp
AnasenEfficiency.h
AnasenArray.cpp
AnasenArray.h
main.cpp
DetectorEfficiency.h
DetectorArray.h
QQQDetector.cpp
QQQDetector.h
SabreDeadChannelMap.cpp
SabreDeadChannelMap.h
SabreDetector.cpp
SabreDetector.h
SabreEfficiency.cpp
SabreEfficiency.h
SabreArray.cpp
SabreArray.h
SX3Detector.cpp
SX3Detector.h
)

View File

@ -1,5 +1,5 @@
#ifndef DETECTOREFFICIENCY_H
#define DETECTOREFFICIENCY_H
#ifndef DETECTOR_ARRAY_H
#define DETECTOR_ARRAY_H
#include <string>
#include <cmath>
@ -14,18 +14,18 @@ struct DetectorResult
std::string det_name = "";
};
class DetectorEfficiency
class DetectorArray
{
public:
DetectorEfficiency() {};
virtual ~DetectorEfficiency() {};
DetectorArray() {};
virtual ~DetectorArray() {};
virtual void CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) = 0;
virtual void DrawDetectorSystem(const std::string& filename) = 0;
virtual double RunConsistencyCheck() = 0;
protected:
inline bool IsDoubleEqual(double x, double y) { return std::fabs(x-y) < s_epsilon ? true : false; };
bool IsDoubleEqual(double x, double y) { return std::fabs(x-y) < s_epsilon ? true : false; };
static constexpr double s_epsilon = 1.0e-6;
};

View File

@ -15,7 +15,7 @@
y
*/
StripDetector::StripDetector(double centerPhi, double centerZ, double centerRho) :
SX3Detector::SX3Detector(double centerPhi, double centerZ, double centerRho) :
m_centerPhi(centerPhi), m_centerZ(centerZ), m_centerRho(centerRho), m_norm(1.0,0.0,0.0), m_uniformFraction(0.0, 1.0), m_isSmearing(false)
{
m_zRotation.SetAngle(m_centerPhi);
@ -35,9 +35,9 @@ StripDetector::StripDetector(double centerPhi, double centerZ, double centerRho)
}
StripDetector::~StripDetector() {}
SX3Detector::~SX3Detector() {}
void StripDetector::CalculateCorners()
void SX3Detector::CalculateCorners()
{
double y_min, y_max, z_min, z_max;
for (int s=0; s<s_nStrips; s++)
@ -75,7 +75,7 @@ void StripDetector::CalculateCorners()
}
}
ROOT::Math::XYZPoint StripDetector::GetHitCoordinates(int front_stripch, double front_strip_ratio)
ROOT::Math::XYZPoint SX3Detector::GetHitCoordinates(int front_stripch, double front_strip_ratio)
{
if (!ValidChannel(front_stripch) || !ValidRatio(front_strip_ratio))
@ -95,10 +95,10 @@ ROOT::Math::XYZPoint StripDetector::GetHitCoordinates(int front_stripch, double
}
StripHit StripDetector::GetChannelRatio(double theta, double phi)
SX3Hit SX3Detector::GetChannelRatio(double theta, double phi)
{
StripHit hit;
SX3Hit hit;
while (phi < 0)
phi += 2*M_PI;

View File

@ -19,19 +19,19 @@
#include "Math/RotationZ.h"
#include "Mask/RandomGenerator.h"
struct StripHit
struct SX3Hit
{
int front_strip_index=-1;
int back_strip_index=-1;
double front_ratio=0.0;
};
class StripDetector
class SX3Detector
{
public:
StripDetector(double centerPhi, double centerZ, double centerRho);
~StripDetector();
SX3Detector(double centerPhi, double centerZ, double centerRho);
~SX3Detector();
const ROOT::Math::XYZPoint& GetFrontStripCoordinates(int stripch, int corner) const { return m_frontStripCoords[stripch][corner]; }
const ROOT::Math::XYZPoint& GetBackStripCoordinates(int stripch, int corner) const { return m_backStripCoords[stripch][corner]; }
const ROOT::Math::XYZPoint& GetRotatedFrontStripCoordinates(int stripch, int corner) const
@ -47,7 +47,7 @@ public:
void SetPixelSmearing(bool isSmearing) { m_isSmearing = isSmearing; }
ROOT::Math::XYZPoint GetHitCoordinates(int front_stripch, double front_strip_ratio);
StripHit GetChannelRatio(double theta, double phi);
SX3Hit GetChannelRatio(double theta, double phi);
private:
bool ValidChannel(int f) { return ((f >= 0 && f < s_nStrips) ? true : false); };

View File

@ -1,4 +1,4 @@
#include "SabreEfficiency.h"
#include "SabreArray.h"
#include <fstream>
#include <iostream>
#include <iomanip>
@ -7,8 +7,8 @@
#include "TTree.h"
SabreEfficiency::SabreEfficiency() :
DetectorEfficiency(), m_deadlayerEloss({14}, {28}, {1}, s_deadlayerThickness),
SabreArray::SabreArray() :
DetectorArray(), m_deadlayerEloss({14}, {28}, {1}, s_deadlayerThickness),
m_detectorEloss({14}, {28}, {1}, s_detectorThickness), m_degraderEloss({73}, {181}, {1}, s_degraderThickness)
{
@ -29,9 +29,9 @@ SabreEfficiency::SabreEfficiency() :
m_activeDetectors[4] = false;
}
SabreEfficiency::~SabreEfficiency() {}
SabreArray::~SabreArray() {}
void SabreEfficiency::CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname)
void SabreArray::CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname)
{
std::cout<<"----------SABRE Efficiency Calculation----------"<<std::endl;
std::cout<<"Loading in output from kinematics simulation: "<<inputname<<std::endl;
@ -186,7 +186,7 @@ void SabreEfficiency::CalculateEfficiency(const std::string& inputname, const st
std::cout<<"---------------------------------------------"<<std::endl;
}
void SabreEfficiency::DrawDetectorSystem(const std::string& filename)
void SabreArray::DrawDetectorSystem(const std::string& filename)
{
std::ofstream output(filename);
@ -231,7 +231,7 @@ void SabreEfficiency::DrawDetectorSystem(const std::string& filename)
output.close();
}
double SabreEfficiency::RunConsistencyCheck()
double SabreArray::RunConsistencyCheck()
{
double theta, phi;
double npoints = 5.0*16.0*4.0;
@ -260,7 +260,7 @@ double SabreEfficiency::RunConsistencyCheck()
}
/*Returns if detected, as well as total energy deposited in SABRE*/
DetectorResult SabreEfficiency::IsSabre(Mask::Nucleus& nucleus)
DetectorResult SabreArray::IsSabre(Mask::Nucleus& nucleus)
{
DetectorResult observation;
if(nucleus.GetKE() <= s_energyThreshold)
@ -300,7 +300,7 @@ DetectorResult SabreEfficiency::IsSabre(Mask::Nucleus& nucleus)
return observation;
}
void SabreEfficiency::CountCoincidences(const std::vector<Mask::Nucleus>& data, std::vector<int>& counts)
void SabreArray::CountCoincidences(const std::vector<Mask::Nucleus>& data, std::vector<int>& counts)
{
if (data.size() == 3 && data[1].isDetected && data[2].isDetected)
{

View File

@ -1,17 +1,17 @@
#ifndef SABREEFFICIENCY_H
#define SABREEFFICIENCY_H
#ifndef SABRE_ARRAY_H
#define SABRE_ARRAY_H
#include "DetectorEfficiency.h"
#include "DetectorArray.h"
#include "SabreDetector.h"
#include "Target.h"
#include "SabreDeadChannelMap.h"
#include "Mask/Nucleus.h"
class SabreEfficiency : public DetectorEfficiency
class SabreArray : public DetectorArray
{
public:
SabreEfficiency();
~SabreEfficiency();
SabreArray();
~SabreArray();
void SetDeadChannelMap(const std::string& filename) { m_deadMap.LoadMapfile(filename); };
void CalculateEfficiency(const std::string& inputname, const std::string& outputname, const std::string& statsname) override;
void DrawDetectorSystem(const std::string& filename) override;

View File

@ -1,5 +1,5 @@
#include "SabreEfficiency.h"
#include "AnasenEfficiency.h"
#include "SabreArray.h"
#include "AnasenArray.h"
#include "KinematicsExceptions.h"
#include <iostream>
#include <string>
@ -24,7 +24,7 @@ int main(int argc, char** argv)
std::string statsname = argv[3];
SabreEfficiency sabre;
SabreArray sabre;
std::string mapfile = "./etc/sabreDeadChannels_May2022.txt";
sabre.SetDeadChannelMap(mapfile);
sabre.CalculateEfficiency(inputname, outputname, statsname);
@ -33,7 +33,7 @@ int main(int argc, char** argv)
/*
AnasenEfficiency anasen;
AnasenArray anasen;
std::string mapfile = "./etc/AnasenDeadChannels.txt";
anasen.SetDeadChannelMap(mapfile);
anasen.CalculateEfficiency(inputname, outputname, statsname);