CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( int  iv)

Definition at line 13 of file ZdcNumberingScheme.cc.

References gather_cfg::cout, and verbosity.

13  {
14  verbosity = iv;
15  if (verbosity>0)
16  std::cout << "Creating ZDCNumberingScheme" << std::endl;
17 }
tuple cout
Definition: gather_cfg.py:121
ZdcNumberingScheme::~ZdcNumberingScheme ( )
virtual

Definition at line 19 of file ZdcNumberingScheme.cc.

References gather_cfg::cout, and verbosity.

19  {
20  if (verbosity>0)
21  std::cout<< " Deleting ZdcNumberingScheme" << std::endl;
22 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

Definition at line 165 of file ZdcNumberingScheme.cc.

References testEve_cfg::level.

Referenced by getUnitID().

165  {
166 
167  //Find number of levels
168  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
169  int level = 0;
170  if (touch) level = ((touch->GetHistoryDepth())+1);
171  return level;
172 }
tuple level
Definition: testEve_cfg.py:34
void ZdcNumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const

Definition at line 174 of file ZdcNumberingScheme.cc.

References i, cuy::ii, and testEve_cfg::level.

175  {
176 
177  //Get name and copy numbers
178  if (level > 0) {
179  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
180  for (int ii = 0; ii < level; ii++) {
181  int i = level - ii - 1;
182  name[ii] = touch->GetVolume(i)->GetName();
183  copyno[ii] = touch->GetReplicaNumber(i);
184  }
185  }
186 }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
tuple level
Definition: testEve_cfg.py:34
unsigned int ZdcNumberingScheme::getUnitID ( const G4Step *  aStep) const
virtual

Definition at line 27 of file ZdcNumberingScheme.cc.

References gather_cfg::cout, detectorLevel(), HcalZDCDetId::EM, HcalZDCDetId::HAD, getHLTprescales::index, testEve_cfg::level, HcalZDCDetId::LUM, mergeVDriftHistosByStation::name, packZdcIndex(), DetId::rawId(), and HcalZDCDetId::Unknown.

Referenced by ZdcSD::setDetUnitId().

27  {
28 
29  uint32_t index = 0;
30  int level = detectorLevel(aStep);
31 
32  if (level > 0) {
33  int* copyno = new int[level];
34  G4String* name = new G4String[level];
35 
36  detectorLevel(aStep, level, copyno, name);
37 
38  int zside = 0;
39  int channel = 0;
40  int fiber = 0;
41  int layer = 0;
43 
44  for (int ich=0; ich < level; ich++) {
45  if (name[ich] == "ZDC") {
46  if(copyno[ich] == 1)zside = 1;
47  if(copyno[ich] == 2)zside = -1;
48  }
49  else if (name[ich] == "ZDC_EMLayer") {
50  section = HcalZDCDetId::EM;
51  layer = copyno[ich];
52  }
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  }
66  else if (name[ich] == "ZDC_LumLayer") {
67  section = HcalZDCDetId::LUM;
68  layer = copyno[ich];
69  channel = layer;
70  }
71  else if (name[ich] == "ZDC_LumGas") {
72  fiber = 1;
73  }
74  else if (name[ich] == "ZDC_HadLayer") {
75  section = HcalZDCDetId::HAD;
76  layer = copyno[ich];
77  if (layer < 6)
78  channel = 1;
79  else if (layer < 12)
80  channel = 2;
81  else if (layer < 18)
82  channel = 3;
83  else
84  channel = 4;
85  }
86  else if (name[ich] == "ZDC_HadFiber") {
87  fiber = copyno[ich];
88  }
89  }
90 
91 #ifdef debug
92  unsigned intindex=0;
93  // intindex = myPacker.packZdcIndex (section, layer, fiber, channel, zside);
94  intindex = packZdcIndex (section, layer, fiber, channel, zside);
95 #endif
96 
97  bool true_for_positive_eta = true;
98  //if(zside == 1)true_for_positive_eta = true;
99  if(zside == -1)true_for_positive_eta = false;
100 
101  HcalZDCDetId zdcId(section, true_for_positive_eta, channel);
102  index = zdcId.rawId();
103 
104 #ifdef debug
105  std::cout<<"DetectorId: ";
106  std::cout<<zdcId<<std::endl;
107 
108 
109  std::cout<< "ZdcNumberingScheme:"
110  << " getUnitID - # of levels = "
111  << level << std::endl;
112  for (int ich = 0; ich < level; ich++)
113  std::cout<< " " << ich << ": copyno " << copyno[ich]
114  << " name=" << name[ich]
115  << " section " << section << " zside " << zside
116  << " layer " << layer << " fiber " << fiber
117  << " channel " << channel << "packedIndex ="
118  << intindex << " detId raw: "<<index<<std::endl;
119 
120 #endif
121 
122  delete[] copyno;
123  delete[] name;
124  }
125 
126  return index;
127 
128 }
static unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z)
tuple cout
Definition: gather_cfg.py:121
tuple level
Definition: testEve_cfg.py:34
int detectorLevel(const G4Step *) const
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 130 of file ZdcNumberingScheme.cc.

References gather_cfg::cout, customizeTrackingMonitorSeedNumber::idx, and unpackZdcIndex().

Referenced by getUnitID().

131  {
132  unsigned int idx = ((z-1)&1)<<20; //bit 20
133  idx += (channel&7)<<17; //bits 17-19
134  idx += (fiber&255)<<9; //bits 9-16
135  idx += (layer&127)<<2; //bits 2-8
136  idx += (section&3); //bits 0-1
137 
138  #ifdef debug
139  std::cout<< "ZDC packing: section " << section << " layer " << layer << " fiber "
140  << fiber << " channel " << channel << " zside " << z << "idx: " <<idx << std::endl;
141  int newsubdet, newlayer, newfiber, newchannel, newz;
142  unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
143  #endif
144 
145  return idx;
146 }
float float float z
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
tuple cout
Definition: gather_cfg.py:121
void ZdcNumberingScheme::setVerbosity ( const int  iv)

Definition at line 25 of file ZdcNumberingScheme.cc.

References verbosity.

25 { verbosity = iv; }
void ZdcNumberingScheme::unpackZdcIndex ( const unsigned int &  idx,
int &  subDet,
int &  layer,
int &  fiber,
int &  channel,
int &  z 
)
static

Definition at line 149 of file ZdcNumberingScheme.cc.

References gather_cfg::cout.

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

151  {
152  z = 1 + ((idx>>20)&1);
153  channel = (idx>>17)&7;
154  fiber = (idx>>9)&255;
155  layer = (idx>>2)&127;
156  section = idx&3;
157 
158  #ifdef debug
159  std::cout<< "ZDC unpacking: idx:"<< idx << " -> section " << section
160  << " layer " << layer << " fiber " << fiber << " channel "
161  << channel << " zside " << z << std::endl;
162  #endif
163 }
float float float z
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

int ZdcNumberingScheme::verbosity
private

Definition at line 38 of file ZdcNumberingScheme.h.

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