\section{marlintpc\-:\-:Pulse\-Finder Class Reference}
\label{classmarlintpc_1_1PulseFinder}\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}}


The \doxyref{Pulse\-Finder}{p.}{classmarlintpc_1_1PulseFinder} class is working horse of the Modular\-Pulse\-Finder\-Processor.  




{\ttfamily \#include $<$Pulse\-Finder.\-h$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct {\bf Internal\-Split\-Pulse}
\begin{DoxyCompactList}\small\item\em Helper class to make more sense to the splitting phase\-: actually keep track of the \char`\"{}split\char`\"{} flag. \end{DoxyCompactList}\item 
class {\bf Pulse}
\begin{DoxyCompactList}\small\item\em Helper class which combined \doxyref{Pulse\-Charge}{p.}{classmarlintpc_1_1PulseFinder_1_1PulseCharge} and \doxyref{Pulse\-Time}{p.}{classmarlintpc_1_1PulseFinder_1_1PulseTime}. \end{DoxyCompactList}\item 
class {\bf Pulse\-Charge}
\begin{DoxyCompactList}\small\item\em Helper class to store the charge and it's error. \end{DoxyCompactList}\item 
class {\bf Pulse\-Time}
\begin{DoxyCompactList}\small\item\em Helper class to store the time and it's error. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf Pulse\-Finder} (float minimum\-Pulse\-Height, int minimum\-Pulse\-Length, float pulse\-Start\-Pedestal\-Width\-Factor, float pulse\-End\-Pedestal\-Width\-Factor, float noise\-Value\-Pedestal\-Width\-Factor, {\bf Pedestal\-Listener} const $\ast$pedestal\-Listener, {\bf A\-D\-C\-Electronics\-Listener} const $\ast$adc\-Electronics\-Listener, int save\-N\-Bins\-Before\-Start=0, int save\-N\-Bins\-After\-End=0, int time\-Calculation\-Mode={\bf I\-N\-F\-L\-E\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T}, double time\-Calculation\-Parameter=0.\-9, int charge\-Calculation\-Mode={\bf S\-U\-M\-Q})
\begin{DoxyCompactList}\small\item\em The constructor. \end{DoxyCompactList}\item 
std\-::vector$<$ Tracker\-Pulse $\ast$ $>$ {\bf find\-Pulses} (Tracker\-Data $\ast$input\-Data)
\begin{DoxyCompactList}\small\item\em Create Tracker\-Pulses from the Tracker\-Data input. \end{DoxyCompactList}\item 
{\bf Pulse} {\bf calculate\-Pulse\-Time\-And\-Charge} (const E\-V\-E\-N\-T\-::\-Tracker\-Data $\ast$tracker\-\_\-data)
\begin{DoxyCompactList}\small\item\em This wrapper function handles the calculation of the pulse time and the pulse charge. \end{DoxyCompactList}\item 
void {\bf set\-Max\-A\-D\-C\-Value\-Override} (float max\-A\-D\-C\-Value)\label{classmarlintpc_1_1PulseFinder_a414597cabaa800152a2ed0250901f5a2}

\begin{DoxyCompactList}\small\item\em Set an overide value for the maximal A\-D\-C value. \end{DoxyCompactList}\item 
void {\bf set\-Pedestal\-Value\-Override} (float pedestal\-Value)\label{classmarlintpc_1_1PulseFinder_a38f2237e1be7f3dab02301162ba931af}

\begin{DoxyCompactList}\small\item\em Set an overide value for the pedestal value (in A\-D\-C counts). \end{DoxyCompactList}\item 
void {\bf set\-Pedestal\-Width\-Override} (float pedestal\-Width)\label{classmarlintpc_1_1PulseFinder_a556d21e11aaad31b77eadeee48a59d0c}

\begin{DoxyCompactList}\small\item\em Set an overide value for the pedestal width (in A\-D\-C counts). \end{DoxyCompactList}\item 
void {\bf set\-Readout\-Frequency\-Override} (float readout\-Frequency)\label{classmarlintpc_1_1PulseFinder_a889d5ddb9bcdfbd698be8d934d18d446}

\begin{DoxyCompactList}\small\item\em Set an override value for the readout frequency in M\-Hz. \end{DoxyCompactList}\item 
void {\bf set\-\_\-is\-Pedestal\-Subtracted\-Override} (bool {\bf is\-Pedestal\-Subtracted})\label{classmarlintpc_1_1PulseFinder_aac2e367bb298ebf7c504d7a1d85d0702}

\begin{DoxyCompactList}\small\item\em Set an override value whether the pedestal has been subtracted. \end{DoxyCompactList}\item 
void {\bf set\-Polarity\-Override} (int polarity)
\begin{DoxyCompactList}\small\item\em Set an override value for the polarity. \end{DoxyCompactList}\item 
void {\bf set\-Force\-Spectrum\-Save} (bool do\-Save=true)
\begin{DoxyCompactList}\small\item\em Flag whether the spectrum is always stored. \end{DoxyCompactList}\item 
void {\bf set\-Switch\-Off\-Splitting} (bool do\-Not\-Split=false)\label{classmarlintpc_1_1PulseFinder_a5cf22964e9a9ebbdd81c63905855e3cb}

\begin{DoxyCompactList}\small\item\em Flag whether to try to split pulses. \end{DoxyCompactList}\item 
void {\bf set\-Plateau\-Cut\-Off} (int max\-Plateau\-Length)
\begin{DoxyCompactList}\small\item\em Set he maximum length of a plateau allowed within a pulse in time bins. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static std\-::string {\bf get\-Revision\-Number} ()\label{classmarlintpc_1_1PulseFinder_adce6e30911472a7a688a9145e7e41e17}

\begin{DoxyCompactList}\small\item\em Log the revision number. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
static const int {\bf I\-N\-F\-L\-E\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T} = 0\label{classmarlintpc_1_1PulseFinder_ac5c6cab82b0dcd9b7c84bdcf0af840b1}

\begin{DoxyCompactList}\small\item\em Time is the inflexion point of the rising slope. \end{DoxyCompactList}\item 
static const int {\bf F\-I\-T\-\_\-\-P\-A\-R\-A\-B\-O\-L\-A} = 1\label{classmarlintpc_1_1PulseFinder_ac32f2e244a393284e0b9032b262d8ba3}

\begin{DoxyCompactList}\small\item\em Time and/or charge is determined by parabolic fit. \end{DoxyCompactList}\item 
static const int {\bf C\-E\-N\-T\-R\-E\-\_\-\-O\-F\-\_\-\-G\-R\-A\-V\-I\-T\-Y} = 2\label{classmarlintpc_1_1PulseFinder_aedc7618de9e1ccf3ca6aab6621532074}

\begin{DoxyCompactList}\small\item\em Time is the center of gravity of the charge. \end{DoxyCompactList}\item 
static const int {\bf F\-I\-R\-S\-T\-\_\-\-A\-B\-O\-V\-E\-\_\-\-T\-H\-R\-E\-S\-H\-O\-L\-D} = 3\label{classmarlintpc_1_1PulseFinder_a592c0716ce82b36f24e03444977d92b0}

\begin{DoxyCompactList}\small\item\em Time is the first sample above the start threshold. \end{DoxyCompactList}\item 
static const int {\bf A\-T\-\_\-\-M\-A\-X\-I\-M\-U\-M} = 4\label{classmarlintpc_1_1PulseFinder_afa50b78553be8714faf7a96d08b1566d}

\begin{DoxyCompactList}\small\item\em Time is the first sample at the maximum. \end{DoxyCompactList}\item 
static const int {\bf C\-O\-N\-S\-T\-A\-N\-T\-\_\-\-F\-R\-A\-C\-T\-I\-O\-N} = 5\label{classmarlintpc_1_1PulseFinder_a3f9b13a7f44ea7ba5473bb36da8ef700}

\begin{DoxyCompactList}\small\item\em Time is at the constant fraction of the maximum pulse. \end{DoxyCompactList}\item 
static const int {\bf G\-A\-M\-M\-A\-\_\-\-F\-I\-T} = 6\label{classmarlintpc_1_1PulseFinder_a8f4867ce586bf8fdaf84337b2595dfda}

\begin{DoxyCompactList}\small\item\em Time from a Gamma\-\_\-4 function fit to the pulse. \end{DoxyCompactList}\item 
static const int {\bf C\-O\-G\-\_\-\-A\-T\-M\-A\-X} = 7\label{classmarlintpc_1_1PulseFinder_ae718805f049a5428a77cc5143e186591}

\begin{DoxyCompactList}\small\item\em C\-O\-G for 2 bin range around maximum. \end{DoxyCompactList}\item 
static const int {\bf B\-O\-X} = 8\label{classmarlintpc_1_1PulseFinder_a360a9133fa0b878a8a9e97a140f71b1e}

\begin{DoxyCompactList}\small\item\em Box Method. \end{DoxyCompactList}\item 
static const int {\bf G\-A\-U\-S\-S\-I\-A\-N\-\_\-\-I\-N\-F\-L\-E\-X\-I\-O\-N} = 9\label{classmarlintpc_1_1PulseFinder_a907e3d68cc5f13fe49fefe338517fa8b}

\begin{DoxyCompactList}\small\item\em Inflexion point of a gaussian fit. \end{DoxyCompactList}\item 
static const int {\bf S\-U\-M\-Q} = 0\label{classmarlintpc_1_1PulseFinder_ab42f6955bd29b6f7de3a59841da52789}

\begin{DoxyCompactList}\small\item\em Charge is the sum of all A\-D\-C counts. \end{DoxyCompactList}\item 
static const int {\bf M\-A\-X\-Q} = 2\label{classmarlintpc_1_1PulseFinder_ad36e1f7a1ac2e62b12d3f49ba66a25c2}

\begin{DoxyCompactList}\small\item\em Charge is the maximal A\-D\-C value. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void {\bf find\-Pulse\-Candidates} (lcio\-::\-Tracker\-Data $\ast$this\-Data, std\-::vector$<$ std\-::pair$<$ lcio\-::\-Tracker\-Data\-Impl $\ast$, int $>$ $>$ $\ast$temp\-Pulse)
\begin{DoxyCompactList}\small\item\em Find pulses by threshold in the A\-D\-C information and closer inspection. \end{DoxyCompactList}\item 
void {\bf brute\-Pulse\-Search} (Tracker\-Data const $\ast$input\-Tracker\-Data, std\-::vector$<$ std\-::pair$<$ std\-::vector$<$ float $>$\-::const\-\_\-iterator, std\-::vector$<$ float $>$\-::const\-\_\-iterator $>$ $>$ $\ast$the\-Candidate\-Pulses)
\begin{DoxyCompactList}\small\item\em The first function that is called during the pulse finding, it simply looks for values above the start threshold and below the end thresholds, the start and end positions are stored by their iterators in the original Tracker\-Data A\-D\-C value vector. \end{DoxyCompactList}\item 
std\-::vector$<$ {\bf Internal\-Split\-Pulse} $>$ {\bf split\-Multiple\-Pulses} (std\-::vector$<$ std\-::pair$<$ std\-::vector$<$ float $>$\-::const\-\_\-iterator, std\-::vector$<$ float $>$\-::const\-\_\-iterator $>$ $>$ $\ast$the\-Candidate\-Pulses, float noise\-Threshold)
\begin{DoxyCompactList}\small\item\em The second part in the pulse finding process. \end{DoxyCompactList}\item 
{\bf Pulse} {\bf calculate\-Pulse\-With\-Fit} (const E\-V\-E\-N\-T\-::\-Tracker\-Data $\ast$tracker\-\_\-data)
\begin{DoxyCompactList}\small\item\em This function calculates the pulse time and charge by fitting a parabola to the log of the data surrounding the extreme point. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-With\-Gamma\-Fit} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)
\begin{DoxyCompactList}\small\item\em This function calculates the pulse time and charge by fitting a Gamma\-\_\-n to the pulse. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-Inflexion\-Point} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)
\begin{DoxyCompactList}\small\item\em Calculate the time information as the inflextion point of the rising slope. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-At\-Maximum} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)\label{classmarlintpc_1_1PulseFinder_aeafb03938ae01d0c3567ff3b4d10127c}

