\section{marlin\-:\-:Processor\-Event\-Seeder Class Reference}
\label{classmarlin_1_1ProcessorEventSeeder}\index{marlin\-::\-Processor\-Event\-Seeder@{marlin\-::\-Processor\-Event\-Seeder}}


\doxyref{Processor}{p.}{classmarlin_1_1Processor} event seeder -\/ provides independent pseudo-\/randomly generated seeds for registered processors on an event by event basis.  




{\ttfamily \#include $<$Processor\-Event\-Seeder.\-h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf $\sim$\-Processor\-Event\-Seeder} ()\label{classmarlin_1_1ProcessorEventSeeder_ad5c590442c6f987199e6181fadebccca}

\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item 
void {\bf register\-Processor} ({\bf Processor} $\ast$proc)\label{classmarlin_1_1ProcessorEventSeeder_a5337fd80fd088cc9897aaebb321ab892}

\begin{DoxyCompactList}\small\item\em Called by Processors to register themselves for the seeding service. \end{DoxyCompactList}\item 
unsigned int {\bf get\-Seed} ({\bf Processor} $\ast$proc)\label{classmarlin_1_1ProcessorEventSeeder_ad8f1345805ba3c989b081de73c6c5037}

\begin{DoxyCompactList}\small\item\em Called by Processors to obtain seed assigned to it for the current event. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
class {\bfseries Processor\-Mgr}\label{classmarlin_1_1ProcessorEventSeeder_a08ac5ce1a2d3bbeeb9dd17fcd3c8ce71}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
\doxyref{Processor}{p.}{classmarlin_1_1Processor} event seeder -\/ provides independent pseudo-\/randomly generated seeds for registered processors on an event by event basis. 

This Class is used to provide individual pseudo-\/random numbers to Processors on an event-\/by-\/event and run-\/by-\/run basis. These may be used by Processors to seed their random number generator of choice. In order to use this service a \doxyref{Processor}{p.}{classmarlin_1_1Processor} must register itself in the init method using\-: \begin{DoxyVerb}   Global::EVENTSEEDER->registerProcessor(this);
\end{DoxyVerb}


and should retrieve its allocated event seed during process\-Event using\-: \begin{DoxyVerb}   int eventSeed = Global::EVENTSEEDER->getSeed(this);
\end{DoxyVerb}


and include the header file\-: \begin{DoxyVerb}#include "marlin/ProcessorEventSeeder.h"                
\end{DoxyVerb}


The global seed is used for a complete job and is set in the \doxyref{Global}{p.}{classmarlin_1_1Global} steering parameters thus\-: \begin{DoxyVerb}   <parameter name="RandomSeed" value="1234567890"/>
\end{DoxyVerb}


Note that the value must be a positive integer, with max value 2,147,483,647 A pseudo-\/random event seed is generated using a three step hashing function of unsigned ints, in the following order\-: event\-\_\-number, run\-\_\-number, Random\-Seed. The hashed int from each step in the above order is used as input to the next hash step. This is used to ensure that in the likely event of similar values of event\-\_\-number, run\-\_\-number and Random\-Seed, different event seeds will be generated.

The event seed is then used to seed rand via srand(seed) and then rand is used to generate one seed per registered processor.

This mechanism ensures reproducible results for every event, regardless of the sequence in which the event is processed in a Marlin job, whilst maintaining the full 32bit range for event and run numbers.

If a call is made to \doxyref{get\-Seed( Processor$\ast$ )}{p.}{classmarlin_1_1ProcessorEventSeeder_ad8f1345805ba3c989b081de73c6c5037} preceededing a call to \doxyref{register\-Processor( Processor$\ast$ )}{p.}{classmarlin_1_1ProcessorEventSeeder_a5337fd80fd088cc9897aaebb321ab892} an exception will be thrown.

\begin{DoxyAuthor}{Author}
S.\-J. Aplin, D\-E\-S\-Y 
\end{DoxyAuthor}


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