]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSPulseGenerator.cxx
moving all definitions to AliHLTPHOSDefinitions
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSPulseGenerator.cxx
CommitLineData
228cb536 1/**************************************************************************
cd906859 2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
228cb536 3 * *
cd906859 4 * Author: Per Thomas Hille for the ALICE HLT Project. *
228cb536 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
cd906859 16#include "AliHLTPHOSPulseGenerator.h"
228cb536 17#include <cmath>
18#include <iostream>
19
228cb536 20using std::cout;
21using std::endl;
22
cd906859 23ClassImp(AliHLTPHOSPulseGenerator)
24
005850ed 25
26
d504c864 27AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
228cb536 28{
005850ed 29 //Never to be called
228cb536 30 cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
31}
32
d504c864 33
d504c864 34AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(const AliHLTPHOSPulseGenerator &): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
cd906859 35{
36
37}
38
39
40AliHLTPHOSPulseGenerator::~AliHLTPHOSPulseGenerator()
228cb536 41{
005850ed 42 //Destructor
228cb536 43 delete fDataPtr;
44 fDataPtr=0;
45}
46
005850ed 47
d504c864 48AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(double a, double t0, int N, double tau, double fs): fAmplitude(a), fNSamples(N),fTau(0), fSampleFreq(fs), fTZero(0), fDataPtr(0), fDT(0)
228cb536 49{
005850ed 50 //See header file for documentation
cd906859 51 fDataPtr = new double[100];
228cb536 52 SetAmplitude(a);
53 SetDT(fs);
54 SetTZero(t0);
55 fNSamples=N;
d504c864 56 fTau=tau;
228cb536 57 fSampleFreq=fs;
228cb536 58}
59
d504c864 60
228cb536 61void
cd906859 62AliHLTPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
228cb536 63{
005850ed 64 //See header file for documentation
cd906859 65 double *tmpSamples;
66 tmpSamples = samples;
67 printf("\nbaselineLevel = %f\n", baselineLevel);
228cb536 68 cout << "AddBaseline not implemented yet" << endl;
69}
70
005850ed 71
228cb536 72void
cd906859 73AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
228cb536 74{
005850ed 75 //See header file for documentation
cd906859 76 printf("\ndataPtr = %f, sigma = %f\n", *dataPtr, *sigma);
228cb536 77 cout << "AddNoise is not implemented yet" << endl;
78}
79
cd906859 80
228cb536 81void
cd906859 82AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
228cb536 83{
005850ed 84 //See header file for documentation
cd906859 85 printf("\ndataPtr = %f, sigma = %f, cutoff = %f\n", *dataPtr, *sigma, cutoff);
228cb536 86 cout << "AddNoise is not implemeted yet" << endl;
87}
88
d504c864 89
228cb536 90double *
cd906859 91AliHLTPHOSPulseGenerator::AddPretriggerSamples(double baselineLevel, double *samples)
228cb536 92{
005850ed 93 //See header file for documentation
cd906859 94 printf("\nbaslinelevel = %f, samples = %f\n", baselineLevel, *samples);
228cb536 95 cout << "AddPretriggerSamples not implemented yet" << endl;
cd906859 96 return 0;
228cb536 97}
98
99
228cb536 100double *
cd906859 101AliHLTPHOSPulseGenerator::GetPulse(double a, double t0)
228cb536 102{
005850ed 103 //See header file for documentation
228cb536 104 return fDataPtr;
105}
106
005850ed 107
228cb536 108void
005850ed 109AliHLTPHOSPulseGenerator::Quantisize(double *dataPtr) const
228cb536 110{
005850ed 111 //See header file for documentation
cd906859 112 double *dtaPtr;
113 dtaPtr = new double[100];
114 dtaPtr = dataPtr;
228cb536 115}
116
d504c864 117
228cb536 118void
cd906859 119AliHLTPHOSPulseGenerator::SetAmplitude(double a)
228cb536 120{
005850ed 121 //See header file for documentation
228cb536 122 fAmplitude=a;
123}
124
d504c864 125
228cb536 126void
cd906859 127AliHLTPHOSPulseGenerator::SetDT(double fs)
228cb536 128{
005850ed 129 //See header file for documentation
228cb536 130 fDT=1/fs;
131}
132
005850ed 133
228cb536 134void
cd906859 135AliHLTPHOSPulseGenerator::SetTZero(double t0)
228cb536 136{
005850ed 137 //See header file for documentation
228cb536 138 fTZero = -t0/1000; // Since time is in nanoseconds and the samplingfrequency is in MHz -> divide by 1000
139}
140
cd906859 141
005850ed 142void
143AliHLTPHOSPulseGenerator::SetSampleFreq(int fs)
144{
145 //See header file for documentation
146 fSampleFreq = fs;
147 SetDT(fs);
148}
149
150
228cb536 151void
cd906859 152AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr)
228cb536 153{
005850ed 154 //See header file for documentation
155 for(int i=0; i<fNSamples; i++)
156 {
157 dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
158 }
228cb536 159}
005850ed 160
161
162void
163AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr, int N)
164{
165 //See header file for documentation
166 for(int i=0; i<N; i++)
167 {
168 dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
169 }
170}
171