\begin{DoxyCompactList}\small\item\em Calculate the time information as the time of the bin with pulse maximum. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-At\-Constant\-Fraction} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)
\begin{DoxyCompactList}\small\item\em Calculate the time information as the time of crossing the threshold set by a fraction of the max. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-Centre\-Of\-Gravity} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)\label{classmarlintpc_1_1PulseFinder_af6f7aee04669ea2c7cec0d474788e737}

\begin{DoxyCompactList}\small\item\em Calculate the time information as centre of gravity. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-C\-O\-G\-At\-Maximum} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)\label{classmarlintpc_1_1PulseFinder_aaca64afca53706f7189d4ffb33858022}

\begin{DoxyCompactList}\small\item\em Calculate the time information as the cog for 2 bin range around the maximum. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-First\-Bin\-Above\-Threshold} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)\label{classmarlintpc_1_1PulseFinder_adaf03c4be202f4287391156843cedb20}

\begin{DoxyCompactList}\small\item\em Calculate the time information as the first bin above threshold. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calc\-Pulse\-Time\-Box\-Method} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)\label{classmarlintpc_1_1PulseFinder_a7a4305c9101eda3e66f38381fad08be6}

\begin{DoxyCompactList}\small\item\em Calculate the time information from the box method. \end{DoxyCompactList}\item 
{\bf Pulse\-Time} {\bf calcu\-Pulse\-Time\-Gaussian\-Inflexion} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)\label{classmarlintpc_1_1PulseFinder_a2531f48cb6a56a442fad8101a92e5fb2}

