/****************************************************************************** * $Id: CbmRichRingSelectNeuralNet.cxx,v 1.1 2006/09/13 14:53:31 hoehne Exp $ * * Class : CbmRichRingSelect2DCuts * Description : Implementation for concrete RICH ring selection algorithm: * reject rings using a trained neural net (input file with weights needed!) * store resulting value (0-1) in "SelectionNN": * 0 = good rings * 1 = rings to be rejected * --> choose a value in between depending on required purity/ efficiency * * Author : Simeon Lebedev * E-mail : salebedev@jinr.ru * ******************************************************************************* * $Log: CbmRichRingSelectNeuralNet.cxx,v $ * Revision 1.1 2006/09/13 14:53:31 hoehne * initial version * * * *******************************************************************************/ #include "CbmRichRingSelectNeuralNet.h" #include "CbmRichHit.h" #include "CbmRichRing.h" #include "TMultiLayerPerceptron.h" #include "TTree.h" using namespace std; //-------------------------------------------------------------------------- // ----- Default constructor ------------------------------------------- CbmRichRingSelectNeuralNet::CbmRichRingSelectNeuralNet() { fVerbose = 1; } // ----- Standard constructor ------------------------------------------ CbmRichRingSelectNeuralNet::CbmRichRingSelectNeuralNet ( Int_t verbose, const char* NNFile ) { fVerbose = verbose; fNeuralNetWeights = NNFile; } // ----- Destructor ---------------------------------------------------- CbmRichRingSelectNeuralNet::~CbmRichRingSelectNeuralNet() {} // ----- Initialization ---------------------------------------------------- void CbmRichRingSelectNeuralNet::Init () { CbmRichRingSelect::Init(); TTree *simu = new TTree ("MonteCarlo","MontecarloData"); Float_t x1,x2,x3,x4,x5,x6,x7,x8; simu->Branch("x1", &x1,"x1/F"); simu->Branch("x2", &x2,"x2/F"); simu->Branch("x3", &x3,"x3/F"); simu->Branch("x4", &x4,"x4/F"); simu->Branch("x5", &x5,"x5/F"); simu->Branch("x6", &x6,"x6/F"); simu->Branch("x7", &x7,"x7/F"); simu->Branch("x8", &x8,"x8/F"); fNN = new TMultiLayerPerceptron("x1,x2,x3,x4,x5,x6,x7:30:x8",simu); //char* NeuralNetWeights = "NeuralNet_RingSelection_Weights.txt"; cout << "-I- CbmRichRingSelectNeuralNet: get NeuralNet weight parameters from: " << fNeuralNetWeights << endl; fNN->LoadWeights(fNeuralNetWeights); } // ----- Exec ---------------------------------------------------- void CbmRichRingSelectNeuralNet::DoSelect(CbmRichRing* ring) { if (fVerbose > 1) ring->Print(); ring->SetAngle(GetAngle(ring)); ring->SetNofHitsOnRing(GetNofHitsOnRing(ring)); Double_t nnPar[7]; nnPar[0] = ring->GetNofHits(); nnPar[1] = ring->GetDistance(); nnPar[2] = ring->GetAngle(); nnPar[3] = ring->GetNofHitsOnRing(); nnPar[4] = ring->GetRadialPosition(); nnPar[5] = ring->GetChi2(); nnPar[6] = ring->GetRadius(); Double_t nnEval = fNN->Evaluate(0,nnPar); if (fVerbose > 1) cout <<"nnEval = "<SetSelectionNN(nnEval); } // ------------------------------------------------------------------------- ClassImp(CbmRichRingSelectNeuralNet)