CMS 3D CMS Logo

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

#include <EcalTPGScale.h>

Public Member Functions

 EcalTPGScale ()
 
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)
 
void setEventSetup (const edm::EventSetup &evtSetup)
 
 ~EcalTPGScale ()
 

Private Attributes

const edm::EventSetupsetup_
 

Detailed Description

Definition at line 8 of file EcalTPGScale.h.

Constructor & Destructor Documentation

◆ EcalTPGScale()

EcalTPGScale::EcalTPGScale ( )

Definition at line 12 of file EcalTPGScale.cc.

12 {}

◆ ~EcalTPGScale()

EcalTPGScale::~EcalTPGScale ( )

Definition at line 14 of file EcalTPGScale.cc.

14 {}

Member Function Documentation

◆ getLinearizedTPG()

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

Definition at line 47 of file EcalTPGScale.cc.

47  {
48  int tpg10bits = 0;
49 
50  // Get compressed look-up table
51  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
52  setup_->get<EcalTPGLutGroupRcd>().get(lutGrpHandle);
53  const EcalTPGGroups::EcalTPGGroupsMap& lutGrpMap = lutGrpHandle.product()->getMap();
54  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId.rawId());
55  uint32_t lutGrp = 999;
56  if (itgrp != lutGrpMap.end())
57  lutGrp = itgrp->second;
58 
59  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
60  setup_->get<EcalTPGLutIdMapRcd>().get(lutMapHandle);
61  const EcalTPGLutIdMap::EcalTPGLutMap& lutMap = lutMapHandle.product()->getMap();
62  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp);
63  if (itLut != lutMap.end()) {
64  const unsigned int* lut = (itLut->second).getLut();
65  for (unsigned int i = 0; i < 1024; i++)
66  if (ADC == (0xff & lut[i])) {
67  tpg10bits = i;
68  break;
69  }
70  }
71 
72  return tpg10bits;
73 }

References edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), get, EcalTPGGroups::getMap(), mps_fire::i, edm::ESHandle< T >::product(), setup_, and ecaldqm::towerId().

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

◆ getTPGInADC()

unsigned int EcalTPGScale::getTPGInADC ( double  energy,
const EcalTrigTowerDetId towerId 
)

Definition at line 75 of file EcalTPGScale.cc.

75  {
76  unsigned int tpgADC = 0;
77 
78  // 1. get lsb
80  setup_->get<EcalTPGPhysicsConstRcd>().get(physHandle);
81  const EcalTPGPhysicsConstMap& physMap = physHandle.product()->getMap();
82 
83  uint32_t eb = DetId(DetId::Ecal, EcalBarrel).rawId();
84  uint32_t ee = DetId(DetId::Ecal, EcalEndcap).rawId();
85  EcalTPGPhysicsConstMapIterator it = physMap.end();
86  if (towerId.subDet() == EcalBarrel)
87  it = physMap.find(eb);
88  else if (towerId.subDet() == EcalEndcap)
89  it = physMap.find(ee);
90  double lsb10bits = 0.;
91  if (it != physMap.end()) {
92  EcalTPGPhysicsConst::Item item = it->second;
93  lsb10bits = item.EtSat / 1024.;
94  }
95 
96  // 2. get compressed look-up table
97  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
98  setup_->get<EcalTPGLutGroupRcd>().get(lutGrpHandle);
99  const EcalTPGGroups::EcalTPGGroupsMap& lutGrpMap = lutGrpHandle.product()->getMap();
100  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId);
101  uint32_t lutGrp = 0;
102  if (itgrp != lutGrpMap.end())
103  lutGrp = itgrp->second;
104 
105  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
106  setup_->get<EcalTPGLutIdMapRcd>().get(lutMapHandle);
107  const EcalTPGLutIdMap::EcalTPGLutMap& lutMap = lutMapHandle.product()->getMap();
108  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp);
109  if (itLut != lutMap.end()) {
110  const unsigned int* lut = (itLut->second).getLut();
111  if (lsb10bits > 0) {
112  int tpgADC10b = int(energy / lsb10bits + 0.5);
113  if (tpgADC10b >= 0 && tpgADC10b < 1024)
114  tpgADC = (0xff & lut[tpgADC10b]);
115  if (tpgADC10b >= 1024)
116  tpgADC = 0xff;
117  }
118  }
119 
120  return tpgADC;
121 }

