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

References gpuVertexFinder::iv, and verbosity.

16  {
17  verbosity = iv;
18  if (verbosity > 0)
19  edm::LogVerbatim("ForwardSim") << "Creating ZDCNumberingScheme";
20 }
Log< level::Info, true > LogVerbatim
int32_t *__restrict__ iv

◆ ~ZdcNumberingScheme()

ZdcNumberingScheme::~ZdcNumberingScheme ( )
virtual

Definition at line 22 of file ZdcNumberingScheme.cc.

References verbosity.

22  {
23  if (verbosity > 0)
24  edm::LogVerbatim("ForwardSim") << " Deleting ZdcNumberingScheme";
25 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ detectorLevel() [1/2]

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

Definition at line 156 of file ZdcNumberingScheme.cc.

References personalPlayback::level.

Referenced by getUnitID().

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

◆ detectorLevel() [2/2]

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

Definition at line 165 of file ZdcNumberingScheme.cc.

References ForwardName::getName(), mps_fire::i, cuy::ii, personalPlayback::level, and Skims_PA_cff::name.

165  {
166  //Get name and copy numbers
167  if (level > 0) {
168  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
169  for (int ii = 0; ii < level; ii++) {
170  int i = level - ii - 1;
171  name[ii] = ForwardName::getName(touch->GetVolume(i)->GetName());
172  copyno[ii] = touch->GetReplicaNumber(i);
173  }
174  }
175 }
ii
Definition: cuy.py:589
std::string getName(const G4String &)
Definition: ForwardName.cc:3

◆ getUnitID()

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

Definition at line 29 of file ZdcNumberingScheme.cc.

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

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

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

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

Referenced by getUnitID().

125  {
126  unsigned int idx = ((z - 1) & 1) << 20; //bit 20
127  idx += (channel & 7) << 17; //bits 17-19
128  idx += (fiber & 255) << 9; //bits 9-16
129  idx += (layer & 127) << 2; //bits 2-8
130  idx += (section & 3); //bits 0-1
131 
132 #ifdef EDM_ML_DEBUG
133  edm::LogVerbatim("ForwardSim") << "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber
134  << " channel " << channel << " zside " << z << "idx: " << std::hex << idx << std::dec;
135  int newsubdet, newlayer, newfiber, newchannel, newz;
136  unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
137 #endif
138 
139  return idx;
140 }
Log< level::Info, true > LogVerbatim
constexpr std::array< uint8_t, layerIndexSize > layer
static void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)

◆ setVerbosity()

void ZdcNumberingScheme::setVerbosity ( const int  iv)

Definition at line 27 of file ZdcNumberingScheme.cc.

References gpuVertexFinder::iv, and verbosity.

27 { verbosity = iv; }
int32_t *__restrict__ iv

◆ unpackZdcIndex()

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

Definition at line 142 of file ZdcNumberingScheme.cc.

References heavyIonCSV_trainingSettings::idx, phase1PixelTopology::layer, hgcalPlots::section, and z.

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

143  {
144  z = 1 + ((idx >> 20) & 1);
145  channel = (idx >> 17) & 7;
146  fiber = (idx >> 9) & 255;
147  layer = (idx >> 2) & 127;
148  section = idx & 3;
149 
150 #ifdef EDM_ML_DEBUG
151  edm::LogVerbatim("ForwardSim") << "ZDC unpacking: idx:" << idx << " -> section " << section << " layer " << layer
152  << " fiber " << fiber << " channel " << channel << " zside " << z;
153 #endif
154 }
Log< level::Info, true > LogVerbatim
constexpr std::array< uint8_t, layerIndexSize > layer

Member Data Documentation

◆ verbosity

int ZdcNumberingScheme::verbosity
private

Definition at line 35 of file ZdcNumberingScheme.h.

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