mirror of
https://github.com/gwm17/Mask.git
synced 2024-11-22 18:28:51 -05:00
Added base class DetectorEfficiency for all detector systems
This commit is contained in:
parent
673fe86db0
commit
46eb87e65b
|
@ -4,32 +4,28 @@
|
|||
#include <string>
|
||||
#include <THashTable.h>
|
||||
|
||||
#include "DetectorEfficiency.h"
|
||||
#include "StripDetector.h"
|
||||
#include "QQQDetector.h"
|
||||
|
||||
class AnasenEfficiency {
|
||||
class AnasenEfficiency : public DetectorEfficiency {
|
||||
public:
|
||||
AnasenEfficiency();
|
||||
~AnasenEfficiency();
|
||||
void CalculateEfficiency(const std::string& filename);
|
||||
inline void SetReactionType(int type) { m_rxn_type = type; };
|
||||
void DrawDetectorSystem(const std::string& filename);
|
||||
double RunConsistencyCheck();
|
||||
void CalculateEfficiency(const std::string& filename) override;
|
||||
void DrawDetectorSystem(const std::string& filename) override;
|
||||
double RunConsistencyCheck() override;
|
||||
|
||||
private:
|
||||
void MyFill(THashTable* table, const std::string& name, const std::string& title, int bins, float min, float max, double val);
|
||||
void MyFill(THashTable* table, const std::string& name, const std::string& title, int binsx, float minx, float maxx, double valx, int binsy, float miny, float maxy, double valy);
|
||||
void RunDecay(const std::string& filename);
|
||||
void RunTwoStep(const std::string& filename);
|
||||
void RunThreeStep(const std::string& filename);
|
||||
void RunDecay(const std::string& filename) override;
|
||||
void Run2Step(const std::string& filename) override;
|
||||
void Run3Step(const std::string& filename) override;
|
||||
void Run1Step(const std::string& filename) override;
|
||||
|
||||
bool IsRing1(double theta, double phi);
|
||||
bool IsRing2(double theta, double phi);
|
||||
bool IsQQQ(double theta, double phi);
|
||||
|
||||
inline bool IsDoubleEqual(double x, double y) { return std::fabs(x-y) < epsilon ? true : false; };
|
||||
|
||||
int m_rxn_type;
|
||||
std::vector<StripDetector> m_Ring1, m_Ring2;
|
||||
std::vector<QQQDetector> m_forwardQQQs;
|
||||
std::vector<QQQDetector> m_backwardQQQs;
|
||||
|
@ -53,7 +49,6 @@ private:
|
|||
/*************************/
|
||||
|
||||
static constexpr double threshold = 0.2; //MeV
|
||||
static constexpr double epsilon = 1.0e-6;
|
||||
static constexpr double deg2rad = M_PI/180.0;
|
||||
};
|
||||
|
||||
|
|
52
include/DetectorEfficiency.h
Normal file
52
include/DetectorEfficiency.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
#ifndef DETECTOREFFICIENCY_H
|
||||
#define DETECTOREFFICIENCY_H
|
||||
|
||||
#include <THashTable.h>
|
||||
#include <TH1.h>
|
||||
#include <TH2.h>
|
||||
#include <string>
|
||||
|
||||
class DetectorEfficiency {
|
||||
public:
|
||||
DetectorEfficiency() { m_rxn_type = -1; };
|
||||
virtual ~DetectorEfficiency() {};
|
||||
|
||||
inline void SetReactionType(int rxntype) { m_rxn_type = rxntype; };
|
||||
virtual void CalculateEfficiency(const std::string& filename) = 0;
|
||||
virtual void DrawDetectorSystem(const std::string& filename) = 0;
|
||||
virtual double RunConsistencyCheck() = 0;
|
||||
|
||||
protected:
|
||||
void MyFill(THashTable* table, const std::string& name, const std::string& title, int bins, float min, float max, double val) {
|
||||
TH1F* h = (TH1F*) table->FindObject(name.c_str());
|
||||
if(h) {
|
||||
h->Fill(val);
|
||||
} else {
|
||||
h = new TH1F(name.c_str(), title.c_str(), bins, min, max);
|
||||
h->Fill(val);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
void MyFill(THashTable* table, const std::string& name, const std::string& title, int binsx, float minx, float maxx, double valx, int binsy, float miny, float maxy, double valy) {
|
||||
TH2F* h = (TH2F*) table->FindObject(name.c_str());
|
||||
if(h) {
|
||||
h->Fill(valx, valy);
|
||||
} else {
|
||||
h = new TH2F(name.c_str(), title.c_str(), binsx, minx, maxx, binsy, miny, maxy);
|
||||
h->Fill(valx, valy);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
inline bool IsDoubleEqual(double x, double y) { return std::fabs(x-y) < epsilon ? true : false; };
|
||||
|
||||
|
||||
virtual void Run2Step(const std::string& filename) = 0;
|
||||
virtual void Run3Step(const std::string& filename) = 0;
|
||||
virtual void RunDecay(const std::string& filename) = 0;
|
||||
virtual void Run1Step(const std::string& filename) = 0;
|
||||
|
||||
static constexpr double epsilon = 1.0e-6;
|
||||
int m_rxn_type;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,38 +1,35 @@
|
|||
#ifndef SABREEFFICIENCY_H
|
||||
#define SABREEFFICIENCY_H
|
||||
|
||||
#include "DetectorEfficiency.h"
|
||||
#include "SabreDetector.h"
|
||||
#include "Target.h"
|
||||
#include "DeadChannelMap.h"
|
||||
#include "Kinematics.h"
|
||||
#include <THashTable.h>
|
||||
|
||||
class SabreEfficiency {
|
||||
class SabreEfficiency : public DetectorEfficiency {
|
||||
public:
|
||||
SabreEfficiency();
|
||||
~SabreEfficiency();
|
||||
inline void SetReactionType(int t) { m_rxn_type = t; };
|
||||
void SetDeadChannelMap(std::string& filename) { dmap.LoadMapfile(filename); };
|
||||
void CalculateEfficiency(const std::string& file);
|
||||
void DrawDetectorSystem(const std::string& filename);
|
||||
double RunConsistencyCheck();
|
||||
void CalculateEfficiency(const std::string& file) override;
|
||||
void DrawDetectorSystem(const std::string& filename) override;
|
||||
double RunConsistencyCheck() override;
|
||||
|
||||
private:
|
||||
void MyFill(THashTable* table, const std::string& name, const std::string& title, int bins, float min, float max, double val);
|
||||
void MyFill(THashTable* table, const std::string& name, const std::string& title, int binsx, float minx, float maxx, double valx, int binsy, float miny, float maxy, double valy);
|
||||
std::pair<bool,double> IsSabre(Mask::NucData* nucleus);
|
||||
void Run2Step(const std::string& filename);
|
||||
void Run3Step(const std::string& filename);
|
||||
void RunDecay(const std::string& filename);
|
||||
void Run2Step(const std::string& filename) override;
|
||||
void Run3Step(const std::string& filename) override;
|
||||
void RunDecay(const std::string& filename) override;
|
||||
void Run1Step(const std::string& filename) override;
|
||||
|
||||
int m_rxn_type;
|
||||
std::vector<SabreDetector> detectors;
|
||||
|
||||
Target deadlayer;
|
||||
Target sabre_eloss;
|
||||
DeadChannelMap dmap;
|
||||
|
||||
|
||||
//Sabre constants
|
||||
const double INNER_R = 0.0326;
|
||||
const double OUTER_R = 0.1351;
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#include <TCanvas.h>
|
||||
#include <TParameter.h>
|
||||
|
||||
AnasenEfficiency::AnasenEfficiency() {
|
||||
AnasenEfficiency::AnasenEfficiency() :
|
||||
DetectorEfficiency()
|
||||
{
|
||||
for(int i=0; i<n_sx3_per_ring; i++) {
|
||||
m_Ring1.emplace_back(4, sx3_length, sx3_width, ring_phi[i], ring1_z, ring_rho[i]);
|
||||
m_Ring2.emplace_back(4, sx3_length, sx3_width, ring_phi[i], -1.0*ring1_z, ring_rho[i]);
|
||||
|
@ -20,27 +22,6 @@ AnasenEfficiency::AnasenEfficiency() {
|
|||
|
||||
AnasenEfficiency::~AnasenEfficiency() {}
|
||||
|
||||
void AnasenEfficiency::MyFill(THashTable* table, const std::string& name, const std::string& title, int bins, float min, float max, double val) {
|
||||
TH1F* h = (TH1F*) table->FindObject(name.c_str());
|
||||
if(h) {
|
||||
h->Fill(val);
|
||||
} else {
|
||||
h = new TH1F(name.c_str(), title.c_str(), bins, min, max);
|
||||
h->Fill(val);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
|
||||
void AnasenEfficiency::MyFill(THashTable* table, const std::string& name, const std::string& title, int binsx, float minx, float maxx, double valx, int binsy, float miny, float maxy, double valy) {
|
||||
TH2F* h = (TH2F*) table->FindObject(name.c_str());
|
||||
if(h) {
|
||||
h->Fill(valx, valy);
|
||||
} else {
|
||||
h = new TH2F(name.c_str(), title.c_str(), binsx, minx, maxx, binsy, miny, maxy);
|
||||
h->Fill(valx, valy);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
|
||||
void AnasenEfficiency::DrawDetectorSystem(const std::string& filename) {
|
||||
TFile* file = TFile::Open(filename.c_str(), "RECREATE");
|
||||
|
@ -278,14 +259,18 @@ void AnasenEfficiency::CalculateEfficiency(const std::string& file) {
|
|||
RunDecay(file);
|
||||
break;
|
||||
}
|
||||
case Mask::Kinematics::ONESTEP_RXN:
|
||||
{
|
||||
Run1Step(file);
|
||||
}
|
||||
case Mask::Kinematics::TWOSTEP:
|
||||
{
|
||||
RunTwoStep(file);
|
||||
Run2Step(file);
|
||||
break;
|
||||
}
|
||||
case Mask::Kinematics::THREESTEP:
|
||||
{
|
||||
RunThreeStep(file);
|
||||
Run3Step(file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +332,12 @@ void AnasenEfficiency::RunDecay(const std::string& filename) {
|
|||
input->Close();
|
||||
}
|
||||
|
||||
void AnasenEfficiency::RunTwoStep(const std::string& filename) {
|
||||
void AnasenEfficiency::Run1Step(const std::string& filename) {
|
||||
std::cout<<"SabreEfficiency::Run1Step Not Implemented!"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
void AnasenEfficiency::Run2Step(const std::string& filename) {
|
||||
|
||||
TFile* input = TFile::Open(filename.c_str(), "UPDATE");
|
||||
TTree* tree = (TTree*) input->Get("DataTree");
|
||||
|
@ -456,7 +446,7 @@ void AnasenEfficiency::RunTwoStep(const std::string& filename) {
|
|||
input->Close();
|
||||
}
|
||||
|
||||
void AnasenEfficiency::RunThreeStep(const std::string& filename) {
|
||||
void AnasenEfficiency::Run3Step(const std::string& filename) {
|
||||
TFile* input = TFile::Open(filename.c_str(), "UPDATE");
|
||||
TTree* tree = (TTree*) input->Get("DataTree");
|
||||
|
||||
|
|
|
@ -7,12 +7,9 @@
|
|||
#include <TGraph.h>
|
||||
#include <TGraph2D.h>
|
||||
#include <TCanvas.h>
|
||||
#include <TH2.h>
|
||||
#include <TH1.h>
|
||||
#include <TCutG.h>
|
||||
|
||||
SabreEfficiency::SabreEfficiency() :
|
||||
m_rxn_type(-1), deadlayer(DEADLAYER_THIN), sabre_eloss(SABRE_THICKNESS)
|
||||
DetectorEfficiency(), deadlayer(DEADLAYER_THIN), sabre_eloss(SABRE_THICKNESS)
|
||||
{
|
||||
detectors.reserve(5);
|
||||
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI0*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
|
||||
|
@ -31,28 +28,6 @@ SabreEfficiency::SabreEfficiency() :
|
|||
|
||||
SabreEfficiency::~SabreEfficiency() {}
|
||||
|
||||
void SabreEfficiency::MyFill(THashTable* table, const std::string& name, const std::string& title, int bins, float min, float max, double val) {
|
||||
TH1F* h = (TH1F*) table->FindObject(name.c_str());
|
||||
if(h) {
|
||||
h->Fill(val);
|
||||
} else {
|
||||
h = new TH1F(name.c_str(), title.c_str(), bins, min, max);
|
||||
h->Fill(val);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
|
||||
void SabreEfficiency::MyFill(THashTable* table, const std::string& name, const std::string& title, int binsx, float minx, float maxx, double valx, int binsy, float miny, float maxy, double valy) {
|
||||
TH2F* h = (TH2F*) table->FindObject(name.c_str());
|
||||
if(h) {
|
||||
h->Fill(valx, valy);
|
||||
} else {
|
||||
h = new TH2F(name.c_str(), title.c_str(), binsx, minx, maxx, binsy, miny, maxy);
|
||||
h->Fill(valx, valy);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
|
||||
void SabreEfficiency::CalculateEfficiency(const std::string& file) {
|
||||
std::cout<<"----------SABRE Efficiency Calculation----------"<<std::endl;
|
||||
std::cout<<"Loading in output from kinematics simulation: "<<file<<std::endl;
|
||||
|
@ -71,6 +46,11 @@ void SabreEfficiency::CalculateEfficiency(const std::string& file) {
|
|||
RunDecay(file);
|
||||
break;
|
||||
}
|
||||
case Mask::Kinematics::ONESTEP_RXN:
|
||||
{
|
||||
Run1Step(file);
|
||||
break;
|
||||
}
|
||||
case Mask::Kinematics::TWOSTEP:
|
||||
{
|
||||
Run2Step(file);
|
||||
|
@ -244,6 +224,11 @@ void SabreEfficiency::RunDecay(const std::string& filename) {
|
|||
|
||||
}
|
||||
|
||||
void SabreEfficiency::Run1Step(const std::string& filename) {
|
||||
std::cout<<"SabreEfficiency::Run1Step Not Implemented!"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
void SabreEfficiency::Run2Step(const std::string& filename) {
|
||||
|
||||
TFile* input = TFile::Open(filename.c_str(), "UPDATE");
|
||||
|
|
Loading…
Reference in New Issue
Block a user