CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
FP420NumberingScheme Class Reference

#include <FP420NumberingScheme.h>

Public Member Functions

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

Static Public Member Functions

static unsigned int packFP420Index (int det, int zside, int station, int superplane)
 
static unsigned packMYIndex (int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule)
 
static int realzside (int rn0, int zsideinorder)
 
static int unpackCopyIndex (int rn0, int zside)
 
static void unpackFP420Index (const unsigned int &idx, int &det, int &zside, int &station, int &superplane)
 
static int unpackLayerIndex (int rn0, int zside)
 
static void unpackMYIndex (const int &idx, int rn0, int pn0, int sn0, int &det, int &zside, int &sector, int &zmodule)
 
static int unpackOrientation (int rn0, int zside)
 

Detailed Description

Definition at line 16 of file FP420NumberingScheme.h.

Constructor & Destructor Documentation

FP420NumberingScheme::FP420NumberingScheme ( )

Definition at line 16 of file FP420NumberingScheme.cc.

16  {
17  // sn0=3, pn0=6, rn0=7;
18 }
FP420NumberingScheme::~FP420NumberingScheme ( )
virtual

Definition at line 20 of file FP420NumberingScheme.cc.

20  {
21  // std::cout << " Deleting FP420NumberingScheme" << std::endl;
22 }

Member Function Documentation

int FP420NumberingScheme::detectorLevel ( const G4Step *  aStep) const
virtual

Definition at line 24 of file FP420NumberingScheme.cc.

References hcalDigis_cfi::level.

Referenced by getUnitID().

24  {
25  //Find number of levels
26  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
27  int level = 0;
28  if (touch)
29  level = ((touch->GetHistoryDepth()) + 1);
30  return level;
31 }
void FP420NumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const
virtual

Definition at line 33 of file FP420NumberingScheme.cc.

References mps_fire::i, cuy::ii, and hcalDigis_cfi::level.

33  {
34  //Get name and copy numbers
35  if (level > 0) {
36  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
37  for (int ii = 0; ii < level; ii++) {
38  int i = level - ii - 1;
39  name[ii] = touch->GetVolume(i)->GetName();
40  copyno[ii] = touch->GetReplicaNumber(i);
41  }
42  }
43 }
ii
Definition: cuy.py:590
unsigned int FP420NumberingScheme::getUnitID ( const G4Step *  aStep) const
virtual

Definition at line 45 of file FP420NumberingScheme.cc.

References detectorLevel(), hcalDigis_cfi::level, dataset::name, packFP420Index(), relativeConstraints::station, and ecaldqm::zside().

Referenced by FP420SD::setDetUnitId().

45  {
46  unsigned intindex = 0;
47  int level = detectorLevel(aStep);
48 
49  // std::cout << "FP420NumberingScheme number of levels= " << level << std::endl;
50 
51  // unsigned int intIndex = 0;
52  if (level > 0) {
53  int* copyno = new int[level];
54  G4String* name = new G4String[level];
55  detectorLevel(aStep, level, copyno, name);
56 
57  // int det = static_cast<int>(FP420);;
58 
59  int det = 1;
60  int stationgen = 0;
61  int zside = 0;
62  int station = 0;
63  int plane = 0;
64  for (int ich = 0; ich < level; ich++) {
65  /*
66  // old set up configuration with equidistant stations
67  if(name[ich] == "FP420Ex") {
68  stationgen = copyno[ich];
69  } else if(name[ich] == "SISTATION") {
70  station = stationgen;
71  } else if(name[ich] == "SIPLANE") {
72  plane = copyno[ich];
73  } else if(name[ich] == "SIDETL") {
74  zside = 1;
75  } else if(name[ich] == "SIDETR") {
76  zside = 2;
77  }
78  */
79  // new and old set up configurations are possible:
80  if (name[ich] == "FP420E") {
81  det = copyno[ich];
82  } else if (name[ich] == "HPS240E") {
83  det = copyno[ich] + 2;
84  } else if (name[ich] == "FP420Ex1" || name[ich] == "HPS240Ex1") {
85  stationgen = 1;
86  // } else if(name[ich] == "FP420Ex2") {
87  // stationgen = 2;
88  } else if (name[ich] == "FP420Ex3" || name[ich] == "HPS240Ex3") {
89  stationgen = 2; // was =3
90  } else if (name[ich] == "SISTATION" || name[ich] == "HPS240SISTATION") {
91  station = stationgen;
92  } else if (name[ich] == "SIPLANE" || name[ich] == "HPS240SIPLANE") {
93  plane = copyno[ich];
94  // SIDETL (or R) can be ether X or Y type in next schemes of readout
95  // !!! (=...) zside
96  //
97  // 1 2 <---copyno
98  // Front(=2) Empty(=4) Back(=6) <--SIDETR OR SENSOR2
99  // 1 2 <---copyno
100  // Front(=1) Back(=3) Empty(=5) <--SIDETL OR SENSOR1
101  //
102  } else if (name[ich] == "SENSOR2" || name[ich] == "HPS240SENSOR2") {
103  // } else if(name[ich] == "SIDETR") {
104  // zside = 4 * copyno[ich] - 2 ;//= 2 6 (copyno=1,2)
105  zside = 3 * copyno[ich]; //= 3 6 (copyno=1,2)
106  } else if (name[ich] == "SENSOR1" || name[ich] == "HPS240SENSOR1") {
107  // } else if(name[ich] == "SIDETL") {
108  // zside = 2 * copyno[ich] - 1 ;//= 1 3 (copyno=1,2)
109  zside = copyno[ich]; //= 1 2 (copyno=1,2)
110  }
111  //
112  // std::cout << "FP420NumberingScheme " << "ich=" << ich << "copyno" << copyno[ich] << "name=" << name[ich] << std::endl;
113  //
114  }
115  // det = 1 for +FP420 , = 2 for -FP420 / (det-1) = 0,1
116  // det = 3 for +HPS240 , = 4 for -HPS240 / (det-1) = 2,3
117  // 0 is as default for every below:
118  // Z index
119  // station number 1 - 8 (in reality just 2 ones)
120  // superplane(superlayer) number 1 - 16 (in reality just 5 ones)
121 
122  // intindex = myPacker.packEcalIndex (det, zside, station, plane);// see examples
123  // intindex = myPacker.packCastorIndex (det, zside, station, plane);// see examples
124  intindex = packFP420Index(det, zside, station, plane);
125  /*
126  //
127  std::cout << "FP420NumberingScheme det=" << det << " zside=" << zside << " station=" <<station << " plane=" << plane << std::endl;
128 
129  for (int ich = 0; ich < level; ich++) {
130  std::cout <<" name = " << name[ich] <<" copy = " << copyno[ich] << std::endl;
131  std::cout << " packed index = intindex" << intindex << std::endl;
132  }
133  //
134  */
135 
136  delete[] copyno;
137  delete[] name;
138  }
139 
140  return intindex;
141 }
virtual int detectorLevel(const G4Step *) const
int zside(DetId const &)
static unsigned int packFP420Index(int det, int zside, int station, int superplane)
unsigned FP420NumberingScheme::packFP420Index ( int  det,
int  zside,
int  station,
int  superplane 
)
static

