3 /**************************************************************************
4 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
6 * Author: Per Thomas Hille for the ALICE HLT Project. *
7 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliHLTPHOSPulseGenerator.h"
25 ClassImp(AliHLTPHOSPulseGenerator)
29 AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
32 cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
36 AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(const AliHLTPHOSPulseGenerator &): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
42 AliHLTPHOSPulseGenerator::~AliHLTPHOSPulseGenerator()
50 AliHLTPHOSPulseGenerator::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)
52 //See header file for documentation
53 fDataPtr = new double[100];
64 AliHLTPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
66 //See header file for documentation
69 printf("\nbaselineLevel = %f\n", baselineLevel);
70 cout << "AddBaseline not implemented yet" << endl;
75 AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
77 //See header file for documentation
78 printf("\ndataPtr = %f, sigma = %f\n", *dataPtr, *sigma);
79 cout << "AddNoise is not implemented yet" << endl;
84 AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
86 //See header file for documentation
87 printf("\ndataPtr = %f, sigma = %f, cutoff = %f\n", *dataPtr, *sigma, cutoff);
88 cout << "AddNoise is not implemeted yet" << endl;
93 AliHLTPHOSPulseGenerator::AddPretriggerSamples(double baselineLevel, double *samples)
95 //See header file for documentation
96 printf("\nbaslinelevel = %f, samples = %f\n", baselineLevel, *samples);
97 cout << "AddPretriggerSamples not implemented yet" << endl;
103 AliHLTPHOSPulseGenerator::GetPulse(double /*a*/, double /*t0*/)
105 //See header file for documentation
111 AliHLTPHOSPulseGenerator::Quantisize(double *dataPtr) const
113 //See header file for documentation
115 dtaPtr = new double[100];
121 AliHLTPHOSPulseGenerator::SetAmplitude(double a)
123 //See header file for documentation
129 AliHLTPHOSPulseGenerator::SetDT(double fs)
131 //See header file for documentation
137 AliHLTPHOSPulseGenerator::SetTZero(double t0)
139 //See header file for documentation
140 fTZero = -t0/1000; // Since time is in nanoseconds and the samplingfrequency is in MHz -> divide by 1000
145 AliHLTPHOSPulseGenerator::SetSampleFreq(int fs)
147 //See header file for documentation
154 AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr)
156 //See header file for documentation
157 for(int i=0; i<fNSamples; i++)
159 dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
165 AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr, int N)
167 //See header file for documentation
168 for(int i=0; i<N; i++)
170 dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);