-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVWIdentification.cpp
82 lines (73 loc) · 2.3 KB
/
VWIdentification.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <VWIdentification.h>
//____________________________________________________
VWIdentification::VWIdentification() :
fFileCuts(0),
fCutsLoaded(false)
{
fIdentificationCuts= (TCutG ***) new TCutG ** [dVWIdentificationZMAX];
for(int i=0; i<dVWIdentificationZMAX; i++) {
fIdentificationCuts[i]= (TCutG **) new TCutG *[dVWIdentificationAMAX];
for(int j=0; j<dVWIdentificationAMAX; j++) {
fIdentificationCuts[i][j]=0;
}
}
}
//____________________________________________________
VWIdentification::~VWIdentification()
{
for(int i=0; i<dVWIdentificationZMAX; i++) {
delete [] fIdentificationCuts[i];
}
delete [] fIdentificationCuts;
if(fFileCuts) {
fFileCuts->Close();
delete fFileCuts;
}
}
//____________________________________________________
int VWIdentification::LoadIdentificationCuts(const char * file_name)
{
int NCuts=0;
fFileCuts = new TFile(file_name);
if(fFileCuts->IsZombie()) {
return -1;
}
for(int i=0; i<dVWIdentificationZMAX; i++) {
for(int j=0; j<dVWIdentificationAMAX; j++) {
fIdentificationCuts[i][j]=(TCutG*)fFileCuts->Get(Form("VW_DETOF_Z%02d_A%02d", i+1, j+1));
if(fIdentificationCuts[i][j]) NCuts++;
}
}
if(NCuts>0) fCutsLoaded=true;
return NCuts;
}
//____________________________________________________
bool VWIdentification::IsChargedParticle(double DE, double TOF) const
{
for(int i=0; i<dVWIdentificationZMAX; i++) {
for(int j=0; j<dVWIdentificationAMAX; j++) {
if(fIdentificationCuts[i][j] && fIdentificationCuts[i][j]->IsInside(TOF,DE)) return true;
}
}
return false;
}
//____________________________________________________
int VWIdentification::GetZ(double DE, double TOF) const
{
for(int i=0; i<dVWIdentificationZMAX; i++) {
for(int j=0; j<dVWIdentificationAMAX; j++) {
if(fIdentificationCuts[i][j] && fIdentificationCuts[i][j]->IsInside(TOF,DE)) return i+1;
}
}
return -1;
}
//____________________________________________________
int VWIdentification::GetA(double DE, double TOF) const
{
for(int i=0; i<dVWIdentificationZMAX; i++) {
for(int j=0; j<dVWIdentificationAMAX; j++) {
if(fIdentificationCuts[i][j] && fIdentificationCuts[i][j]->IsInside(TOF,DE)) return j+1;
}
}
return -1;
}