CMS 3D CMS Logo

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

#include <HcalHitRelabeller.h>

Public Member Functions

double energyWt (const uint32_t testId) const
 
 HcalHitRelabeller (bool nd=false)
 
void process (std::vector< PCaloHit > &hcalHits)
 
DetId relabel (const uint32_t testId) const
 
void setGeometry (const HcalDDDRecConstants *&)
 

Static Public Member Functions

static DetId relabel (const uint32_t testId, const HcalDDDRecConstants *theRecNumber)
 

Private Attributes

bool neutralDensity_
 
const HcalDDDRecConstantstheRecNumber
 

Detailed Description

Definition at line 10 of file HcalHitRelabeller.h.

Constructor & Destructor Documentation

◆ HcalHitRelabeller()

HcalHitRelabeller::HcalHitRelabeller ( bool  nd = false)

Definition at line 9 of file HcalHitRelabeller.cc.

References neutralDensity_.

9  : theRecNumber(nullptr), neutralDensity_(nd) {
10 #ifdef EDM_ML_DEBUG
11  edm::LogVerbatim("HcalSim") << "HcalHitRelabeller initialized with"
12  << " neutralDensity " << neutralDensity_;
13 #endif
14 }
Log< level::Info, true > LogVerbatim
const HcalDDDRecConstants * theRecNumber

Member Function Documentation

◆ energyWt()

double HcalHitRelabeller::energyWt ( const uint32_t  testId) const

Definition at line 95 of file HcalHitRelabeller.cc.

References LEDCalibrationChannels::depth, PVValHelper::eta, HcalDDDRecConstants::getLayer0Wt(), pixelTopology::layer, phi, theRecNumber, HcalTestNumbering::unpackHcalIndex(), z, and ecaldqm::zside().

Referenced by process().

