MarlinUtil  1.12.1
Public Types | Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CHT Class Reference

Helper class for decoding/encoding lcio::CalorimeterHit types for the ILD detector. More...

#include <CalorimeterHitType.h>

Public Types

enum  CaloType { em = 0, had = 1, muon = 2 }
 calorimeter types
 
enum  CaloID {
  unknown = 0, ecal = 1, hcal = 2, yoke = 3,
  lcal = 4, lhcal = 5, bcal = 6
}
 calo ids - specific to ILD
 
enum  Layout {
  any = 0, barrel = 1, endcap = 2, plug = 3,
  ring = 4
}
 calo layout / subdetector
 

Public Member Functions

 CHT (int type)
 C'tor for initialization from CalorimeterHit::getType()
 
 CHT (CaloType c, CaloID n, Layout l, unsigned layer)
 C'tor for encoding the calo type inforamtion.
 
CaloType caloType () const
 calorimeter type: CHT::em , CHT::had, CHT::muon
 
CaloID caloID () const
 calo ID - see enum CaloID for allowed values
 
Layout layout () const
 calo layout - see enum layout for allowed values
 
unsigned layer () const
 calo layer of hit
 
bool is (CaloType t) const
 
bool is (CaloID n) const
 
bool is (Layout l) const
 
 operator int () const
 automatic conversion to int
 
int toInt () const
 explicit conversion to int
 

Protected Attributes

int _type
 

Static Protected Attributes

static const int fCaloType = 1
 
static const int fCaloID = 10
 
static const int fLayout = 1000
 
static const int fLayer = 10000
 

Detailed Description

Helper class for decoding/encoding lcio::CalorimeterHit types for the ILD detector.

The encoding is: caloType + 10 * caloID + 1000 * layout + 10000 * layerNum
(see enums: CaloType, CaloID and Layout for possible values).
Example usage:

   lcio::CalorimeterHit* cHit = .... ;
   // set the type (e.g. in digitization ) 
   cHit->setType( CHT( CHT::em ,  CHT::ecal , CHT::plug , 12 ) ) ;
   ...
   CHT cht = cHit->getType() ;
   //   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() ;
   // use only EcalPlug hits:
   if( cht.is( CHT::ecal) && cht.is( CHT::plug) )
   // get the layer number (e.g. for calibration or clustering) 
   unsigned l = cht.layer() ; 
   // or directly :
   unsigned l = CHT(  cHit->getType() ).layer()  ;
   // detailed print:
   std::cout <<  CHT(  cHit->getType() ) << std::endl ;

F.Gaede, DESY, 12/2008


The documentation for this class was generated from the following file: