CFEL - ASG Software Suite  2.5.0
CASS
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
cass::pp112 Class Reference

cfd analysis of waveform More...

#include <waveform.h>

+ Inheritance diagram for cass::pp112:
+ Collaboration diagram for cass::pp112:

Public Member Functions

 pp112 (const name_t &name)
 constructor More...
 
virtual void process (const CASSEvent &, result_t &)
 copy the last waveform from the channel More...
 
virtual void loadSettings (size_t)
 load the settings of this pp More...
 
- Public Member Functions inherited from cass::Processor
 Processor (const name_t &name)
 constructor More...
 
virtual ~Processor ()
 virtual destructor More...
 
virtual void processEvent (const CASSEvent &event)
 process the event More...
 
virtual const result_tresult (const CASSEvent::id_t eventid=0)
 retrieve a result for a given id. More...
 
virtual void releaseEvent (const CASSEvent &event)
 tell the list that the result for event can be overwritten More...
 
result_t::shared_pointer resultCopy (const uint64_t eventid)
 retrieve histogram for id More...
 
virtual void load ()
 load the general settings More...
 
virtual void aboutToQuit ()
 function that will be called when the processor is about to be deleted More...
 
const names_tdependencies ()
 Define all processors keys a processor depends on. More...
 
void clearDependencies ()
 clear the dependenies More...
 
void clearHistograms ()
 clear the histograms More...
 
virtual void processCommand (std::string command)
 process command in pp More...
 
const name_t name () const
 retrieve the name of this processor More...
 
bool hide () const
 retrieve the hide flag of this processor More...
 
const std::string & comment () const
 retrieve the comment of this processor More...
 

Protected Types

enum  ColumnNames {
  position = 0, height = 1, maxpos = 2, fwhm = 3,
  startpos = 4, endpos = 5, integral = 6, width = 7,
  polarity = 8, CoM = 9, nbrOf
}
 enum describing the contents of the resulting table More...
 
typedef result_t::storage_t table_t
 definition of the table More...
 
typedef std::pair< float, float > fitparam_t
 define the fitparameters More...
 
typedef std::pair< float, float > point_t
 define a point More...
 
typedef std::vector< point_tpoints_t
 define points More...
 

Protected Member Functions

fitparam_t linearRegression (points_t::const_iterator first, points_t::const_iterator last)
 make a linear regression through points More...
 
void createNewtonPolynomial (const float *x, const float *y, float *coeff)
 create Newton Polynomial More...
 
float evalNewtonPolynomial (const float *x, const float *coeff, float X)
 evaluate Newton Polynomial More...
 
float findXForGivenY (const float *x, const float *coeff, const float Y, const float Start)
 Achims Numerical Approximation. More...
 
- Protected Member Functions inherited from cass::Processor
virtual void createHistList (result_t::shared_pointer result)
 create result list. More...
 
void setupGeneral ()
 general setup of the processor More...
 
bool setupCondition (bool defaultConditionType=true)
 setup the condition. More...
 
shared_pointer setupDependency (const std::string &depVarName, const name_t &name="")
 setup the dependecy. More...
 

Protected Attributes

shared_pointer _waveform
 the Processor that contains the waveform to convert More...
 
size_t _delay
 the delay in bins More...
 
float _fraction
 the fraction More...
 
float _walk
 the walk in volts More...
 
float _threshold
 the threshold More...
 
float _baseline
 the baseline More...
 
- Protected Attributes inherited from cass::Processor
const name_t _name
 the processors name More...
 
bool _hide
 flag to tell whether this pp should be hidden in the dropdown list More...
 
std::string _comment
 optional comment that one can add to a processor. More...
 
CachedList _resultList
 the list of results More...
 
names_t _dependencies
 the list of dependencies More...
 
shared_pointer _condition
 pointer to the processor that will contain the condition More...
 

Additional Inherited Members

- Public Types inherited from cass::Processor
typedef std::tr1::shared_ptr< Processorshared_pointer
 a shared pointer of this More...
 
typedef std::string name_t
 define the name type More...
 
typedef std::list< name_tnames_t
 define the list of names More...
 
typedef CachedList::item_type result_t
 define the results More...
 
typedef CachedList::item_sp resultsp_t
 define the shared pointer to the result More...
 

Detailed Description

cfd analysis of waveform

