// // File : PFPedro.hh // // Purpose: Declaration of the class PFPedro // // $Id: PFPedro.hh 9725 2010-09-28 07:31:17Z mathes $ // /** @file PFPedro.hh * Declaration of the pulse finder class PFPedro. * @author P. Facal, INFN Rome, H.-J. Mathes, FzK */ #ifndef _PFPedro_hh_ #define _PFPedro_hh_ #include // --- forward declaration(s) class TFADCData; /** The class PFPedro implements the pulse finding algorithm used bei P.Facal, * INFN Rome for the SunFlower display software. * * The strategy is to * @li calculate a threshold by integrating first over all ADC bins * @li the to lower this threshold subsequently in order to find pulses * @li finally the pulse with the largest integral is taken * * The original algorithm was modified to be able to work also with * reduced length ADC traces. * * Adjustable parameters: * @li kMaxPulses = maximum number of pulses per FADC trace * @li kCalculationStart = start of statistics calculation ahead of pulse (times 100 ns) * @li kCalculationEnd = end of statistics calculation ahead of pulse (times 100 ns) * @li kMinPulseLength = minimum pulse length (times 100 ns) * @li kTriggerThreshold = 3.4 (originally) */ class PFPedro : public VPulseFinder { public: /** Maximum number of pulses which can be handled by this class. */ static const int kMaxPulses = 20; /** Minimum pulse length (times 100 ns). Note: Pedro has used 8. */ static const int kMinPulseLength = 6; /** The trigger threshold for the pulse finding. */ static const float kTriggerThreshold; /** Constructor of the class PFPedro. The internal variables are * initialized to default values. */ PFPedro(); /** Destructor of the class PFPedro. */ ~PFPedro(); /** Create and return a copy of the present object. */ virtual VPulseFinder* Clone(const char *newname="") const { VPulseFinder *v = new PFPedro( *this ); v->SetName( newname ); return v; } /** Try to find pulses and calculate their characteristics. */ void FindPulse(TFADCData*); // --- getters ... /** Get the number of pulses reconstructed by the pulse finder. */ int GetNPulses() { return fNPulses; } /** Get the length of the i-th pulse in ADC channels. * * If i is not specified, the value for the first pulse is returned * which is often (but not always) the largest pulse. */ int GetPulseLength(int i = 0) { return fPulseLength[i]; } /** Get the (charge) integral of the i-th pulse. */ float GetPulseIntegral(int i = 0) { return fPulseIntegral[i]; } /** Get the pulse start position (in ADC channels) for the i-th pulse. */ int GetPulseStart(int i) { return fPulseStart[i]; } /** Return true, if the pulse finder found at least one pulse. */ bool PulseFound() { return (fNPulses > 0) ? 1 : 0; } /** Set the minimum length required to detect a pulse (times 100 ns). */ void SetMinPulseLength(int m_length) { fMinPulseLength = m_length; } // --- setters /** Set the verbose print level, the higher the level, the more output. * We have: * @li level >= 1 : print final results * @li level >= 2 : print intermediate results * @li level >= 3 : print almost everything */ static void SetPrintLevel(unsigned int level = 1) { fgPrintLevel = level; } protected: /** Calculate the integral of the pulse (needs pedestal info). */ void CalculatePulseIntegral(); /** Calculate the pedestal and its variance. Called by FindPulse(). */ void CalculateStatistic(TFADCData*); /** Init internal variables to some default values. */ void Clear(Option_t *o=""); private: static unsigned int fgPrintLevel; // verbose print level unsigned int fBinWidthFactor; // bin width dep. factor: 1,2 or 4 int fNPulses; // number of pulses found int fPulseLength[kMaxPulses]; // pulse length float fPulseIntegral[kMaxPulses]; // pulse integrals int fPulseStart[kMaxPulses]; // pulse start bins int fNMaxPulse; // index of largest pulse int fNMaxPulseIntegral; float fMaxPulseIntegral; int fMinPulseLength; // minimum pulse legth required int fPulseTime[kMaxPulses]; // takes time stamp into account }; #endif // _PFPedro_hh_