CMS 3D CMS Logo

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

#include <EcalTPGScale.h>

Classes

struct  Tokens
 

Public Member Functions

 EcalTPGScale (Tokens const &, const edm::EventSetup &evtSetup)
 
unsigned int getLinearizedTPG (unsigned int ADC, const EcalTrigTowerDetId &towerId) const
 
unsigned int getTPGInADC (double energy, const EcalTrigTowerDetId &towerId) const
 
double getTPGInGeV (const EcalTriggerPrimitiveDigi &tpDigi) const
 
double getTPGInGeV (unsigned int ADC, const EcalTrigTowerDetId &towerId) const
 

Private Attributes

EcalTPGLutIdMap const & lut_
 
EcalTPGLutGroup const & lutGrp_
 
EcalTPGPhysicsConst const & phys_
 

Detailed Description

Definition at line 16 of file EcalTPGScale.h.

Constructor & Destructor Documentation

◆ EcalTPGScale()

EcalTPGScale::EcalTPGScale ( Tokens const &  tokens,
const edm::EventSetup evtSetup 
)

Definition at line 10 of file EcalTPGScale.cc.

11  : phys_(evtSetup.getData(tokens.physConstToken_)),
12  lutGrp_(evtSetup.getData(tokens.lutGrpToken_)),
13  lut_(evtSetup.getData(tokens.lutMapToken_))
14 
15 {}

Member Function Documentation

◆ getLinearizedTPG()

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

Definition at line 44 of file EcalTPGScale.cc.

44  {
45  int tpg10bits = 0;
46 
47  const EcalTPGGroups::EcalTPGGroupsMap& lutGrpMap = lutGrp_.getMap();
48  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId.rawId());
49  uint32_t lutGrp = 999;
50  if (itgrp != lutGrpMap.end())
51  lutGrp = itgrp->second;
52 
53  const EcalTPGLutIdMap::EcalTPGLutMap& lutMap = lut_.getMap();
54  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp);
55  if (itLut != lutMap.end()) {
56  const unsigned int* lut = (itLut->second).getLut();
57  for (unsigned int i = 0; i < 1024; i++)
58  if (ADC == (0xff & lut[i])) {
59  tpg10bits = i;
60  break;
61  }
62  }
63 
64  return tpg10bits;
65 }

References EcalTPGLutIdMap::getMap(), EcalTPGGroups::getMap(), mps_fire::i, lut_, lutGrp_, and ecaldqm::towerId().

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

◆ getTPGInADC()

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

Definition at line 67 of file EcalTPGScale.cc.

67  {
68  unsigned int tpgADC = 0;
69 
70  // 1. get lsb
71 
72  const EcalTPGPhysicsConstMap& physMap = phys_.getMap();
73 
74  uint32_t eb = DetId(DetId::Ecal, EcalBarrel).rawId();
75  uint32_t ee = DetId(DetId::Ecal, EcalEndcap).rawId();
76  EcalTPGPhysicsConstMapIterator it = physMap.end();
77  if (towerId.subDet() == EcalBarrel)
78  it = physMap.find(eb);
79  else if (towerId.subDet() == EcalEndcap)
80  it = physMap.find(ee);
81  double lsb10bits = 0.;
82  if (it != physMap.end()) {
83  EcalTPGPhysicsConst::Item item = it->second;
84  lsb10bits = item.EtSat / 1024.;
85  }
86 
87  // 2. get compressed look-up table
88 
89  const EcalTPGGroups::EcalTPGGroupsMap& lutGrpMap = lutGrp_.getMap();
90  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId);
91  uint32_t lutGrp = 0;
92  if (itgrp != lutGrpMap.end())
93  lutGrp = itgrp->second;
94 
95  const EcalTPGLutIdMap::EcalTPGLutMap& lutMap = lut_.getMap();
96  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp);
97  if (itLut != lutMap.end()) {
98  const unsigned int* lut = (itLut->second).getLut();
99  if (lsb10bits > 0) {
100  int tpgADC10b = int(energy / lsb10bits + 0.5);
101  if (tpgADC10b >= 0 && tpgADC10b < 1024)
102  tpgADC = (0xff & lut[tpgADC10b]);
103  if (tpgADC10b >= 1024)
104  tpgADC = 0xff;
105  }
106  }
107 
108  return tpgADC;
109 }

References DetId::Ecal, EcalBarrel, EcalEndcap, HCALHighEnergyHPDFilter_cfi::energy, EcalTPGLutIdMap::getMap(), EcalTPGGroups::getMap(), EcalTPGPhysicsConst::getMap(), createfilelist::int, B2GTnPMonitor_cfi::item, lut_, lutGrp_, phys_, DetId::rawId(), and ecaldqm::towerId().

Referenced by testEcalTPGScale::analyze().

◆ getTPGInGeV() [1/2]

double EcalTPGScale::getTPGInGeV ( const EcalTriggerPrimitiveDigi tpDigi) const

◆ getTPGInGeV() [2/2]

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

Definition at line 23 of file EcalTPGScale.cc.

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

References DetId::Ecal, EcalBarrel, EcalEndcap, getLinearizedTPG(), EcalTPGPhysicsConst::getMap(), B2GTnPMonitor_cfi::item, phys_, DetId::rawId(), and ecaldqm::towerId().

Member Data Documentation

◆ lut_

EcalTPGLutIdMap const& EcalTPGScale::lut_
private

Definition at line 36 of file EcalTPGScale.h.

Referenced by getLinearizedTPG(), and getTPGInADC().

◆ lutGrp_

EcalTPGLutGroup const& EcalTPGScale::lutGrp_
private

Definition at line 35 of file EcalTPGScale.h.

Referenced by getLinearizedTPG(), and getTPGInADC().

◆ phys_

EcalTPGPhysicsConst const& EcalTPGScale::phys_
private

Definition at line 34 of file EcalTPGScale.h.

Referenced by getTPGInADC(), and getTPGInGeV().

mps_fire.i
i
Definition: mps_fire.py:428
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
EcalTPGScale::lutGrp_
EcalTPGLutGroup const & lutGrp_
Definition: EcalTPGScale.h:35
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalTPGScale::getLinearizedTPG
unsigned int getLinearizedTPG(unsigned int ADC, const EcalTrigTowerDetId &towerId) const
Definition: EcalTPGScale.cc:44
EcalBarrel
Definition: EcalSubdetector.h:10
DetId
Definition: DetId.h:17
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
EcalTPGScale::getTPGInGeV
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
Definition: EcalTPGScale.cc:17
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
DetId::Ecal
Definition: DetId.h:27
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
ecaldqm::towerId
unsigned towerId(DetId const &)
Definition: EcalDQMCommonUtils.cc:79
EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
Definition: EcalTPGPhysicsConst.h:36
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
EcalTPGScale::phys_
EcalTPGPhysicsConst const & phys_
Definition: EcalTPGScale.h:34
EcalTPGPhysicsConstMapIterator
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
Definition: EcalTPGPhysicsConst.h:37
EcalTPGLutIdMap::getMap
const EcalTPGLutMap & getMap() const
Definition: EcalTPGLutIdMap.h:18
EcalTPGGroups::EcalTPGGroupsMap
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
EcalTPGScale::lut_
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36