References DetId::Ecal, EcalBarrel, EcalEndcap, HCALHighEnergyHPDFilter_cfi::energy, edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), get, EcalTPGGroups::getMap(), EcalTPGPhysicsConst::getMap(), createfilelist::int, B2GTnPMonitor_cfi::item, edm::ESHandle< T >::product(), DetId::rawId(), setup_, and ecaldqm::towerId().

Referenced by testEcalTPGScale::analyze().

◆ getTPGInGeV() [1/2]

double EcalTPGScale::getTPGInGeV ( const EcalTriggerPrimitiveDigi tpDigi)

◆ getTPGInGeV() [2/2]

double EcalTPGScale::getTPGInGeV ( unsigned int  ADC,
const EcalTrigTowerDetId towerId 
)

Definition at line 24 of file EcalTPGScale.cc.

24  {
25  // 1. get lsb
27  setup_->get<EcalTPGPhysicsConstRcd>().get(physHandle);
28  const EcalTPGPhysicsConstMap& physMap = physHandle.product()->getMap();
29 
30  uint32_t eb = DetId(DetId::Ecal, EcalBarrel).rawId();
31  uint32_t ee = DetId(DetId::Ecal, EcalEndcap).rawId();
32  EcalTPGPhysicsConstMapIterator it = physMap.end();
33  if (towerId.subDet() == EcalBarrel)
34  it = physMap.find(eb);
35  else if (towerId.subDet() == EcalEndcap)
36  it = physMap.find(ee);
37  double lsb10bits = 0.;
38  if (it != physMap.end()) {
39  EcalTPGPhysicsConst::Item item = it->second;
40  lsb10bits = item.EtSat / 1024.;
41  }
42 
43  // 2. linearized TPG
44  return lsb10bits * getLinearizedTPG(ADC, towerId);
45 }

References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), get, getLinearizedTPG(), EcalTPGPhysicsConst::getMap(), B2GTnPMonitor_cfi::item, edm::ESHandle< T >::product(), DetId::rawId(), setup_, and ecaldqm::towerId().

◆ setEventSetup()

void EcalTPGScale::setEventSetup ( const edm::EventSetup evtSetup)

Member Data Documentation

◆ setup_

const edm::EventSetup* EcalTPGScale::setup_
private
EcalTPGScale::getTPGInGeV
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:18
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:355
EcalTPGLutIdMap::EcalTPGLutMap
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
Definition: EcalTPGLutIdMap.h:12
EcalTPGGroups::EcalTPGGroupsMapItr
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalBarrel
Definition: EcalSubdetector.h:10
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalTPGScale::getLinearizedTPG
unsigned int getLinearizedTPG(unsigned int ADC, const EcalTrigTowerDetId &towerId)
Definition: EcalTPGScale.cc:47
edm::ESHandle
Definition: DTSurvey.h:22
ADC
Definition: ZdcTBAnalysis.h:46
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
EcalEndcap
Definition: EcalSubdetector.h:10
EcalTPGPhysicsConst::getMap
const std::map< uint32_t, Item > & getMap() const
Definition: EcalTPGPhysicsConst.h:27
EcalTPGPhysicsConst::Item
Definition: EcalTPGPhysicsConst.h:14
createfilelist.int
int
Definition: createfilelist.py:10
EcalTPGGroups::getMap
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
EcalTPGScale::setup_
const edm::EventSetup * setup_
Definition: EcalTPGScale.h:22
DetId::Ecal
Definition: DetId.h:27
get
#define get
ecaldqm::towerId
unsigned towerId(DetId const &)
Definition: EcalDQMCommonUtils.cc:79
EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
Definition: EcalTPGPhysicsConst.h:36
EcalTPGLutIdMapRcd
Definition: EcalTPGLutIdMapRcd.h:5
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalTriggerPrimitiveDigi::id
const EcalTrigTowerDetId & id() const
Definition: EcalTriggerPrimitiveDigi.h:29
EcalTPGLutIdMap::EcalTPGLutMapItr
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
Definition: EcalTPGLutIdMap.h:13
EcalTriggerPrimitiveDigi::compressedEt
int compressedEt() const
get the encoded/compressed Et of interesting sample
Definition: EcalTriggerPrimitiveDigi.cc:19
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
EcalTPGLutGroupRcd
Definition: EcalTPGLutGroupRcd.h:5
EcalTPGPhysicsConstMapIterator
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
Definition: EcalTPGPhysicsConst.h:37
EcalTPGPhysicsConstRcd
Definition: EcalTPGPhysicsConstRcd.h:5
EcalTPGGroups::EcalTPGGroupsMap
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19