CMS 3D CMS Logo

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

#include <ZdcNumberingScheme.h>

Public Member Functions

int detectorLevel (const G4Step *) const
 
void detectorLevel (const G4Step *, int &, int *, G4String *) const
 
virtual unsigned int getUnitID (const G4Step *aStep) const
 
void setVerbosity (const int)
 
 ZdcNumberingScheme (int)
 
virtual ~ZdcNumberingScheme ()
 

Static Public Member Functions

static unsigned int packZdcIndex (int subDet, int layer, int fiber, int channel, int z)
 
static void unpackZdcIndex (const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
 

Private Attributes

int verbosity
 

Detailed Description

Definition at line 13 of file ZdcNumberingScheme.h.

Constructor & Destructor Documentation

◆ ZdcNumberingScheme()

ZdcNumberingScheme::ZdcNumberingScheme ( int  iv)

Definition at line 13 of file ZdcNumberingScheme.cc.

13  {
14  verbosity = iv;
15  if (verbosity > 0)
16  std::cout << "Creating ZDCNumberingScheme" << std::endl;
17 }

References gather_cfg::cout, and verbosity.

◆ ~ZdcNumberingScheme()

ZdcNumberingScheme::~ZdcNumberingScheme ( )
virtual

Definition at line 19 of file ZdcNumberingScheme.cc.

19  {
20  if (verbosity > 0)
21  std::cout << " Deleting ZdcNumberingScheme" << std::endl;
22 }

References gather_cfg::cout, and verbosity.

Member Function Documentation

◆ detectorLevel() [1/2]

int ZdcNumberingScheme::detectorLevel ( const G4Step *  aStep) const

Definition at line 153 of file ZdcNumberingScheme.cc.

153  {
154  //Find number of levels
155  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
156  int level = 0;
157  if (touch)
158  level = ((touch->GetHistoryDepth()) + 1);
159  return level;
160 }

References personalPlayback::level.

Referenced by getUnitID().

◆ detectorLevel() [2/2]

void ZdcNumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const

Definition at line 162 of file ZdcNumberingScheme.cc.

162  {
163  //Get name and copy numbers
164  if (level > 0) {
165  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
166  for (int ii = 0; ii < level; ii++) {
167  int i = level - ii - 1;
168  name[ii] = touch->GetVolume(i)->GetName();
169  copyno[ii] = touch->GetReplicaNumber(i);
170  }
171  }
172 }

References mps_fire::i, cuy::ii, personalPlayback::level, and Skims_PA_cff::name.

◆ getUnitID()

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

Definition at line 26 of file ZdcNumberingScheme.cc.

26  {
27  uint32_t index = 0;
28  int level = detectorLevel(aStep);
29 
30  if (level > 0) {
31  int* copyno = new int[level];
32  G4String* name = new G4String[level];
33 
34  detectorLevel(aStep, level, copyno, name);
35 
36  int zside = 0;
37  int channel = 0;
38  int fiber = 0;
39  int layer = 0;
41 
42  for (int ich = 0; ich < level; ich++) {
43  if (name[ich] == "ZDC") {
44  if (copyno[ich] == 1)
45  zside = 1;
46  if (copyno[ich] == 2)
47  zside = -1;
48  } else if (name[ich] == "ZDC_EMLayer") {
50 #ifdef debug
51  layer = copyno[ich];
52 #endif
53  } else if (name[ich] == "ZDC_EMFiber") {
54  fiber = copyno[ich];
55  if (fiber < 20)
56  channel = 1;
57  else if (fiber < 39)
58  channel = 2;
59  else if (fiber < 58)
60  channel = 3;
61  else if (fiber < 77)
62  channel = 4;
63  else
64  channel = 5;
65  } else if (name[ich] == "ZDC_LumLayer") {
67  layer = copyno[ich];
68  channel = layer;
69  } else if (name[ich] == "ZDC_HadLayer") {
71  layer = copyno[ich];
72  if (layer < 6)
73  channel = 1;
74  else if (layer < 12)
75  channel = 2;
76  else if (layer < 18)
77  channel = 3;
78  else
79  channel = 4;
80  }
81 #ifdef debug
82  else if (name[ich] == "ZDC_LumGas") {
83  fiber = 1;
84  } else if (name[ich] == "ZDC_HadFiber") {
85  fiber = copyno[ich];
86  }
87 #endif
88  }
89 
90 #ifdef debug
91  unsigned intindex = 0;
92  intindex = packZdcIndex(section, layer, fiber, channel, zside);
93 #endif
94 
95  bool true_for_positive_eta = true;
96  if (zside == -1)
97  true_for_positive_eta = false;
98 
99  HcalZDCDetId zdcId(section, true_for_positive_eta, channel);
100  index = zdcId.rawId();
101 
102 #ifdef debug
103  std::cout << "DetectorId: ";
104  std::cout << zdcId << std::endl;
105 
106  std::cout << "ZdcNumberingScheme:"
107  << " getUnitID - # of levels = " << level << std::endl;
108  for (int ich = 0; ich < level; ich++)
109  std::cout << " " << ich << ": copyno " << copyno[ich] << " name=" << name[ich] << " section " << section
110  << " zside " << zside << " layer " << layer << " fiber " << fiber << " channel " << channel
111  << "packedIndex =" << intindex << " detId raw: " << index << std::endl;
112 
113 #endif
114 
115  delete[] copyno;
116  delete[] name;
117  }
118 
119  return index;
120 }

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

◆ packZdcIndex()

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

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 122 of file ZdcNumberingScheme.cc.

122  {
123  unsigned int idx = ((z - 1) & 1) << 20; //bit 20
124  idx += (channel & 7) << 17; //bits 17-19
125  idx += (fiber & 255) << 9; //bits 9-16
126  idx += (layer & 127) << 2; //bits 2-8
127  idx += (section & 3); //bits 0-1
128 
129 #ifdef debug
130  std::cout << "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber << " channel " << channel
131  << " zside " << z << "idx: " << idx << std::endl;
132  int newsubdet, newlayer, newfiber, newchannel, newz;
133  unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
134 #endif
135 
136  return idx;
137 }

References gather_cfg::cout, heavyIonCSV_trainingSettings::idx, hgcalPlots::section, unpackZdcIndex(), and z.

Referenced by getUnitID().

◆ setVerbosity()

void ZdcNumberingScheme::setVerbosity ( const int  iv)

Definition at line 24 of file ZdcNumberingScheme.cc.

24 { verbosity = iv; }

References verbosity.

◆ unpackZdcIndex()

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

Definition at line 139 of file ZdcNumberingScheme.cc.

140  {
141  z = 1 + ((idx >> 20) & 1);
142  channel = (idx >> 17) & 7;
143  fiber = (idx >> 9) & 255;
144  layer = (idx >> 2) & 127;
145  section = idx & 3;
146 
147 #ifdef debug
148  std::cout << "ZDC unpacking: idx:" << idx << " -> section " << section << " layer " << layer << " fiber " << fiber
149  << " channel " << channel << " zside " << z << std::endl;
150 #endif
151 }

References gather_cfg::cout, heavyIonCSV_trainingSettings::idx, hgcalPlots::section, and z.

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

Member Data Documentation

◆ verbosity

int ZdcNumberingScheme::verbosity
private

Definition at line 35 of file ZdcNumberingScheme.h.

Referenced by setVerbosity(), ZdcNumberingScheme(), and ~ZdcNumberingScheme().

personalPlayback.level
level
Definition: personalPlayback.py:22
ZdcNumberingScheme::verbosity
int verbosity
Definition: ZdcNumberingScheme.h:35
mps_fire.i
i
Definition: mps_fire.py:428
HcalZDCDetId::HAD
Definition: HcalZDCDetId.h:23
HcalZDCDetId::Section
Section
Definition: HcalZDCDetId.h:23
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
gather_cfg.cout
cout
Definition: gather_cfg.py:144
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
HcalZDCDetId
Definition: HcalZDCDetId.h:16
DDAxes::z
ZdcNumberingScheme::packZdcIndex
static unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z)
Definition: ZdcNumberingScheme.cc:122
ZdcNumberingScheme::unpackZdcIndex
static void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
Definition: ZdcNumberingScheme.cc:139
HcalZDCDetId::Unknown
Definition: HcalZDCDetId.h:23
ZdcNumberingScheme::detectorLevel
int detectorLevel(const G4Step *) const
Definition: ZdcNumberingScheme.cc:153
hgcalPlots.section
section
Definition: hgcalPlots.py:2049
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HcalZDCDetId::LUM
Definition: HcalZDCDetId.h:23
HcalZDCDetId::EM
Definition: HcalZDCDetId.h:23
cuy.ii
ii
Definition: cuy.py:590