\begin{DoxyCompactList}\small\item\em Calculate the time information from the inflexion point of a gausssian fit. \end{DoxyCompactList}\item 
{\bf Pulse\-Charge} {\bf calc\-Pulse\-Charge\-Sum\-Q} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)
\begin{DoxyCompactList}\small\item\em Calculate the integrated charge of the given pulse by summing up all bins of the A\-D\-C spectrum. \end{DoxyCompactList}\item 
{\bf Pulse\-Charge} {\bf calc\-Pulse\-Charge\-Max\-Q} (const lcio\-::\-Tracker\-Data $\ast$this\-Pulse)
\begin{DoxyCompactList}\small\item\em Use the maximum value as pulse charge. \end{DoxyCompactList}\item 
float {\bf get\-Pedestal\-Value} (const int hardware\-\_\-channel, const int readout\-\_\-group)\label{classmarlintpc_1_1PulseFinder_ab49fa77721f17da900f5864938c48d80}

\begin{DoxyCompactList}\small\item\em Returns the pedestal value for a given Tracker\-Data / Tracker\-Pulse object taking into consideration whether it should be overwritten by the override parameter. \end{DoxyCompactList}\item 
float {\bf get\-Pedestal\-Width} (const int hardware\-\_\-channel, const int readout\-\_\-group)\label{classmarlintpc_1_1PulseFinder_a7749ddbe55196cb6ef1b0eff57e69f9f}

\begin{DoxyCompactList}\small\item\em Returns the pedestal width for a given Tracker\-Data / Tracker\-Pulse object taking into consideration whether it should be overwritten by the override parameter. \end{DoxyCompactList}\item 
bool {\bf is\-Pedestal\-Subtracted} (const int readout\-\_\-group)\label{classmarlintpc_1_1PulseFinder_a2724d664812430124d849a7b2d27876a}

\begin{DoxyCompactList}\small\item\em Returns if the data has been pedestal subtracted in the read-\/out electronics or not. \end{DoxyCompactList}\item 
int {\bf get\-Polarity} (const int readout\-\_\-group)\label{classmarlintpc_1_1PulseFinder_a03c970a5f380213084e5ae667a0adf5f}

\begin{DoxyCompactList}\small\item\em Returns the polarity of a Tracker\-Data / Tracker\-Pulse object taking into consideration whether is should be overwritten by the override parameter. \end{DoxyCompactList}\item 
float {\bf get\-Readout\-Frequency} (const int readout\-\_\-group)\label{classmarlintpc_1_1PulseFinder_ab35b0ac45e0cc14e8a753329f7fafc62}

\begin{DoxyCompactList}\small\item\em Returns the readout frequency of a readout group (in Mhz) taking into consideration whether it should be overwritten by the override parameter. \end{DoxyCompactList}\item 
float {\bf get\-Max\-A\-D\-C\-Value} (const int readout\-\_\-group)\label{classmarlintpc_1_1PulseFinder_ae2031ce1defc5e42c48a9373537c4851}

\begin{DoxyCompactList}\small\item\em Returns the maximum A\-D\-C value of a readout group taking into consideration whether it should be overwritten by the override parameter. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
float {\bf \-\_\-pulse\-Start\-Pedestal\-Width\-Factor}\label{classmarlintpc_1_1PulseFinder_a9f6dcc9f3d841a1de3f2a086cfb4a031}

\begin{DoxyCompactList}\small\item\em factor to calculate the start threshold \end{DoxyCompactList}\item 
float {\bf \-\_\-pulse\-End\-Pedestal\-Width\-Factor}\label{classmarlintpc_1_1PulseFinder_a85d736632f1a878d390c48fc8ceff635}

\begin{DoxyCompactList}\small\item\em factor to calculate the end threshold \end{DoxyCompactList}\item 
float {\bf \-\_\-noise\-Value\-Pedestal\-Width\-Factor}\label{classmarlintpc_1_1PulseFinder_afdfb1e4014bfc568d9f0a2ab5de55fa4}

\begin{DoxyCompactList}\small\item\em factor to calculate noise value \end{DoxyCompactList}\item 
int {\bf \-\_\-time\-Calculation\-Mode}\label{classmarlintpc_1_1PulseFinder_a7d91d8d06dd3dc3ad031efeb58b0fea0}

\begin{DoxyCompactList}\small\item\em The mode used for time calculation. \end{DoxyCompactList}\item 
int {\bf \-\_\-\-C\-O\-G\-At\-Max\-Parameter}\label{classmarlintpc_1_1PulseFinder_a4b460a36ab225696ac2a62765be5612b}

\begin{DoxyCompactList}\small\item\em parameters for time methods \end{DoxyCompactList}\item 
double {\bf \-\_\-\-Const\-Frac\-Parameter}\label{classmarlintpc_1_1PulseFinder_a13d8373999002a4c94d8de723f687134}

\begin{DoxyCompactList}\small\item\em parameters for time methods \end{DoxyCompactList}\item 
int {\bf \-\_\-charge\-Calculation\-Mode}\label{classmarlintpc_1_1PulseFinder_a076db027a504f5c53998ef3c0d1c37be}

\begin{DoxyCompactList}\small\item\em The mode used for charge calculation. \end{DoxyCompactList}\item 
float {\bf \-\_\-minimum\-Pulse\-Height}\label{classmarlintpc_1_1PulseFinder_a9d96d9af9e48b61e7371683a0b076653}

\begin{DoxyCompactList}\small\item\em minimal value for the pulse maximum in adc counts \end{DoxyCompactList}\item 
int {\bf \-\_\-minimum\-Pulse\-Length}\label{classmarlintpc_1_1PulseFinder_ab711585453b16800d2a47912356d2403}

\begin{DoxyCompactList}\small\item\em minimal length for a pulse in number of time bins \end{DoxyCompactList}\item 
int {\bf \-\_\-save\-N\-Bins\-Before\-Start}\label{classmarlintpc_1_1PulseFinder_ac55cf080df12e6123ffbe2d27309f3f8}

\begin{DoxyCompactList}\small\item\em \subsection*{of bins stored before the start threshold}\end{DoxyCompactList}\item 
int {\bf \-\_\-save\-N\-Bins\-After\-End}\label{classmarlintpc_1_1PulseFinder_a668ab7d34b3bbe501fbed0887f4479a6}

