\section{lccd\-:\-:D\-B\-File\-Handler Class Reference}
\label{classlccd_1_1DBFileHandler}\index{lccd\-::\-D\-B\-File\-Handler@{lccd\-::\-D\-B\-File\-Handler}}


Implementation of \doxyref{Conditions\-Handler\-Base}{p.}{classlccd_1_1ConditionsHandlerBase} that reads the conditions data from a special L\-C\-I\-O file.  




{\ttfamily \#include $<$D\-B\-File\-Handler.\-hh$>$}

Inheritance diagram for lccd\-:\-:D\-B\-File\-Handler\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classlccd_1_1DBFileHandler}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf D\-B\-File\-Handler} (const std\-::string \&file\-Name, const std\-::string \&{\bf name}, const std\-::string \&input\-Collection=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em Default constructor. \end{DoxyCompactList}\item 
virtual void {\bf register\-Default\-Collection} (lcio\-::\-L\-C\-Collection $\ast$col)\label{classlccd_1_1DBFileHandler_a140df5bfe8df13b4ff4cd597204900b0}

\begin{DoxyCompactList}\small\item\em Register a pointer to a default collection which will be passed to the \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener} if no data can be found for a given time stamp. \end{DoxyCompactList}\item 
virtual lcio\-::\-L\-C\-Collection $\ast$ {\bf default\-Collection} ()\label{classlccd_1_1DBFileHandler_a4436221338bf445960807d5824b04ff5}

\begin{DoxyCompactList}\small\item\em The default collection registered with the handler. \end{DoxyCompactList}\item 
virtual lcio\-::\-L\-C\-Collection $\ast$ {\bf last\-Valid\-Collection} ()\label{classlccd_1_1DBFileHandler_ade259adf22cca71a349f1c25c2fd8dc4}

\begin{DoxyCompactList}\small\item\em The last valid collection held by the handler. \end{DoxyCompactList}\item 
virtual void {\bf update} ({\bf L\-C\-C\-D\-Time\-Stamp} timestamp)
\begin{DoxyCompactList}\small\item\em Reads the event with the conditions data valid for the given time stamp, if\-:\par
 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void {\bf init} ()\label{classlccd_1_1DBFileHandler_ab3160094be2793ffa579b28342d2f1d7}

\begin{DoxyCompactList}\small\item\em Initializes the validity intervall map from the run header. \end{DoxyCompactList}\item 
int {\bf find\-Event\-Number} ({\bf L\-C\-C\-D\-Time\-Stamp} time\-Stamp)\label{classlccd_1_1DBFileHandler_a37ab5472336d5b1ba688dd4a85178703}

\begin{DoxyCompactList}\small\item\em The conditions event number for the given time stamp. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
std\-::string {\bf \-\_\-file\-Name}\label{classlccd_1_1DBFileHandler_a8d998051dd80844b4ff9534279ee26ad}

\begin{DoxyCompactList}\small\item\em Name of L\-C\-I\-O input file with conditions data. \end{DoxyCompactList}\item 
std\-::string {\bf \-\_\-input\-Collection}\label{classlccd_1_1DBFileHandler_ac12dc531ce4bd31a0fcab5e5f58ca5ac}

\begin{DoxyCompactList}\small\item\em Name of L\-C\-Collection in first event. \end{DoxyCompactList}\item 
Validity\-Vector {\bf \-\_\-val\-Vec}\label{classlccd_1_1DBFileHandler_a9c3c74ec9a38797dbc591323e6caf7db}

\begin{DoxyCompactList}\small\item\em Vector that holds the validity time intervalls for all events. \end{DoxyCompactList}\item 
L\-C\-Reader $\ast$ {\bf \-\_\-lc\-Reader}\label{classlccd_1_1DBFileHandler_abd2d76bece42264c21c5f37c5bff845a}

\begin{DoxyCompactList}\small\item\em The L\-C\-I\-O input file reader. \end{DoxyCompactList}\item 
lcio\-::\-L\-C\-Collection $\ast$ {\bf \-\_\-default\-Collection}\label{classlccd_1_1DBFileHandler_ad7ebfcabd2bea7730df050874c551f10}

