CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalTPGScale Class Referenceabstract

#include <EcalTPGScale.h>

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 More...
 
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 More...
 
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. More...
 
void setEventSetup (const edm::EventSetup &evtSetup)
 
virtual void setup (const edm::EventSetup &es) const
 Get any needed information from the event setup. More...
 
 ~EcalTPGScale ()
 
virtual ~EcalTPGScale ()=default
 

Private Attributes

const edm::EventSetupsetup_
 

Detailed Description

To be stored in the CaloTPGRecord

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.

14 { }
EcalTPGScale::~EcalTPGScale ( )

Definition at line 16 of file EcalTPGScale.cc.

17 { }
virtual EcalTPGScale::~EcalTPGScale ( )
virtualdefault

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(), EcalTPGGroups::getMap(), mps_fire::i, lumiPlot::lut, edm::ESHandle< T >::product(), DetId::rawId(), and setup_.

Referenced by testEcalTPGScale::analyze(), and getTPGInGeV().

55 {
56  int tpg10bits = 0 ;
57 
58  // Get compressed look-up table
59  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
60  setup_->get<EcalTPGLutGroupRcd>().get( lutGrpHandle );
61  const EcalTPGGroups::EcalTPGGroupsMap & lutGrpMap = lutGrpHandle.product()->getMap() ;
62  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId.rawId()) ;
63  uint32_t lutGrp = 999 ;
64  if (itgrp != lutGrpMap.end()) lutGrp = itgrp->second ;
65 
66  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
67  setup_->get<EcalTPGLutIdMapRcd>().get( lutMapHandle );
68  const EcalTPGLutIdMap::EcalTPGLutMap & lutMap = lutMapHandle.product()->getMap() ;
69  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp) ;
70  if (itLut != lutMap.end()) {
71  const unsigned int * lut = (itLut->second).getLut() ;
72  for (unsigned int i=0 ; i<1024 ; i++)
73  if (ADC == (0xff & lut[i])) {
74  tpg10bits = i ;
75  break ;
76  }
77  }
78 
79  return tpg10bits ;
80 }
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:28
const edm::EventSetup * setup_
Definition: EcalTPGScale.h:23
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:23
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
void get(HolderT &iHolder) const
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:22
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
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(), EcalTPGGroups::getMap(), EcalTPGPhysicsConst::getMap(), createfilelist::int, lumiPlot::lut, edm::ESHandle< T >::product(), DetId::rawId(), setup_, and EcalTrigTowerDetId::subDet().

Referenced by testEcalTPGScale::analyze().

83 {
84  unsigned int tpgADC = 0 ;
85 
86  // 1. get lsb
88  setup_->get<EcalTPGPhysicsConstRcd>().get( physHandle );
89  const EcalTPGPhysicsConstMap & physMap = physHandle.product()->getMap() ;
90 
91  uint32_t eb = DetId(DetId::Ecal,EcalBarrel).rawId() ;
92  uint32_t ee = DetId(DetId::Ecal,EcalEndcap).rawId() ;
93  EcalTPGPhysicsConstMapIterator it = physMap.end() ;
94  if (towerId.subDet() == EcalBarrel) it = physMap.find(eb) ;
95  else if (towerId.subDet() == EcalEndcap) it = physMap.find(ee) ;
96  double lsb10bits = 0. ;
97  if (it != physMap.end()) {
98  EcalTPGPhysicsConst::Item item = it->second ;
99  lsb10bits = item.EtSat/1024. ;
100  }
101 
102  // 2. get compressed look-up table
103  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
104  setup_->get<EcalTPGLutGroupRcd>().get( lutGrpHandle );
105  const EcalTPGGroups::EcalTPGGroupsMap & lutGrpMap = lutGrpHandle.product()->getMap() ;
106  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId) ;
107  uint32_t lutGrp = 0 ;
108  if (itgrp != lutGrpMap.end()) lutGrp = itgrp->second ;
109 
110  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
111  setup_->get<EcalTPGLutIdMapRcd>().get( lutMapHandle );
112  const EcalTPGLutIdMap::EcalTPGLutMap & lutMap = lutMapHandle.product()->getMap() ;
113  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp) ;
114  if (itLut != lutMap.end()) {
115  const unsigned int * lut = (itLut->second).getLut() ;
116  if (lsb10bits>0) {
117  int tpgADC10b = int(energy/lsb10bits+0.5) ;
118  if (tpgADC10b>=0 && tpgADC10b<1024) tpgADC = (0xff & lut[tpgADC10b]) ;
119  if (tpgADC10b>=1024) tpgADC = 0xff ;
120  }
121  }
122 
123  return tpgADC ;
124 }
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:28
const edm::EventSetup * setup_
Definition: EcalTPGScale.h:23
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:23
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
void get(HolderT &iHolder) const
Definition: DetId.h:18
const std::map< uint32_t, Item > & getMap() const
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
T get() const
Definition: EventSetup.h:63
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
T const * product() const
Definition: ESHandle.h:86
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:22
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
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(), EcalTPGPhysicsConst::getMap(), edm::ESHandle< T >::product(), DetId::rawId(), setup_, and EcalTrigTowerDetId::subDet().

32 {
33  // 1. get lsb
35  setup_->get<EcalTPGPhysicsConstRcd>().get( physHandle );
36  const EcalTPGPhysicsConstMap & physMap = physHandle.product()->getMap() ;
37 
38  uint32_t eb = DetId(DetId::Ecal,EcalBarrel).rawId() ;
39  uint32_t ee = DetId(DetId::Ecal,EcalEndcap).rawId() ;
40  EcalTPGPhysicsConstMapIterator it = physMap.end() ;
41  if (towerId.subDet() == EcalBarrel) it = physMap.find(eb) ;
42  else if (towerId.subDet() == EcalEndcap) it = physMap.find(ee) ;
43  double lsb10bits = 0. ;
44  if (it != physMap.end()) {
45  EcalTPGPhysicsConst::Item item = it->second ;
46  lsb10bits = item.EtSat/1024. ;
47  }
48 
49  // 2. linearized TPG
50  return lsb10bits * getLinearizedTPG(ADC, towerId) ;
51 
52 }
unsigned int getLinearizedTPG(unsigned int ADC, const EcalTrigTowerDetId &towerId)
Definition: EcalTPGScale.cc:54
const edm::EventSetup * setup_
Definition: EcalTPGScale.h:23
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
Definition: DetId.h:18
const std::map< uint32_t, Item > & getMap() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
T get() const
Definition: EventSetup.h:63
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
T const * product() const
Definition: ESHandle.h:86
virtual void EcalTPGScale::releaseSetup ( ) const
inlinevirtual

Release any objects obtained from the EventSetup.

Definition at line 33 of file EcalTPGScale.h.

33 { }
void EcalTPGScale::setEventSetup ( const edm::EventSetup evtSetup)
virtual void EcalTPGScale::setup ( const edm::EventSetup es) const
inlinevirtual

Get any needed information from the event setup.

Definition at line 31 of file EcalTPGScale.h.

Referenced by o2olib.O2OTool::execute().

31 { }

Member Data Documentation

const edm::EventSetup* EcalTPGScale::setup_
private

Definition at line 23 of file EcalTPGScale.h.

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