CMS 3D CMS Logo

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

#include <HcalHitRelabeller.h>

Public Member Functions

 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 Member Functions

double energyWt (const uint32_t testId) const
 

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
private

Definition at line 88 of file HcalHitRelabeller.cc.

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

Referenced by process().

88  {
89  int det, z, depth, eta, phi, layer;
91  int zside = (z == 0) ? (-1) : (1);
92  double wt = (((det == 1) || (det == 2)) && (depth == 1)) ? theRecNumber->getLayer0Wt(det, phi, zside) : 1.0;
93 #ifdef EDM_ML_DEBUG
94  edm::LogVerbatim("HcalSim") << "EnergyWT::det: " << det << " z: " << z << ":" << zside << " depth: " << depth
95  << " ieta: " << eta << " iphi: " << phi << " layer: " << layer << " wt " << wt;
96 #endif
97  return wt;
98 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
constexpr std::array< uint8_t, layerIndexSize > 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, HCALHighEnergyHPDFilter_cfi::energy, energyWt(), cuy::ii, neutralDensity_, DetId::rawId(), relabel(), and theRecNumber.

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  double energy = (hcalHit.energy());
27  if (neutralDensity_) {
28  energy *= (energyWt(hcalHit.id()));
29  hcalHit.setEnergy(energy);
30  }
31  DetId newid = relabel(hcalHit.id());
32 #ifdef EDM_ML_DEBUG
33  edm::LogVerbatim("HcalSim") << "Hit " << ii << " out of " << hcalHits.size() << " " << std::hex << newid.rawId()
34  << std::dec << " E " << energy;
35 #endif
36  hcalHit.setID(newid.rawId());
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("HcalSim") << "Modified Hit " << HcalDetId(hcalHit.id());
39  ++ii;
40 #endif
41  }
42  } else {
43  edm::LogWarning("HcalSim") << "HcalHitRelabeller: no valid HcalDDDRecConstants";
44  }
45 }
Log< level::Info, true > LogVerbatim
DetId relabel(const uint32_t testId) const
ii
Definition: cuy.py:589
Definition: DetId.h:17
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

◆ 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 53 of file HcalHitRelabeller.cc.

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

53  {
54 #ifdef EDM_ML_DEBUG
55  edm::LogVerbatim("HcalSim") << "Enter HcalHitRelabeller::relabel";
56 #endif
57  HcalDetId hid;
58  int det, z, depth, eta, phi, layer, sign;
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("HcalSim") << "det: " << det << " "
62  << "z: " << z << " "
63  << "depth: " << depth << " "
64  << "ieta: " << eta << " "
65  << "iphi: " << phi << " "
66  << "layer: " << layer;
67 #endif
68  sign = (z == 0) ? (-1) : (1);
70 
71  if (id.subdet == int(HcalBarrel)) {
72  hid = HcalDetId(HcalBarrel, sign * id.eta, id.phi, id.depth);
73  } else if (id.subdet == int(HcalEndcap)) {
74  hid = HcalDetId(HcalEndcap, sign * id.eta, id.phi, id.depth);
75  } else if (id.subdet == int(HcalOuter)) {
76  hid = HcalDetId(HcalOuter, sign * id.eta, id.phi, id.depth);
77  } else if (id.subdet == int(HcalForward)) {
78  hid = HcalDetId(HcalForward, sign * id.eta, id.phi, id.depth);
79  }
80 #ifdef EDM_ML_DEBUG
81  edm::LogVerbatim("HcalSim") << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId() << std::dec
82  << " det, z, depth, eta, phi = " << det << " " << z << " " << id.depth << " " << id.eta
83  << " " << id.phi << " ---> " << hid;
84 #endif
85  return hid;
86 }
Log< level::Info, true > LogVerbatim
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
constexpr std::array< uint8_t, layerIndexSize > 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 47 of file HcalHitRelabeller.cc.

References theRecNumber.

47 { theRecNumber = recNum; }
const HcalDDDRecConstants * theRecNumber

Member Data Documentation

◆ neutralDensity_

bool HcalHitRelabeller::neutralDensity_
private

Definition at line 22 of file HcalHitRelabeller.h.

Referenced by HcalHitRelabeller(), and process().

◆ theRecNumber

const HcalDDDRecConstants* HcalHitRelabeller::theRecNumber
private

Definition at line 21 of file HcalHitRelabeller.h.

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