\section{marlintpc\-:\-:Pedestal\-Calculator Class Reference}
\label{classmarlintpc_1_1PedestalCalculator}\index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}}


Calculates the pedestals out of raw data.  




{\ttfamily \#include $<$Pedestal\-Calculator.\-h$>$}

Inheritance diagram for marlintpc\-:\-:Pedestal\-Calculator\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classmarlintpc_1_1PedestalCalculator}
\end{center}
\end{figure}
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct {\bf Channel\-Pedestal}
\begin{DoxyCompactList}\small\item\em Structure to store the pedestal of a channel and other needed informations during internal calculations. \end{DoxyCompactList}\item 
struct {\bf Stc\-Pedestal}
\begin{DoxyCompactList}\small\item\em Structure to store pedestal value and width. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual Processor $\ast$ {\bfseries new\-Processor} ()\label{classmarlintpc_1_1PedestalCalculator_a26b1d0a8f91f7a028b36e30b31c5f79b}

\item 
virtual void {\bf init} ()
\begin{DoxyCompactList}\small\item\em Called at the begin of the job before anything is read. \end{DoxyCompactList}\item 
virtual void {\bf process\-Run\-Header} (lcio\-::\-L\-C\-Run\-Header $\ast$run)\label{classmarlintpc_1_1PedestalCalculator_ae4113aa3968ab94cce7adc554a7bbb1b}

\begin{DoxyCompactList}\small\item\em Called for every run. \end{DoxyCompactList}\item 
virtual void {\bf process\-Event} (lcio\-::\-L\-C\-Event $\ast$evt)
\begin{DoxyCompactList}\small\item\em Called for every event -\/ the working horse. \end{DoxyCompactList}\item 
virtual void {\bfseries check} (lcio\-::\-L\-C\-Event $\ast$evt)\label{classmarlintpc_1_1PedestalCalculator_a39e35a9f67e1df639280d7bd3a528d37}

\item 
virtual void {\bf end} ()\label{classmarlintpc_1_1PedestalCalculator_aed2b934ff3f84ef5cf36169c30384bdf}

\begin{DoxyCompactList}\small\item\em Called after data processing for clean up. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Types}
\begin{DoxyCompactItemize}
\item 
typedef std\-::vector\\*
$<$ {\bf Stc\-Pedestal} $\ast$ $>$ {\bf Pedestal\-Vector\-\_\-t}
\begin{DoxyCompactList}\small\item\em Typedef\-: vector to store pedestal data. \end{DoxyCompactList}\item 
typedef std\-::map$<$ std\-::pair\\*
$<$ int, int $>$, {\bf Channel\-Pedestal} $\ast$ $>$ {\bf Pedestal\-Map\-\_\-t}
\begin{DoxyCompactList}\small\item\em Typedef\-: Map to store the pedestal data during calculation. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf Stc\-Pedestal} $\ast$ {\bf calc\-Pedestal} (Float\-Vec $\ast$Data)
\begin{DoxyCompactList}\small\item\em Claculates the pedestal mean and width from raw data. \end{DoxyCompactList}\item 
virtual void {\bf calc\-Average} ({\bf Channel\-Pedestal} $\ast$this\-Channel\-Pedestal)
\begin{DoxyCompactList}\small\item\em Calculates average of pedestals of different events of a channel. \end{DoxyCompactList}\item 
virtual void {\bf Create\-Pedestal\-Collection} ({\bf Pedestal\-Map\-\_\-t} $\ast$this\-Channel\-Pedestal\-Collection)\label{classmarlintpc_1_1PedestalCalculator_a0882e998e9b25595fd6ebd1edee9470f}

\begin{DoxyCompactList}\small\item\em Creates an L\-C\-Collection\-Vector of Pedestals and fills it with the calculated pedestals. \end{DoxyCompactList}\item 
virtual void {\bf print\-Pedestal} ({\bf Pedestal\-Map\-\_\-t} $\ast$this\-Channel\-Pedestal\-Collection)\label{classmarlintpc_1_1PedestalCalculator_a396eedd6b77f90637caa922beabdeca3}

\begin{DoxyCompactList}\small\item\em Write the pedestal to the std output. \end{DoxyCompactList}\item 
virtual void {\bf print\-Pedestal\-Short} ({\bf Pedestal\-Map\-\_\-t} $\ast$this\-Channel\-Pedestal\-Collection)\label{classmarlintpc_1_1PedestalCalculator_a0b5a7e55cfd92489dc72ae2629c692e9}

