EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichRingSelectNeuralNet.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichRingSelectNeuralNet.h
1  /*
2 * Description : Implementation for concrete RICH ring selection algorithm:
3 * reject rings using a trained neural net (input file with weights needed!)
4 * store resulting value (0-1) in "SelectionNN":
5 * 0 = good rings
6 * 1 = rings to be rejected
7 * --> choose a value in between depending on required purity/ efficiency
8 *
9 * Author : Semen Lebedev
10 * E-mail : S.Lebedev@gsi.de
11 * */
12 
13 #ifndef CBM_RICH_RING_SELECT_NEURALNET_H
14 #define CBM_RICH_RING_SELECT_NEURALNET_H
15 
16 #include "NNfunction.h"
17 #include "CbmRichRingLight.h"
19 
20 #include <iostream>
21 
22 using std::cout;
23 using std::endl;
24 
25 
27 {
28 
29  const char* fNeuralNetWeights;
30 
31 public:
32  CbmRichRingSelectNeuralNet (const char* NNFile);// Standard constructor
34 
35  virtual void Init();
36  void DoSelect(CbmRichRingLight* ring);
37 
40 };
41 
42 #endif
43 
44 
46 {
47  fNeuralNetWeights = NNFile;
48 }
49 
50 
52 {}
53 
55 {
57  fNNfunction = new NNfunction();
58 }
59 
60 // ----- Exec ----------------------------------------------------
62 {
63  if (ring->GetRadius() >= 10.f || ring->GetRadius() <= 0.f ||
64  ring->GetNofHits() <= 5.f ||
65  ring->GetRadialPosition() <= 0.f || ring->GetRadialPosition() >= 999.f ){
66 
67  ring->SetSelectionNN(-1.f);
68  return;
69  }
71  if (ring->GetNofHitsOnRing() < 5){
72  ring->SetSelectionNN(-1.f);
73  return;
74  }
75 
76  ring->SetAngle(fSelectImpl->GetAngle(ring));
77  if (ring->GetAngle() < 0.f || ring->GetAngle() > 6.3f){
78  ring->SetSelectionNN(-1.f);
79  return;
80  }
81 
82  double nnPar[10];
83  nnPar[0] = ring->GetNofHits();
84  nnPar[1] = ring->GetAngle();
85  nnPar[2] = ring->GetNofHitsOnRing();
86  nnPar[3] = ring->GetRadialPosition();
87  nnPar[4] = ring->GetRadius();
88  nnPar[5] = ring->GetChi2() / ring->GetNDF();
89 
90  float nnEval = fNNfunction->Value(0,nnPar);
91 
92  ring->SetSelectionNN(nnEval);
93 }
94