\begin{DoxyCompactList}\small\item\em \subsection*{of bins stored after the end threshold}\end{DoxyCompactList}\item 
{\bf Pedestal\-Listener} const $\ast$ {\bf \-\_\-pedestal\-Listener}\label{classmarlintpc_1_1PulseFinder_a4402f9b92786ebd8c43b5f2f422c4cd4}

\begin{DoxyCompactList}\small\item\em the recommended way of providing the access to the pedestal values\-: \end{DoxyCompactList}\item 
{\bf A\-D\-C\-Electronics\-Listener} const $\ast$ {\bf \-\_\-adc\-Electronics\-Listener}\label{classmarlintpc_1_1PulseFinder_af7c61066619761a629abab85422af029}

\begin{DoxyCompactList}\small\item\em the recommended way to access the electronics parameters \end{DoxyCompactList}\item 
bool {\bfseries \-\_\-use\-Pedestal\-Value\-Override}\label{classmarlintpc_1_1PulseFinder_a5efa0038cb62691210f2d98bb9c6f436}

\item 
bool {\bfseries \-\_\-use\-Pedestal\-Width\-Override}\label{classmarlintpc_1_1PulseFinder_a629b500d370fce942e127185cc5daef0}

\item 
bool {\bfseries \-\_\-use\-\_\-is\-Pedestal\-Subtracted\-Override}\label{classmarlintpc_1_1PulseFinder_a489f42a41d08492a4abab70beb2ab4c6}

\item 
bool {\bfseries \-\_\-use\-Polarity\-Override}\label{classmarlintpc_1_1PulseFinder_a04db9666dc38a32ec7e76d60044980aa}

\item 
bool {\bfseries \-\_\-use\-Readout\-Frequency\-Override}\label{classmarlintpc_1_1PulseFinder_a0977be83083f1d14d3a3f0ba8b420e9a}

\item 
bool {\bfseries \-\_\-use\-Max\-A\-D\-C\-Value\-Override}\label{classmarlintpc_1_1PulseFinder_a9bd04c15f57b2f47cc253bfb3681c436}

\item 
float {\bf \-\_\-maximum\-A\-D\-C\-Value\-Override}\label{classmarlintpc_1_1PulseFinder_a245edfe802277e9d9b06828de594222b}

\begin{DoxyCompactList}\small\item\em maximum adc value, needed to determine if a pulse is maxed out \end{DoxyCompactList}\item 
float {\bf \-\_\-readout\-Frequency\-Override}
\begin{DoxyCompactList}\small\item\em The readout frequency of every readout group (in M\-Hz). \end{DoxyCompactList}\item 
float {\bf \-\_\-pedestal\-Value\-Override}\label{classmarlintpc_1_1PulseFinder_a7de4bf5a832f7cc99a088458a15eeee2}

\begin{DoxyCompactList}\small\item\em The default pedestal value which is used if the pedestal\-Listener is not set. \end{DoxyCompactList}\item 
float {\bf \-\_\-pedestal\-Width\-Override}\label{classmarlintpc_1_1PulseFinder_a54391bee8e51c6a51af2493bc219b2ce}

\begin{DoxyCompactList}\small\item\em The default pedestal width which is used if the pedestal\-Listener is not set. \end{DoxyCompactList}\item 
bool {\bf \-\_\-is\-Pedestal\-Subtracted\-Override}
\begin{DoxyCompactList}\small\item\em Sets, if the data is already pedestal subtracted in the read-\/out electronics. \end{DoxyCompactList}\item 
int {\bf \-\_\-polarity\-Override}\label{classmarlintpc_1_1PulseFinder_a30213bb8fb51b783c674448c5bf263ea}

\begin{DoxyCompactList}\small\item\em the polarity of all readout groups, overrides L\-C\-C\-D \end{DoxyCompactList}\item 
bool {\bf \-\_\-force\-Spectrum\-Save}\label{classmarlintpc_1_1PulseFinder_a631b993bb1b4194393935dc007513d8e}

\begin{DoxyCompactList}\small\item\em flag whether to always save the spectrum \end{DoxyCompactList}\item 
bool {\bf \-\_\-switch\-Off\-Splitting}\label{classmarlintpc_1_1PulseFinder_a635d2a3c88f12a539b6493aabdb04b1b}

\begin{DoxyCompactList}\small\item\em flag whether to try to split pulses \end{DoxyCompactList}\item 
int {\bf \-\_\-max\-Plateau\-Length}\label{classmarlintpc_1_1PulseFinder_a7fefb1550c0b16480b11dd684b524524}

\begin{DoxyCompactList}\small\item\em The maximum length of a plateau within a pulse in time bins. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
class {\bfseries Pulse\-Finder\-Tester}\label{classmarlintpc_1_1PulseFinder_a7c02e4edefa6977d41d26179ce18f0ff}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \doxyref{Pulse\-Finder}{p.}{classmarlintpc_1_1PulseFinder} class is working horse of the Modular\-Pulse\-Finder\-Processor. 

It contains the finding and splitting algorithms which are used in the processor. This allows for unit testing of the methods which is not possible if they are members of the processor, as processors cannot be instantiated outside of Marlin.

First the pulses are searched using a threshold based method, where the start and end thresholds are calculated from the pedestal widths and the Pedestal\-Width\-Factor parameters. Then these candidates are further processed by splitting multiple pulses. In a last step quality flags are assigned to account for
\begin{DoxyItemize}
\item multiple pulses (changed shape/charge information)
\item overflows, where the A\-D\-C values are saturated
\item anomalous shape, currently only pulses with a long plateau which has been cut off
\item whether a pulse has been split
\end{DoxyItemize}

There are different modes to calculate the pulse time or the pulse charge\-:

