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.

9  : theRecNumber(nullptr), neutralDensity_(nd) {
10 #ifdef EDM_ML_DEBUG
11  edm::LogVerbatim("HcalSim") << "HcalHitRelabeller initialized with"
12  << " neutralDensity " << neutralDensity_;
13 #endif
14 }

References neutralDensity_.

Member Function Documentation

◆ energyWt()

double HcalHitRelabeller::energyWt ( const uint32_t  testId) const
private

Definition at line 88 of file HcalHitRelabeller.cc.

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 }

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

Referenced by process().

◆ process()

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

Definition at line 16 of file HcalHitRelabeller.cc.

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 }

References TauDecayModes::dec, HCALHighEnergyHPDFilter_cfi::energy, energyWt(), cuy::ii, neutralDensity_, DetId::rawId(), relabel(), and theRecNumber.

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

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 }

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.

◆ setGeometry()

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

Definition at line 47 of file HcalHitRelabeller.cc.

47 { theRecNumber = recNum; }

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

ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
HcalDDDRecConstants::getLayer0Wt
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
Definition: HcalDDDRecConstants.h:85
HcalBarrel
Definition: HcalAssistant.h:33
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HcalHitRelabeller::neutralDensity_
bool neutralDensity_
Definition: HcalHitRelabeller.h:22
DetId
Definition: DetId.h:17
HcalTestNumbering::unpackHcalIndex
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
Definition: HcalTestNumbering.cc:18
PVValHelper::eta
Definition: PVValidationHelpers.h:70
DDAxes::z
HcalOuter
Definition: HcalAssistant.h:35
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
HcalDetId
Definition: HcalDetId.h:12
HcalForward
Definition: HcalAssistant.h:36
DDAxes::phi
HcalHitRelabeller::relabel
DetId relabel(const uint32_t testId) const
Definition: HcalHitRelabeller.cc:49
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HcalEndcap
Definition: HcalAssistant.h:34
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HcalHitRelabeller::theRecNumber
const HcalDDDRecConstants * theRecNumber
Definition: HcalHitRelabeller.h:21
HcalDDDRecConstants::HcalID
Definition: HcalDDDRecConstants.h:28
HcalHitRelabeller::energyWt
double energyWt(const uint32_t testId) const
Definition: HcalHitRelabeller.cc:88
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
cuy.ii
ii
Definition: cuy.py:589
HcalDDDRecConstants::getHCID
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
Definition: HcalDDDRecConstants.cc:161