95  {
96  int det, z, depth, eta, phi, layer;
98  int zside = (z == 0) ? (-1) : (1);
99  double wt = ((((det == 1) && (layer <= 1)) || ((det == 2) && (layer <= 2))) && (depth == 1))
101  : 1.0;
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HcalSim") << "EnergyWT::det: " << det << " z: " << z << ":" << zside << " depth: " << depth
104  << " ieta: " << eta << " iphi: " << phi << " layer: " << layer << " wt " << wt;
105 #endif
106  return wt;
107 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
const HcalDDDRecConstants * theRecNumber

◆ process()

void HcalHitRelabeller::process ( std::vector< PCaloHit > &  hcalHits)

Definition at line 16 of file HcalHitRelabeller.cc.

References TauDecayModes::dec, LEDCalibrationChannels::depth, HcalDetId::depth(), HCALHighEnergyHPDFilter_cfi::energy, energyWt(), PVValHelper::eta, HcalDetId::ietaAbs(), cuy::ii, HcalDetId::iphi(), pixelTopology::layer, neutralDensity_, HcalTestNumbering::packHcalIndex(), phi, DetId::rawId(), relabel(), HcalDetId::subdet(), theRecNumber, HcalTestNumbering::unpackHcalIndex(), z, and HcalDetId::zside().

16  {
17  if (theRecNumber) {
18 #ifdef EDM_ML_DEBUG
19  int ii(0);
20 #endif
21  for (auto& hcalHit : hcalHits) {
22 #ifdef EDM_ML_DEBUG
23  edm::LogVerbatim("HcalSim") << "Hit[" << ii << "] " << std::hex << hcalHit.id() << std::dec << " Neutral density "
24  << neutralDensity_;
25 #endif
26  uint32_t hid;
27  int det, z, depth, eta, phi, layer;
28  HcalTestNumbering::unpackHcalIndex(hcalHit.id(), det, z, depth, eta, phi, layer);
29  if ((det == 2) && (layer == 2) && (eta == 18))
30  depth = 2;
32  double wt = (neutralDensity_) ? (energyWt(hid)) : 1.0;
33  double energy = wt * (hcalHit.energy());
34  hcalHit.setEnergy(energy);
35  uint32_t newid = relabel(hid).rawId();
36 #ifdef EDM_ML_DEBUG
37  edm::LogVerbatim("HcalSim") << "Hit " << ii << " out of " << hcalHits.size() << " " << std::hex << newid
38  << std::dec << " E " << energy << " wt " << wt;
39 #endif
40  hcalHit.setID(newid);
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("HcalSim") << "Final Setting::subdet: " << HcalDetId(newid).subdet()
43  << " z: " << HcalDetId(newid).zside() << " depth: " << HcalDetId(newid).depth()
44  << " ieta: " << HcalDetId(newid).ietaAbs() << " iphi: " << HcalDetId(newid).iphi()
45  << " wt " << wt;
46  ++ii;
47 #endif
48  }
49  } else {
50  edm::LogWarning("HcalSim") << "HcalHitRelabeller: no valid HcalDDDRecConstants";
51  }
52 }
Log< level::Info, true > LogVerbatim
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
DetId relabel(const uint32_t testId) const
ii
Definition: cuy.py:589
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
double energyWt(const uint32_t testId) const
const HcalDDDRecConstants * theRecNumber
Log< level::Warning, false > LogWarning
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164

◆ relabel() [1/2]

DetId HcalHitRelabeller::relabel ( const uint32_t  testId) const

◆ relabel() [2/2]

DetId HcalHitRelabeller::relabel ( const uint32_t  testId,
const HcalDDDRecConstants theRecNumber 
)
static

Definition at line 60 of file HcalHitRelabeller.cc.

References TauDecayModes::dec, LEDCalibrationChannels::depth, PVValHelper::eta, HcalDDDRecConstants::getHCID(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, pixelTopology::layer, phi, DetId::rawId(), Validation_hcalonly_cfi::sign, theRecNumber, HcalTestNumbering::unpackHcalIndex(), and z.

60  {
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HcalSim") << "Enter HcalHitRelabeller::relabel";
63 #endif
64  HcalDetId hid;
65  int det, z, depth, eta, phi, layer, sign;
67 
68  sign = (z == 0) ? (-1) : (1);
70  int depth0 = ((det == 1) && (layer == 2) && (eta == 15)) ? depth : id.depth;
71 
72  if (id.subdet == int(HcalBarrel)) {
73  hid = HcalDetId(HcalBarrel, sign * id.eta, id.phi, depth0);
74  } else if (id.subdet == int(HcalEndcap)) {
75  hid = HcalDetId(HcalEndcap, sign * id.eta, id.phi, depth0);
76  } else if (id.subdet == int(HcalOuter)) {
77  hid = HcalDetId(HcalOuter, sign * id.eta, id.phi, depth0);
78  } else if (id.subdet == int(HcalForward)) {
79  hid = HcalDetId(HcalForward, sign * id.eta, id.phi, depth0);
80  }
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("HcalSim") << "Initial indices:"
83  << "subdet: " << det << " "
84  << "z: " << z << " "
85  << "depth: " << depth << " "
86  << "ieta: " << eta << " "
87  << "iphi: " << phi << " "
88  << "layer: " << layer << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId()
89  << std::dec << " subdet, z, depth, eta, phi = " << det << " " << z << " " << id.depth
90  << " " << id.eta << " " << id.phi << " ---> " << hid;
91 #endif
92  return hid;
93 }
Log< level::Info, true > LogVerbatim
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const HcalDDDRecConstants * theRecNumber

◆ setGeometry()

void HcalHitRelabeller::setGeometry ( const HcalDDDRecConstants *&  recNum)

Definition at line 54 of file HcalHitRelabeller.cc.

References theRecNumber.

54 { theRecNumber = recNum; }
const HcalDDDRecConstants * theRecNumber

Member Data Documentation

◆ neutralDensity_

bool HcalHitRelabeller::neutralDensity_
private

Definition at line 21 of file HcalHitRelabeller.h.

Referenced by HcalHitRelabeller(), and process().

◆ theRecNumber

const HcalDDDRecConstants* HcalHitRelabeller::theRecNumber
private

Definition at line 20 of file HcalHitRelabeller.h.

Referenced by energyWt(), process(), relabel(), and setGeometry().