19#include "FairRootManager.h"
22#include "TClonesArray.h"
24#include "TMultiLayerPerceptron.h"
42 if (
fNN != NULL) {
delete fNN; }
45 fAnnWeights = string(gSystem->Getenv(
"VMCWORKDIR")) +
"/parameters/rich/rich_v17a_elid_ann_weights.txt";
48 fAnnWeights = string(gSystem->Getenv(
"VMCWORKDIR")) +
"/parameters/rich/rich_v16a_elid_ann_weights.txt";
51 fAnnWeights = string(gSystem->Getenv(
"VMCWORKDIR")) +
"/parameters/rich/rich_v17a_elid_ann_weights.txt";
54 TTree* simu =
new TTree(
"MonteCarlo",
"MontecarloData");
58 simu->Branch(
"x0", &
x[0],
"x0/D");
59 simu->Branch(
"x1", &
x[1],
"x1/D");
60 simu->Branch(
"x2", &
x[2],
"x2/D");
61 simu->Branch(
"x3", &
x[3],
"x3/D");
62 simu->Branch(
"x4", &
x[4],
"x4/D");
63 simu->Branch(
"x5", &
x[5],
"x5/D");
64 simu->Branch(
"x6", &
x[6],
"x6/D");
65 simu->Branch(
"x7", &
x[7],
"x7/D");
66 simu->Branch(
"x8", &
x[8],
"x8/D");
67 simu->Branch(
"xOut", &xOut,
"xOut/D");
69 fNN =
new TMultiLayerPerceptron(
"x0,x1,x2,x3,x4,x5,x6,x7,x8:18:xOut", simu);
70 cout <<
"-I- CbmRichElIdAnn: get NeuralNet weight parameters from: " <<
fAnnWeights << endl;
73 FairRootManager* ioman = FairRootManager::Instance();
75 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
76 if (
fRichRings == NULL) { LOG(error) <<
"CbmRichElectronIdAnn::Init() fRichRings == NULL"; }
77 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
78 if (
fGlobalTracks == NULL) { LOG(error) <<
"CbmRichElectronIdAnn::Init() fGlobalTracks == NULL"; }
81 LOG(error) <<
"FairRootManager::Instance() == NULL";
87 double errorValue = -1.;
88 if (globalTrackIndex < 0)
return errorValue;
93 if (globalTrack == NULL)
return errorValue;
96 if (richId == -1)
return errorValue;
98 if (richRing == NULL)
return errorValue;
103 || richRing->
GetBaxis() <= 0. || richRing->
GetNofHits() <= 5. || rtDistance <= 0. || rtDistance >= 999.
110 params[0] = richRing->
GetAaxis() / 10.;
111 params[1] = richRing->
GetBaxis() / 10.;
112 params[2] = (richRing->
GetPhi() + 1.57) / 3.14;
114 params[4] = (richRing->
GetChi2() / richRing->
GetNDF()) / 1.2;
117 params[7] = rtDistance / 5.;
118 params[8] = momentum / 15.;
120 for (
int k = 0; k < 9; k++) {
121 if (params[k] < 0.0) params[k] = 0.0;
122 if (params[k] > 1.0) params[k] = 1.0;
125 double nnEval =
fNN->Evaluate(0, params);
127 if (TMath::IsNaN(nnEval) == 1) {
Implementation of the electron identification algorithm in the RICH detector using Artificial Neural ...
@ CbmRichGeometryTypeTwoWings
@ CbmRichGeometryTypeCylindrical
int32_t GetRichRingIndex() const
CbmRichElectronIdAnn()
Standard constructor.
double CalculateAnnValue(int globalTrackIndex, double momentum)
Calculate output value of the ANN.
TClonesArray * fRichRings
string fAnnWeights
Set path to the file with ANN weights.
virtual ~CbmRichElectronIdAnn()
Destructor.
void Init()
Initialize ANN before use.
TMultiLayerPerceptron * fNN
TClonesArray * fGlobalTracks
static CbmRichGeoManager & GetInstance()
double GetRadialAngle() const
int32_t GetNofHits() const
float GetRadialPosition() const
static double GetRingTrackDistance(int globalTrackId)