\doxyref{Pulse}{p.}{classmarlintpc_1_1PulseFinder_1_1Pulse} charge\-: \begin{DoxyItemize}
\item S\-U\-M\-Q The sum of all A\-D\-C values on the pulse (the default value). \item F\-I\-T\-\_\-\-P\-A\-R\-A\-B\-O\-L\-A Parabolic fit around the maximum of the pulse. \item M\-A\-X\-Q The maximal A\-D\-C value in the pulse.\end{DoxyItemize}
\doxyref{Pulse}{p.}{classmarlintpc_1_1PulseFinder_1_1Pulse} time\-: \begin{DoxyItemize}
\item I\-N\-F\-E\-L\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T The infexion point on the rising slope (the default value). (In fact it is the C\-O\-G of the derivatives. Is this really the infelxion point? M\-K) \item F\-I\-T\-\_\-\-P\-A\-R\-A\-B\-O\-L\-A Parabolic fit around the maximum of the pulse. \item C\-E\-N\-T\-R\-E\-\_\-\-O\-F\-\_\-\-G\-R\-A\-V\-I\-T\-Y The centre of grafity of all charge in the pulse. \item F\-I\-R\-S\-T\-\_\-\-A\-B\-O\-V\-E\-\_\-\-T\-H\-R\-E\-S\-H\-O\-L\-D The first value abve the threshold. This method has a jitter and a walk due to threshold effects \item A\-T\-\_\-\-M\-A\-X\-I\-M\-U\-M Time of the sample with the maximumal value in the pulse. \item C\-O\-N\-S\-T\-A\-N\-T\-\_\-\-F\-R\-A\-C\-T\-I\-O\-N Signal crossing at a constant fraction of the maximal pulse height. \item G\-A\-M\-M\-A\-\_\-\-F\-I\-T Fits a Gamma\-\_\-4 function to the pulses \item C\-O\-G\-\_\-\-A\-T\-M\-A\-X Center of gravity around maximum.\end{DoxyItemize}
parameter for time methods\-: (default 0.\-9 for constant fraction)
\begin{DoxyItemize}
\item fraction for constant fraction,
\item no. of neighboring bins for center of gravity at maxbin
\end{DoxyItemize}

By default also the initial Tracker\-Data (=A\-D\-C) spectrum is stored. By setting the {\ttfamily force\-Sectrum\-Save} flag to false one can choose to store the spectrum only when one of the quality flags is set. This feature is always on.

\begin{DoxyAuthor}{Author}
Ch. Rosemann, D\-E\-S\-Y (original author of the methods) 

Martin Killenberg (implementation as a separate class) 
\end{DoxyAuthor}


\subsection{Constructor \& Destructor Documentation}
\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!Pulse\-Finder@{Pulse\-Finder}}
\index{Pulse\-Finder@{Pulse\-Finder}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{Pulse\-Finder}]{\setlength{\rightskip}{0pt plus 5cm}marlintpc\-::\-Pulse\-Finder\-::\-Pulse\-Finder (
\begin{DoxyParamCaption}
\item[{float}]{minimum\-Pulse\-Height, }
\item[{int}]{minimum\-Pulse\-Length, }
\item[{float}]{pulse\-Start\-Pedestal\-Width\-Factor, }
\item[{float}]{pulse\-End\-Pedestal\-Width\-Factor, }
\item[{float}]{noise\-Value\-Pedestal\-Width\-Factor, }
\item[{{\bf Pedestal\-Listener} const $\ast$}]{pedestal\-Listener, }
\item[{{\bf A\-D\-C\-Electronics\-Listener} const $\ast$}]{adc\-Electronics\-Listener, }
\item[{int}]{save\-N\-Bins\-Before\-Start = {\ttfamily 0}, }
\item[{int}]{save\-N\-Bins\-After\-End = {\ttfamily 0}, }
\item[{int}]{time\-Calculation\-Mode = {\ttfamily {\bf I\-N\-F\-L\-E\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T}}, }
\item[{double}]{time\-Calculation\-Parameter = {\ttfamily 0.9}, }
\item[{int}]{charge\-Calculation\-Mode = {\ttfamily {\bf S\-U\-M\-Q}}}
\end{DoxyParamCaption}
)}\label{classmarlintpc_1_1PulseFinder_acb899dab40071890f3c27eea4b3d7252}


The constructor. 


\begin{DoxyParams}{Parameters}
{\em minimum\-Pulse\-Height} & The minimum pulse height in adc count \\
\hline
{\em minimum\-Pulse\-Length} & The minimum pulse length in time samples\\
\hline
{\em pulse\-Start\-Pedestal\-Width\-Factor} & The start threshold is calculated as pulse\-Start\-Pedestal\-Width\-Factor $\ast$ pedestal\-Width.  pedestal should be added if not already subtracted\\
\hline
{\em pulse\-End\-Pedestal\-Width\-Factor} & The end threshold is calculated as pulse\-End\-Pedestal\-Width\-Factor $\ast$ pedestal\-Width.  pedestal should be added if not already subtracted\\
\hline
{\em Noise\-Value\-Pedestal\-Width\-Factor} & The noise value is calculated as noise\-Value\-Pedestal\-Width\-Factor $\ast$ pedestal\-Width.\\
\hline
{\em pedestal\-Listener} & Pointer to the pedestal listener. If you do not have a pedestal listener you can set it to N\-U\-L\-L. In this case you have to provide override parameters for pedestal\-Value and pedestal\-Width.\\
\hline
{\em adc\-Electronics\-Listener} & Pointer to the electronics listener. If you do not have an electronics listener you can set it to N\-U\-L\-L. In this case you have to provide override values for maximum\-A\-D\-C\-Value, readout\-Frequency, is\-Pedestal\-Subtracted and polarity.\\
\hline
{\em save\-N\-Bins\-Before\-Start} & Store n bins before the first bin which is above the start threshold (default 0).\\
\hline
{\em save\-N\-Bins\-After\-End} & Store n bins after the last bin which is above the end threshold (default 0).\\
\hline
{\em time\-Calculation\-Mode} & The mode used to calculate the pulse time (default I\-N\-F\-E\-L\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T)\\
\hline
{\em time\-Calculation\-Parameter} & parameter for time methods\-: fraction for constant fraction, no. of neighboring bins for center of gravity at maxbin (default 0.\-9 for constant fraction)\\
\hline
{\em charge\-Calculation\-Mode} & The mode used to calculate the pulse charge (default S\-U\-M\-Q). \\
\hline
\end{DoxyParams}


References \-\_\-charge\-Calculation\-Mode, \-\_\-\-C\-O\-G\-At\-Max\-Parameter, \-\_\-\-Const\-Frac\-Parameter, \-\_\-time\-Calculation\-Mode, A\-T\-\_\-\-M\-A\-X\-I\-M\-U\-M, B\-O\-X, C\-E\-N\-T\-R\-E\-\_\-\-O\-F\-\_\-\-G\-R\-A\-V\-I\-T\-Y, C\-O\-G\-\_\-\-A\-T\-M\-A\-X, C\-O\-N\-S\-T\-A\-N\-T\-\_\-\-F\-R\-A\-C\-T\-I\-O\-N, F\-I\-R\-S\-T\-\_\-\-A\-B\-O\-V\-E\-\_\-\-T\-H\-R\-E\-S\-H\-O\-L\-D, F\-I\-T\-\_\-\-P\-A\-R\-A\-B\-O\-L\-A, G\-A\-M\-M\-A\-\_\-\-F\-I\-T, G\-A\-U\-S\-S\-I\-A\-N\-\_\-\-I\-N\-F\-L\-E\-X\-I\-O\-N, I\-N\-F\-L\-E\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T, M\-A\-X\-Q, and S\-U\-M\-Q.