Definition at line 143 of file FP420NumberingScheme.cc.

References training_settings::idx.

Referenced by getUnitID(), cms::DigitizerFP420::produce(), and FP420Test::update().

143  {
144  //
145  unsigned int idx = ((det - 1) & 3) << 19; //bit 19-20 (det-1):0- 3 = 4-->2**2 = 4 -> 4-1 ->((det-1)&3) 2 bit: 0-1
146  // unsigned int idx = ((det-1)&1)<<20;//bit 20-20 (det-1):0- 1 = 2-->2**1 = 2 -> 2-1 ->((det-1)&1) 1 bit: 0
147  idx += (zside & 7) << 7; //bits 7- 9 zside:0- 7 = 8-->2**3 = 8 -> 8-1 -> (zside&7) 3 bits:0-2
148  // idx += (zside&3)<<7; //bits 7- 8 zside:0- 3 = 4-->2**2 = 4 -> 4-1 -> (zside&3) 2 bits:0-1
149  idx += (station & 7) << 4; //bits 4- 6 station:0- 7 = 8-->2**3 = 8 -> 8-1 ->(station&7) 3 bits:0-2
150  idx += (plane & 15); //bits 0- 3 plane:0-15 =16-->2**4 =16 ->16-1 -> (plane&15) 4 bits:0-3
151 
152  //
153 
154  // std::cout << "FP420 packing: det " << det << " zside " << zside << " station " << station << " plane " << plane << " idx " << idx << std::endl;
155  // int newdet, newzside, newstation,newplane;
156  // unpackFP420Index(idx, newdet, newzside, newstation,newplane);
157 
158  //
159 
160  return idx;
161 }
int zside(DetId const &)
static unsigned FP420NumberingScheme::packMYIndex ( int  rn0,
int  pn0,
int  sn0,
int  det,
int  zside,
int  sector,
int  zmodule 
)
inlinestatic

Definition at line 38 of file FP420NumberingScheme.h.

Referenced by cms::DigitizerFP420::produce(), cms::ClusterizerFP420::produce(), FP420ClusterMain::run(), TrackProducerFP420::trackFinderSophisticated(), and FP420Test::update().

38  {
39  int zScale = (rn0 - 1); // rn0=3 - current --> for update rn0=7
40  int sScale = zScale * (pn0 - 1); //pn0=6
41  int dScale = sScale * (sn0 - 1); //sn0=3
42 
43  unsigned int intindex = dScale * (det - 1) + sScale * (sector - 1) + zScale * (zmodule - 1) + zside;
44  //
45  return intindex;
46  }
int zside(DetId const &)
static int FP420NumberingScheme::realzside ( int  rn0,
int  zsideinorder 
)
inlinestatic

Definition at line 100 of file FP420NumberingScheme.h.

References ecaldqm::zside().

