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 16 of file FP420NumberingScheme.cc.

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

◆ ~FP420NumberingScheme()

FP420NumberingScheme::~FP420NumberingScheme ( )
virtual

Definition at line 20 of file FP420NumberingScheme.cc.

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

Member Function Documentation

◆ detectorLevel() [1/2]

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

Definition at line 24 of file FP420NumberingScheme.cc.

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 }

References personalPlayback::level.

Referenced by getUnitID().

◆ detectorLevel() [2/2]

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

Definition at line 33 of file FP420NumberingScheme.cc.

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 }

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

◆ getUnitID()

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

Definition at line 45 of file FP420NumberingScheme.cc.

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 }

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

Referenced by FP420SD::setDetUnitId().

◆ packFP420Index()

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

Definition at line 143 of file FP420NumberingScheme.cc.

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 }

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

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

◆ packMYIndex()

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

Definition at line 37 of file FP420NumberingScheme.h.

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

References ecaldqm::zside().

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

◆ realzside()

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

Definition at line 99 of file FP420NumberingScheme.h.

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

References ecaldqm::zside().

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

◆ unpackCopyIndex()

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

Definition at line 69 of file FP420NumberingScheme.h.

69  {
70  // 1,2,3
71  int copyIndex = 0;
72  if (zside > (rn0 - 1) || zside < 1) {
73  } else {
74  int layerIndex = 1, b;
75  float a = (zside + 1) / 2.;
76  b = (int)a;
77  if (a - b != 0.)
78  layerIndex = 2;
79  if (layerIndex == 2)
80  copyIndex = zside / 2;
81  if (layerIndex == 1)
82  copyIndex = (zside + 1) / 2;
83  }
84 
85  return copyIndex;
86  }

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

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

◆ unpackFP420Index()

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

Definition at line 163 of file FP420NumberingScheme.cc.

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 }

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

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

◆ unpackLayerIndex()

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

Definition at line 56 of file FP420NumberingScheme.h.

56  {
57  // 1,2
58  int layerIndex = 1, b;
59  float a = (zside + 1) / 2.;
60  b = (int)a;
61  if (a - b != 0.)
62  layerIndex = 2;
63  //
64  if (zside > (rn0 - 1) || zside < 1)
65  layerIndex = 0;
66  return layerIndex;
67  }

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

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

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

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

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

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

◆ unpackOrientation()

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

Definition at line 88 of file FP420NumberingScheme.h.

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

References ecaldqm::zside().

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

personalPlayback.level
level
Definition: personalPlayback.py:22
mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
relativeConstraints.station
station
Definition: relativeConstraints.py:67
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
FP420NumberingScheme::packFP420Index
static unsigned int packFP420Index(int det, int zside, int station, int superplane)
Definition: FP420NumberingScheme.cc:143
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
createfilelist.int
int
Definition: createfilelist.py:10
FP420NumberingScheme::detectorLevel
virtual int detectorLevel(const G4Step *) const
Definition: FP420NumberingScheme.cc:24
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cuy.ii
ii
Definition: cuy.py:590