\subsection{Member Function Documentation}
\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!brute\-Pulse\-Search@{brute\-Pulse\-Search}}
\index{brute\-Pulse\-Search@{brute\-Pulse\-Search}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{brute\-Pulse\-Search}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pulse\-Finder\-::brute\-Pulse\-Search (
\begin{DoxyParamCaption}
\item[{Tracker\-Data const $\ast$}]{input\-Tracker\-Data, }
\item[{std\-::vector$<$ std\-::pair$<$ std\-::vector$<$ float $>$\-::const\-\_\-iterator, std\-::vector$<$ float $>$\-::const\-\_\-iterator $>$ $>$ $\ast$}]{the\-Candidate\-Pulses}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_a27b2a1b9428898df0a0618df08e5a4fb}


The first function that is called during the pulse finding, it simply looks for values above the start threshold and below the end thresholds, the start and end positions are stored by their iterators in the original Tracker\-Data A\-D\-C value vector. 

Here already pulses which are too short are suppressed. 
\begin{DoxyParams}{Parameters}
{\em A\-D\-C\-Spectrum} & the A\-D\-C spectrum to be searched \\
\hline
{\em the\-Candidate\-Pulses} & a vector of the pairs of start and end positions of the pulse candidates (as iterators) \\
\hline
\end{DoxyParams}


References \-\_\-minimum\-Pulse\-Height, \-\_\-minimum\-Pulse\-Length, \-\_\-pulse\-End\-Pedestal\-Width\-Factor, \-\_\-pulse\-Start\-Pedestal\-Width\-Factor, get\-Pedestal\-Width(), and get\-Polarity().



Referenced by find\-Pulse\-Candidates(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calc\-Pulse\-Charge\-Max\-Q@{calc\-Pulse\-Charge\-Max\-Q}}
\index{calc\-Pulse\-Charge\-Max\-Q@{calc\-Pulse\-Charge\-Max\-Q}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calc\-Pulse\-Charge\-Max\-Q}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse\-Charge} marlintpc\-::\-Pulse\-Finder\-::calc\-Pulse\-Charge\-Max\-Q (
\begin{DoxyParamCaption}
\item[{const lcio\-::\-Tracker\-Data $\ast$}]{this\-Pulse}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_a580fbb86220e74eff481bc9018753557}


Use the maximum value as pulse charge. 

F\-I\-X\-M\-E\-: Does not use polarity. I think negative polarity does not work anyway from reading the rest of the code. (M\-K) 

References get\-Max\-A\-D\-C\-Value(), get\-Pedestal\-Value(), get\-Pedestal\-Width(), get\-Polarity(), and is\-Pedestal\-Subtracted().



Referenced by calculate\-Pulse\-Time\-And\-Charge(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calc\-Pulse\-Charge\-Sum\-Q@{calc\-Pulse\-Charge\-Sum\-Q}}
\index{calc\-Pulse\-Charge\-Sum\-Q@{calc\-Pulse\-Charge\-Sum\-Q}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calc\-Pulse\-Charge\-Sum\-Q}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse\-Charge} marlintpc\-::\-Pulse\-Finder\-::calc\-Pulse\-Charge\-Sum\-Q (
\begin{DoxyParamCaption}
\item[{const lcio\-::\-Tracker\-Data $\ast$}]{this\-Pulse}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_abadd2eb15e8f560b3580223969c673d1}


Calculate the integrated charge of the given pulse by summing up all bins of the A\-D\-C spectrum. 

The polarity of the pulse is taken into acount 
\begin{DoxyParams}{Parameters}
{\em this\-Pulse} & A\-D\-C spectrum for charge calculation \\
\hline
\end{DoxyParams}


References get\-Pedestal\-Width(), and get\-Polarity().



Referenced by calculate\-Pulse\-Time\-And\-Charge(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calc\-Pulse\-Time\-At\-Constant\-Fraction@{calc\-Pulse\-Time\-At\-Constant\-Fraction}}
\index{calc\-Pulse\-Time\-At\-Constant\-Fraction@{calc\-Pulse\-Time\-At\-Constant\-Fraction}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calc\-Pulse\-Time\-At\-Constant\-Fraction}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse\-Time} marlintpc\-::\-Pulse\-Finder\-::calc\-Pulse\-Time\-At\-Constant\-Fraction (
\begin{DoxyParamCaption}
\item[{const lcio\-::\-Tracker\-Data $\ast$}]{this\-Pulse}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_aa819debbaad9160a4694f12e3861ed81}


Calculate the time information as the time of crossing the threshold set by a fraction of the max. 

charge in a pulse. 

References \-\_\-\-Const\-Frac\-Parameter, get\-Polarity(), and get\-Readout\-Frequency().



Referenced by calculate\-Pulse\-Time\-And\-Charge().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calc\-Pulse\-Time\-Inflexion\-Point@{calc\-Pulse\-Time\-Inflexion\-Point}}
\index{calc\-Pulse\-Time\-Inflexion\-Point@{calc\-Pulse\-Time\-Inflexion\-Point}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calc\-Pulse\-Time\-Inflexion\-Point}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse\-Time} marlintpc\-::\-Pulse\-Finder\-::calc\-Pulse\-Time\-Inflexion\-Point (
\begin{DoxyParamCaption}
\item[{const lcio\-::\-Tracker\-Data $\ast$}]{this\-Pulse}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_ae2dfe3bf8e90475139012c71e296f0cf}


Calculate the time information as the inflextion point of the rising slope. 

This is the default way. 

References \-\_\-noise\-Value\-Pedestal\-Width\-Factor, get\-Pedestal\-Width(), get\-Polarity(), and get\-Readout\-Frequency().



Referenced by calculate\-Pulse\-Time\-And\-Charge(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calc\-Pulse\-Time\-With\-Gamma\-Fit@{calc\-Pulse\-Time\-With\-Gamma\-Fit}}
\index{calc\-Pulse\-Time\-With\-Gamma\-Fit@{calc\-Pulse\-Time\-With\-Gamma\-Fit}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calc\-Pulse\-Time\-With\-Gamma\-Fit}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse\-Time} marlintpc\-::\-Pulse\-Finder\-::calc\-Pulse\-Time\-With\-Gamma\-Fit (
\begin{DoxyParamCaption}
\item[{const lcio\-::\-Tracker\-Data $\ast$}]{this\-Pulse}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_ace2ef69740eabbf4c94479c7b645acc9}


This function calculates the pulse time and charge by fitting a Gamma\-\_\-n to the pulse. 


\begin{DoxyParams}{Parameters}
{\em data} & the pulse data \\
\hline
\end{DoxyParams}