\begin{DoxyCompactList}\small\item\em Writes a summery of the pedestals to the std output. \end{DoxyCompactList}\item 
virtual void {\bfseries print\-Pedestal} (L\-C\-Collection $\ast$this\-Collection)\label{classmarlintpc_1_1PedestalCalculator_af1b6bac05ea60bcfc3e0f58c9ce6e3d1}

\item 
virtual void {\bf make\-L\-C\-C\-D\-Data} ()\label{classmarlintpc_1_1PedestalCalculator_ab71932d8545b9b09b9724b0ee1837417}

\begin{DoxyCompactList}\small\item\em Converts the pedestal information to \doxyref{Pedestal objects }{p.}{classtpcconddata_1_1Pedestal} and stores them into an L\-C\-Collection Vector. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
{\bf Pedestal\-Map\-\_\-t} $\ast$ {\bf \-\_\-\-Pedestal\-Map}\label{classmarlintpc_1_1PedestalCalculator_a880663c9ffcb37ed300336794fa1e2fa}

\begin{DoxyCompactList}\small\item\em Map to store the pedestals internally during the calculation. \end{DoxyCompactList}\item 
std\-::pair$<$ int, int $>$ {\bf \-\_\-\-Channel\-Pair}\label{classmarlintpc_1_1PedestalCalculator_a971c768ab7fd2102121866a4f44292ea}

\begin{DoxyCompactList}\small\item\em Channel identifier, pair of two integers (first one for the pad and second one for the readout group) \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-input\-Col\-Name}\label{classmarlintpc_1_1PedestalCalculator_aee359a703af86bfd216190092191fed0}

\begin{DoxyCompactList}\small\item\em Name of the input collection. \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-pedestal\-Col\-Name}\label{classmarlintpc_1_1PedestalCalculator_a76343651a6c4fdae57e8fa6d0841d529}

\begin{DoxyCompactList}\small\item\em Name of the pedestal collection. \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-simple\-File\-Name}\label{classmarlintpc_1_1PedestalCalculator_a3d97a458129ea9358fd1bf50dd097a9e}

\begin{DoxyCompactList}\small\item\em Name of the simple file where the pedestal collection should be stored (optional) \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-db\-Folder}\label{classmarlintpc_1_1PedestalCalculator_a8a5e8b4b558e5a1d01b00653c9dc522d}

\begin{DoxyCompactList}\small\item\em Name of the folder, where the pedestal collection should be stored in the database (optional) \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-db\-Init\-String}\label{classmarlintpc_1_1PedestalCalculator_a0ab194ff1149f948ddc14e3e9111852e}

\begin{DoxyCompactList}\small\item\em D\-B\-Init String (optional, can also be provided by evironment varibale) \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-conditions\-Tag}\label{classmarlintpc_1_1PedestalCalculator_a455432e33284edd08bc9c185331a7b60}

\begin{DoxyCompactList}\small\item\em Tag of the conditions data that should be stored. \end{DoxyCompactList}\item 
int {\bf \-\_\-write\-Every\-N\-Events}\label{classmarlintpc_1_1PedestalCalculator_ade0cc93ab2b2476587f1db2387d27ae9}

\begin{DoxyCompactList}\small\item\em Calculate and write the calculated pedestals after this number of events. \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-valid\-From}\label{classmarlintpc_1_1PedestalCalculator_a7c7edc6c91990fcabea3036f9cf79021}

\begin{DoxyCompactList}\small\item\em Time from when the calculated pedestals will be valid (is stored in the database). \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-valid\-Till}\label{classmarlintpc_1_1PedestalCalculator_a8d92c7e6527d14a37bbd61d5408f26b6}

\begin{DoxyCompactList}\small\item\em Time till when the calculated pedestals will be valid (is stored in the database). \end{DoxyCompactList}\item 
int {\bf \-\_\-calculation\-Iterations}\label{classmarlintpc_1_1PedestalCalculator_ae142dc45557168df30892e6a4ff3f01a}

\begin{DoxyCompactList}\small\item\em How many times the calculation iterates over the raw data vector. \end{DoxyCompactList}\item 
int {\bf \-\_\-ignore\-Surrounding}\label{classmarlintpc_1_1PedestalCalculator_ab991b8533bf2e21a0d04837ff4131a40}

