CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTPGScale Class Reference

#include <EcalTPGScale.h>

List of all members.

Public Member Functions

 EcalTPGScale ()
virtual double et_bin_high (const EcalTrigTowerDetId &id, const EcalTriggerPrimitiveSample &s) const =0
virtual double et_bin_low (const EcalTrigTowerDetId &id, const EcalTriggerPrimitiveSample &s) const =0
 smallest ET value which would resolve into this sample
virtual double et_RCT (const EcalTrigTowerDetId &id, const EcalTriggerPrimitiveSample &s) const =0
 nominal ET value of this sample/code as to be used in RCT LUT creation
unsigned int getLinearizedTPG (unsigned int ADC, const EcalTrigTowerDetId &towerId)
unsigned int getTPGInADC (double energy, const EcalTrigTowerDetId &towerId)
double getTPGInGeV (const EcalTriggerPrimitiveDigi &tpDigi)
double getTPGInGeV (unsigned int ADC, const EcalTrigTowerDetId &towerId)
virtual void releaseSetup () const
 Release any objects obtained from the EventSetup.
void setEventSetup (const edm::EventSetup &evtSetup)
virtual void setup (const edm::EventSetup &es) const
 Get any needed information from the event setup.
 ~EcalTPGScale ()

Private Attributes

const edm::EventSetupsetup_

Detailed Description

To be stored in the CaloTPGRecord

Date:
2007/02/19 16:24:20
Revision:
1.1
Author:
J. Mans - Minnesota

Definition at line 8 of file EcalTPGScale.h.


Constructor & Destructor Documentation

EcalTPGScale::EcalTPGScale ( )

Definition at line 13 of file EcalTPGScale.cc.

{ }
EcalTPGScale::~EcalTPGScale ( )

Definition at line 16 of file EcalTPGScale.cc.

{ }

Member Function Documentation

virtual double EcalTPGScale::et_bin_high ( const EcalTrigTowerDetId id,
const EcalTriggerPrimitiveSample s 
) const [pure virtual]

smallest ET value which would not resolve into sample (too big)

virtual double EcalTPGScale::et_bin_low ( const EcalTrigTowerDetId id,
const EcalTriggerPrimitiveSample s 
) const [pure virtual]

smallest ET value which would resolve into this sample

virtual double EcalTPGScale::et_RCT ( const EcalTrigTowerDetId id,
const EcalTriggerPrimitiveSample s 
) const [pure virtual]

nominal ET value of this sample/code as to be used in RCT LUT creation

unsigned int EcalTPGScale::getLinearizedTPG ( unsigned int  ADC,
const EcalTrigTowerDetId towerId 
)

Definition at line 54 of file EcalTPGScale.cc.

References edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), i, edm::ESHandle< T >::product(), DetId::rawId(), and setup_.

Referenced by getTPGInGeV().

{
  int tpg10bits = 0 ;
 
  // Get compressed look-up table
  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
  setup_->get<EcalTPGLutGroupRcd>().get( lutGrpHandle );
  const EcalTPGGroups::EcalTPGGroupsMap & lutGrpMap = lutGrpHandle.product()->getMap() ;  
  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId.rawId()) ;
  uint32_t lutGrp = 999 ;
  if (itgrp != lutGrpMap.end()) lutGrp = itgrp->second ;

  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
  setup_->get<EcalTPGLutIdMapRcd>().get( lutMapHandle );
  const EcalTPGLutIdMap::EcalTPGLutMap & lutMap = lutMapHandle.product()->getMap() ;  
  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp) ;
  if (itLut != lutMap.end()) {
    const unsigned int * lut = (itLut->second).getLut() ;
    for (unsigned int i=0 ; i<1024 ; i++)
      if (ADC == (0xff & lut[i])) {
        tpg10bits = i ;
        break ;
      }
  }

  return tpg10bits ;
}
unsigned int EcalTPGScale::getTPGInADC ( double  energy,
const EcalTrigTowerDetId towerId 
)

Definition at line 82 of file EcalTPGScale.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EcalTPGPhysicsConst::Item::EtSat, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::ESHandle< T >::product(), DetId::rawId(), setup_, and EcalTrigTowerDetId::subDet().