Available PostProcessors:
"112": cfd analysis of waveform
See also
Processor for a list of all commonly available cass.ini settings.
User definable Parameters:

Processor/%name%/{Waveform}
The name of the Processor containing the waveform that should be converted. Default is 'Unknown'

Processor/%name%/{Delay}
Delay in units of the input x-axis is used. Default is 5.

Processor/%name%/{Fraction}
Fraction used. Default is 0.6

Processor/%name%/{Threshold}
threshold in units of the y-axis. Default is 0.1

Processor/%name%/{Walk}
walk in units of the y-axis. Default is 0.

Author
Lutz Foucar

Definition at line 138 of file waveform.h.

Member Typedef Documentation

typedef std::pair<float,float> cass::pp112::fitparam_t
protected

define the fitparameters

Definition at line 172 of file waveform.h.

typedef std::pair<float,float> cass::pp112::point_t
protected

define a point

Definition at line 175 of file waveform.h.

typedef std::vector<point_t> cass::pp112::points_t
protected

define points

Definition at line 178 of file waveform.h.

definition of the table

Definition at line 152 of file waveform.h.

Member Enumeration Documentation

enum cass::pp112::ColumnNames
protected

enum describing the contents of the resulting table

Enumerator
position 
height 
maxpos 
fwhm 
startpos 
endpos 
integral 
width 
polarity 
CoM 
nbrOf 

Definition at line 155 of file waveform.h.

Constructor & Destructor Documentation

pp112::pp112 ( const name_t name)

constructor

Definition at line 198 of file waveform.cpp.

References loadSettings().

Member Function Documentation

void pp112::createNewtonPolynomial ( const float *  x,
const float *  y,
float *  coeff 
)
protected

create Newton Polynomial

This function creates the coefficients for Newton interpolating Polynomials. Newton Polynomials are created from n Points and have the form $p(x) = c_0 + c_1(x-x_0) + c_2(x-x_0)(x-x_1)+...+c_{n-1}(x-x_0)(x-x_1)...(x-x_{n-2})$ given that you have n Points $(x_0,y_0), (x_1,y_1), ..., (x_{n-1},y_{n-1})$ Here we do it for 4 Points.

Parameters
[in]xthe x-values of the points
[in]ythe y-values of the points
[out]coeffthe coefficients of the newton polynomial

Definition at line 257 of file waveform.cpp.

Referenced by process().

float pp112::evalNewtonPolynomial ( const float *  x,
const float *  coeff,
float  X 
)
protected

evaluate Newton Polynomial

this function evaluates the Newton Polynomial that was created from n Points $(x_0,y_0),..., (x_{n-1},y_{n-1}) with coefficients (c_0,...,c_{n-1})$ using Horner's Rule. This is done for an polynomial with 4 entries

Returns
the newton polynomial
Parameters
[in]xarray of x values
[in]coeffarray of coefficients
[in]X

Definition at line 274 of file waveform.cpp.

Referenced by findXForGivenY().

float pp112::findXForGivenY ( const float *  x,
const float *  coeff,
const float  Y,
const float  Start 
)
protected

Achims Numerical Approximation.

this function should find x value corrosponding to a given y value in a newton polynomial. It does it the following way:

  1. create a lower and upper boundary point
  2. create an interating x-value and initialize it with the Start value
  3. evaluate the y-value at the x-value
  4. if the y value is bigger than the requested value the start point is defines the new upper or lower boundary depending on the slope.
  5. the new x-point is defined by the arithmetic mean between the tow boundary points.
  6. do points 3-5 until the new x-value does not differ more than 0.005 from the old one.
Parameters
[in]xtwo points describing upper and lower boundaries
[in]coeffthe newton polynomial coefficents
[in]Ythe requested y-values to find the x-value for
[in]Startthe x-value we start the search with

initialize the boundaries

intialize the starting value

right value? then return the correspoinding x value

find the type of crossing

if its a negative crossing, and the y-value is bigger than the requested then point is the new lower boundary. If the y-value is smaller than the requested value, then the value is the new upper boundary. If we hit the spot, return the corresponding x-value

if its a positive crossing, and the y-value is bigger than the requested then point is the new upper boundary. If the y-value is smaller than the requested value, then the value is the new lower boundary. If we hit the spot, return the corresponding x-value

find new boundaries until the difference between the x-values of the boundaries is samller than 0.005

