CMS 3D CMS Logo

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

#include <FP420NumberingScheme.h>

Public Member Functions

 FP420NumberingScheme ()
 
unsigned int getUnitID (const G4Step *aStep) const
 
 ~FP420NumberingScheme ()=default
 

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 ( )
default

Member Function Documentation

◆ getUnitID()

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

Definition at line 21 of file FP420NumberingScheme.cc.

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

Referenced by FP420SD::setDetUnitId().

21  {
22  unsigned intindex = 0;
23  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
24  int level = (nullptr != touch) ? touch->GetHistoryDepth() + 1 : 0;
25 
26 #ifdef EDM_ML_DEBUG
27  edm::LogVerbatim("FP420") << "FP420NumberingScheme number of levels= " << level;
28 #endif
29  if (level > 0) {
30  int det = 1;
31  int stationgen = 0;
32  int zside = 0;
33  int station = 0;
34  int plane = 0;
35  for (int ich = 0; ich < level; ich++) {
36  int i = level - ich - 1;
37  const G4String& name = touch->GetVolume(i)->GetName();
38  int copyno = touch->GetReplicaNumber(i);
39 
40  // new and old set up configurations are possible:
41  if (name == "FP420E") {
42  det = copyno;
43  } else if (name == "HPS240E") {
44  det = copyno + 2;
45  } else if (name == "FP420Ex1" || name == "HPS240Ex1") {
46  stationgen = 1;
47  } else if (name == "FP420Ex3" || name == "HPS240Ex3") {
48  stationgen = 2; // was =3
49  } else if (name == "SISTATION" || name == "HPS240SISTATION") {
50  station = stationgen;
51  } else if (name == "SIPLANE" || name == "HPS240SIPLANE") {
52  plane = copyno;
53  // SIDETL (or R) can be ether X or Y type in next schemes of readout
54  // !!! (=...) zside
55  //
56  // 1 2 <---copyno
57  // Front(=2) Empty(=4) Back(=6) <--SIDETR OR SENSOR2
58  // 1 2 <---copyno
59  // Front(=1) Back(=3) Empty(=5) <--SIDETL OR SENSOR1
60  //
61  } else if (name == "SENSOR2" || name == "HPS240SENSOR2") {
62  zside = 3 * copyno; //= 3 6 (copyno=1,2)
63  } else if (name == "SENSOR1" || name == "HPS240SENSOR1") {
64  zside = copyno; //= 1 2 (copyno=1,2)
65  }
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("FP420") << "FP420NumberingScheme "
68  << "ich=" << ich << " copyno=" << copyno << " name=" << name;
69 #endif
70  }
71  // det = 1 for +FP420 , = 2 for -FP420 / (det-1) = 0,1
72  // det = 3 for +HPS240 , = 4 for -HPS240 / (det-1) = 2,3
73  // 0 is as default for every below:
74  // Z index
75  // station number 1 - 8 (in reality just 2 ones)
76  // superplane(superlayer) number 1 - 16 (in reality just 5 ones)
77 
78  intindex = packFP420Index(det, zside, station, plane);
79  //
80 #ifdef EDM_ML_DEBUG
81  edm::LogVerbatim("FP420") << "FP420NumberingScheme det=" << det << " zside=" << zside << " station=" << station
82  << " plane=" << plane;
83 #endif
84  }
85  return intindex;
86 }
Log< level::Info, true > LogVerbatim
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 88 of file FP420NumberingScheme.cc.

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

Referenced by getUnitID().

88  {
89  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
90  idx += (zside & 7) << 7; //bits 7- 9 zside:0- 7 = 8-->2**3 = 8 -> 8-1 -> (zside&7) 3 bits:0-2
91  idx += (station & 7) << 4; //bits 4- 6 station:0- 7 = 8-->2**3 = 8 -> 8-1 ->(station&7) 3 bits:0-2
92  idx += (plane & 15); //bits 0- 3 plane:0-15 =16-->2**4 =16 ->16-1 -> (plane&15) 4 bits:0-3
93 
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("FP420") << "FP420 packing: det " << det << " zside " << zside << " station " << station
96  << " plane " << plane << " idx " << idx;
97 #endif
98 
99  return idx;
100 }
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 25 of file FP420NumberingScheme.h.

References nano_mu_digi_cff::sector, and ecaldqm::zside().

Referenced by FP420Test::update().