\begin{DoxyCompactList}\small\item\em \subsection*{time slices before and after the currend slice must not be a signal.}\end{DoxyCompactList}\item 
float {\bf \-\_\-init\-Calc\-Width}\label{classmarlintpc_1_1PedestalCalculator_a5b20317088f2a174fa69e7c312c285c9}

\begin{DoxyCompactList}\small\item\em Start value for the pedestal width for the calculation. \end{DoxyCompactList}\item 
double {\bf \-\_\-precision}\label{classmarlintpc_1_1PedestalCalculator_abe1e5d7998de72b999ec90ca7ca3e07c}

\begin{DoxyCompactList}\small\item\em Precision of pedestal calculation. \end{DoxyCompactList}\item 
double {\bf \-\_\-signal\-Threshold}\label{classmarlintpc_1_1PedestalCalculator_ab45e4c2c9ea6071eda86ad0aac1635ba}

\begin{DoxyCompactList}\small\item\em Data time slice is considered a signal during calculation iteration, if is bigger than signal\-Threshold $\ast$ pedestal width. \end{DoxyCompactList}\item 
bool {\bf \-\_\-make\-Run\-Number\-Folder}\label{classmarlintpc_1_1PedestalCalculator_a1b1ed62eb2eff0ad5c13518903833529}

\begin{DoxyCompactList}\small\item\em parameter if sub-\/folder named by run number should be automatically added to the database folder \end{DoxyCompactList}\item 
int {\bfseries \-\_\-\-N\-Run}\label{classmarlintpc_1_1PedestalCalculator_aa52fd669dbcfb925acfdfc118197f07e}

\item 
int {\bfseries \-\_\-\-N\-Evt}\label{classmarlintpc_1_1PedestalCalculator_a7c4186e3841efba24a6aa27a5f58c1d1}

\item 
lcio\-::long64 {\bfseries \-\_\-valid\-From\-Int}\label{classmarlintpc_1_1PedestalCalculator_a588df1cb3eb07c44875aa169cdb6a7b4}

\item 
lcio\-::long64 {\bfseries \-\_\-valid\-Till\-Int}\label{classmarlintpc_1_1PedestalCalculator_a25a18f8ecbc1db7a221e271f50f46d27}

\item 
lcio\-::long64 {\bfseries \-\_\-last\-Since\-Time}\label{classmarlintpc_1_1PedestalCalculator_a02441e309882375cd8fed5a97c135e34}

\item 
lcio\-::long64 {\bfseries \-\_\-last\-Event\-Time}\label{classmarlintpc_1_1PedestalCalculator_adfa9c577c749983c5a12e04509c45688}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Calculates the pedestals out of raw data. 