\begin{DoxyCompactList}\small\item\em The registered default collection. \end{DoxyCompactList}\item 
lcio\-::\-L\-C\-Collection $\ast$ {\bf \-\_\-last\-Valid\-Collection}
\begin{DoxyCompactList}\small\item\em The last valid collection of conditions data. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Implementation of \doxyref{Conditions\-Handler\-Base}{p.}{classlccd_1_1ConditionsHandlerBase} that reads the conditions data from a special L\-C\-I\-O file. 

The file has to be extracted from a data base beforehand. e.\-g. with \doxyref{lccd\-::\-D\-B\-Interface\-::create\-D\-B\-File()}{p.}{classlccd_1_1DBInterface_aa8b3009b022dc72b1d42d828e5f5fed3} or created otherwise by fullfilling the following requirements\-:\par
 
\begin{DoxyItemize}
\item the run header has a pair of string vector parameters D\-B\-Since and D\-B\-Till with time stamps for every event in the file 
\item the collections in the events have to have a common name 
\item consecutive events hold condition collections for consecutive validity time intervalls $<$/lu$>$ \par
 This can be used for example to run a calibration job with a well defined tag of calibration constants from a database without actually having access to the database, e.\-g. in a grid environment.

In the case where no collection is available for a given time range, the default collection will be set as the present collection, and will be the one returned to the registered \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener}. The previously last valid collection i.\-e. not the Default Collection, will be held and can be accessed via the method \doxyref{last\-Valid\-Collection()}{p.}{classlccd_1_1DBFileHandler_ade259adf22cca71a349f1c25c2fd8dc4}.

The Default Collection should be set via the method \doxyref{register\-Default\-Collection( lcio\-::\-L\-C\-Collection$\ast$ col)}{p.}{classlccd_1_1DBFileHandler_a140df5bfe8df13b4ff4cd597204900b0} In the case of no collection found and no Default Collection set an exception will be raised. Only one Default Collection may be registered per Conditions Handler. Trying to register additional Default Collections will cause an lccd\-::\-Exception( std\-::string ) to be thrown.

The default collection may be accessed via the method \doxyref{default\-Collection()}{p.}{classlccd_1_1DBFileHandler_a4436221338bf445960807d5824b04ff5}, and if so desired this method should be used by the \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener} to verify if this is the collection provided via the call-\/back method conditions\-Changed.

Upon registering an \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener} with the Conditions Handler the call-\/back method registered\-With\-Handler( I\-Conditions\-Handler$\ast$ ch ) will be called. Likewise calling \doxyref{remove\-Change\-Listener( I\-Conditions\-Change\-Listener$\ast$ cl)}{p.}{classlccd_1_1ConditionsHandlerBase_a3231c12576bf08b59d698d8575dd48b0} will call the call-\/back method de\-Registered\-With\-Handler( I\-Conditions\-Handler$\ast$ ch )

\begin{DoxyAuthor}{Author}
F.\-Gaede, S.\-Aplin, D\-E\-S\-Y 
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}

\end{DoxyVersion}
\begin{DoxyParagraph}{Id\-:}
\doxyref{D\-B\-File\-Handler.\-hh}{p.}{DBFileHandler_8hh_source},v 1.\-3 2007-\/04-\/27 13\-:21\-:31 gaede Exp 
\end{DoxyParagraph}

\end{DoxyItemize}

