// // File : FastPulseFinder.hh // // Purpose: Declaration of the class FastPulseFinder // // $Id: FastPulseFinder.hh 9725 2010-09-28 07:31:17Z mathes $ // /** @file FastPulseFinder.hh * Declaration of the partly abstract base class FastPulseFinder. * @author H.-J. Mathes, FzK */ #ifndef _FastPulseFinder_hh_ #define _FastPulseFinder_hh_ #include #include #include #include // --- forward declaration(s) class TFADCData; /** Class which implements a 'fast' pulse finding algorithm using the extra * trigger bit which is available in each single FADC data word. */ class FastPulseFinder : public VPulseFinder { public: /** Maximum number of pulses which could be found by this pulse finder. */ static const UInt_t kNMaxPulses = 5; public: /** Constructor of the class FastPulseFinder. All internal variables are * set to 0 and the minimum pulse length is set to 1. */ FastPulseFinder(); // //! Destructor of the class FastPulseFinder. // ~FastPulseFinder() { } /** Create and return a copy of the present object. */ VPulseFinder* Clone(const char *newname="") const { VPulseFinder* v = new FastPulseFinder( *this ); v->SetName( newname ); return v; } /** Find one or more pulses from analysing the trigger bit of the FADC * data. * * Up to kNMaxPulses could be found. The longest pulse will be * returned as first pulse, i.e. the pulses will be sorted according * to their length. * * The methods which return the characteristics of individual pulses * don't check the passed index arguments against the number of pulses * reconstructed or against the maximum number of pulses which could be * reconstructed. */ void FindPulse(TFADCData*); public: // getters /** Get the number of pulses reconstructed by the pulse finder. */ int GetNPulses() { return fNPulses; } /** Get the length of the i-th pulse. * * If i is not specified, the value for the first pulse is returned. */ int GetPulseLength(int i = 0) { return fPulseLength[i]; } /** Get the (charge) integral of the i-th pulse. * * As this pulse finder should be more considered to be a trigger finder, * pulse integrals cannot be provided. So we always return the constand * value 0. */ float GetPulseIntegral(int) { return 0; } /** Get the pulse start position (in ADC channels) for the i-th pulse. */ int GetPulseStart(int i = 0) { return fPulseStart[i]; } /** Return kTRUE, if the pulse finder found at least one pulse. */ Bool_t PulseFound() { return ( fNPulses > 0 ) ? kTRUE : kFALSE; } public: // setters /** Set the debug print level, the higher the level, the more output. * * We have: * @li debug >= 1 : print only results * @li debug >= 2 : print intermediate results * @li debug >= 3 : print almost everything */ static void SetDebugLevel(UInt_t debug = 1) { fgDebugLevel = debug; } /** Set the minimum length of a pulse which is to be accepted by this * pulse finder. */ void SetMinPulseLength(UInt_t min_length) { fMinPulseLength = min_length; } protected: /** Sort all pulses found according to their pulse length. */ void Sort() { FD_CERR << "FastPulseFinder::Sort() not implemented !" << std::endl; } private: static unsigned int fgDebugLevel; // debug print level unsigned int fMinPulseLength; unsigned int fNPulses; // number of pulses found unsigned int fPulseLength[kNMaxPulses]; unsigned int fPulseStart[kNMaxPulses]; }; #endif // _FastPulseFinder_hh_