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 {}
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
EcalTPGPhysicsConst const & phys_
Definition: EcalTPGScale.h:34
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36
EcalTPGLutGroup const & lutGrp_
Definition: EcalTPGScale.h:35

Member Function Documentation

◆ getLinearizedTPG()

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

Definition at line 44 of file EcalTPGScale.cc.

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

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

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 }
const EcalTPGLutMap & getMap() const
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
EcalTPGLutGroup const & lutGrp_
Definition: EcalTPGScale.h:35
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr

◆ getTPGInADC()

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

Definition at line 67 of file EcalTPGScale.cc.

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().

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 }
const EcalTPGLutMap & getMap() const
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
EcalTPGPhysicsConst const & phys_
Definition: EcalTPGScale.h:34
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
const std::map< uint32_t, Item > & getMap() const
EcalTPGLutGroup const & lutGrp_
Definition: EcalTPGScale.h:35
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr

◆ 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.

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

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 }
EcalTPGPhysicsConst const & phys_
Definition: EcalTPGScale.h:34
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
unsigned int getLinearizedTPG(unsigned int ADC, const EcalTrigTowerDetId &towerId) const
Definition: EcalTPGScale.cc:44
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const std::map< uint32_t, Item > & getMap() const
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator

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().