Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 73 → Rev 85

/lightguide/trunk/include/guide.h
5,7 → 5,7
#include "TVector3.h"
#include "TMath.h"
#include "TPolyLine3D.h"
#include "TRandom.h"
#include "TRandom2.h"
#include "TDatime.h"
#include "TH1F.h"
#include "TH2F.h"
40,22 → 40,21
CRay() :
r(TVector3(0,0,0)),
k(TVector3(1,0,0)),
//p(TVector3(0,1,0)),
p(TVector3(0,0,1)),
p(TVector3(0,1,0)),
color(kBlack)
{};
CRay(TVector3 r0, TVector3 k0) :
r(r0),
k(k0.Unit()),
//p(TVector3(0,1,0)),
p(TVector3(0,0,1)),
p(TVector3(0,1,0)),
//p(TVector3(0,0,1)),
color(kBlack)
{};
CRay(double x0, double y0, double z0, double l0, double m0, double n0) :
r(TVector3(x0,y0,z0)),
k(TVector3(l0,m0,n0).Unit()),
//p(TVector3(0,1,0)),
p(TVector3(0,0,1)),
p(TVector3(0,1,0)),
//p(TVector3(0,0,1)),
color(kBlack)
{};
 
67,7 → 66,7
if (p.Dot(k)>1e-3) printf("*** ERROR in CRay: E has component || with k\n");
};
 
//inline CRay & operator = (const CRay &);
inline CRay & operator = (const CRay &);
 
TVector3 GetR() const {return r;};
TVector3 GetK() const {return k;};
103,6 → 102,7
CPlane4();
CPlane4(TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4);
CPlane4(TVector3 *vr);
~CPlane4() { };
void Set(TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4);
void Set(TVector3 *vr) {Set(vr[0], vr[1], vr[2], vr[3]);};
void FlipN(){n = -n;};
119,7 → 119,8
void Draw(int color = 1, int width = 1);
 
private:
TVector3 r[4], n;
TVector3 r[4];
TVector3 n;
double A, B, C, D;
TVector3 edge[4]; // vektorji stranic
double angle_r[4]; // koti ob posameznem vogalu
132,6 → 133,8
public:
CPlaneR(TVector3 c, TVector3 n0, double R0)
{center = c; n = n0; _r = R0;};
CPlaneR(){ n=TVector3(0,0,0); center=TVector3(0,0,0); _r=0; };
~CPlaneR() {};
 
void Set(TVector3 c, TVector3 n0, double R0)
{center = c; n = n0; _r = R0;};
163,6 → 166,17
CSurface(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4,
double n10, double n20, double reflectivity);
CSurface(int type0, TVector3 *vr, double n10, double n20, double reflectivity);
~CSurface() {};
CSurface& operator=(const CSurface& rhs) {
type=rhs.type;
n1=rhs.n1;
n2=rhs.n2;
n1_n2=rhs.n1_n2;
reflection=rhs.reflection;
cosTtotal=rhs.cosTtotal;
fresnel=rhs.fresnel;
return *this;
}
 
void SetV(TVector3 *vr){CPlane4::Set(vr);};
void SetType(int type0){type = type0;};
175,7 → 189,7
void Set(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4, double n10, double n20, double reflectivity)
{type = type0; CPlane4::Set(r1, r2, r3, r4); SetIndex(n10, n20); reflection = reflectivity;};
 
int PropagateRay(CRay in, CRay *out, TVector3 *intersection);
int PropagateRay(CRay in, CRay& out, TVector3 *intersection);
 
double N1_N2(int sign) { return ((sign > 0) ? n1/n2 : n2/n1);};
 
185,7 → 199,7
int type; //0 = dummy; 1 = refractor; 2 = reflector; 3 = total reflection
double n1, n2, n1_n2; //index of refraction, n1 @ +normal, n2 @ -normal
double reflection; // odbojnost stranic
TRandom rand; // za racunanje verjetnosti odboja od zrcala
TRandom2 rand; // za racunanje verjetnosti odboja od zrcala
double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2
 
int fresnel; // ali naj uposteva Fresnelove enacbe
318,29 → 332,28
public:
Guide(TVector3 center0, DetectorParameters& parameters);
~Guide() {
for (int jk=0; jk<6; jk++) delete s_side[jk];
delete grease;
delete noCoupling;
delete hfate;
delete hnodb_all;
delete hnodb_exit;
delete hin;
delete hout;
//for (int jk=0; jk<6; jk++) delete s_side[jk];
//delete [] s_side;
//delete hfate;
//delete hnodb_all;
//delete hnodb_exit;
//delete hin;
//delete hout;
}
 
Fate PropagateRay(CRay in, CRay *out, int *n_points, TVector3 *points);
Fate PropagateRay(CRay in, CRay& out, int *n_points, TVector3 *points);
 
