]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSPulseGenerator.cxx
The AliHLTPHOSPeakfinder class was made as a derived class of a HLT component
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSPulseGenerator.cxx
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
21 using std::cout;
22 using std::endl; 
23
24 AliPHOSPulseGenerator::AliPHOSPulseGenerator()
25 {
26   cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
27   fDataPtr=0;
28 }
29
30 AliPHOSPulseGenerator::~AliPHOSPulseGenerator()
31 {
32   delete fDataPtr;
33   fDataPtr=0;
34 }
35
36 AliPHOSPulseGenerator::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
51 void 
52 AliPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
53 {
54   cout << "AddBaseline not implemented yet" << endl;
55 }
56
57 void 
58 AliPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
59 {
60   cout << "AddNoise is not implemented yet" << endl;
61 }
62
63 void 
64 AliPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
65 {
66   cout << "AddNoise is not implemeted yet" << endl;
67 }
68
69
70 double *
71 AliPHOSPulseGenerator::AddPretriggerSamples(double baslineLevel, double *samples)
72 {
73   cout << "AddPretriggerSamples not implemented yet" << endl;
74 }
75
76
77
78 double *
79 AliPHOSPulseGenerator::GetPulse()
80 {
81   return fDataPtr;
82 }
83
84 void 
85 AliPHOSPulseGenerator::Quantisize(double *dataPtr)
86 {
87   //  cout << "Quantisize is not implemented yet" << endl;
88 }
89
90 void
91 AliPHOSPulseGenerator::SetAmplitude(double a)
92 {
93   fAmplitude=a;
94 }
95
96 void 
97 AliPHOSPulseGenerator::SetDT(double fs)
98 {
99   fDT=1/fs;  
100 }
101
102 void
103 AliPHOSPulseGenerator::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
109 void
110 AliPHOSPulseGenerator::MakePulse(double *dtaPtr)
111 {
112   
113 for(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 }