This processor calculates the channel pedestals out of measurement raw data. The signals are filtered out and the pedestal values and widths are calculated from the remaining A\-D\-C spectrum. Usually, one thousand events are enough to make a decent calculation. The processor writes the pedestal in every case at the end of the input and always when a new run header comes. In addition the parameter Write\-Every\-N\-Events can be set so that after a certain amount of events a new collection will be written. After the calculation the \doxyref{Pedestal objects }{p.}{classtpcconddata_1_1Pedestal} are stored in a L\-C\-Collection\-Vector and stored as L\-C\-C\-D data. 
\begin{DoxyParams}{Parameters}
{\em Input\-Col\-Name} & Name of\-Name for the input colletion the input colletion (string, default=\char`\"{}\-T\-P\-C\-Converted\-Raw\-Data\char`\"{}) \\
\hline
{\em Pedestal\-Collection\-Name} & Name of the collection containing the pedestals. (string, default\-: \char`\"{}\-T\-P\-C\-Pedestal\char`\"{}) \\
\hline
{\em Simple\-File\-Name} & Name of the simple L\-C\-I\-O file the pedestals should be written to (without\-: .slcio !). If this is set, the processor will write the $\ast$pedestal calculation results to a simple L\-C\-I\-O file in a collection. The name given here will be expanded by the run numbers (as given in the run header) and if Write\-Every\-N\-Events is set in addition by a 3 digit counting variable. Also the file name extension \char`\"{}.\-slcio\char`\"{} will be automatically added (optional, string) \\
\hline
{\em D\-B\-Folder} & Folder in the database where the pedestals will be written to. This is an optional parameter. if it is set, the skript will try to write the results to a database. If not and the simple file option is not chossen, the data will not be written after the calculation. (optional string, default \char`\"{}test/pedestals\char`\"{}) \\
\hline
{\em D\-B\-Init\-String} & Init spring for the connection to the database. This parameter is optional. If you do not set it, the environment variable \$\-L\-C\-C\-D\-\_\-\-D\-B\-\_\-\-I\-N\-I\-T should be set to the database details, since in this case this processor tries to get the parameters then from there. The string (either as parameter or as environment variable) should have the form \char`\"{}\-D\-B\-\_\-\-H\-O\-S\-T\-:\-D\-B\-\_\-\-N\-A\-M\-E\-:\-D\-B\-\_\-\-U\-S\-E\-R\-:\-P\-A\-S\-S\-W\-D\char`\"{}. (string, optional, no default) \\
\hline
{\em Conditions\-Tag} & This parameter sets the tag of the conditions data you are writing. If not set, no tagging will be performed (optional, string, default\-: \char`\"{}1.\-0\char`\"{}) \\
\hline
{\em Write\-Every\-N\-Events} & This parameter gives the option to write the calculated pedestals every N events, if set to -\/1 the pedestals will be calculated and written after all events in the input file(s) have been read. (integer, default\-: -\/1) \\
\hline
{\em Valid\-From} & This optional parameter sets the time the conditions data will be valid from in the conditions database. If not set, the time of the first event will be taken at the validuity start time. (lcio\-::long64) \\
\hline
{\em Valid\-Till} & This optional parameter sets the time the conditions data will be valid till in the conditions database. If not set, the time of the last event will be taken at the validuity end time. (lcio\-::long64) \\
\hline
{\em Calculation\-Iterations} & How many times the calculation iterates over the raw data vector. (integer, default\-: 5) \\
\hline
{\em Ignore\-Surrounding} & \# time slices before and after the currend slice must not be a signal. (integer, default\-: 5) \\
\hline
{\em Init\-Calc\-Width} & Start value for the pedestal width for the calculation. (float, default\-: 512.\-0) \\
\hline
{\em Precision} & Precision of pedestal calculation. (double, default\-: 1.\-0\-E-\/5) \\
\hline
{\em Signal\-Threshold} & Data time slice is considered a signal during calculation iteration, if is bigger than signal\-Threshold $\ast$ pedestal width. (double, default\-: 5.\-0) \\
\hline
{\em Make\-Run\-Number\-Folder} & If true, a sub-\/folder named like the run number will be created in the database folder D\-B\-Folder. The pedestals are then stored in this folder for this run (bool, default\-: false) \\
\hline
\end{DoxyParams}
\begin{DoxyAuthor}{Author}
M. E. Janssen (D\-E\-S\-Y), R. Diener (D\-E\-S\-Y) 
\end{DoxyAuthor}


\subsection{Member Typedef Documentation}
\index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}!Pedestal\-Map\-\_\-t@{Pedestal\-Map\-\_\-t}}
\index{Pedestal\-Map\-\_\-t@{Pedestal\-Map\-\_\-t}!marlintpc::PedestalCalculator@{marlintpc\-::\-Pedestal\-Calculator}}
\subsubsection[{Pedestal\-Map\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef std\-::map$<$ std\-::pair$<$int, int$>$, {\bf Channel\-Pedestal}$\ast$ $>$ {\bf marlintpc\-::\-Pedestal\-Calculator\-::\-Pedestal\-Map\-\_\-t}\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PedestalCalculator_af3d68653de7209e162aa22b046a901ef}


Typedef\-: Map to store the pedestal data during calculation. 

Typedef of a map of Channel\-Pedestals to store the pedestal data during the calculation. The key is a pair of integers, first entry\-: channel I\-D, second\-: readout group. The \doxyref{Channel\-Pedestal}{p.}{structmarlintpc_1_1PedestalCalculator_1_1ChannelPedestal} struct contains\-: channel and readout group I\-D, a data vector (for A\-D\-C counts), a Pedestal\-Vector\-\_\-t and tow structs for the average of the pedestal value and width and the error of the average values \index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}!Pedestal\-Vector\-\_\-t@{Pedestal\-Vector\-\_\-t}}
\index{Pedestal\-Vector\-\_\-t@{Pedestal\-Vector\-\_\-t}!marlintpc::PedestalCalculator@{marlintpc\-::\-Pedestal\-Calculator}}
\subsubsection[{Pedestal\-Vector\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef std\-::vector$<${\bf Stc\-Pedestal}$\ast$$>$ {\bf marlintpc\-::\-Pedestal\-Calculator\-::\-Pedestal\-Vector\-\_\-t}\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PedestalCalculator_af87aac56ceafd7dc7d6955477303c983}


Typedef\-: vector to store pedestal data. 

Typedef to store the pedestal (the \doxyref{Stc\-Pedestal}{p.}{structmarlintpc_1_1PedestalCalculator_1_1StcPedestal} struct contains the mean and the width of the pedestal) in a vector 

\subsection{Member Function Documentation}
\index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}!calc\-Average@{calc\-Average}}
\index{calc\-Average@{calc\-Average}!marlintpc::PedestalCalculator@{marlintpc\-::\-Pedestal\-Calculator}}
\subsubsection[{calc\-Average}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pedestal\-Calculator\-::calc\-Average (
\begin{DoxyParamCaption}
\item[{{\bf Channel\-Pedestal} $\ast$}]{this\-Channel\-Pedestal}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}\label{classmarlintpc_1_1PedestalCalculator_a6a751d2c5b1d96ffdf5376115d76da8d}


Calculates average of pedestals of different events of a channel. 

Calculates the average of the values for mean and width of the pedestal of the given structure and save it in this structure. 

References marlintpc\-::\-Pedestal\-Calculator\-::\-Channel\-Pedestal\-::\-Average, marlintpc\-::\-Pedestal\-Calculator\-::\-Channel\-Pedestal\-::\-Average\-Error, marlintpc\-::\-Pedestal\-Calculator\-::\-Stc\-Pedestal\-::\-Mean, marlintpc\-::\-Pedestal\-Calculator\-::\-Channel\-Pedestal\-::\-Pedestal\-Col, and marlintpc\-::\-Pedestal\-Calculator\-::\-Stc\-Pedestal\-::\-Width.

\index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}!calc\-Pedestal@{calc\-Pedestal}}
\index{calc\-Pedestal@{calc\-Pedestal}!marlintpc::PedestalCalculator@{marlintpc\-::\-Pedestal\-Calculator}}
\subsubsection[{calc\-Pedestal}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Pedestal\-Calculator\-::\-Stc\-Pedestal} $\ast$ marlintpc\-::\-Pedestal\-Calculator\-::calc\-Pedestal (
\begin{DoxyParamCaption}
\item[{Float\-Vec $\ast$}]{Data}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classmarlintpc_1_1PedestalCalculator_a6f94449a9eb5cb013b7f89462175fd5e}


