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

References testEve_cfg::level.

Referenced by getUnitID().

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

Definition at line 34 of file FP420NumberingScheme.cc.

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

35  {
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 }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
tuple level
Definition: testEve_cfg.py:34
unsigned int FP420NumberingScheme::getUnitID ( const G4Step *  aStep) const
virtual

Definition at line 51 of file FP420NumberingScheme.cc.

References detectorLevel(), testEve_cfg::level, mergeVDriftHistosByStation::name, packFP420Index(), relativeConstraints::station, and ecaldqm::zside().

Referenced by FP420SD::setDetUnitId().

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

Definition at line 152 of file FP420NumberingScheme.cc.

References customizeTrackingMonitorSeedNumber::idx.

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

152  {
153  //
154  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
155  // 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
156  idx += (zside&7)<<7; //bits 7- 9 zside:0- 7 = 8-->2**3 = 8 -> 8-1 -> (zside&7) 3 bits:0-2
157  // idx += (zside&3)<<7; //bits 7- 8 zside:0- 3 = 4-->2**2 = 4 -> 4-1 -> (zside&3) 2 bits:0-1
158  idx += (station&7)<<4; //bits 4- 6 station:0- 7 = 8-->2**3 = 8 -> 8-1 ->(station&7) 3 bits:0-2
159  idx += (plane&15); //bits 0- 3 plane:0-15 =16-->2**4 =16 ->16-1 -> (plane&15) 4 bits:0-3
160 
161  //
162 
163  // std::cout << "FP420 packing: det " << det << " zside " << zside << " station " << station << " plane " << plane << " idx " << idx << std::endl;
164  // int newdet, newzside, newstation,newplane;
165  // unpackFP420Index(idx, newdet, newzside, newstation,newplane);
166 
167  //
168 
169  return idx;
170 }
int zside(DetId const &)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static unsigned FP420NumberingScheme::packMYIndex ( int  rn0,
int  pn0,
int  sn0,
int  det,
int  zside,
int  sector,
int  zmodule 
)
inlinestatic

Definition at line 40 of file FP420NumberingScheme.h.

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

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

Definition at line 99 of file FP420NumberingScheme.h.

References ecaldqm::zside().

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

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) {zside = 0;}
107  else if(zsideinorder<4) {zside = 2*zsideinorder-1;}
108  else if(zsideinorder<7) {zside = 2*zsideinorder-6;}
109  else{zside = 0;}
110  zsidereal=zside;
111  //
112  //old:
113  if(rn0==3){
114  if(zside>2) zsidereal=0;
115  }
116  //new:
117  if(rn0==7){
118  // if(zside==3 || zside==6) zsidereal=0; // ????
119  if(zside==4 || zside==5) zsidereal=0;
120  }
121  //
122  return zsidereal;
123  }
int zside(DetId const &)
static int FP420NumberingScheme::unpackCopyIndex ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 73 of file FP420NumberingScheme.h.

References a, and b.

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

73  {
74  // 1,2,3
75  int copyIndex = 0;
76  if(zside>(rn0-1) || zside<1) {
77  }
78  else {
79  int layerIndex = 1, b;
80  float a = (zside+1)/2.;
81  b = (int)a;
82  if(a-b != 0.) layerIndex = 2;
83  if(layerIndex==2) copyIndex = zside/2;
84  if(layerIndex==1) copyIndex = (zside+1)/2;
85  }
86 
87  return copyIndex;
88  }
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 174 of file FP420NumberingScheme.cc.

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

176  {
177  det = (idx>>19)&3;
178  //det = (idx>>20)&1;
179  det += 1;
180  zside = (idx>>7)&7;
181  // zside = (idx>>7)&3;
182  station = (idx>>4)&7;
183  plane = idx&15;
184  //
185 
186  // std::cout << " FP420unpacking: idx=" << idx << " zside " << zside << " station " << station << " plane " << plane << std::endl;
187 
188  //
189 }
int zside(DetId const &)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static int FP420NumberingScheme::unpackLayerIndex ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 62 of file FP420NumberingScheme.h.

References a, and b.

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

62  {
63  // 1,2
64  int layerIndex = 1, b;
65  float a = (zside+1)/2.;
66  b = (int)a;
67  if(a-b != 0.) layerIndex = 2;
68  //
69  if(zside>(rn0-1) || zside<1) layerIndex = 0;
70  return layerIndex;
71  }
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 51 of file FP420NumberingScheme.h.

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

53  {
54  int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
55 
56  det = (idx-1)/dScale + 1;
57  sector = (idx-1- dScale*(det - 1))/sScale + 1;
58  zmodule = (idx-1- dScale*(det - 1)- sScale*(sector - 1) )/ zScale + 1;
59  zside = idx - dScale*(det - 1) - sScale*(sector - 1) - zScale*(zmodule - 1);
60  }
int zside(DetId const &)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static int FP420NumberingScheme::unpackOrientation ( int  rn0,
int  zside 
)
inlinestatic

Definition at line 90 of file FP420NumberingScheme.h.

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

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