CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( 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 {}
EcalTPGPhysicsConst const & phys_
Definition: EcalTPGScale.h:34
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36
bool getData(T &iHolder) const
Definition: EventSetup.h:128
EcalTPGLutGroup const & lutGrp_
Definition: EcalTPGScale.h:35

Member Function Documentation

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 DetId::rawId().

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 EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36
const EcalTPGLutMap & getMap() 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
unsigned int EcalTPGScale::getTPGInADC ( double  energy,
const EcalTrigTowerDetId towerId 
) const

Definition at line 67 of file EcalTPGScale.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EcalTPGPhysicsConst::Item::EtSat, EcalTPGLutIdMap::getMap(), EcalTPGGroups::getMap(), EcalTPGPhysicsConst::getMap(), B2GTnPMonitor_cfi::item, lut_, lutGrp_, phys_, DetId::rawId(), and EcalTrigTowerDetId::subDet().

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 EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
EcalTPGPhysicsConst const & phys_
Definition: EcalTPGScale.h:34
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalTPGLutIdMap const & lut_
Definition: EcalTPGScale.h:36
const EcalTPGLutMap & getMap() const
Definition: DetId.h:17
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
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
double EcalTPGScale::getTPGInGeV ( const EcalTriggerPrimitiveDigi tpDigi) const

Definition at line 17 of file EcalTPGScale.cc.

References EcalTriggerPrimitiveDigi::compressedEt(), EcalTriggerPrimitiveDigi::id(), and ecaldqm::towerId().

Referenced by testEcalTPGScale::analyze(), L1CaloInputScalesGenerator::analyze(), L1CaloInputScaleTester::analyze(), EcalTrigPrimAnalyzer::analyze(), L1RCTSaveInput::analyze(), L1RCTLutWriter::analyze(), EcalRecHitWorkerRecover::estimateEnergy(), EcalRecHitWorkerRecover::run(), and EcalDeadCellTriggerPrimitiveFilter::setEvtTPstatus().

17  {
18  const EcalTrigTowerDetId& towerId = tpDigi.id();
19  int ADC = tpDigi.compressedEt();
20  return getTPGInGeV(ADC, towerId);
21 }
int compressedEt() const
get the encoded/compressed Et of interesting sample
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
Definition: EcalTPGScale.cc:17
const EcalTrigTowerDetId & id() const
double EcalTPGScale::getTPGInGeV ( unsigned int  ADC,
const EcalTrigTowerDetId towerId 
) const

Definition at line 23 of file EcalTPGScale.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EcalTPGPhysicsConst::Item::EtSat, getLinearizedTPG(), EcalTPGPhysicsConst::getMap(), B2GTnPMonitor_cfi::item, phys_, DetId::rawId(), and EcalTrigTowerDetId::subDet().

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
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Definition: DetId.h:17
const std::map< uint32_t, Item > & getMap() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
unsigned int getLinearizedTPG(unsigned int ADC, const EcalTrigTowerDetId &towerId) const
Definition: EcalTPGScale.cc:44

Member Data Documentation

EcalTPGLutIdMap const& EcalTPGScale::lut_
private

Definition at line 36 of file EcalTPGScale.h.

Referenced by getLinearizedTPG(), and getTPGInADC().

EcalTPGLutGroup const& EcalTPGScale::lutGrp_
private

Definition at line 35 of file EcalTPGScale.h.

Referenced by getLinearizedTPG(), and getTPGInADC().

EcalTPGPhysicsConst const& EcalTPGScale::phys_
private

Definition at line 34 of file EcalTPGScale.h.

Referenced by getTPGInADC(), and getTPGInGeV().