Claculates the pedestal mean and width from raw data. 

Calculate the mean and the width of the pedestal out of the given raw data vector. \begin{DoxyReturn}{Returns}
A structure Pedestal containing these values (channel and readout group I\-D, a data vector [A\-D\-C counts], a Pedestal\-Vector\-\_\-t and tow structs for the average of the pedestal value and width and the error of the avergae values). 
\end{DoxyReturn}


References marlintpc\-::\-Pedestal\-Calculator\-::\-Stc\-Pedestal\-::\-Mean, and marlintpc\-::\-Pedestal\-Calculator\-::\-Stc\-Pedestal\-::\-Width.

\index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}!init@{init}}
\index{init@{init}!marlintpc::PedestalCalculator@{marlintpc\-::\-Pedestal\-Calculator}}
\subsubsection[{init}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pedestal\-Calculator\-::init (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classmarlintpc_1_1PedestalCalculator_a062fb0985866af70bffe5df426a7cf1a}


Called at the begin of the job before anything is read. 

Use to initialize the processor, e.\-g. book histograms. \index{marlintpc\-::\-Pedestal\-Calculator@{marlintpc\-::\-Pedestal\-Calculator}!process\-Event@{process\-Event}}
\index{process\-Event@{process\-Event}!marlintpc::PedestalCalculator@{marlintpc\-::\-Pedestal\-Calculator}}
\subsubsection[{process\-Event}]{\setlength{\rightskip}{0pt plus 5cm}void marlintpc\-::\-Pedestal\-Calculator\-::process\-Event (
\begin{DoxyParamCaption}
\item[{lcio\-::\-L\-C\-Event $\ast$}]{evt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classmarlintpc_1_1PedestalCalculator_a2257763c8f0afa6bb8d2bbe524c2e36f}


Called for every event -\/ the working horse. 

std\-::cout$<$$<$\char`\"{}clear data\char`\"{}$<$$<$std\-::endl; 

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