CbmRoot
Loading...
Searching...
No Matches
CbmRichRingSelectAnn.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev, Andrey Lebedev, Denis Bertini [committer] */
4
6
7#include "CbmRichGeoManager.h"
8#include "CbmRichRingLight.h"
10#include "TMultiLayerPerceptron.h"
11#include "TSystem.h"
12#include "TTree.h"
13
14#include <iostream>
15
16using std::cout;
17using std::endl;
18
19CbmRichRingSelectAnn::CbmRichRingSelectAnn() : fAnnWeights(""), fNN(NULL), fSelectImpl(NULL)
20{
22 fAnnWeights = string(gSystem->Getenv("VMCWORKDIR")) + "/parameters/rich/rich_v17a_select_ann_weights.txt";
23 }
24 else if (CbmRichGeoManager::GetInstance().fGP->fGeometryType == CbmRichGeometryTypeTwoWings) {
25 fAnnWeights = string(gSystem->Getenv("VMCWORKDIR")) + "/parameters/rich/rich_v16a_select_ann_weights.txt";
26 }
27 else {
28 fAnnWeights = string(gSystem->Getenv("VMCWORKDIR")) + "/parameters/rich/rich_v17a_select_ann_weights.txt";
29 }
30}
31
33
35{
37
38 TTree* simu = new TTree("MonteCarlo", "MontecarloData");
39 Double_t x[6];
40 Double_t xOut;
41
42 simu->Branch("x0", &x[0], "x0/D");
43 simu->Branch("x1", &x[1], "x1/D");
44 simu->Branch("x2", &x[2], "x2/D");
45 simu->Branch("x3", &x[3], "x3/D");
46 simu->Branch("x4", &x[4], "x4/D");
47 simu->Branch("x5", &x[5], "x5/D");
48 simu->Branch("xOut", &xOut, "xOut/D");
49
50 fNN = new TMultiLayerPerceptron("x0,x1,x2,x3,x4,x5:10:xOut", simu);
51 cout << "-I- CbmRichRingSelectAnn: get ANN weight parameters from: " << fAnnWeights << endl;
52 fNN->LoadWeights(fAnnWeights.c_str());
53}
54
56{
57 if (ring->GetRadius() >= 10.f || ring->GetRadius() <= 0.f || ring->GetNofHits() <= 5.f
58 || ring->GetRadialPosition() <= 0.f || ring->GetRadialPosition() >= 999.f) {
59
60 ring->SetSelectionNN(-1.f);
61 return;
62 }
64 if (ring->GetNofHitsOnRing() < 5) {
65 ring->SetSelectionNN(-1.f);
66 return;
67 }
68
69 ring->SetAngle(fSelectImpl->GetAngle(ring));
70 if (ring->GetAngle() < 0.f || ring->GetAngle() > 6.3f) {
71 ring->SetSelectionNN(-1.f);
72 return;
73 }
74
75 double params[6];
76 params[0] = ring->GetNofHits() / 45.;
77 params[1] = ring->GetAngle() / 6.28;
78 params[2] = ring->GetNofHitsOnRing() / 45.;
79 params[3] = ring->GetRadialPosition() / 110.;
80 params[4] = ring->GetRadius() / 10.;
81 params[5] = (ring->GetChi2() / ring->GetNofHits()) / 0.4;
82
83 float nnEval = fNN->Evaluate(0, params);
84
85 /* float nofHitsEval = ring->GetNofHits() / 35.;
86 if (nofHitsEval > 1) nofHitsEval = 1.;
87 float angleEval = 1. - ring->GetAngle() / 6.29;
88 if (angleEval > 1.) angleEval = 1.;
89 if (angleEval < 0.) angleEval = 0.;
90 float radialPosEval = ring->GetRadialPosition() / 100;
91 if (radialPosEval > 1.) radialPosEval = 1.;
92
93
94 nnEval = nofHitsEval * angleEval * radialPosEval;*/
95
96 ring->SetSelectionNN(nnEval);
97}
@ CbmRichGeometryTypeTwoWings
@ CbmRichGeometryTypeCylindrical
Implementation for concrete RICH ring selection algorithm: reject rings using a trained neural net (i...
static CbmRichGeoManager & GetInstance()
float GetRadius() const
void SetAngle(float angle)
void SetSelectionNN(float selectionNN)
float GetAngle() const
void SetNofHitsOnRing(unsigned short onring)
int GetNofHits() const
Return number of hits in ring.
float GetChi2() const
float GetRadialPosition() const
Return radial position of the ring.
unsigned short GetNofHitsOnRing() const
TMultiLayerPerceptron * fNN
void DoSelect(CbmRichRingLight *ring)
CbmRichRingSelectAnn()
Standard constructor.
virtual ~CbmRichRingSelectAnn()
Destructor.
virtual void Init()
Initialize ANN.
CbmRichRingSelectImpl * fSelectImpl
int GetNofHitsOnRingCircle(CbmRichRingLight *ring)
float GetAngle(CbmRichRingLight *ring)