]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliPHOSPulseGenerator.cxx
The AliHLTPHOSPeakfinder class was made as a derived class of a HLT component
[u/mrichter/AliRoot.git] / HLT / PHOS / AliPHOSPulseGenerator.cxx
CommitLineData
9b37718a 1/**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Per Thomas Hille for the ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16#include "AliPHOSPulseGenerator.h"
17//#include <stdio.h>
18#include <cmath>
19#include <iostream>
20
21using std::cout;
22using std::endl;
23
24AliPHOSPulseGenerator::AliPHOSPulseGenerator()
25{
26 cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
27 fDataPtr=0;
28}
29
30AliPHOSPulseGenerator::~AliPHOSPulseGenerator()
31{
32 delete fDataPtr;
33 fDataPtr=0;
34}
35
36AliPHOSPulseGenerator::AliPHOSPulseGenerator(double a, double t0, int N, double t, double fs)
37{
38 fDataPtr = new double[N];
39 SetAmplitude(a);
40 SetDT(fs);
41 SetTZero(t0);
42 fNSamples=N;
43 fTau=t;
44 fSampleFreq=fs;
45 // dT=tau/fs; //Function values are calculated at intervals dT
46 // fDT=1/fs; //Function values are calculated at intervals dT
47 fDataPtr = new double[N];
48 MakePulse(fDataPtr);
49}
50
51void
52AliPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
53{
54 cout << "AddBaseline not implemented yet" << endl;
55}
56
57void
58AliPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
59{
60 cout << "AddNoise is not implemented yet" << endl;
61}
62
63void
64AliPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
65{
66 cout << "AddNoise is not implemeted yet" << endl;
67}
68
69
70double *
71AliPHOSPulseGenerator::AddPretriggerSamples(double baslineLevel, double *samples)
72{
73 cout << "AddPretriggerSamples not implemented yet" << endl;
74}
75
76
77
78double *
79AliPHOSPulseGenerator::GetPulse()
80{
81 return fDataPtr;
82}
83
84void
85AliPHOSPulseGenerator::Quantisize(double *dataPtr)
86{
87 // cout << "Quantisize is not implemented yet" << endl;
88}
89
90void
91AliPHOSPulseGenerator::SetAmplitude(double a)
92{
93 fAmplitude=a;
94}
95
96void
97AliPHOSPulseGenerator::SetDT(double fs)
98{
99 fDT=1/fs;
100}
101
102void
103AliPHOSPulseGenerator::SetTZero(double t0)
104{
105 fTZero = -t0/1000; // Since time is in nanoseconds and the samplingfrequency is in MHz -> divide by 1000
106}
107
108//private
109void
110AliPHOSPulseGenerator::MakePulse(double *dtaPtr)
111{
112
113for(int i=0; i<fNSamples; i++)
114 {
115 dtaPtr[i]=fAmplitude*exp(2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
116 }
117}