{
  unsigned int tpgADC = 0 ;

  // 1. get lsb
  edm::ESHandle<EcalTPGPhysicsConst> physHandle;
  setup_->get<EcalTPGPhysicsConstRcd>().get( physHandle );
  const EcalTPGPhysicsConstMap & physMap = physHandle.product()->getMap() ;

  uint32_t eb = DetId(DetId::Ecal,EcalBarrel).rawId() ;
  uint32_t ee = DetId(DetId::Ecal,EcalEndcap).rawId() ;
  EcalTPGPhysicsConstMapIterator it = physMap.end() ;
  if (towerId.subDet() == EcalBarrel) it = physMap.find(eb) ;
  else if (towerId.subDet() == EcalEndcap) it = physMap.find(ee) ;
  double lsb10bits = 0. ;
  if (it != physMap.end()) {
    EcalTPGPhysicsConst::Item item = it->second ;
    lsb10bits = item.EtSat/1024. ;
  }

  // 2. get compressed look-up table
  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
  setup_->get<EcalTPGLutGroupRcd>().get( lutGrpHandle );
  const EcalTPGGroups::EcalTPGGroupsMap & lutGrpMap = lutGrpHandle.product()->getMap() ;  
  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId) ;
  uint32_t lutGrp = 0 ;
  if (itgrp != lutGrpMap.end()) lutGrp = itgrp->second ;
  
  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
  setup_->get<EcalTPGLutIdMapRcd>().get( lutMapHandle );
  const EcalTPGLutIdMap::EcalTPGLutMap & lutMap = lutMapHandle.product()->getMap() ;  
  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp) ;
  if (itLut != lutMap.end()) {
    const unsigned int * lut = (itLut->second).getLut() ;
    if (lsb10bits>0) {
      int tpgADC10b = int(energy/lsb10bits+0.5) ;
      if (tpgADC10b>=0 && tpgADC10b<1024) tpgADC = (0xff & lut[tpgADC10b]) ;
      if (tpgADC10b>=1024) tpgADC = 0xff ;
    }
  }

  return tpgADC ;
}
double EcalTPGScale::getTPGInGeV ( const EcalTriggerPrimitiveDigi tpDigi)
double EcalTPGScale::getTPGInGeV ( unsigned int  ADC,
const EcalTrigTowerDetId towerId 
)

Definition at line 31 of file EcalTPGScale.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EcalTPGPhysicsConst::Item::EtSat, edm::EventSetup::get(), getLinearizedTPG(), edm::ESHandle< T >::product(), DetId::rawId(), setup_, and EcalTrigTowerDetId::subDet().

{ 
  // 1. get lsb
  edm::ESHandle<EcalTPGPhysicsConst> physHandle;
  setup_->get<EcalTPGPhysicsConstRcd>().get( physHandle );
  const EcalTPGPhysicsConstMap & physMap = physHandle.product()->getMap() ;

  uint32_t eb = DetId(DetId::Ecal,EcalBarrel).rawId() ;
  uint32_t ee = DetId(DetId::Ecal,EcalEndcap).rawId() ;
  EcalTPGPhysicsConstMapIterator it = physMap.end() ;
  if (towerId.subDet() == EcalBarrel) it = physMap.find(eb) ;
  else if (towerId.subDet() == EcalEndcap) it = physMap.find(ee) ;
  double lsb10bits = 0. ;
  if (it != physMap.end()) {
    EcalTPGPhysicsConst::Item item = it->second ;
    lsb10bits = item.EtSat/1024. ;
  }

  // 2. linearized TPG
  return lsb10bits * getLinearizedTPG(ADC, towerId) ;

}
virtual void EcalTPGScale::releaseSetup ( ) const [inline, virtual]

Release any objects obtained from the EventSetup.

Definition at line 34 of file EcalTPGScale.h.

{ }
void EcalTPGScale::setEventSetup ( const edm::EventSetup evtSetup)
virtual void EcalTPGScale::setup ( const edm::EventSetup es) const [inline, virtual]

Get any needed information from the event setup.

Definition at line 32 of file EcalTPGScale.h.

{ }

Member Data Documentation

Definition at line 23 of file EcalTPGScale.h.

Referenced by getLinearizedTPG(), getTPGInADC(), getTPGInGeV(), and setEventSetup().