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 15 of file FP420NumberingScheme.h.

Constructor & Destructor Documentation

◆ FP420NumberingScheme()

FP420NumberingScheme::FP420NumberingScheme ( )

Definition at line 17 of file FP420NumberingScheme.cc.

17  {
18  // sn0=3, pn0=6, rn0=7;
19 }

◆ ~FP420NumberingScheme()

FP420NumberingScheme::~FP420NumberingScheme ( )
virtual

Definition at line 21 of file FP420NumberingScheme.cc.

21  {
22 #ifdef EDM_ML_DEBUG
23  edm::LogVerbatim("FP420") << " Deleting FP420NumberingScheme";
24 #endif
25 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ detectorLevel() [1/2]

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

Definition at line 27 of file FP420NumberingScheme.cc.

References personalPlayback::level.

Referenced by getUnitID().

27  {
28  //Find number of levels
29  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
30  int level = 0;
31  if (touch)
32  level = ((touch->GetHistoryDepth()) + 1);
33  return level;
34 }

◆ detectorLevel() [2/2]

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

Definition at line 36 of file FP420NumberingScheme.cc.

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

36  {
37  //Get name and copy numbers
38  if (level > 0) {
39  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
40  for (int ii = 0; ii < level; ii++) {
41  int i = level - ii - 1;
42  name[ii] = touch->GetVolume(i)->GetName();
43  copyno[ii] = touch->GetReplicaNumber(i);
44  }
45  }
46 }
ii
Definition: cuy.py:589

◆ getUnitID()

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

Definition at line 48 of file FP420NumberingScheme.cc.

References detectorLevel(), personalPlayback::level, Skims_PA_cff::name, packFP420Index(), relativeConstraints::station, and ecaldqm::zside().

Referenced by FP420SD::setDetUnitId().

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

◆ packFP420Index()

unsigned FP420NumberingScheme::packFP420Index ( int  det,
int  zside,
int  station,
int  superplane 
)
static

Definition at line 148 of file FP420NumberingScheme.cc.

References heavyIonCSV_trainingSettings::idx, relativeConstraints::station, and ecaldqm::zside().

Referenced by getUnitID(), and FP420Test::update().

148  {
149  //
150  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
151  // 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
152  idx += (zside & 7) << 7; //bits 7- 9 zside:0- 7 = 8-->2**3 = 8 -> 8-1 -> (zside&7) 3 bits:0-2
153  // idx += (zside&3)<<7; //bits 7- 8 zside:0- 3 = 4-->2**2 = 4 -> 4-1 -> (zside&3) 2 bits:0-1
154  idx += (station & 7) << 4; //bits 4- 6 station:0- 7 = 8-->2**3 = 8 -> 8-1 ->(station&7) 3 bits:0-2
155  idx += (plane & 15); //bits 0- 3 plane:0-15 =16-->2**4 =16 ->16-1 -> (plane&15) 4 bits:0-3
156 
157  //
158 
159 #ifdef EDM_ML_DEBUG
160  edm::LogVerbatim("FP420") << "FP420 packing: det " << det << " zside " << zside << " station " << station
161  << " plane " << plane << " idx " << idx;
162 #endif
163  // int newdet, newzside, newstation,newplane;
164  // unpackFP420Index(idx, newdet, newzside, newstation,newplane);
165 
166  //
167 
168  return idx;
169 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)

◆ packMYIndex()

static unsigned FP420NumberingScheme::packMYIndex ( int  rn0,
int  pn0,
int  sn0,
int  det,
int  zside,
int  sector,
int  zmodule 
)
inlinestatic

Definition at line 35 of file FP420NumberingScheme.h.

References ecaldqm::zside().

Referenced by FP420Test::update().

35  {
36  int zScale = (rn0 - 1); // rn0=3 - current --> for update rn0=7
37  int sScale = zScale * (pn0 - 1); //pn0=6
38  int dScale = sScale * (sn0 - 1); //sn0=3
39 
40  unsigned int intindex = dScale * (det - 1) + sScale * (sector - 1) + zScale * (zmodule - 1) + zside;
41  //
42  return intindex;
43  }
int zside(DetId const &)

◆ realzside()

static int FP420NumberingScheme::realzside ( int  rn0,
int  zsideinorder 
)
inlinestatic

Definition at line 97 of file FP420NumberingScheme.h.

References ecaldqm::zside().

Referenced by FP420Test::update().

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

◆ unpackCopyIndex()

static int FP420NumberingScheme::unpackCopyIndex ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 67 of file FP420NumberingScheme.h.

References a, b, createfilelist::int, and ecaldqm::zside().

Referenced by FP420Test::update().

67  {
68  // 1,2,3
69  int copyIndex = 0;
70  if (zside > (rn0 - 1) || zside < 1) {
71  } else {
72  int layerIndex = 1, b;
73  float a = (zside + 1) / 2.;
74  b = (int)a;
75  if (a - b != 0.)
76  layerIndex = 2;
77  if (layerIndex == 2)
78  copyIndex = zside / 2;
79  if (layerIndex == 1)
80  copyIndex = (zside + 1) / 2;
81  }
82 
83  return copyIndex;
84  }
int zside(DetId const &)
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ unpackFP420Index()

void FP420NumberingScheme::unpackFP420Index ( const unsigned int &  idx,
int &  det,
int &  zside,
int &  station,
int &  superplane 
)
static

Definition at line 171 of file FP420NumberingScheme.cc.

References heavyIonCSV_trainingSettings::idx, relativeConstraints::station, and ecaldqm::zside().

Referenced by FP420Test::update().

171  {
172  det = (idx >> 19) & 3;
173  //det = (idx>>20)&1;
174  det += 1;
175  zside = (idx >> 7) & 7;
176  // zside = (idx>>7)&3;
177  station = (idx >> 4) & 7;
178  plane = idx & 15;
179  //
180 
181 #ifdef EDM_ML_DEBUG
182  edm::LogVerbatim("FP420") << " FP420unpacking: idx=" << idx << " zside " << zside << " station " << station
183  << " plane " << plane;
184 #endif
185  //
186 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)

◆ unpackLayerIndex()

static int FP420NumberingScheme::unpackLayerIndex ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 54 of file FP420NumberingScheme.h.

References a, b, createfilelist::int, and ecaldqm::zside().

Referenced by FP420Test::update().

54  {
55  // 1,2
56  int layerIndex = 1, b;
57  float a = (zside + 1) / 2.;
58  b = (int)a;
59  if (a - b != 0.)
60  layerIndex = 2;
61  //
62  if (zside > (rn0 - 1) || zside < 1)
63  layerIndex = 0;
64  return layerIndex;
65  }
int zside(DetId const &)
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ unpackMYIndex()

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 45 of file FP420NumberingScheme.h.

References heavyIonCSV_trainingSettings::idx, and ecaldqm::zside().

45  {
46  int zScale = (rn0 - 1), sScale = (rn0 - 1) * (pn0 - 1), dScale = (rn0 - 1) * (pn0 - 1) * (sn0 - 1);
47 
48  det = (idx - 1) / dScale + 1;
49  sector = (idx - 1 - dScale * (det - 1)) / sScale + 1;
50  zmodule = (idx - 1 - dScale * (det - 1) - sScale * (sector - 1)) / zScale + 1;
51  zside = idx - dScale * (det - 1) - sScale * (sector - 1) - zScale * (zmodule - 1);
52  }
int zside(DetId const &)

◆ unpackOrientation()

static int FP420NumberingScheme::unpackOrientation ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 86 of file FP420NumberingScheme.h.

References ecaldqm::zside().

Referenced by FP420Test::update().

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