12 #include "CbmRichUtil.h"
13 #include "FairLogger.h"
14 #include "FairRootManager.h"
15 #include "TClonesArray.h"
17 #include "TMultiLayerPerceptron.h"
27 : fAnnWeights(
""), fNN(NULL), fGlobalTracks(NULL), fRichRings(NULL) {
34 if (
fNN != NULL) {
delete fNN; }
39 +
"/parameters/rich/rich_v17a_elid_ann_weights.txt";
43 +
"/parameters/rich/rich_v16a_elid_ann_weights.txt";
46 +
"/parameters/rich/rich_v17a_elid_ann_weights.txt";
49 TTree* simu =
new TTree(
"MonteCarlo",
"MontecarloData");
53 simu->Branch(
"x0", &
x[0],
"x0/D");
54 simu->Branch(
"x1", &
x[1],
"x1/D");
55 simu->Branch(
"x2", &
x[2],
"x2/D");
56 simu->Branch(
"x3", &
x[3],
"x3/D");
57 simu->Branch(
"x4", &
x[4],
"x4/D");
58 simu->Branch(
"x5", &
x[5],
"x5/D");
59 simu->Branch(
"x6", &
x[6],
"x6/D");
60 simu->Branch(
"x7", &
x[7],
"x7/D");
61 simu->Branch(
"x8", &
x[8],
"x8/D");
62 simu->Branch(
"xOut", &xOut,
"xOut/D");
64 fNN =
new TMultiLayerPerceptron(
"x0,x1,x2,x3,x4,x5,x6,x7,x8:18:xOut", simu);
65 cout <<
"-I- CbmRichElIdAnn: get NeuralNet weight parameters from: "
69 FairRootManager* ioman = FairRootManager::Instance();
71 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
73 LOG(error) <<
"CbmRichElectronIdAnn::Init() fRichRings == NULL";
75 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
77 LOG(error) <<
"CbmRichElectronIdAnn::Init() fGlobalTracks == NULL";
80 LOG(error) <<
"FairRootManager::Instance() == NULL";
86 double errorValue = -1.;
87 if (globalTrackIndex < 0)
return errorValue;
93 if (globalTrack == NULL)
return errorValue;
96 if (richId == -1)
return errorValue;
99 if (richRing == NULL)
return errorValue;
105 || richRing->
GetNofHits() <= 5. || rtDistance <= 0. || rtDistance >= 999.
114 params[0] = richRing->
GetAaxis() / 10.;
115 params[1] = richRing->
GetBaxis() / 10.;
116 params[2] = (richRing->
GetPhi() + 1.57) / 3.14;
118 params[4] = (richRing->
GetChi2() / richRing->
GetNDF()) / 1.2;
121 params[7] = rtDistance / 5.;
122 params[8] = momentum / 15.;
124 for (
int k = 0; k < 9; k++) {
125 if (params[k] < 0.0) params[k] = 0.0;
126 if (params[k] > 1.0) params[k] = 1.0;
129 double nnEval =
fNN->Evaluate(0, params);
131 if (TMath::IsNaN(nnEval) == 1) {