Referenced by TrackProducerFP420::trackFinderSophisticated(), and FP420Test::update().

100  {
101  // zsideinorder:1 2 3 4 5 6
102  //sensorsold 1 0 0 2 0 0
103  //sensorsnew 1 0 5 2 4 0 ???
104  //sensorsnew 1 3 0 2 0 6
105  //zside 1 3 5 2 4 6 over layers 1 and 2
106  int zside, zsidereal;
107  if (zsideinorder < 0) {
108  zside = 0;
109  } else if (zsideinorder < 4) {
110  zside = 2 * zsideinorder - 1;
111  } else if (zsideinorder < 7) {
112  zside = 2 * zsideinorder - 6;
113  } else {
114  zside = 0;
115  }
116  zsidereal = zside;
117  //
118  //old:
119  if (rn0 == 3) {
120  if (zside > 2)
121  zsidereal = 0;
122  }
123  //new:
124  if (rn0 == 7) {
125  // if(zside==3 || zside==6) zsidereal=0; // ????
126  if (zside == 4 || zside == 5)
127  zsidereal = 0;
128  }
129  //
130  return zsidereal;
131  }
int zside(DetId const &)
static int FP420NumberingScheme::unpackCopyIndex ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 70 of file FP420NumberingScheme.h.

References a, b, and createfilelist::int.

Referenced by TrackProducerFP420::trackFinderSophisticated(), and FP420Test::update().

70  {
71  // 1,2,3
72  int copyIndex = 0;
73  if (zside > (rn0 - 1) || zside < 1) {
74  } else {
75  int layerIndex = 1, b;
76  float a = (zside + 1) / 2.;
77  b = (int)a;
78  if (a - b != 0.)
79  layerIndex = 2;
80  if (layerIndex == 2)
81  copyIndex = zside / 2;
82  if (layerIndex == 1)
83  copyIndex = (zside + 1) / 2;
84  }
85 
86  return copyIndex;
87  }
int zside(DetId const &)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void FP420NumberingScheme::unpackFP420Index ( const unsigned int &  idx,
int &  det,
int &  zside,
int &  station,
int &  superplane 
)
static

Definition at line 163 of file FP420NumberingScheme.cc.

Referenced by ChargeDividerFP420::DeconvolutionShape(), ChargeDividerFP420::PeakShape(), cms::DigitizerFP420::produce(), and FP420Test::update().

163  {
164  det = (idx >> 19) & 3;
165  //det = (idx>>20)&1;
166  det += 1;
167  zside = (idx >> 7) & 7;
168  // zside = (idx>>7)&3;
169  station = (idx >> 4) & 7;
170  plane = idx & 15;
171  //
172 
173  // std::cout << " FP420unpacking: idx=" << idx << " zside " << zside << " station " << station << " plane " << plane << std::endl;
174 
175  //
176 }
int zside(DetId const &)
static int FP420NumberingScheme::unpackLayerIndex ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 57 of file FP420NumberingScheme.h.

References a, b, and createfilelist::int.

Referenced by cms::DigitizerFP420::produce(), TrackProducerFP420::trackFinderSophisticated(), and FP420Test::update().

57  {
58  // 1,2
59  int layerIndex = 1, b;
60  float a = (zside + 1) / 2.;
61  b = (int)a;
62  if (a - b != 0.)
63  layerIndex = 2;
64  //
65  if (zside > (rn0 - 1) || zside < 1)
66  layerIndex = 0;
67  return layerIndex;
68  }
int zside(DetId const &)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
static void FP420NumberingScheme::unpackMYIndex ( const int &  idx,
int  rn0,
int  pn0,
int  sn0,
int &  det,
int &  zside,
int &  sector,
int &  zmodule 
)
inlinestatic

Definition at line 48 of file FP420NumberingScheme.h.

Referenced by cms::DigitizerFP420::produce().

48  {
49  int zScale = (rn0 - 1), sScale = (rn0 - 1) * (pn0 - 1), dScale = (rn0 - 1) * (pn0 - 1) * (sn0 - 1);
50 
51  det = (idx - 1) / dScale + 1;
52  sector = (idx - 1 - dScale * (det - 1)) / sScale + 1;
53  zmodule = (idx - 1 - dScale * (det - 1) - sScale * (sector - 1)) / zScale + 1;
54  zside = idx - dScale * (det - 1) - sScale * (sector - 1) - zScale * (zmodule - 1);
55  }
int zside(DetId const &)
static int FP420NumberingScheme::unpackOrientation ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 89 of file FP420NumberingScheme.h.

Referenced by cms::DigitizerFP420::produce(), TrackProducerFP420::trackFinderSophisticated(), and FP420Test::update().

89  {
90  // Front: Orientation= 1; Back: Orientation= 2
91  int Orientation = 2;
92  if (zside > (rn0 - 1) || zside < 1)
93  Orientation = 0;
94  if (zside == 1 || zside == 2)
95  Orientation = 1;
96  //
97  return Orientation;
98  }
int zside(DetId const &)