\section{C\-H\-T Class Reference}
\label{classCHT}\index{C\-H\-T@{C\-H\-T}}


Helper class for decoding/encoding lcio\-::\-Calorimeter\-Hit types for the I\-L\-D detector.  




{\ttfamily \#include $<$Calorimeter\-Hit\-Type.\-h$>$}

\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum {\bf Calo\-Type} \{ {\bfseries em} = 0, 
{\bfseries had} = 1, 
{\bfseries muon} = 2
 \}
\begin{DoxyCompactList}\small\item\em calorimeter types \end{DoxyCompactList}\item 
enum {\bf Calo\-I\-D} \{ \\*
{\bfseries unknown} = 0, 
{\bfseries ecal} = 1, 
{\bfseries hcal} = 2, 
{\bfseries yoke} = 3, 
\\*
{\bfseries lcal} = 4, 
{\bfseries lhcal} = 5, 
{\bfseries bcal} = 6
 \}
\begin{DoxyCompactList}\small\item\em calo ids -\/ specific to I\-L\-D \end{DoxyCompactList}\item 
enum {\bf Layout} \{ \\*
{\bfseries any} = 0, 
{\bfseries barrel} = 1, 
{\bfseries endcap} = 2, 
{\bfseries plug} = 3, 
\\*
{\bfseries ring} = 4
 \}
\begin{DoxyCompactList}\small\item\em calo layout / subdetector \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf C\-H\-T} (int type)\label{classCHT_ad5a8a8ba2aac736ecc51b764ae36509d}

\begin{DoxyCompactList}\small\item\em C'tor for initialization from Calorimeter\-Hit\-::get\-Type() \end{DoxyCompactList}\item 
{\bf C\-H\-T} ({\bf Calo\-Type} c, {\bf Calo\-I\-D} n, {\bf Layout} l, unsigned {\bf layer})\label{classCHT_ab7f52d0891047a579e7b595384061848}

\begin{DoxyCompactList}\small\item\em C'tor for encoding the calo type inforamtion. \end{DoxyCompactList}\item 
{\bf Calo\-Type} {\bf calo\-Type} () const \label{classCHT_a14c38ba3322b8b942c80340619478f34}

\begin{DoxyCompactList}\small\item\em calorimeter type\-: C\-H\-T\-::em , C\-H\-T\-::had, C\-H\-T\-::muon \end{DoxyCompactList}\item 
{\bf Calo\-I\-D} {\bf calo\-I\-D} () const \label{classCHT_a78331e7ac4c75872eaffac0a6790b8c4}

\begin{DoxyCompactList}\small\item\em calo I\-D -\/ see enum Calo\-I\-D for allowed values \end{DoxyCompactList}\item 
{\bf Layout} {\bf layout} () const \label{classCHT_a2d4e77ea30868217586e15a8190cc732}

\begin{DoxyCompactList}\small\item\em calo layout -\/ see enum layout for allowed values \end{DoxyCompactList}\item 
unsigned {\bf layer} () const \label{classCHT_a29f147402d56d4098718f0bdd01e3deb}

\begin{DoxyCompactList}\small\item\em calo layer of hit \end{DoxyCompactList}\item 
bool {\bfseries is} ({\bf Calo\-Type} t) const \label{classCHT_a24ad64de5619e94fc56947ad8d5bcd27}

\item 
bool {\bfseries is} ({\bf Calo\-I\-D} n) const \label{classCHT_a87ec13d46db3e0d279d827766c20b973}

\item 
bool {\bfseries is} ({\bf Layout} l) const \label{classCHT_a580633fab213a56e4a94cdefd65e64c9}

\item 
{\bf operator int} () const \label{classCHT_ade433dbedeb13242d38c5aac4c36f52f}

\begin{DoxyCompactList}\small\item\em automatic conversion to int \end{DoxyCompactList}\item 
int {\bf to\-Int} () const \label{classCHT_aee72b198317a4ef0a987854d10e8f5a4}

\begin{DoxyCompactList}\small\item\em explicit conversion to int \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
int {\bfseries \-\_\-type}\label{classCHT_a71261c9fb3225a3f798d003c42c2e032}

\end{DoxyCompactItemize}
\subsection*{Static Protected Attributes}
\begin{DoxyCompactItemize}
\item 
static const int {\bfseries f\-Calo\-Type} = 1\label{classCHT_af7eadae63fe49f9af4b47cd3c550f8a2}

\item 
static const int {\bfseries f\-Calo\-I\-D} = 10\label{classCHT_a0d923e85ebb52534d89d4e44b194dc3b}

\item 
static const int {\bfseries f\-Layout} = 1000\label{classCHT_a6cb539f2384d603499dbc83551556b61}

\item 
static const int {\bfseries f\-Layer} = 10000\label{classCHT_a69d4b6c22431cca5c6c2e07965865163}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Helper class for decoding/encoding lcio\-::\-Calorimeter\-Hit types for the I\-L\-D detector. 

The encoding is\-: calo\-Type + 10 $\ast$ calo\-I\-D + 1000 $\ast$ layout + 10000 $\ast$ layer\-Num \par
 (see enums\-: Calo\-Type, Calo\-I\-D and Layout for possible values).\par
 Example usage\-: \par
 
\begin{DoxyPre}
   lcio::CalorimeterHit* cHit = .... ;\end{DoxyPre}



\begin{DoxyPre}   // set the type (e.g. in digitization ) 
   cHit->setType( CHT( CHT::em ,  CHT::ecal , CHT::plug , 12 ) ) ;\end{DoxyPre}



\begin{DoxyPre}   ...\end{DoxyPre}



\begin{DoxyPre}   \doxyref{CHT}{p.}{classCHT} cht = cHit->getType() ;\end{DoxyPre}



\begin{DoxyPre}   //   sum energies for electromagentic, hadronic and tailcatcher:
   if( cht.is( CHT::em ) ) 
        e\_em +=  cHit->getEnergy() ;
   else 
     if ( cht.is(CHT::had ) ) 
        e\_had += cHit->getEnergy() ;
     else
        e\_muon += cHit->getEnergy() ;\end{DoxyPre}



\begin{DoxyPre}   // use only EcalPlug hits:
   if( cht.is( CHT::ecal) \&\& cht.is( CHT::plug) )\end{DoxyPre}



\begin{DoxyPre}   // get the layer number (e.g. for calibration or clustering) 
   unsigned l = cht.layer() ; 
   // or directly :
   unsigned l = \doxyref{CHT}{p.}{classCHT}(  cHit->getType() ).\doxyref{layer()}{p.}{classCHT_a29f147402d56d4098718f0bdd01e3deb}  ;\end{DoxyPre}



\begin{DoxyPre}   // detailed print:
   std::cout <<  \doxyref{CHT}{p.}{classCHT}(  cHit->getType() ) << std::endl ;\end{DoxyPre}



\begin{DoxyPre}\end{DoxyPre}


F.\-Gaede, D\-E\-S\-Y, 12/2008 

The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
Calorimeter\-Hit\-Type.\-h\end{DoxyCompactItemize}
