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