-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRivelatore.cxx
More file actions
65 lines (38 loc) · 1.25 KB
/
Rivelatore.cxx
File metadata and controls
65 lines (38 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <Riostream.h>
#include "TObject.h"
#include "TMath.h"
#include "TAxis.h"
#include "TFile.h"
#include "TH1.h"
#include "TRandom3.h"
#include "Punto.h"
#include "Retta.h"
#include "Neutron.h"
#include "Rivelatore.h"
ClassImp(Rivelatore)
Rivelatore::Rivelatore(double raggio, double x_centro, double y_centro, double z_centro):TObject(),
rp(raggio),
xp(x_centro),
yp(y_centro),
zp(z_centro),
tp(0){
}
Rivelatore::~Rivelatore(){
// distruttore
}
//-------------------------------------------
double Rivelatore::Intersezione(Neutron *n){
if( n->GetZ()>=0 ){
double vx=TMath::Sin(n->GetTheta())*TMath::Cos(n->GetPhi());
double vy=TMath::Sin(n->GetTheta())*TMath::Sin(n->GetPhi());
double vz=TMath::Cos(n->GetTheta());
double beq=2*(vx*(n->GetX()-this->xp)+vy*(n->GetY()-this->yp)+vz*(n->GetZ()-this->zp));
double ceq=TMath::Power(n->GetX()-this->xp,2)+TMath::Power(n->GetY()-this->yp,2)+TMath::Power(n->GetZ()-this->zp,2)-(this->rp*this->rp);
double delta=beq*beq-4*ceq;
double t_1=(0.5)*(-beq+TMath::Sqrt(delta));
double t_2=(0.5)*(-beq-TMath::Sqrt(delta));
if(delta>0){ this->tp+=TMath::Abs(t_1-t_2);
return TMath::Abs(t_1-t_2); }else{return 0;}
}
return 0;
}