the new x value is the arithmetic mean between the two boundaries and determines the new x-values to be checked (with the corresponding y-value)

if its a negative crossing, and the y-value is bigger than the requested then point is the new lower boundary. If the y-value is smaller than the requested value, then the value is the new upper boundary. If we hit the spot, return the corresponding x-value

if its a positive crossing, and the y-value is bigger than the requested then point is the new upper boundary. If the y-value is smaller than the requested value, then the value is the new lower boundary. If we hit the spot, return the corresponding x-value

return the arithmentic mean between the two boundaries

Definition at line 284 of file waveform.cpp.

References evalNewtonPolynomial().

Referenced by process().

pp112::fitparam_t pp112::linearRegression ( points_t::const_iterator  first,
points_t::const_iterator  last 
)
protected

make a linear regression through points

Returns
the constant and the slope
Parameters
pointsvector containing the x,y coordintas of the points

Definition at line 238 of file waveform.cpp.

Referenced by process().

void pp112::loadSettings ( size_t  )
virtual
void pp112::process ( const CASSEvent evt,
result_t result 
)
virtual

copy the last waveform from the channel

clear the resulting table to fill it with the values of this image

get a table row that we can later add to the table

calculate the constant fraction at i

calculate the constant fraction at i+1

check wether the criteria for a Peak are fullfilled: one point above one below the walk original point above the threshold

it could be that the first criteria is 0 because one of the Constant Fraction Signal Points or both are exactly where the walk is

both points are on the walk: go to next loop until at least one is over or under the walk

only first is on walk: this is what we want, so do nothing

only second is on walk: we want that the first point will be on the walk so in the next loop iteration this point will be the first

check the polarity

if two pulses are close together then the cfsignal goes through the walk three times, where only two crossings are good. So we need to check for the one where it is not good

negative polarity, but positive Puls -> skip

positive polarity, but negative Puls -> skip

to find the position of the crossing more precisely we need two more points, so create them here

calculate the constant fraction at i+1

calculate the constant fraction at i+2

find x with a linear interpolation between the two points

make a linear regression to find the slope of the leading edge

Find x with a cubic polynomial interpolation between four points do this with the Newtons interpolation Polynomial. Numericaly solve the Newton Polynomial, give the linear approach for x as Start Value

add info of the peak

go left from center until either i == 0, or the datapoint is inside the noise or we go from the previous one (i+1) to the actual one (i) through the baseline

go right form center until either i < pulslength, or the datapoint is inside the noise or we go from the previous one (i-1) to the actual one (i) through the baseline

go through whole peak and determine the integral and center of mass, while finding the maximum.

determine the fwhm of the peak with linear regression

go from maxpos to left until last point that is above 0.5*height

go from maxpos to right until last point that is above 0.5*height

make linear regression through 4 points

add peak to table

Reimplemented from cass::Processor.

Definition at line 374 of file waveform.cpp.

References _baseline, _delay, _fraction, _threshold, _walk, _waveform, cass::Result< T >::appendRows(), cass::Result< T >::axis(), CoM, createNewtonPolynomial(), endpos, findXForGivenY(), cass::fuzzycompare(), fwhm, height, cass::CASSEvent::id(), integral, linearRegression(), cass::Result< T >::lock, maxpos, nbrOf, polarity, position, cass::Result< T >::resetTable(), cass::Result< T >::shape(), startpos, width, cass::ACQIRIS::x, cass::Result< float >::xAxis, and cass::ACQIRIS::y.

Member Data Documentation

float cass::pp112::_baseline
protected

the baseline

Definition at line 253 of file waveform.h.

Referenced by process().

size_t cass::pp112::_delay
protected

the delay in bins

Definition at line 241 of file waveform.h.

Referenced by loadSettings(), and process().

float cass::pp112::_fraction
protected

the fraction

Definition at line 244 of file waveform.h.

Referenced by loadSettings(), and process().

float cass::pp112::_threshold
protected

the threshold

Definition at line 250 of file waveform.h.

Referenced by loadSettings(), and process().

float cass::pp112::_walk
protected

the walk in volts

Definition at line 247 of file waveform.h.

Referenced by loadSettings(), and process().

shared_pointer cass::pp112::_waveform
protected

the Processor that contains the waveform to convert

Definition at line 238 of file waveform.h.

Referenced by loadSettings(), and process().


The documentation for this class was generated from the following files: