7 #ifndef FP420NumberingScheme_h
8 #define FP420NumberingScheme_h
11 #include <boost/cstdint.hpp>
12 #include "G4ThreeVector.hh"
24 virtual unsigned int getUnitID(
const G4Step* aStep)
const;
28 virtual void detectorLevel(
const G4Step*,
int&,
int*, G4String*)
const;
34 static void unpackFP420Index(
const unsigned int& idx,
int& det,
int& zside,
int& station,
int& superplane);
43 int det,
int zside,
int sector,
int zmodule){
45 int sScale = zScale*(pn0-1);
46 int dScale = sScale*(sn0-1);
48 unsigned int intindex = dScale*(det - 1)+sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
54 int rn0,
int pn0,
int sn0,
55 int& det,
int& zside,
int& sector,
int& zmodule) {
56 int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
58 det = (idx-1)/dScale + 1;
59 sector = (idx-1- dScale*(det - 1))/sScale + 1;
60 zmodule = (idx-1- dScale*(det - 1)- sScale*(sector - 1) )/ zScale + 1;
61 zside = idx - dScale*(det - 1) - sScale*(sector - 1) - zScale*(zmodule - 1);
66 int layerIndex = 1,
b;
67 float a = (zside+1)/2.;
69 if(a-
b != 0.) layerIndex = 2;
71 if(zside>(rn0-1) || zside<1) layerIndex = 0;
78 if(zside>(rn0-1) || zside<1) {
81 int layerIndex = 1,
b;
82 float a = (zside+1)/2.;
84 if(a-
b != 0.) layerIndex = 2;
85 if(layerIndex==2) copyIndex = zside/2;
86 if(layerIndex==1) copyIndex = (zside+1)/2;
95 if(zside>(rn0-1) || zside<1) Orientation = 0;
96 if(zside==1 || zside==2) Orientation = 1;
108 if(zsideinorder<0) {zside = 0;}
109 else if(zsideinorder<4) {zside = 2*zsideinorder-1;}
110 else if(zsideinorder<7) {zside = 2*zsideinorder-6;}
116 if(zside>2) zsidereal=0;
121 if(zside==4 || zside==5) zsidereal=0;
virtual int detectorLevel(const G4Step *) const
int unpackOrientation(int rn0, int zside)
int realzside(int rn0, int zsideinorder)
int unpackCopyIndex(int rn0, int zside)
static void unpackFP420Index(const unsigned int &idx, int &det, int &zside, int &station, int &superplane)
virtual ~FP420NumberingScheme()
unsigned packMYIndex(int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule)
virtual unsigned int getUnitID(const G4Step *aStep) const
static unsigned int packFP420Index(int det, int zside, int station, int superplane)
void unpackMYIndex(const int &idx, int rn0, int pn0, int sn0, int &det, int &zside, int §or, int &zmodule)
int unpackLayerIndex(int rn0, int zside)