\subsection{Constructor \& Destructor Documentation}
\index{lccd\-::\-D\-B\-File\-Handler@{lccd\-::\-D\-B\-File\-Handler}!D\-B\-File\-Handler@{D\-B\-File\-Handler}}
\index{D\-B\-File\-Handler@{D\-B\-File\-Handler}!lccd::DBFileHandler@{lccd\-::\-D\-B\-File\-Handler}}
\subsubsection[{D\-B\-File\-Handler}]{\setlength{\rightskip}{0pt plus 5cm}lccd\-::\-D\-B\-File\-Handler\-::\-D\-B\-File\-Handler (
\begin{DoxyParamCaption}
\item[{const std\-::string \&}]{file\-Name, }
\item[{const std\-::string \&}]{name, }
\item[{const std\-::string \&}]{input\-Collection = {\ttfamily \char`\"{}\char`\"{}}}
\end{DoxyParamCaption}
)}\label{classlccd_1_1DBFileHandler_ac986a70e1709b86da0c676ff4d569234}


Default constructor. 

You have to specify the following parameters\-:


\begin{DoxyParams}{Parameters}
{\em file\-Name} & the L\-C\-I\-O file that holds the conditions data. \\
\hline
{\em name} & of this conditions data set -\/ used, e.\-g. as collection name in update(\-L\-C\-Event$\ast$ evt) \\
\hline
{\em input\-Collection} & name of collection in input file -\/ if not given the name of this conditions data set is used \\
\hline
\end{DoxyParams}


References lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-col, \-\_\-default\-Collection, \-\_\-input\-Collection, \-\_\-last\-Valid\-Collection, and init().



\subsection{Member Function Documentation}
\index{lccd\-::\-D\-B\-File\-Handler@{lccd\-::\-D\-B\-File\-Handler}!update@{update}}
\index{update@{update}!lccd::DBFileHandler@{lccd\-::\-D\-B\-File\-Handler}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void lccd\-::\-D\-B\-File\-Handler\-::update (
\begin{DoxyParamCaption}
\item[{{\bf L\-C\-C\-D\-Time\-Stamp}}]{timestamp}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classlccd_1_1DBFileHandler_a9ca320c3e756f0748b6b566d21f69b81}


Reads the event with the conditions data valid for the given time stamp, if\-:\par
 


\begin{DoxyItemize}
\item the time stamp lies outside the validity range of the current collection  
\item and there is an event in the file that has a corresponding validity range as defined by the string vector parameters D\-B\-Since and D\-B\-Till in the run header $<$/lu$>$ Note in the case that no valid collection is available for time\-Stamp, the default collection will be sent if registered, otherwise an exception will be thrown which can not be caught in user code. If sent the default collection will have the following attributes attached as collection parameters\-: D\-B\-S\-I\-N\-C\-E, D\-B\-T\-I\-L\-L and D\-B\-Q\-U\-E\-R\-Y\-T\-I\-M\-E 
\end{DoxyItemize}

Implements {\bf lccd\-::\-Conditions\-Handler\-Base} \doxyref{}{p.}{classlccd_1_1ConditionsHandlerBase_aafbe952660e65887cd9290b4e62ae256}.



References lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-col, \-\_\-default\-Collection, \-\_\-file\-Name, \-\_\-input\-Collection, \-\_\-last\-Valid\-Collection, \-\_\-lc\-Reader, lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-valid\-Since, lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-valid\-Till, \-\_\-val\-Vec, lccd\-::\-D\-B\-Q\-U\-E\-R\-Y\-T\-I\-M\-E, lccd\-::\-D\-B\-S\-I\-N\-C\-E, lccd\-::\-D\-B\-T\-I\-L\-L, find\-Event\-Number(), lccd\-::\-Conditions\-Handler\-Base\-::name(), and lccd\-::\-Conditions\-Handler\-Base\-::notify\-Listeners().



\subsection{Member Data Documentation}
\index{lccd\-::\-D\-B\-File\-Handler@{lccd\-::\-D\-B\-File\-Handler}!\-\_\-last\-Valid\-Collection@{\-\_\-last\-Valid\-Collection}}
\index{\-\_\-last\-Valid\-Collection@{\-\_\-last\-Valid\-Collection}!lccd::DBFileHandler@{lccd\-::\-D\-B\-File\-Handler}}
\subsubsection[{\-\_\-last\-Valid\-Collection}]{\setlength{\rightskip}{0pt plus 5cm}lcio\-::\-L\-C\-Collection$\ast$ lccd\-::\-D\-B\-File\-Handler\-::\-\_\-last\-Valid\-Collection\hspace{0.3cm}{\ttfamily [protected]}}\label{classlccd_1_1DBFileHandler_ad4c538262fccfff7f3adaca6f12dcb5b}


The last valid collection of conditions data. 



Referenced by D\-B\-File\-Handler(), and update().



The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
D\-B\-File\-Handler.\-hh\item 
D\-B\-File\-Handler.\-cc\end{DoxyCompactItemize}