double getD() { return _d; }
double getN1() { return _n1; };
double getN2() { return _n2; };
double getN3() { return _n3; };
TH1F* GetHFate() const {return hfate;};
TH1F* GetHNOdb_all() const {return hnodb_all;};
TH1F* GetHNOdb_exit() const {return hnodb_exit;};
TH2F* GetHIn() const {return hin;};
TH2F* GetHOut() const {return hout;};
int GetExitHits() {return (int)hfate->GetBinContent(5);};
int GetEnteranceHits() {return (int)hfate->GetBinContent(6);};
TH1F* GetHFate() {return &hfate;};
TH1F* GetHNOdb_all() {return &hnodb_all;};
TH1F* GetHNOdb_exit() {return &hnodb_exit;};
TH2F* GetHIn() {return &hin;};
TH2F* GetHOut() {return &hout;};
int GetExitHits() {return (int)hfate.GetBinContent(5);};
int GetEnteranceHits() {return (int)hfate.GetBinContent(6);};
void GetVFate(int *out);
int GetMAXODB() const {return MAX_REFLECTIONS;};
 
355,14 → 368,18
double _absorption;
double _A;
bool _badCoupling;
TRandom rand; // for material absorption
CSurface *s_side[6];
CPlaneR* grease;
CSurface* noCoupling;
TVector3 center, vodnik_edge[8];
TRandom2 rand; // for material absorption
CSurface s_side[6];
CPlaneR grease;
CSurface noCoupling;
TVector3 center;
TVector3 vodnik_edge[8];
 
TH1F *hfate, *hnodb_all, *hnodb_exit;
TH2F *hin, *hout;
TH1F hfate;
TH1F hnodb_all;
TH1F hnodb_exit;
TH2F hin;
TH2F hout;
};
 
 
371,17 → 388,15
{
public:
Plate(DetectorParameters& parameters);
~Plate() {
for (int jk=0; jk<6; jk++) delete sides[jk]; // the same, needs solution
};
~Plate() { };
 
void draw(int color, int width);
void drawSkel(int color, int width);
Fate propagateRay(CRay, CRay*, int*, TVector3*);
Fate propagateRay(CRay, CRay&, int*, TVector3*);
 
private:
TVector3 plate_edge[8];
CSurface *sides[6];
CSurface sides[6];
};
 
 
390,17 → 405,17
public:
CDetector(TVector3 center0, DetectorParameters& parameters);
~CDetector() {
delete glass;
delete glass_circle;
delete hglass;
delete active;
delete hactive;
delete hlaser;
delete detector;
delete hdetector;
delete guide;
delete plate;
delete histoPlate;
//delete glass;
//delete glass_circle;
//delete hglass;
//delete active;
//delete hactive;
//delete hlaser;
//delete detector;
//delete hdetector;
//delete guide;
//delete plate;
//delete histoPlate;
//delete window;
//delete window_circle;
//delete hwindow;
437,15 → 452,16
 
//void Init();
 
int Propagate(CRay, CRay*, int);
int Propagate(CRay, CRay&, int);
 
Guide* GetLG() const {return guide;};
Guide* GetLG() {return &guide;};
//TH2F* GetHWindow() const {return hwindow;};
TH2F* GetHGlass() const {return hglass;};
TH2F* GetHActive() const {return hactive;};
TH2F* GetHLaser() const {return hlaser;};
TH2F* GetHDetector() const {return hdetector;};
TH2F* GetHPlate() const {return histoPlate;};
TH2F* GetHGlass() {return &hglass;};
TH2F* GetHActive() {return &hactive;};
TH2F* GetHLaser() {return &hlaser;};
TH2F* GetHDetector() {return &hdetector;};
TH2F* GetHPlate() {return &histoPlate;};
TH2F* GetGenerated() {return &generated;};
 
//double GetSiPM() const {return SiPM;};
//double GetM() const {return M;};
470,17 → 486,18
 
int glass_on;
double glass_d;
CSurface *glass;
CPlaneR *glass_circle;
TH2F *hglass;
CSurface glass;
CPlaneR glass_circle;
TH2F hglass;
 
//double x_gap, y_gap, z_gap;
CPlane4* active;
CPlaneR* grease;
TH2F *hactive, *hlaser;
CPlane4 active;
CPlaneR grease;
TH2F hactive;
TH2F hlaser;
 
CPlane4 *detector;
TH2F *hdetector;
CPlane4 detector;
TH2F hdetector;
 
int col_in, col_lg, col_out, col_rgla;
int col_LG, col_glass, col_active;
495,16 → 512,18
//CPlaneR *window_circle;
//TH2F *hwindow;
 
Guide *guide;
Plate *plate;
Guide guide;
Plate plate;
 
double _plateWidth;
int _plateOn;
 
TH2F *histoPlate;
TH2F histoPlate;
 
double offsetY;
double offsetZ;
 
TH2F generated;
};