References get\-Readout\-Frequency().



Referenced by calculate\-Pulse\-Time\-And\-Charge().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calculate\-Pulse\-Time\-And\-Charge@{calculate\-Pulse\-Time\-And\-Charge}}
\index{calculate\-Pulse\-Time\-And\-Charge@{calculate\-Pulse\-Time\-And\-Charge}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calculate\-Pulse\-Time\-And\-Charge}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse} marlintpc\-::\-Pulse\-Finder\-::calculate\-Pulse\-Time\-And\-Charge (
\begin{DoxyParamCaption}
\item[{const E\-V\-E\-N\-T\-::\-Tracker\-Data $\ast$}]{tracker\-\_\-data}
\end{DoxyParamCaption}
)}\label{classmarlintpc_1_1PulseFinder_a9f822fe33c63176afbe5eb071362d930}


This wrapper function handles the calculation of the pulse time and the pulse charge. 

They are combined into one function because it is faster to calculate both values at the same time if the fit method is used. It can also be modified to add new methods of calculating these values without modifying the main event loop. New addition\-: errors on all the values! Convention\-: first time and time error, then charge and charge error 
\begin{DoxyParams}{Parameters}
{\em data} & the pulse data \\
\hline
\end{DoxyParams}


References \-\_\-charge\-Calculation\-Mode, \-\_\-time\-Calculation\-Mode, A\-T\-\_\-\-M\-A\-X\-I\-M\-U\-M, B\-O\-X, calc\-Pulse\-Charge\-Max\-Q(), calc\-Pulse\-Charge\-Sum\-Q(), calc\-Pulse\-Time\-At\-Constant\-Fraction(), calc\-Pulse\-Time\-At\-Maximum(), calc\-Pulse\-Time\-Box\-Method(), calc\-Pulse\-Time\-Centre\-Of\-Gravity(), calc\-Pulse\-Time\-C\-O\-G\-At\-Maximum(), calc\-Pulse\-Time\-First\-Bin\-Above\-Threshold(), calc\-Pulse\-Time\-Inflexion\-Point(), calc\-Pulse\-Time\-With\-Gamma\-Fit(), calculate\-Pulse\-With\-Fit(), calcu\-Pulse\-Time\-Gaussian\-Inflexion(), C\-E\-N\-T\-R\-E\-\_\-\-O\-F\-\_\-\-G\-R\-A\-V\-I\-T\-Y, C\-O\-G\-\_\-\-A\-T\-M\-A\-X, C\-O\-N\-S\-T\-A\-N\-T\-\_\-\-F\-R\-A\-C\-T\-I\-O\-N, F\-I\-R\-S\-T\-\_\-\-A\-B\-O\-V\-E\-\_\-\-T\-H\-R\-E\-S\-H\-O\-L\-D, F\-I\-T\-\_\-\-P\-A\-R\-A\-B\-O\-L\-A, G\-A\-M\-M\-A\-\_\-\-F\-I\-T, G\-A\-U\-S\-S\-I\-A\-N\-\_\-\-I\-N\-F\-L\-E\-X\-I\-O\-N, I\-N\-F\-L\-E\-X\-I\-O\-N\-\_\-\-P\-O\-I\-N\-T, M\-A\-X\-Q, and S\-U\-M\-Q.



Referenced by find\-Pulses().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!calculate\-Pulse\-With\-Fit@{calculate\-Pulse\-With\-Fit}}
\index{calculate\-Pulse\-With\-Fit@{calculate\-Pulse\-With\-Fit}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{calculate\-Pulse\-With\-Fit}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pulse\-Finder\-::\-Pulse} marlintpc\-::\-Pulse\-Finder\-::calculate\-Pulse\-With\-Fit (
\begin{DoxyParamCaption}
\item[{const E\-V\-E\-N\-T\-::\-Tracker\-Data $\ast$}]{tracker\-\_\-data}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_a912349d49f1c5d5fd03cb0a9251b12bb}


This function calculates the pulse time and charge by fitting a parabola to the log of the data surrounding the extreme point. 


\begin{DoxyParams}{Parameters}
{\em data} & the pulse data \\
\hline
\end{DoxyParams}


References get\-Polarity(), and get\-Readout\-Frequency().



Referenced by calculate\-Pulse\-Time\-And\-Charge(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!find\-Pulse\-Candidates@{find\-Pulse\-Candidates}}
\index{find\-Pulse\-Candidates@{find\-Pulse\-Candidates}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{find\-Pulse\-Candidates}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pulse\-Finder\-::find\-Pulse\-Candidates (
\begin{DoxyParamCaption}
\item[{lcio\-::\-Tracker\-Data $\ast$}]{this\-Data, }
\item[{std\-::vector$<$ std\-::pair$<$ lcio\-::\-Tracker\-Data\-Impl $\ast$, int $>$ $>$ $\ast$}]{temp\-Pulse}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_a17ee71e094846d32e6284092db0340e6}


Find pulses by threshold in the A\-D\-C information and closer inspection. 

This is the somewhat \char`\"{}master\char`\"{} function that determines all aspects of the pulses, it calls some further functions for easier reading. 
\begin{DoxyParams}{Parameters}
{\em this\-Data} & 'raw' data as Tracker\-Data \\
\hline
{\em temp\-Pulse} & a helper data construct, a pair of the Tracker\-Data of a pulse and the quality bit \\
\hline
{\em noise\-Value} & the width of the pedestal \\
\hline
\end{DoxyParams}


References \-\_\-max\-Plateau\-Length, \-\_\-minimum\-Pulse\-Height, \-\_\-minimum\-Pulse\-Length, \-\_\-noise\-Value\-Pedestal\-Width\-Factor, \-\_\-save\-N\-Bins\-After\-End, \-\_\-save\-N\-Bins\-Before\-Start, brute\-Pulse\-Search(), get\-Max\-A\-D\-C\-Value(), get\-Pedestal\-Value(), get\-Pedestal\-Width(), get\-Polarity(), is\-Pedestal\-Subtracted(), and split\-Multiple\-Pulses().



Referenced by find\-Pulses(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!find\-Pulses@{find\-Pulses}}
\index{find\-Pulses@{find\-Pulses}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{find\-Pulses}]{\setlength{\rightskip}{0pt plus 5cm}std\-::vector$<$ Tracker\-Pulse $\ast$ $>$ marlintpc\-::\-Pulse\-Finder\-::find\-Pulses (
\begin{DoxyParamCaption}
\item[{Tracker\-Data $\ast$}]{input\-Data}
\end{DoxyParamCaption}
)}\label{classmarlintpc_1_1PulseFinder_a0e25a6c7ab67526dcf2d64d5d1c41748}


Create Tracker\-Pulses from the Tracker\-Data input. 

It uses find\-Pulse\-Candidates and composes Tracker\-Pulse objects out of the Tracker\-Data.

All Tracker\-Pulses and the contained Tracker\-Data objects have been created on the heap. Do not forget to store them in a collection or delete them to avoid memory leaks!

\begin{DoxyAttention}{Attention}
When storing the pulses do not forget to store the tracker data objects they contain to a collection! Check for N\-U\-L\-L before adding to the collection! 
\end{DoxyAttention}


References \-\_\-force\-Spectrum\-Save, calculate\-Pulse\-Time\-And\-Charge(), and find\-Pulse\-Candidates().



Referenced by marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!set\-Force\-Spectrum\-Save@{set\-Force\-Spectrum\-Save}}
\index{set\-Force\-Spectrum\-Save@{set\-Force\-Spectrum\-Save}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{set\-Force\-Spectrum\-Save}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pulse\-Finder\-::set\-Force\-Spectrum\-Save (
\begin{DoxyParamCaption}
\item[{bool}]{do\-Save = {\ttfamily true}}
\end{DoxyParamCaption}
)}\label{classmarlintpc_1_1PulseFinder_a13bac4346f7dfe18819a86ff7fe76c2e}


