CPulseFitter.h
//-----------------------------------------------------------------------------
// $Header$
//
// COOL Program Library
// Copyright (C) CERES collaboration, 1996
//
// Declaration of class ...
//
//-----------------------------------------------------------------------------
#ifndef CPULSEFITTER_H
#define CPULSEFITTER_H
#include "cool.h"
#include "CCyclicCollection.h"
#include "CCell.h"
#include "CSidcSetup.h"
#include "rw/tpordvec.h"
#include "CCoGPulse.h"
#include "CList.h"
class CPulseFitter {
public:
CPulseFitter(double, double, double);
~CPulseFitter();
CPulseFitter(const CPulseFitter &);
CPulseFitter & operator = (const CPulseFitter &);
CBoolean fitAndSplit(CCyclicCollection<CCell>&, CList<CCoGPulse>&, int);
void fillPulse(CCoGPulse*, double, double, double);
void testSaturation(CCyclicCollection<CCell>&, int);
protected:
int ianode, tMin, tMax;
//getMaxima
protected:
void getMaxima( CCyclicCollection<CCell>&);
void getMomenta(CCyclicCollection<CCell>&);
private:
void scanUpVicinity(CCyclicCollection<CCell>&);
void scanDownVicinity(CCyclicCollection<CCell>&);
protected:
int maxPos[20], isSaturated[20], numberOfMaxima, minRegionLength;
float maxAmp[20];
double pulseCoG, pulseRMS, pulseCMS, pulseArea ;
float derivative[256];
int lowBorder, upBorder;
float upScan[3],downScan[3];
int pup, pdown;
//gaussRegression
protected:
CBoolean param3Regression(CCyclicCollection<CCell>&, int, int);
protected:
float gussChi2, gaussSigma, gaussTime0, gaussAmpl, gaussArea;
float subtrac[256], w[256], z[256];
private:
double aa,bb,cc;
// void rejectSubtract(int* region);
//robustFit
protected:
void doDoubleFit(CCyclicCollection<CCell>&, float*, float*);
private:
void getNewAmpl(CCyclicCollection<CCell>&, float*, float*);
void getNewPos( CCyclicCollection<CCell>&, float*, float*, float*);
float calibratedPulseSigma(float);
CBoolean singlePulseMaxSigma(float, float);
protected:
float finalPos[3], finalAmpl[3], finalSigma[3];
float startSigma[3];
float newAmpl[3],newPos[3];
int numberOfIteration;
float epsilon, deltaMax, maxIterations;
float calibratedSigma0, calibratedSigma1, calibratedSigmaDeviation;
};
#endif /* CPULSEFITTER_H */