+++ /dev/null
-#ifdef __CINT__
-
-#pragma link off all globals;
-#pragma link off all classes;
-#pragma link off all functions;
-
-#pragma link C++ class AliHLTPHOSPeakFinder+;
-#pragma link C++ class AliHLTPHOSPulseGenerator+;
-#pragma link C++ class AliHLTPHOSEmcCalibData+;
-
-#endif
+++ /dev/null
-
-/**************************************************************************
- * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: Per Thomas Hille for the ALICE HLT Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-
-#include "AliHLTPHOSPeakFinder.h"
-#include <iostream>
-
-using std::cout;
-using std::endl;
-
-ClassImp(AliHLTPHOSPeakFinder)
-
-
-AliHLTPHOSPeakFinder::AliHLTPHOSPeakFinder(const AliHLTPHOSPeakFinder&):TObject(), AliHLTPHOSRawAnalyzer(), fDTofGuess(0), fDAmplGuess(0), kfMCovarPtrPtr(0), fPCovarPtrPtr(0)
-{
-
-}
-
-
-
-/**
- * The AliHLTPHOSPeakfinder class is the class for extracting the basic signal parameters
- * "timing" and "energy" from the PHOS raw data. Physical data will for a given readout channel be
- * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in
- * calculation is of type double.
- **/
-AliHLTPHOSPeakFinder::AliHLTPHOSPeakFinder():fDTofGuess(0), fDAmplGuess(0), kfMCovarPtrPtr(0), fPCovarPtrPtr(0)
-{
- cout <<"You cannot invoke the Fitter without arguments"<<endl;;
-}
-
-
-/**
-* Main constructor
-* @param dataPtr Data array for wich a subarray will be taken to perform the fit
-* @param fs the sampling frequency in entities of MHz. Needed in order to calculate physical time
-**/
-AliHLTPHOSPeakFinder::AliHLTPHOSPeakFinder(double *dtaPtr, double fs): fDTofGuess(0), fDAmplGuess(0), kfMCovarPtrPtr(0), fPCovarPtrPtr(0)
-{
- fFloatDataPtr = dtaPtr;
- fSampleFrequency = fs;
-} //end AliHLTPHOSPeakFinder
-
-
-AliHLTPHOSPeakFinder::~AliHLTPHOSPeakFinder()
-{
-
-} //end AliHLTPHOSPeakFinder
-
-
-void
-AliHLTPHOSPeakFinder::Analyze() const
-{
-
-}
-
-/**
-* Extraction of timing and energy using the Peakfinde Algorithm.
-* The. The parameters "start" and "length" defines a sub array of the data array
-* that will be used for the the fit. If start+length must not exeed the total length
-* of the Data array. "start" must be chosen as close as possible to t0.
-* The baseline must also be subtracted.
-* The length of "tVector" and "aVector" mus be equal to length.
-* "index + length" must not exeed the length of the data array set in the constructor.
-* @param start the start index of the subarray of the data array.
-* @param length the number of samples to use starting from index
-* @param tVector the peakfinder vector for timing
-* @param aVector the peakfinder vector for amplitude (energy)
-**/
-void
-AliHLTPHOSPeakFinder::FitPeakFinder(int start, int length, double *tVector, double *aVector)
-{
- fDTof = 0;
- fDAmpl = 0;
-
- printf("\nstart = %d, length = %d\n", start, length);
-
- double tmpTime[1008];
-
- // double tmpTime[length];
-
- for(int i=0; i < length; i++)
- {
- fDAmpl += aVector[i]*fFloatDataPtr[i];
- }
-
- for(int i=0; i < length; i++)
- {
- tmpTime[i] = tVector[i]*fFloatDataPtr[i];
- fDTof = fDTof + tmpTime[i];
- }
-
- fDTof = fDTof/fDAmpl;
- //thats all
-} //end FitPeakFinder
-
-
-
-/**
- * This method finds the start index of the pulse (relative to the data array) by serching for
- * three or more continious samples above trheshold.
- * @param treshold treshold to use when searchin for the start of the pulse
- **/
-int
-AliHLTPHOSPeakFinder::FindStartIndex(double treshold)
-{
- printf("\ntreshold = %f \n", treshold);
- cout << "Find Start index not yet implemented" << endl;
- return 0;
-} //end FindStartIndex
-
-
-/**
- * This function applies only to the Chi and Least mean square fit. An initial guess is made
- * based on the average of the first 5 samples and the first value exeeding this value.
- **/
-void
-AliHLTPHOSPeakFinder::MakeInitialGuess()
-{
- cout << "Make initial guess not yet implemeted" << endl;
-}
-
-
-/**
- * This function applies only to the Chi and Least mean square fit. An initial guess is made
- * based on the average of the first 5 samples and the first value exeeding threshold + this value.
- * @param treshold The index of the first value above treshold is ntaken to be the first value.
- **/
-void
-AliHLTPHOSPeakFinder::MakeInitialGuess(int treshold)
-{
- printf("\ntreshold = %d\n", treshold);
- cout << "Make initial guess not yet implemeted" << endl;
-}
-
-
+++ /dev/null
-#include "AliHLTPHOSRawAnalyzer.h"
-#include <iostream>
-
-using std::cout;
-using std::endl;
-
-
-AliHLTPHOSRawAnalyzer:: AliHLTPHOSRawAnalyzer():fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), n(99999)
-{
-
-
-}
-
-
-
-/**
-* Attemps to level the basline to zero.
-* The baseline will be calculated from the pretrigger samples and subtracted from the
-* data array.
-* If pretrigger samples are not present then the basline correction will be incorrect.
-* @param dataPtr array for wich to correct the basline
-* @param N the number of pretrigger samples used to calculate the baseline.
-**/
-void
-AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, int N)
-{
- fFloatDataPtr = dataPtr;
- n=N;
- cout << "Baseline correction not yet implemeted" << endl;
-} //end BaselineCorrection
-
-/**
-* Shifts the basline with the amount given by baselineValue
-* If pretrigger samples are not present then the basline correction will be incorrect.
-* @param dataPtr array for wich to correct the basline
-* @param BaslineValue the basline value to subtract..
-**/
-void
-AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, double baselineValue)
-{
- fFloatDataPtr = dataPtr;
- printf("\nbaselineValue = %f\n", baselineValue);
- cout << "Baseline correction not yet implemeted" << endl;
-} //end BaslineCorrection
-
-
-/**
- * Gives the timing in entities of sample indexes
- * Physical time is found by multiplying with the sampling intervall (Ts).
- **/
-float
-AliHLTPHOSRawAnalyzer::GetTiming()
-{
- return fDTof;
-} //end GetTiming
-
-
-/**
- * Gives the time in entities of ADC channels (quantization levels).
- * Absolute enrgy is found by multiplying with offline calibration constants.
- **/
-float
-AliHLTPHOSRawAnalyzer::GetEnergy()
-{
- return fDAmpl;
-} //end GetEnergy
-
-
-/**
- * Set data array. Overrides data data array set in the constructor.
- **/
-void
-AliHLTPHOSRawAnalyzer::SetData(double *data)
-{
- double *dta;
- dta = data;
- cout << "Set data not yet implemented" << endl;
-}
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: Per Thomas Hille for the ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-#include "AliPHOSFitter.h"
-#include <iostream>
-
-using std::cout;
-using std::endl;
-
-AliPHOSFitter::AliPHOSFitter()
-{
- cout <<"You cannot invoke the Fitter without arguments"<<endl;;
- fFloatDataPtr = 0;
- kfMCovarPtrPtr = 0;
- fPCovarPtrPtr = 0;
-}
-
-AliPHOSFitter::AliPHOSFitter(double *dtaPtr, double fs)
-{
- fFloatDataPtr = dtaPtr;
- fSampleFrequency = fs;
-} //end AliPHOSFitter
-
-AliPHOSFitter::~AliPHOSFitter()
-{
- delete fFloatDataPtr;
- delete kfMCovarPtrPtr;
- delete fPCovarPtrPtr;
- fFloatDataPtr = 0;
- kfMCovarPtrPtr = 0;
- fPCovarPtrPtr = 0;
-} //end AliPHOSFitter
-
-void
-AliPHOSFitter::BaselineCorrection(double *dataPtr, int N)
-{
- cout << "Baseline correction not yet implemeted" << endl;
-} //end BaselineCorrection
-
-void
-AliPHOSFitter::BaselineCorrection(double *dataPtr, double baselineValue)
-{
- cout << "Baseline correction not yet implemeted" << endl;
-} //end BaslineCorrection
-
-void
-AliPHOSFitter::FitChiSquare(int start, int lenght)
-{
- cout << "Chi square fit is not yet implemented" << endl;
-} //end FitChiSquare
-
-void
-AliPHOSFitter::FitChiSquare(int start, int lenght, double tGuess, double aGues)
-{
- cout << "Chi square fit is not yet implemented" << endl;
-} //end FitChiSquare
-
-void
-AliPHOSFitter::FitKLevel(double kLevel, int start, int lenght)
-{
- cout << "Fitting with the k-level method is not yet implemented" << endl;
-} //end FitKLevel
-
-void
-AliPHOSFitter::FitLeastMeanSquare(int start, int lenght, const double **kmCovarPtrPtr, double **pCovarPtrPtr)
-{
- cout << "Optimized least square fit is not yet implemented" << endl;
-} //end FitLeastMeanSquare
-
-void
-AliPHOSFitter::FitLeastMeanSquare(int start, int lenght, const double **kmCovarPtrPtr, double **pCovarPtrPtr, double tGuess, double aGues)
-{
- cout << "Optimized least square fit is not yet implemented" << endl;
-} //end FitLeastMeanSquare
-
-void
-AliPHOSFitter::FitPeakFinder(int start, int length, double *tVector, double *aVector)
-{
- fDTof = 0;
- fDAmpl = 0;
-
- double tmpAmpl[length];;
- double tmpTime[length];
-
- for(int i=0; i < length; i++)
- {
- fDAmpl += aVector[i]*fFloatDataPtr[i];
- }
-
- for(int i=0; i < length; i++)
- {
- tmpTime[i] = tVector[i]*fFloatDataPtr[i];
- fDTof = fDTof + tmpTime[i];
- }
-
- fDTof = fDTof/fDAmpl;
- //thats all
-} //end FitPeakFinder
-
-int
-AliPHOSFitter::FindStartIndex(double treshold)
-{
- cout << "Find Start index not yet implemented" << endl;
-} //end FindStartIndex
-
-
-float
-AliPHOSFitter::GetTiming()
-{
- double tmp;
- // tmp = (fDTof/fDAmpl);
- return fDTof;
- // return tmp;
-} //end GetTiming
-
-
-float
-AliPHOSFitter::GetEnergy()
-{
- return fDAmpl;
-} //end GetEnergy
-
-
-void
-AliPHOSFitter::SetData(double *data)
-{
- cout << "Set data not yet implemented" << endl;
-}
-
-//private section
-
-void
-AliPHOSFitter::MakeInitialGuess()
-{
- cout << "Make initial guess not yet implemeted" << endl;
-}
-
-
-void
-AliPHOSFitter::MakeInitialGuess(int treshold)
-{
- cout << "Make initial guess not yet implemeted" << endl;
-}
-
+++ /dev/null
-#ifndef ALIPHOSFITTER_H
-#define ALIPHOSFITTER_H
-/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-
-
-/**
- * The PhosFitter class is the class for extracting the basic signal parameters
- * "timing" and "energy" from the PHOS raw data. Physical data will for a given readout channel be
- * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in
- * calculation is of type double.
- **/
-class AliPHOSFitter
- {
- public:
- /**
- * Default constructor
- **/
- AliPHOSFitter();
-
- /**
- * Main constructor
- * @param dataPtr Data array for wich a subarray will be taken to perform the fit
- * @param fs the sampling frequency in entities of MHz. Needed in order to calculate physical time
- **/
- AliPHOSFitter(double *dataPtr, double fs);
-
- /**
- * Destructor
- **/
- ~AliPHOSFitter();
-
-
- /**
- * Attemps to level the basline to zero.
- * The baseline will be calculated from the pretrigger samples and subtracted from the
- * data array.
- * If pretrigger samples are not present then the basline correction will be incorrect.
- * @param dataPtr array for wich to correct the basline
- * @param N the number of pretrigger samples used to calculate the baseline.
- **/
- void BaselineCorrection(double *dataPtr, int N);
-
- /**
- * Shifts the basline with the amount given by baselineValue
- * If pretrigger samples are not present then the basline correction will be incorrect.
- * @param dataPtr array for wich to correct the basline
- * @param BaslineValue the basline value to subtract..
- **/
- void BaselineCorrection(double *dataPtr, double baselineValue);
-
- /**
- * Extraction of timing and energy using a least square fit assuming uncorrelated measurement errors.
- * This is also called a "Chi square fit". The default method is the Levenberg Marquardt nonlinear fit.
- * If the errors are correlated (which is typically the case)
- * the timing and energy will not be mimimum variance lower bound. Correlated errors might also give a
- * systematic error. The parameters "start" and "length" defines the subarray of the data array set in the
- * constructor that will be used in the fit. "start + length" cannot exeed the length of the data array.
- * The baseline must be subtracted before performing the fit othervise the result can be biased.
- * the initial guess parameters is found by the method "MakeInitialGuess".
- * @param start the start index of the subarray of the data array.
- * @param length the number of samples to use starting from index
- * @param start the start index of the subarray of the data array.
- * @param length the number of samples to use starting from index
- **/
- void FitChiSquare(int start, int lenght);
-
- /**
- * Extraction of timing and energy using a least square fit assuming uncorrelated measurement errors.
- * This is also called a "Chi square fit". The default method is the Levenberg Marquardt nonlinear fit.
- * If the errors are correlated (which is typically the case)
- * the timing and energy will not be mimimum variance lower bound. Correlated errors might also give a
- * systematic error. The parameters "start" and "length" defines the subarray of the data array set in the
- * constructor that will be used in the fit. "start + length" cannot exeed the length of the data array.
- * The baseline must be subtracted before performing the fit othervise the result can be biased.
- * A good initial guess greatly enchanes performance. A poor initial guess might give a solution that is a local
- * minima instead of a global minima. If the startindex of the pulse is the first sample above a low (2-3 ADC levels)
- * above the baseline, then the initial guess of t0 an be set to zero. A good initial guess for amplitude will
- * for a gamma 2 function be for instance (Max sample valu - baseline)*exp(2). If a Gamma N function is used
- * multiply with exp(N).
- * @param start the start index of the subarray of the data array.
- * @param length the number of samples to use starting from index
- * @param tGuess initial guess for timing (in entities of samples)
- * @param aGuess initial guess for energy in entities of (ADC channels)*exp(2) (for a gamma 2 fuction)
- **/
- void FitChiSquare(int start, int lenght, double tGuess, double aGuess);
-
- /**
- * Extraction of timing an energy using the
- * K-level method.
- * @param kLevel the K-level
- * "start" and "length" defines the subarray of the data array (set in the constructor)
- * @param start index of samples to use relative to the the data array
- * @param length the number of samples to use (starting at "start")
- **/
- void FitKLevel(double kLevel, int start, int lenght);
-
- /**
- * This method gives the statistically best possible unbiased estimate of t0 and amplitude provided that a good
- * estimate of the covariance matrix exists.
- * Extraction of timing and energy using a least square fit assuming correlated errors.
- * The user must supply the autocovariance matrix. For N number of samples this matrix
- * will be a NxN matrix.
- * The default method is the Levenberg Marquardt nonlinear fit.
- * The parameters "start" and "length" defines the subarray of the data array set in the
- * constructor that will be used in the fit. "start + length" cannot exeed the length of the data array.
- * The baseline must be subtracted before performing the fit othervise the result wil biased.
- * If the startindex of the pulse is the first sample above a low (2-3 ADC levels)
- * above the baseline, then the initial guess of t0 an be set to zero. A good initial guess for amplitude will
- * for a gamma 2 function be for instance (Max sample valu - baseline)*exp(2). If a Gamma N function is used
- * multiply with exp(N).
- * The correlation matrix for the parameters is written to the matrix pointe to by pCovar
- * @param start the start index of the subarray of the data array.
- * @param length the number of samples to use starting from "start"
- * @param kmCovarPtrPtr the measurement correlation matrix
- * @param pCovarPtrPtr the correlation matrix of the estimated parameters
- * @param tGuess initial guess of t0 in entities of sampling intervals
- * @param aGuess initial guess of the amplitude in entities of ADC levels*exp(2)
- **/
- void FitLeastMeanSquare(int start, int lenght, const double **kmCovarPtrPtr, double **pCovarPtrPtr);
-
- /**
- * This method gives the statistically best possible unbiased estimate of t0 and amplitude provided that a good
- * estimate of the covariance matrix exists.
- * For N number of samples this covariance matrix must be an NxN matrix.
- * The default method is the Levenberg Marquardt nonlinear fit.
- * The parameters "start" and "length" defines the subarray of the data array set in the
- * constructor that will be used in the fit. "start + length" cannot exeed the length of the data array.
- * The baseline must be subtracted before performing the fit othervise the result wil biased.
- * A good initial guess will greatly enchance performance.
- * a poor initial guess will slow down the algorithm and possibly lead to convergens to local minima
- * of the cost function instead of the global minima. A very bad intial guess might give divergence of the solution.
- * If the startindex of the pulse is the first sample above a low (2-3 ADC levels)
- * above the baseline, then the initial guess of t0 can be set to zero. A good initial guess for amplitude will
- * for a gamma 2 function be for instance (Max sample value - baseline)*exp(2). If a Gamma N function is used
- * multiply with exp(N).
- * @param start the start index of the subarray of the data array.
- * @param length the number of samples to use starting from index
- * @param mCovar the measurement correlation matrix
- * @param pCovar the correlation matrix of the estimated parameters
- * @param tGuess initial guess of t0 in entities of sampling intervals
- * @param aGuess initial guess of the amplitude in entities of ADC levels*exp(2)
- **/
- void FitLeastMeanSquare(int start, int lenght, const double **kmCovarPtrPtr, double **pCovarPtrPtr, double tGuess, double aGuess);
-
- /**
- * Extraction of timing and energy using the Peakfinde Algorithm.
- * The. The parameters "start" and "length" defines a sub array of the data array
- * that will be used for the the fit. If start+length must not exeed the total length
- * of the Data array. "start" must be chosen as close as possible to t0.
- * The baseline must also be subtracted.
- * The length of "tVector" and "aVector" mus be equal to length.
- * "index + length" must not exeed the length of the data array set in the constructor.
- * @param start the start index of the subarray of the data array.
- * @param length the number of samples to use starting from index
- * @param tVector the peakfinder vector for timing
- * @param aVector the peakfinder vector for amplitude (energy)
- **/
- void FitPeakFinder(int start, int lenght, double *tVector, double *aVector);
-
- /**
- * This method finds the start index of the pulse (relative to the data array) by serching for
- * three or more continious samples above trheshold.
- * @param treshold treshold to use when searchin for the start of the pulse
- **/
- int FindStartIndex(double treshold);
-
- /**
- * Gives the timing in entities of sample indexes
- * Physical time is found by multiplying with the sampling intervall (Ts).
- **/
- float GetTiming();
-
- /**
- * Gives the time in entities of ADC channels (quantization levels).
- * Absolute enrgy is found by multiplying with offline calibration constants.
- **/
- float GetEnergy();
-
- // /**
- // * Set data array. Overrrides the data array set in the constructor.
- // **/
- // void SetData(int *data);
-
- /**
- * Set data array. Overrides data data array set in the constructor.
- **/
- void SetData(double *data);
-
-
- private:
-
- /**
- * This function applies only to the Chi and Least mean square fit. An initial guess is made
- * based on the average of the first 5 samples and the first value exeeding this value.
- **/
- void MakeInitialGuess();
-
- /**
- * This function applies only to the Chi and Least mean square fit. An initial guess is made
- * based on the average of the first 5 samples and the first value exeeding threshold + this value.
- * @param treshold The index of the first value above treshold is ntaken to be the first value.
- **/
- void MakeInitialGuess(int treshold);
-
- double *fFloatDataPtr; /**<Float representation of data that should be fitted */
- double fSampleFrequency; /**<The ADC sample frequency in MHz used under data taking */
- double fTau; /**<The risetime in micro seconds*/
- double fDTof; /**<Time of flight in entities of sample intervals */
- double fDAmpl; /**<Amplitude in entities of ADC levels*/
- double fDTofGuess; /**<Initial guess for t0*/
- double fDAmplGuess; /**<Initial guess for amplitude*/
- double **kfMCovarPtrPtr; /**<Covariance matrix of the measurements*/
- double **fPCovarPtrPtr; /**<Covariance matrix of the estimated parameters*/
- };
-
-#endif
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: Per Thomas Hille for the ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-#include "AliPHOSPulseGenerator.h"
-//#include <stdio.h>
-#include <cmath>
-#include <iostream>
-
-using std::cout;
-using std::endl;
-
-AliPHOSPulseGenerator::AliPHOSPulseGenerator()
-{
- cout << "You cannot invoke the Pulsgenerator without parameters" << endl;
- fDataPtr=0;
-}
-
-AliPHOSPulseGenerator::~AliPHOSPulseGenerator()
-{
- delete fDataPtr;
- fDataPtr=0;
-}
-
-AliPHOSPulseGenerator::AliPHOSPulseGenerator(double a, double t0, int N, double t, double fs)
-{
- fDataPtr = new double[N];
- SetAmplitude(a);
- SetDT(fs);
- SetTZero(t0);
- fNSamples=N;
- fTau=t;
- fSampleFreq=fs;
- // dT=tau/fs; //Function values are calculated at intervals dT
- // fDT=1/fs; //Function values are calculated at intervals dT
- fDataPtr = new double[N];
- MakePulse(fDataPtr);
-}
-
-void
-AliPHOSPulseGenerator::AddBaseline(double baselineLevel, double *samples)
-{
- cout << "AddBaseline not implemented yet" << endl;
-}
-
-void
-AliPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma)
-{
- cout << "AddNoise is not implemented yet" << endl;
-}
-
-void
-AliPHOSPulseGenerator::AddNoise(double *dataPtr, double *sigma, double cutoff)
-{
- cout << "AddNoise is not implemeted yet" << endl;
-}
-
-
-double *
-AliPHOSPulseGenerator::AddPretriggerSamples(double baslineLevel, double *samples)
-{
- cout << "AddPretriggerSamples not implemented yet" << endl;
-}
-
-
-
-double *
-AliPHOSPulseGenerator::GetPulse()
-{
- return fDataPtr;
-}
-
-void
-AliPHOSPulseGenerator::Quantisize(double *dataPtr)
-{
- // cout << "Quantisize is not implemented yet" << endl;
-}
-
-void
-AliPHOSPulseGenerator::SetAmplitude(double a)
-{
- fAmplitude=a;
-}
-
-void
-AliPHOSPulseGenerator::SetDT(double fs)
-{
- fDT=1/fs;
-}
-
-void
-AliPHOSPulseGenerator::SetTZero(double t0)
-{
- fTZero = -t0/1000; // Since time is in nanoseconds and the samplingfrequency is in MHz -> divide by 1000
-}
-
-//private
-void
-AliPHOSPulseGenerator::MakePulse(double *dtaPtr)
-{
-
-for(int i=0; i<fNSamples; i++)
- {
- dtaPtr[i]=fAmplitude*exp(2)*pow((i*fDT-fTZero)/fTau, 2)*exp(-2*(i*fDT-fTZero)/fTau);
- }
-}
+++ /dev/null
-#ifndef ALIPHOSPULSEGENERATOR_H
-#define ALIPHOSPULSEGENERATOR_H
-/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-class AliPHOSPulseGenerator
-{
- public:
- /**
- * Default constructor
- **/
- AliPHOSPulseGenerator();
-
- /**
- * Destructor
- **/
- ~AliPHOSPulseGenerator();
-
- /**
- * Contruct a pulsegenrator object an initializes all necessary parameters
- * @param a Amplitude in ADC levels (0 -1023)
- * @param t0 Timedelay in nanoseconds of signal relative the first sample. This value should be between 0 and Ts
- * where Ts is the sample interval
- **/
- AliPHOSPulseGenerator(double a, double t0, const int N, const double t, const double f);
-
- /**
- * Adds a baseline offset to the signal
- * @param baselineLevel The basline level to add
- * @param *samples The sample array for which to add te basline offset
- **/
- void AddBaseline(double baselineLevel, double *samples);
-
- /**
- * Adds pretrigger samples to the sample array and returns
- * a new array containing the pretrigger samples concatenatet
- * in front of the samples given by "samples"
- * @param The baseline value of the pretrigger samples
- * @param The sample array for which to add the pretrigger samples
- **/
- double *AddPretriggerSamples(double baslineLevel, double *samples);
-
- /**
- * Adds Gaussian white noise to the sample array given by *dataPtr.
- * @param dataPtr array of samples
- * @param sigma the noise amplitude in entities of ADC levels
- **/
- void AddNoise(double *dataPtr, double *sigma);
-
- /**
- * Adds correlated Gaussian noise with cutof frequency "cutoff"
- * @param dataPtr array of values
- * @param sigma noise amplitude in entities of ADC levels
- * @param -30DB cutoff frequency of the noise in entities of sampling frequency
- **/
- void AddNoise(double *dataPtr, double *sigma, double cutoff);
-
- /**
- * Returns the generated pulse with the parameters given in the constructor
- **/
- double *GetPulse();
-
- /**
- * Returns a Pulse with new amplidude and t0
- * @param a new amplidude, overriding the one given in the constructor
- **/
- double *GetPulse(double a, double t0);
-
- /**
- * Emulates the ADC. Rounds down to nearest Integerevalue all entries given by
- * dataPtr
- **/
- void Quantisize(double *dataPtr);
-
- /** sets the timedelay. Take as argument the timedelay in
- * nanoseconds and sets in i entities of sample intervals
- *
- **/
-
- void SetAmplitude(double a);
- void SetDT(double fs);
- void SetTZero(double t0);
-private:
- void MakePulse(double *dtaPtr);
- void MakePulse(double *dtaPtr, double ampl);
- double fAmplitude;
- int fNSamples;
- double fTau;
- double fSampleFreq;
- double fTZero;
- double *fDataPtr;
- double fDT;
- double *fEvent;
-};
-
-#endif
-