CMS 3D CMS Logo

Functions
ZdcNumberingScheme Namespace Reference

Functions

unsigned int getUnitID (const G4Step *aStep)
 
unsigned int packZdcIndex (int subDet, int layer, int fiber, int channel, int z)
 
void unpackZdcIndex (const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
 

Function Documentation

◆ getUnitID()

unsigned int ZdcNumberingScheme::getUnitID ( const G4Step *  aStep)

Definition at line 42 of file ZdcNumberingScheme.cc.

References TauDecayModes::dec, HcalZDCDetId::EM, HcalZDCDetId::HAD, personalPlayback::level, HcalZDCDetId::LUM, Skims_PA_cff::name, packZdcIndex(), DetId::rawId(), hgcalPlots::section, HcalZDCDetId::Unknown, and ecaldqm::zside().

Referenced by ZdcSD::setDetUnitId().

42  {
43  uint32_t index = 0;
44  int level = detectorLevel(aStep);
45 
46  if (level > 0) {
47  std::vector<int> copyno;
48  std::vector<G4String> name;
49 
50  detectorLevel(aStep, level, copyno, name);
51 
52  int zside = 0;
53  int channel = 0;
54  int fiber = 0;
55  int layer = 0;
57 
58  for (int ich = 0; ich < level; ich++) {
59  if (name[ich] == "ZDC") {
60  if (copyno[ich] == 1)
61  zside = 1;
62  if (copyno[ich] == 2)
63  zside = -1;
64  } else if (name[ich] == "ZDC_EMLayer") {
66 #ifdef EDM_ML_DEBUG
67  layer = copyno[ich];
68 #endif
69  } else if (name[ich] == "ZDC_EMFiber") {
70  fiber = copyno[ich];
71  if (fiber < 20)
72  channel = 1;
73  else if (fiber < 39)
74  channel = 2;
75  else if (fiber < 58)
76  channel = 3;
77  else if (fiber < 77)
78  channel = 4;
79  else
80  channel = 5;
81  } else if (name[ich] == "ZDC_LumLayer") {
83  layer = copyno[ich];
84  channel = layer;
85  } else if (name[ich] == "ZDC_HadLayer") {
87  layer = copyno[ich];
88  if (layer < 6)
89  channel = 1;
90  else if (layer < 12)
91  channel = 2;
92  else if (layer < 18)
93  channel = 3;
94  else
95  channel = 4;
96  }
97 #ifdef EDM_ML_DEBUG
98  else if (name[ich] == "ZDC_LumGas") {
99  fiber = 1;
100  } else if (name[ich] == "ZDC_HadFiber") {
101  fiber = copyno[ich];
102  }
103 #endif
104  }
105 
106 #ifdef EDM_ML_DEBUG
107  unsigned intindex = 0;
108  intindex = packZdcIndex(section, layer, fiber, channel, zside);
109 #endif
110 
111  bool true_for_positive_eta = true;
112  if (zside == -1)
113  true_for_positive_eta = false;
114 
115  HcalZDCDetId zdcId(section, true_for_positive_eta, channel);
116  index = zdcId.rawId();
117 
118 #ifdef EDM_ML_DEBUG
119  edm::LogVerbatim("ForwardSim") << "DetectorId: " << zdcId;
120 
121  edm::LogVerbatim("ForwardSim") << "ZdcNumberingScheme:"
122  << " getUnitID - # of levels = " << level;
123  for (int ich = 0; ich < level; ich++)
124  edm::LogVerbatim("ForwardSim") << " " << ich << ": copyno " << copyno[ich] << " name=" << name[ich]
125  << " section " << section << " zside " << zside << " layer " << layer
126  << " fiber " << fiber << " channel " << channel << "packedIndex =" << intindex
127  << " detId raw: " << std::hex << index << std::dec;
128 
129 #endif
130  }
131 
132  return index;
133  }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z)

◆ packZdcIndex()

unsigned ZdcNumberingScheme::packZdcIndex ( int  subDet,
int  layer,
int  fiber,
int  channel,
int  z 
)

pack the Unit ID for Zdc
z = 1,2 = -z,+z; subDet = 1,2,3 = EM,Lum,HAD; fiber = 1-96 (EM,HAD), 1 (Lum); channel = 1-5 (EM), layer# (Lum), 1-3 (HAD)

Definition at line 135 of file ZdcNumberingScheme.cc.

References TauDecayModes::dec, heavyIonCSV_trainingSettings::idx, hgcalPlots::section, and unpackZdcIndex().

Referenced by getUnitID().

135  {
136  unsigned int idx = ((z - 1) & 1) << 20; //bit 20
137  idx += (channel & 7) << 17; //bits 17-19
138  idx += (fiber & 255) << 9; //bits 9-16
139  idx += (layer & 127) << 2; //bits 2-8
140  idx += (section & 3); //bits 0-1
141 
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("ForwardSim") << "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber
144  << " channel " << channel << " zside " << z << "idx: " << std::hex << idx
145  << std::dec;
146  int newsubdet, newlayer, newfiber, newchannel, newz;
147  unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
148 #endif
149 
150  return idx;
151  }
Log< level::Info, true > LogVerbatim
float float float z
void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)

◆ unpackZdcIndex()

void ZdcNumberingScheme::unpackZdcIndex ( const unsigned int &  idx,
int &  subDet,
int &  layer,
int &  fiber,
int &  channel,
int &  z 
)

Definition at line 153 of file ZdcNumberingScheme.cc.

References heavyIonCSV_trainingSettings::idx, and hgcalPlots::section.

Referenced by packZdcIndex(), and ZdcTestAnalysis::update().

153  {
154  z = 1 + ((idx >> 20) & 1);
155  channel = (idx >> 17) & 7;
156  fiber = (idx >> 9) & 255;
157  layer = (idx >> 2) & 127;
158  section = idx & 3;
159 
160 #ifdef EDM_ML_DEBUG
161  edm::LogVerbatim("ForwardSim") << "ZDC unpacking: idx:" << idx << " -> section " << section << " layer " << layer
162  << " fiber " << fiber << " channel " << channel << " zside " << z;
163 #endif
164  }
Log< level::Info, true > LogVerbatim
float float float z