test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalHitRelabeller Class Reference

#include <HcalHitRelabeller.h>

Public Member Functions

 HcalHitRelabeller (const edm::ParameterSet &ps)
 
void process (std::vector< PCaloHit > &hcalHits)
 
void setGeometry (const CaloGeometry *&theGeometry)
 

Private Member Functions

DetId relabel (const uint32_t testId) const
 

Private Attributes

bool m_CorrectPhi
 
std::vector< std::vector< int > > m_segmentation
 
const CaloGeometrytheGeometry
 

Detailed Description

Definition at line 10 of file HcalHitRelabeller.h.

Constructor & Destructor Documentation

HcalHitRelabeller::HcalHitRelabeller ( const edm::ParameterSet ps)

Definition at line 10 of file HcalHitRelabeller.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), i, gen::k, m_CorrectPhi, m_segmentation, and mergeVDriftHistosByStation::name.

10  {
11  // try to make sure the memory gets pinned in place
12  m_segmentation.resize(29);
13  m_CorrectPhi = ps.getUntrackedParameter<bool>("CorrectPhi",false);
14  for (int i=0; i<29; i++) {
15  char name[10];
16  snprintf(name,10,"Eta%d",i+1);
17  if (i>0) {
18  m_segmentation[i]=ps.getUntrackedParameter<std::vector<int> >(name,m_segmentation[i-1]);
19  } else {
20  m_segmentation[i]=ps.getUntrackedParameter<std::vector<int> >(name);
21  }
22  }
23 #ifdef DEBUG
24  for (int i=0; i<29; i++) {
25  std::cout << "Segmentation[" << i << "] with " << m_segmentation[i].size() << " elements:";
26  for (unsigned int k=0; k<m_segmentation[i].size(); ++k)
27  std::cout << " " << m_segmentation[i][k];
28  std::cout << std::endl;
29  }
30  std::cout << "correctPhi " << m_CorrectPhi << std::endl;
31 #endif
32 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
std::vector< std::vector< int > > m_segmentation
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

Definition at line 34 of file HcalHitRelabeller.cc.

References gather_cfg::cout, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), cuy::ii, python.tagInventory::newid, DetId::rawId(), relabel(), and theGeometry.

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

34  {
35 
36  for (unsigned int ii=0; ii<hcalHits.size(); ++ii) {
37 
38 #ifdef DEBUG
39  std::cout << "Hit[" << ii << "] " << std::hex << hcalHits[ii].id() << std::dec << '\n';
40 #endif
41  DetId newid = relabel(hcalHits[ii].id());
42 #ifdef DEBUG
43  std::cout << "Hit " << ii << " out of " << hcalHits.size() << " " << std::hex << newid.rawId() << std::dec << '\n';
44  HcalDetId newcell(newid);
45  const CaloCellGeometry *cellGeometry =
47  GlobalPoint globalposition = (GlobalPoint)(cellGeometry->getPosition());
48 
49  std::cout << "PCaloHit " << newcell << " position: " << globalposition << std::endl;
50  std::cout.flush();
51 #endif
52  hcalHits[ii].setID(newid.rawId());
53 #ifdef DEBUG
54  std::cout << "Modified Hit " << hcalHits[ii] << std::endl;
55 #endif
56  }
57  //End Change by Wetzel
58 
59 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
const CaloGeometry * theGeometry
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
int ii
Definition: cuy.py:588
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: DetId.h:18
tuple cout
Definition: gather_cfg.py:121
DetId relabel(const uint32_t testId) const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
DetId HcalHitRelabeller::relabel ( const uint32_t  testId) const
private

Definition at line 66 of file HcalHitRelabeller.cc.

References gather_cfg::cout, eta(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, m_CorrectPhi, m_segmentation, phi, DetId::rawId(), HcalTestNumbering::unpackHcalIndex(), and detailsBasic3DVector::z.

Referenced by process().

66  {
67 
68 #ifdef DEBUG
69  std::cout << "Enter HcalHitRelabeller::relabel " << std::endl;
70 #endif
71  HcalDetId hid;
72  int det, z, depth, eta, phi, layer, sign;
73  HcalTestNumbering::unpackHcalIndex(testId,det,z,depth,eta,phi,layer);
74 
75  layer-=1; // one is added in the simulation, here used for indexing
76 
77  sign=(z==0)?(-1):(1);
78 #ifdef DEBUG
79  std::cout << "det: " << det << " "
80  << "z: " << z << " "
81  << "depth: " << depth << " "
82  << "ieta: " << eta << " "
83  << "iphi: " << phi << " "
84  << "layer: " << layer << " ";
85  std::cout.flush();
86 #endif
87  int newDepth = 0; // moved out of if's just for printing purposes...
88  int phi_skip = phi;
89  if (m_CorrectPhi) {
90  if (eta >= 40) phi_skip = (phi-1)*4 - 1;
91  else if (eta > 20) phi_skip = (phi-1)*2 + 1;
92  if (phi_skip < 0) phi_skip += 72;
93  }
94 
95  if (det==int(HcalBarrel)) {
96  newDepth=m_segmentation[eta-1][layer];
97  if(eta==16 && newDepth > 2) newDepth=2;// tower 16 HACK to be watched out..
98  hid=HcalDetId(HcalBarrel,eta*sign,phi_skip,newDepth);
99  }
100  if (det==int(HcalEndcap)) {
101  newDepth=m_segmentation[eta-1][layer];
102  if (eta==16 && newDepth<3) newDepth=3; // tower 16 HACK to be watched out..
103  hid=HcalDetId(HcalEndcap,eta*sign,phi_skip,newDepth);
104  }
105  if (det==int(HcalOuter)) {
106  hid=HcalDetId(HcalOuter,eta*sign,phi_skip,4);
107  newDepth = 4;
108  }
109  if (det==int(HcalForward)) {
110  hid=HcalDetId(HcalForward,eta*sign,phi_skip,depth);
111  newDepth = depth;
112  }
113 #ifdef DEBUG
114  std::cout << " new HcalDetId -> hex.RawID = "
115  << std::hex << hid.rawId() << std::dec;
116  std::cout.flush();
117  std::cout << " det, z, depth, eta, phi = "
118  << det << " "
119  << z << " "
120  << newDepth << " "
121  << eta << " "
122  << phi << " " << phi_skip << " "
123  << " ---> " << hid << std::endl;
124 #endif
125  return hid;
126 }
T eta() const
float float float z
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
std::vector< std::vector< int > > m_segmentation
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
void HcalHitRelabeller::setGeometry ( const CaloGeometry *&  theGeometry)

Definition at line 62 of file HcalHitRelabeller.cc.

References relativeConstraints::geom, and theGeometry.

Referenced by HcalDigitizer::updateGeometry().

62  {
63  theGeometry = geom;
64 }

Member Data Documentation

bool HcalHitRelabeller::m_CorrectPhi
private

Definition at line 22 of file HcalHitRelabeller.h.

Referenced by HcalHitRelabeller(), and relabel().

std::vector<std::vector<int> > HcalHitRelabeller::m_segmentation
private

Definition at line 21 of file HcalHitRelabeller.h.

Referenced by HcalHitRelabeller(), and relabel().

const CaloGeometry* HcalHitRelabeller::theGeometry
private

Definition at line 19 of file HcalHitRelabeller.h.

Referenced by process(), and setGeometry().