EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
CbmRichElectronIdAnn.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file CbmRichElectronIdAnn.cxx
1
8
#include "
CbmRichElectronIdAnn.h
"
9
#include "
CbmRichRing.h
"
10
#include "TMultiLayerPerceptron.h"
11
#include "TTree.h"
12
#include "TMath.h"
13
#include "TSystem.h"
14
15
#include <iostream>
16
17
using
std::cout;
18
using
std::endl;
19
20
CbmRichElectronIdAnn::CbmRichElectronIdAnn
():
21
fAnnWeights(
""
),
22
fNN(NULL)
23
{
24
fAnnWeights
= string(gSystem->Getenv(
"VMCWORKDIR"
)) +
"/parameters/rich/rich_elid_ann_weights.txt"
;
25
}
26
27
CbmRichElectronIdAnn::~CbmRichElectronIdAnn
()
28
{
29
30
}
31
32
void
CbmRichElectronIdAnn::Init
()
33
{
34
TTree *simu =
new
TTree (
"MonteCarlo"
,
"MontecarloData"
);
35
Double_t
x
[9];
36
Double_t xOut;
37
38
simu->Branch(
"x0"
, &x[0],
"x0/D"
);
39
simu->Branch(
"x1"
, &x[1],
"x1/D"
);
40
simu->Branch(
"x2"
, &x[2],
"x2/D"
);
41
simu->Branch(
"x3"
, &x[3],
"x3/D"
);
42
simu->Branch(
"x4"
, &x[4],
"x4/D"
);
43
simu->Branch(
"x5"
, &x[5],
"x5/D"
);
44
simu->Branch(
"x6"
, &x[6],
"x6/D"
);
45
simu->Branch(
"x7"
, &x[7],
"x7/D"
);
46
simu->Branch(
"x8"
, &x[8],
"x8/D"
);
47
simu->Branch(
"xOut"
, &xOut,
"xOut/D"
);
48
49
fNN
=
new
TMultiLayerPerceptron(
"x0,x1,x2,x3,x4,x5,x6,x7,x8:18:xOut"
,simu);
50
cout <<
"-I- CbmRichElIdAnn: get NeuralNet weight parameters from: "
<<
fAnnWeights
<< endl;
51
fNN
->LoadWeights(
fAnnWeights
.c_str());
52
}
53
54
double
CbmRichElectronIdAnn::DoSelect
(
55
CbmRichRing
* ring,
56
double
momentum
)
57
{
58
if
(ring->
GetAaxis
() >= 10. || ring->
GetAaxis
() <= 0. ||
59
ring->
GetBaxis
() >= 10. || ring->
GetBaxis
() <= 0. ||
60
ring->
GetNofHits
() <= 5. ||
61
ring->
GetDistance
() <= 0. || ring->
GetDistance
() >= 999. ||
62
ring->
GetRadialPosition
() <= 0. || ring->
GetRadialPosition
() >= 999. ||
63
ring->
GetPhi
() <= -6.5 || ring->
GetPhi
() >= 6.5 ||
64
ring->
GetRadialAngle
() <=-6.5 || ring->
GetRadialAngle
() >= 6.5 ){
65
66
return
-1.;
67
}
68
double
params[9];
69
params[0] = ring->
GetAaxis
() / 10.;
70
params[1] = ring->
GetBaxis
() / 10.;
71
params[2] = (ring->
GetPhi
() + 1.57) / 3.14;
72
params[3] = ring->
GetRadialAngle
() / 6.28;
73
params[4] = (ring->
GetChi2
()/ring->
GetNDF
()) / 1.2;
74
params[5] = ring->
GetRadialPosition
() / 110.;
75
params[6] = ring->
GetNofHits
() / 45.;
76
params[7] = ring->
GetDistance
() / 5.;
77
params[8] = momentum / 15.;
78
79
for
(
int
k
= 0;
k
< 9;
k
++){
80
if
(params[
k
] < 0.0) params[
k
] = 0.0;
81
if
(params[
k
] > 1.0) params[
k
] = 1.0;
82
}
83
84
double
nnEval =
fNN
->Evaluate(0, params);
85
86
if
(TMath::IsNaN(nnEval) == 1) {
87
cout <<
" -W- CbmRichElectronIdAnn: nnEval nan "
<< endl;
88
nnEval = -1.;
89
}
90
91
return
nnEval;
92
}
EicRoot
blob
master
rich
CbmRichElectronIdAnn.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:37
using
1.8.2 with
EIC GitHub integration