Flag whether the spectrum is always stored. 

By default this only happend if the quality word is not 0. 

References \-\_\-force\-Spectrum\-Save.



Referenced by marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!set\-Plateau\-Cut\-Off@{set\-Plateau\-Cut\-Off}}
\index{set\-Plateau\-Cut\-Off@{set\-Plateau\-Cut\-Off}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{set\-Plateau\-Cut\-Off}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pulse\-Finder\-::set\-Plateau\-Cut\-Off (
\begin{DoxyParamCaption}
\item[{int}]{max\-Plateau\-Length}
\end{DoxyParamCaption}
)}\label{classmarlintpc_1_1PulseFinder_a31f30f7642a852c650a8445a2ac36639}


Set he maximum length of a plateau allowed within a pulse in time bins. 

This used to cut off strange pulses that go into a plateau. 

References \-\_\-max\-Plateau\-Length.



Referenced by marlintpc\-::\-Pulse\-Finder\-Tester\-::\-Pulse\-Finder\-Tester().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!set\-Polarity\-Override@{set\-Polarity\-Override}}
\index{set\-Polarity\-Override@{set\-Polarity\-Override}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{set\-Polarity\-Override}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pulse\-Finder\-::set\-Polarity\-Override (
\begin{DoxyParamCaption}
\item[{int}]{polarity}
\end{DoxyParamCaption}
)}\label{classmarlintpc_1_1PulseFinder_a13917137970b1e32b2d9bdbb8ba60dd9}


Set an override value for the polarity. 

It should be +1 or -\/1. 

References \-\_\-polarity\-Override.



Referenced by marlintpc\-::\-Pulse\-Finder\-Tester\-::\-Pulse\-Finder\-Tester().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!split\-Multiple\-Pulses@{split\-Multiple\-Pulses}}
\index{split\-Multiple\-Pulses@{split\-Multiple\-Pulses}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{split\-Multiple\-Pulses}]{\setlength{\rightskip}{0pt plus 5cm}vector$<$ {\bf Pulse\-Finder\-::\-Internal\-Split\-Pulse} $>$ marlintpc\-::\-Pulse\-Finder\-::split\-Multiple\-Pulses (
\begin{DoxyParamCaption}
\item[{std\-::vector$<$ std\-::pair$<$ std\-::vector$<$ float $>$\-::const\-\_\-iterator, std\-::vector$<$ float $>$\-::const\-\_\-iterator $>$ $>$ $\ast$}]{the\-Candidate\-Pulses, }
\item[{float}]{noise\-Threshold}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_aaef2a4df5e2be35a1fdb6471bf64cef0}


The second part in the pulse finding process. 

Check the pulse candidates for possible multiple pulses by looking more closely at the A\-D\-C spectrum. Then replace the /old/ pairs of start/end iterators with the appropriate new number of pairs. T\-O\-D\-O\-: adjust the charges in the bins at the joined boundary of the split pulses 
\begin{DoxyParams}{Parameters}
{\em the\-Candidate\-Pulses} & a vector of the pairs of start and end positions of the pulse candidates (as iterators) \\
\hline
{\em noise\-Threshold} & Threshold to avoid splitting at minima caused by noise on flat signals. The threshold has to be given here because it cannot be determined from the cell\-I\-D as only iterators are given to this function. \\
\hline
\end{DoxyParams}


References \-\_\-switch\-Off\-Splitting.



Referenced by find\-Pulse\-Candidates(), and marlintpc\-::\-Pulse\-Finder\-Tester\-::run\-All\-Tests().



\subsection{Member Data Documentation}
\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!\-\_\-is\-Pedestal\-Subtracted\-Override@{\-\_\-is\-Pedestal\-Subtracted\-Override}}
\index{\-\_\-is\-Pedestal\-Subtracted\-Override@{\-\_\-is\-Pedestal\-Subtracted\-Override}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{\-\_\-is\-Pedestal\-Subtracted\-Override}]{\setlength{\rightskip}{0pt plus 5cm}bool marlintpc\-::\-Pulse\-Finder\-::\-\_\-is\-Pedestal\-Subtracted\-Override\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_aac49a2da595f728b7d10e7b625a3af25}


Sets, if the data is already pedestal subtracted in the read-\/out electronics. 

This overrides any information provided by L\-C\-C\-D 

Referenced by is\-Pedestal\-Subtracted(), and set\-\_\-is\-Pedestal\-Subtracted\-Override().

\index{marlintpc\-::\-Pulse\-Finder@{marlintpc\-::\-Pulse\-Finder}!\-\_\-readout\-Frequency\-Override@{\-\_\-readout\-Frequency\-Override}}
\index{\-\_\-readout\-Frequency\-Override@{\-\_\-readout\-Frequency\-Override}!marlintpc::PulseFinder@{marlintpc\-::\-Pulse\-Finder}}
\subsubsection[{\-\_\-readout\-Frequency\-Override}]{\setlength{\rightskip}{0pt plus 5cm}float marlintpc\-::\-Pulse\-Finder\-::\-\_\-readout\-Frequency\-Override\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PulseFinder_a2bad5ee2f7a3b274812ff1dd7352fda2}


The readout frequency of every readout group (in M\-Hz). 

This overrides any information provided by L\-C\-C\-D 

Referenced by get\-Readout\-Frequency(), and set\-Readout\-Frequency\-Override().



The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
Pulse\-Finder.\-h\item 
Pulse\-Finder.\-cc\end{DoxyCompactItemize}
