-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensor.C
More file actions
67 lines (41 loc) · 1.23 KB
/
Sensor.C
File metadata and controls
67 lines (41 loc) · 1.23 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
#include <iostream>
#include "Sensor.h"
#include "TDatime.h"
#include "TF1.h"
#include "TAxis.h"
Sensor::Sensor(const char* name):
_name(name),
_thickness(0.),_Vdepl(0.),_Vbias(0.),_Bfield(0.), _Efieldfunc(0)
{ }
Sensor::Sensor(const char* name, const double thick, const double vdepl):
_name(name),
_thickness(thick), _Vdepl(vdepl), _Vbias(0.), _Bfield(0.)
{
TDatime now;
char fname[300];
sprintf(fname,"%s_%s_efield",now.AsString(),_name.c_str());
_Efieldfunc = new TF1(fname,this,&Sensor::getEfield,0,_thickness,0);
}
Sensor::~Sensor() {
delete _Efieldfunc;
}
double Sensor::eField(const double z) const {
return getEfield(&z,0);
}
void Sensor::SetLineColor(Color_t color) {
_Efieldfunc->SetLineColor(color);
}
void Sensor::SetLineStyle(Style_t style) {
_Efieldfunc->SetLineStyle(style);
}
TF1* Sensor::EfieldFunc() const {
// if(_Efieldfunc->GetXaxis()!=0 && _Efieldfunc->GetYaxis()!=0) {
// _Efieldfunc->GetXaxis()->SetTitle("depth [m]");
// _Efieldfunc->GetYaxis()->SetTitle("E [V/m]");
// }
return _Efieldfunc;
}
double Sensor::getEfield(const double* x, const double*) const {
double z = x[0];
return (_Vbias-_Vdepl)/_thickness + 2*_Vdepl/_thickness*(1-z/_thickness);
}