25  {
26  int zScale = (rn0 - 1); // rn0=3 - current --> for update rn0=7
27  int sScale = zScale * (pn0 - 1); //pn0=6
28  int dScale = sScale * (sn0 - 1); //sn0=3
29  unsigned int intindex = dScale * (det - 1) + sScale * (sector - 1) + zScale * (zmodule - 1) + zside;
30  return intindex;
31  }
int zside(DetId const &)

◆ realzside()

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

Definition at line 82 of file FP420NumberingScheme.h.

References ecaldqm::zside().

Referenced by FP420Test::update().

82  {
83  // zsideinorder:1 2 3 4 5 6
84  //sensorsold 1 0 0 2 0 0
85  //sensorsnew 1 0 5 2 4 0 ???
86  //sensorsnew 1 3 0 2 0 6
87  //zside 1 3 5 2 4 6 over layers 1 and 2
88  int zside, zsidereal;
89  if (zsideinorder < 0) {
90  zside = 0;
91  } else if (zsideinorder < 4) {
92  zside = 2 * zsideinorder - 1;
93  } else if (zsideinorder < 7) {
94  zside = 2 * zsideinorder - 6;
95  } else {
96  zside = 0;
97  }
98  zsidereal = zside;
99  //
100  //old:
101  if (rn0 == 3) {
102  if (zside > 2)
103  zsidereal = 0;
104  }
105  //new:
106  if (rn0 == 7) {
107  if (zside == 4 || zside == 5)
108  zsidereal = 0;
109  }
110  return zsidereal;
111  }
int zside(DetId const &)

◆ unpackCopyIndex()

static int FP420NumberingScheme::unpackCopyIndex ( 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,3
56  int copyIndex = 0;
57  if (zside <= (rn0 - 1) && zside >= 1) {
58  int layerIndex = 1;
59  float a = (zside + 1) / 2.;
60  int b = (int)a;
61  if (a - b != 0.)
62  layerIndex = 2;
63  if (layerIndex == 2)
64  copyIndex = zside / 2;
65  if (layerIndex == 1)
66  copyIndex = (zside + 1) / 2;
67  }
68  return copyIndex;
69  }
int zside(DetId const &)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ unpackFP420Index()

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

Definition at line 102 of file FP420NumberingScheme.cc.

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

Referenced by FP420Test::update().

102  {
103  det = (idx >> 19) & 3;
104  det += 1;
105  zside = (idx >> 7) & 7;
106  station = (idx >> 4) & 7;
107  plane = idx & 15;
108  //
109 
110 #ifdef EDM_ML_DEBUG
111  edm::LogVerbatim("FP420") << " FP420unpacking: idx=" << idx << " zside " << zside << " station " << station
112  << " plane " << plane;
113 #endif
114  //
115 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)

◆ unpackLayerIndex()

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

Definition at line 41 of file FP420NumberingScheme.h.

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

Referenced by FP420Test::update().

41  {
42  // 1,2
43  int layerIndex = 1, b;
44  float a = (zside + 1) / 2.;
45  b = (int)a;
46  if (a - b != 0.)
47  layerIndex = 2;
48  //
49  if (zside > (rn0 - 1) || zside < 1)
50  layerIndex = 0;
51  return layerIndex;
52  }
int zside(DetId const &)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

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

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

33  {
34  int zScale = (rn0 - 1), sScale = (rn0 - 1) * (pn0 - 1), dScale = (rn0 - 1) * (pn0 - 1) * (sn0 - 1);
35  det = (idx - 1) / dScale + 1;
36  sector = (idx - 1 - dScale * (det - 1)) / sScale + 1;
37  zmodule = (idx - 1 - dScale * (det - 1) - sScale * (sector - 1)) / zScale + 1;
38  zside = idx - dScale * (det - 1) - sScale * (sector - 1) - zScale * (zmodule - 1);
39  }
int zside(DetId const &)

◆ unpackOrientation()

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

Definition at line 71 of file FP420NumberingScheme.h.

References ecaldqm::zside().

Referenced by FP420Test::update().

71  {
72  // Front: Orientation= 1; Back: Orientation= 2
73  int Orientation = 2;
74  if (zside > (rn0 - 1) || zside < 1)
75  Orientation = 0;
76  if (zside == 1 || zside == 2)
77  Orientation = 1;
78  //
79  return Orientation;
80  }
int zside(DetId const &)