]>
Commit | Line | Data |
---|---|---|
e37e3c84 | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the Experimental Nuclear * | |
3 | * Physics Group, Dep. of Physics * | |
4 | * University of Oslo, Norway, 2007 * | |
5 | * * | |
6 | * Author: Per Thomas Hille <perthomas.hille@yale.edu> * | |
7 | * for the ALICE HLT Project. * | |
8 | * Contributors are mentioned in the code where appropriate. * | |
9 | * Please report bugs to perthi@fys.uio.no * | |
10 | * * | |
11 | * Permission to use, copy, modify and distribute this software and its * | |
12 | * documentation strictly for non-commercial purposes is hereby granted * | |
13 | * without fee, provided that the above copyright notice appears in all * | |
14 | * copies and that both the copyright notice and this permission notice * | |
15 | * appear in the supporting documentation. The authors make no claims * | |
16 | * about the suitability of this software for any purpose. It is * | |
17 | * provided "as is" without express or implied warranty. * | |
18 | **************************************************************************/ | |
19 | ||
20 | // Evaluation of peak position | |
21 | // and amplitude using Neural Networks (NN) | |
22 | // ------------------ | |
23 | // ------------------ | |
24 | // ------------------ | |
25 | ||
26 | ||
27 | #include "AliCaloRawAnalyzerNN.h" | |
28 | #include "AliCaloNeuralFit.h" | |
29 | #include "AliCaloFitResults.h" | |
30 | #include "AliCaloBunchInfo.h" | |
31 | ||
32 | #include <iostream> | |
33 | ||
34 | using namespace std; | |
35 | ||
36 | ClassImp( AliCaloRawAnalyzerNN ) | |
37 | ||
48a2e3eb | 38 | AliCaloRawAnalyzerNN::AliCaloRawAnalyzerNN() : AliCaloRawAnalyzer("Neural Network", "NN"), fNeuralNet(0) |
e37e3c84 | 39 | { |
40 | // Comment | |
41 | ||
42 | fNeuralNet = new AliCaloNeuralFit(); | |
43 | ||
44 | for(int i=0; i < 5 ; i++) | |
45 | { | |
46 | fNNInput[i] = 0; | |
47 | } | |
48 | ||
49 | } | |
50 | ||
51 | ||
52 | AliCaloRawAnalyzerNN::~AliCaloRawAnalyzerNN() | |
53 | { | |
54 | delete fNeuralNet; | |
55 | } | |
56 | ||
57 | ||
58 | AliCaloFitResults | |
59 | AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector, | |
60 | const UInt_t altrocfg1, const UInt_t altrocfg2 ) | |
61 | { | |
62 | // The eveluation of Peak position and amplitude using the Neural Network | |
63 | if( bunchvector.size() <= 0 ) | |
64 | { | |
f57baa2d | 65 | return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid , AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid ); |
e37e3c84 | 66 | } |
67 | ||
f57baa2d | 68 | short maxampindex; |
e37e3c84 | 69 | short maxamp; |
70 | ||
f57baa2d | 71 | int index = SelectBunch( bunchvector, &maxampindex , &maxamp ) ; |
e37e3c84 | 72 | |
f57baa2d | 73 | if( index < 0 ) |
e37e3c84 | 74 | { |
f57baa2d | 75 | return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid); |
e37e3c84 | 76 | } |
77 | ||
78 | int first = 0; | |
79 | int last = 0; | |
80 | ||
f57baa2d | 81 | Float_t ped = ReverseAndSubtractPed( &(bunchvector.at( index ) ) , altrocfg1, altrocfg2, fReversed ); |
e37e3c84 | 82 | |
f57baa2d | 83 | short maxrev = maxampindex - bunchvector.at(index).GetStartBin(); |
84 | short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1); | |
85 | double maxf = maxamp - ped; | |
86 | ||
87 | SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxrev , &first, &last); | |
e37e3c84 | 88 | |
e37e3c84 | 89 | if(maxrev < 1000 ) |
90 | { | |
91 | if ( ( maxrev - first) < 2 && (last - maxrev ) < 2) | |
92 | { | |
f57baa2d | 93 | return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kNoFit, maxf, maxrev+timebinOffset, AliCaloFitResults::kNoFit, AliCaloFitResults::kNoFit, |
94 | AliCaloFitResults::kNoFit, AliCaloFitSubarray(index, maxrev, first, last) ); | |
e37e3c84 | 95 | } |
96 | else | |
97 | { | |
e37e3c84 | 98 | |
99 | for(int i=0; i < 5 ; i++) | |
100 | { | |
101 | fNNInput[i] = fReversed[maxrev-2 +i]/(maxamp -ped); | |
102 | } | |
103 | ||
3b8fd9fe | 104 | |
a9ebbc7a | 105 | double amp = (maxamp - ped)*fNeuralNet->Value( 0, fNNInput[0], fNNInput[1], fNNInput[2], fNNInput[3], fNNInput[4]); |
3b8fd9fe | 106 | double tof = (fNeuralNet->Value( 1, fNNInput[0], fNNInput[1], fNNInput[2], fNNInput[3], fNNInput[4]) + timebinOffset ) ; |
e37e3c84 | 107 | |
f57baa2d | 108 | return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kDummy, amp , tof, AliCaloFitResults::kDummy, AliCaloFitResults::kDummy, |
109 | AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); | |
e37e3c84 | 110 | |
111 | } | |
112 | } | |
f57baa2d | 113 | return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kNoFit, maxf, maxrev+timebinOffset, AliCaloFitResults::kNoFit, AliCaloFitResults::kNoFit, |
114 | AliCaloFitResults::kNoFit, AliCaloFitSubarray(index, maxrev, first, last) ); | |
e37e3c84 | 115 | } |
116 | ||
e37e3c84 | 117 |