1 \section{Peak\-Finder\-Test.cxx File Reference}
2 \label{PeakFinderTest_8cxx}\index{PeakFinderTest.cxx@{PeakFinderTest.cxx}}
5 {\tt \#include \char`\"{}Ali\-HLTPHOSPulse\-Generator.h\char`\"{}}\par
6 {\tt \#include \char`\"{}Ali\-HLTPHOSRaw\-Analyzer\-Peak\-Finder.h\char`\"{}}\par
7 {\tt \#include $<$stdio.h$>$}\par
8 {\tt \#include $<$cmath$>$}\par
9 \subsection*{Functions}
10 \begin{CompactItemize}
12 void {\bf set\-File\-Name} (char $\ast$f\-Name, int start, int length, double tau, double fs)
18 \subsection{Function Documentation}
19 \index{PeakFinderTest.cxx@{Peak\-Finder\-Test.cxx}!main@{main}}
20 \index{main@{main}!PeakFinderTest.cxx@{Peak\-Finder\-Test.cxx}}
21 \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int main ()}\label{PeakFinderTest_8cxx_a1}
24 Testing of the Class Ali\-PHOSFitter
26 Definition at line 11 of file Peak\-Finder\-Test.cxx.
28 References Ali\-HLTPHOSRaw\-Analyzer\-Peak\-Finder::Evaluate(), Ali\-HLTPHOSRaw\-Analyzer::Get\-Energy(), Ali\-HLTPHOSPulse\-Generator::Get\-Pulse(), Ali\-HLTPHOSRaw\-Analyzer::Get\-Timing(), Ali\-HLTPHOSRaw\-Analyzer\-Peak\-Finder::Set\-AVector(), Ali\-HLTPHOSRaw\-Analyzer::Set\-Data(), set\-File\-Name(), Ali\-HLTPHOSRaw\-Analyzer::Set\-Sample\-Freq(), and Ali\-HLTPHOSRaw\-Analyzer\-Peak\-Finder::Set\-TVector().
30 \footnotesize\begin{verbatim}12 {
32 14 int start = 0; // Start index of subarray of sample array
33 15 int N = 128; // Number of samples
34 16 char fileName[100]; // Name of file containing Peakfinder vectors
35 17 double amplitude; // Amplitude/energy in ADC levels
36 18 double t0; // timedelay in nanoseconds
38 20 double tau = 2; // risetime in microseconds
39 21 double fs = 20; // sample frequency in Megahertz
40 22 double timeVector[N]; // Peakfinder vector for reconstruction of time
41 23 double amplitudeVector[N]; // Peakfinder vector for reconstruction of energy
45 27 int ts = (int)(1000/fs);
46 28 printf("\nts=%d\n", ts);
48 30 printf("type amplitude in ADC levels (0-1023):");
49 31 scanf("%lf", &litude);
50 32 printf("type timedelay in nanoseconds (0-%d):", ts);
53 35 AliHLTPHOSPulseGenerator *pulseGenPtr = new AliHLTPHOSPulseGenerator(amplitude, t0, N, tau, fs);
54 36 double *data = pulseGenPtr->GetPulse();
56 38 setFileName(fileName, start, N, tau, fs);
57 39 fp = fopen(fileName,"r");
61 43 printf("\nFile does not exist\n");
65 47 for(int i=0; i < N; i++)
67 49 fscanf(fp, "%lf", &litudeVector[i]);
72 54 for(int i=0; i < N; i++)
74 56 fscanf(fp, "%lf", &timeVector[i]);
77 59 fscanf(fp, "%lf", &aSystError);
78 60 fscanf(fp, "%lf", &tSystError);
79 61 printf("\nPeakfinder vectors loaded from %s\n", fileName);
83 65 tSystError = tSystError*pow(10, 9); //to give systematic error of timing in nanoseconds
84 66 aSystError = aSystError*100; //to give systematic error of amplitude in percent
87 69 // AliHLTPHOSAnalyzerPeakFinder *fitPtr= new AliHLTPHOSAnalyzerPeakFinder(data, fs);
88 70 AliHLTPHOSRawAnalyzerPeakFinder *fitPtr= new AliHLTPHOSRawAnalyzerPeakFinder();
90 72 fitPtr->SetData(data);
91 73 fitPtr->SetSampleFreq(fs);
92 74 fitPtr->SetTVector(timeVector, 100);
93 75 fitPtr->SetAVector(amplitudeVector, 100);
95 77 fitPtr->Evaluate(start, N);
100 82 time = fitPtr->GetTiming();
101 83 energy = fitPtr->GetEnergy();
103 85 printf("\nReal amplitude \t\t= %lf ADC counts \nReconstructed amplitude\t= %lf ADC counts\n", amplitude, energy);
104 86 printf("\nReal time \t\t= %lf nanoseconds \nReconstructed time\t= %lf nanoseconds\n", t0, time);
105 87 printf("\n\nMaximum systematic error in amplitude \t= %lf %%", aSystError);
106 88 printf("\nMaximum systematic error for timing \t= %lf nanoseconds\n\n", tSystError);
109 \end{verbatim}\normalsize
112 \index{PeakFinderTest.cxx@{Peak\-Finder\-Test.cxx}!setFileName@{setFileName}}
113 \index{setFileName@{setFileName}!PeakFinderTest.cxx@{Peak\-Finder\-Test.cxx}}
114 \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void set\-File\-Name (char $\ast$ {\em f\-Name}, int {\em start}, int {\em length}, double {\em tau}, double {\em fs})}\label{PeakFinderTest_8cxx_a0}
119 Definition at line 92 of file Peak\-Finder\-Test.cxx.
121 Referenced by main().
123 \footnotesize\begin{verbatim}93 {
124 94 sprintf(fName, "PFVectors/start%dN%dtau%.ffs%.f.txt", start, N, tau, fs);
125 95 // printf("\nfilename: %s\n", fName);
127 \end{verbatim}\normalsize