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 *)
 
void detectorLevel (const G4Step *, int &, std::vector< int > &, std::vector< G4String > &)
 
unsigned int getUnitID (const G4Step *aStep)
 
void setVerbosity (const int)
 
 ZdcNumberingScheme (int)
 
 ~ZdcNumberingScheme ()=default
 

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 12 of file ZdcNumberingScheme.h.

Constructor & Destructor Documentation

◆ ZdcNumberingScheme()

ZdcNumberingScheme::ZdcNumberingScheme ( int  iv)

Definition at line 15 of file ZdcNumberingScheme.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, and verbosity.

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

◆ ~ZdcNumberingScheme()

ZdcNumberingScheme::~ZdcNumberingScheme ( )
default

Member Function Documentation

◆ detectorLevel() [1/2]

int ZdcNumberingScheme::detectorLevel ( const G4Step *  aStep)

Definition at line 144 of file ZdcNumberingScheme.cc.

References personalPlayback::level.

Referenced by getUnitID().

144  {
145  //Find number of levels
146  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
147  int level = 0;
148  if (touch)
149  level = ((touch->GetHistoryDepth()) + 1);
150  return level;
151 }

◆ detectorLevel() [2/2]

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

Definition at line 153 of file ZdcNumberingScheme.cc.

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

156  {
157  //Get name and copy numbers
158  if (level > 0) {
159  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
160  for (int ii = 0; ii < level; ii++) {
161  int i = level - ii - 1;
162  name.emplace_back(touch->GetVolume(i)->GetName());
163  copyno.emplace_back(touch->GetReplicaNumber(i));
164  }
165  }
166 }
ii
Definition: cuy.py:589

◆ getUnitID()

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

Definition at line 23 of file ZdcNumberingScheme.cc.

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

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

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

References FCDTask_cfi::fiber, heavyIonCSV_trainingSettings::idx, nano_mu_digi_cff::layer, hgcalPlots::section, unpackZdcIndex(), and z.

Referenced by getUnitID().

113  {
114  unsigned int idx = ((z - 1) & 1) << 20; //bit 20
115  idx += (channel & 7) << 17; //bits 17-19
116  idx += (fiber & 255) << 9; //bits 9-16
117  idx += (layer & 127) << 2; //bits 2-8
118  idx += (section & 3); //bits 0-1
119 
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("ForwardSim") << "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber
122  << " channel " << channel << " zside " << z << "idx: " << idx;
123  int newsubdet, newlayer, newfiber, newchannel, newz;
124  unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
125 #endif
126 
127  return idx;
128 }
Log< level::Info, true > LogVerbatim
static void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)

◆ setVerbosity()

void ZdcNumberingScheme::setVerbosity ( const int  iv)

◆ unpackZdcIndex()

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

Definition at line 130 of file ZdcNumberingScheme.cc.

References FCDTask_cfi::fiber, heavyIonCSV_trainingSettings::idx, nano_mu_digi_cff::layer, hgcalPlots::section, and z.

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

131  {
132  z = 1 + ((idx >> 20) & 1);
133  channel = (idx >> 17) & 7;
134  fiber = (idx >> 9) & 255;
135  layer = (idx >> 2) & 127;
136  section = idx & 3;
137 
138 #ifdef EDM_ML_DEBUG
139  edm::LogVerbatim("ForwardSim") << "ZDC unpacking: idx:" << idx << " -> section " << section << " layer " << layer
140  << " fiber " << fiber << " channel " << channel << " zside " << z;
141 #endif
142 }
Log< level::Info, true > LogVerbatim

Member Data Documentation

◆ verbosity

int ZdcNumberingScheme::verbosity
private

Definition at line 34 of file ZdcNumberingScheme.h.

Referenced by setVerbosity(), and ZdcNumberingScheme().