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 ( bool  nd = false)

Definition at line 9 of file HcalHitRelabeller.cc.

9  :
10  theRecNumber(0),
11  neutralDensity_(nd) { }
const HcalDDDRecConstants * theRecNumber

Member Function Documentation

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

Definition at line 91 of file HcalHitRelabeller.cc.

References gather_cfg::cout, particleFlowClusterECALTimeSelected_cfi::depth, stringResolutionProvider_cfi::eta, HcalDDDRecConstants::getLayer0Wt(), phi, theRecNumber, HcalTestNumbering::unpackHcalIndex(), z, and HcalDigiParam_cfi::zside.

Referenced by process().

91  {
92 
93  HcalDetId hid;
94  int det, z, depth, eta, phi, layer;
95  HcalTestNumbering::unpackHcalIndex(testId,det,z,depth,eta,phi,layer);
96  int zside = (z==0) ? (-1) : (1);
97  double wt = (((det==1) || (det==2)) && (depth == 1)) ?
98  theRecNumber->getLayer0Wt(det,phi,zside) : 1.0;
99 #ifdef EDM_ML_DEBUG
100  std::cout << "EnergyWT::det: " << det << " z: " << z << ":" << zside
101  << " depth: " << depth << " ieta: " << eta << " iphi: " << phi
102  << " layer: " << layer << " wt " << wt << std::endl;
103 #endif
104  return wt;
105 }
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
const HcalDDDRecConstants * theRecNumber
double getLayer0Wt(int det, int phi, int zside) const
void HcalHitRelabeller::process ( std::vector< PCaloHit > &  hcalHits)

Definition at line 13 of file HcalHitRelabeller.cc.

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

Referenced by HcalDigitizer::accumulateCaloHits(), ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

13  {
14 
15  if (theRecNumber) {
16  for (unsigned int ii=0; ii<hcalHits.size(); ++ii) {
17 
18 #ifdef EDM_ML_DEBUG
19  std::cout << "Hit[" << ii << "] " << std::hex << hcalHits[ii].id()
20  << std::dec << " Neutral density " << neutralDensity_ << "\n";
21 #endif
22  double energy = (hcalHits[ii].energy());
23  if (neutralDensity_) {
24  energy *= (energyWt(hcalHits[ii].id()));
25  hcalHits[ii].setEnergy(energy);
26  }
27  DetId newid = relabel(hcalHits[ii].id());
28 #ifdef EDM_ML_DEBUG
29  std::cout << "Hit " << ii << " out of " << hcalHits.size() << " "
30  << std::hex << newid.rawId() << std::dec << " E " << energy
31  << std::endl;
32 #endif
33  hcalHits[ii].setID(newid.rawId());
34 #ifdef EDM_ML_DEBUG
35  std::cout << "Modified Hit " << HcalDetId(hcalHits[ii].id()) <<std::endl;
36 #endif
37  }
38  } else {
39  edm::LogWarning("HcalSim") << "HcalHitRelabeller: no valid HcalDDDRecConstants";
40  }
41 
42 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
ii
Definition: cuy.py:588
Definition: DetId.h:18
const HcalDDDRecConstants * theRecNumber
DetId relabel(const uint32_t testId) const
double energyWt(const uint32_t testId) const
DetId HcalHitRelabeller::relabel ( const uint32_t  testId) const
DetId HcalHitRelabeller::relabel ( const uint32_t  testId,
const HcalDDDRecConstants theRecNumber 
)
static

Definition at line 52 of file HcalHitRelabeller.cc.

References gather_cfg::cout, TauDecayModes::dec, particleFlowClusterECALTimeSelected_cfi::depth, stringResolutionProvider_cfi::eta, HcalDDDRecConstants::getHCID(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, phi, DetId::rawId(), Validation_hcalonly_cfi::sign, HcalTestNumbering::unpackHcalIndex(), and z.

52  {
53 
54 #ifdef EDM_ML_DEBUG
55  std::cout << "Enter HcalHitRelabeller::relabel " << std::endl;
56 #endif
57  HcalDetId hid;
58  int det, z, depth, eta, phi, layer, sign;
59  HcalTestNumbering::unpackHcalIndex(testId,det,z,depth,eta,phi,layer);
60 #ifdef EDM_ML_DEBUG
61  std::cout << "det: " << det << " "
62  << "z: " << z << " "
63  << "depth: " << depth << " "
64  << "ieta: " << eta << " "
65  << "iphi: " << phi << " "
66  << "layer: " << layer << std::endl;
67 #endif
68  sign=(z==0)?(-1):(1);
69  HcalDDDRecConstants::HcalID id = theRecNumber->getHCID(det,sign*eta,phi,layer,depth);
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  std::cout << " new HcalDetId -> hex.RawID = "
82  << std::hex << hid.rawId() << std::dec;
83  std::cout.flush();
84  std::cout << " det, z, depth, eta, phi = " << det << " "
85  << z << " "<< id.depth << " " << id.eta << " "
86  << id.phi << " ---> " << hid << std::endl;
87 #endif
88  return hid;
89 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
void HcalHitRelabeller::setGeometry ( const HcalDDDRecConstants *&  recNum)

Definition at line 44 of file HcalHitRelabeller.cc.

References theRecNumber.

Referenced by HcalDigitizer::updateGeometry().

44  {
45  theRecNumber = recNum;
46 }
const HcalDDDRecConstants * theRecNumber

Member Data Documentation

bool HcalHitRelabeller::neutralDensity_
private

Definition at line 22 of file HcalHitRelabeller.h.

Referenced by process().

const HcalDDDRecConstants* HcalHitRelabeller::theRecNumber
private

Definition at line 21 of file HcalHitRelabeller.h.

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