1 /**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "AliHLTPHOSPulseGenerator.h"
23 ClassImp(AliHLTPHOSPulseGenerator)
27 AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
30 cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
34 AliHLTPHOSPulseGenerator::AliHLTPHOSPulseGenerator(const AliHLTPHOSPulseGenerator &): fAmplitude(0), fNSamples(0),fTau(0), fSampleFreq(0), fTZero(0), fDataPtr(0), fDT(0)
40 AliHLTPHOSPulseGenerator::~AliHLTPHOSPulseGenerator()
48 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)
50 //See header file for documentation
51 fDataPtr = new double[100];
62 AliHLTPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
64 //See header file for documentation
67 printf("\nbaselineLevel = %f\n", baselineLevel);
68 cout << "AddBaseline not implemented yet" << endl;
73 AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
75 //See header file for documentation
76 printf("\ndataPtr = %f, sigma = %f\n", *dataPtr, *sigma);
77 cout << "AddNoise is not implemented yet" << endl;
82 AliHLTPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
84 //See header file for documentation
85 printf("\ndataPtr = %f, sigma = %f, cutoff = %f\n", *dataPtr, *sigma, cutoff);
86 cout << "AddNoise is not implemeted yet" << endl;
91 AliHLTPHOSPulseGenerator::AddPretriggerSamples(double baselineLevel, double *samples)
93 //See header file for documentation
94 printf("\nbaslinelevel = %f, samples = %f\n", baselineLevel, *samples);
95 cout << "AddPretriggerSamples not implemented yet" << endl;
101 AliHLTPHOSPulseGenerator::GetPulse(double /*a*/, double /*t0*/)
103 //See header file for documentation
109 AliHLTPHOSPulseGenerator::Quantisize(double *dataPtr) const
111 //See header file for documentation
113 dtaPtr = new double[100];
119 AliHLTPHOSPulseGenerator::SetAmplitude(double a)
121 //See header file for documentation
127 AliHLTPHOSPulseGenerator::SetDT(double fs)
129 //See header file for documentation
135 AliHLTPHOSPulseGenerator::SetTZero(double t0)
137 //See header file for documentation
138 fTZero = -t0/1000; // Since time is in nanoseconds and the samplingfrequency is in MHz -> divide by 1000
143 AliHLTPHOSPulseGenerator::SetSampleFreq(int fs)
145 //See header file for documentation
152 AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr)
154 //See header file for documentation
155 for(int i=0; i<fNSamples; i++)
157 dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
163 AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr, int N)
165 //See header file for documentation
166 for(int i=0; i<N; i++)
168 dtaPtr[i]=fAmplitude*exp((Double_t)2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);