#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 |
unsigned | packMYIndex (int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule) |
int | realzside (int rn0, int zsideinorder) |
int | unpackCopyIndex (int rn0, int zside) |
int | unpackLayerIndex (int rn0, int zside) |
void | unpackMYIndex (const int &idx, int rn0, int pn0, int sn0, int &det, int &zside, int §or, int &zmodule) |
int | unpackOrientation (int rn0, int zside) |
virtual | ~FP420NumberingScheme () |
Static Public Member Functions | |
static unsigned int | packFP420Index (int det, int zside, int station, int superplane) |
static void | unpackFP420Index (const unsigned int &idx, int &det, int &zside, int &station, int &superplane) |
Definition at line 18 of file FP420NumberingScheme.h.
FP420NumberingScheme::FP420NumberingScheme | ( | ) |
Definition at line 15 of file FP420NumberingScheme.cc.
{
// sn0=3, pn0=6, rn0=7;
}
FP420NumberingScheme::~FP420NumberingScheme | ( | ) | [virtual] |
Definition at line 19 of file FP420NumberingScheme.cc.
{
// std::cout << " Deleting FP420NumberingScheme" << std::endl;
}
int FP420NumberingScheme::detectorLevel | ( | const G4Step * | aStep | ) | const [virtual] |
Definition at line 24 of file FP420NumberingScheme.cc.
References testEve_cfg::level.
Referenced by getUnitID().
void FP420NumberingScheme::detectorLevel | ( | const G4Step * | aStep, |
int & | level, | ||
int * | copyno, | ||
G4String * | name | ||
) | const [virtual] |
Definition at line 33 of file FP420NumberingScheme.cc.
References i, and testEve_cfg::level.
unsigned int FP420NumberingScheme::getUnitID | ( | const G4Step * | aStep | ) | const [virtual] |
Definition at line 50 of file FP420NumberingScheme.cc.
References detectorLevel(), testEve_cfg::level, mergeVDriftHistosByStation::name, packFP420Index(), and relativeConstraints::station.
Referenced by FP420SD::setDetUnitId().
{ unsigned intindex=0; int level = detectorLevel(aStep); // std::cout << "FP420NumberingScheme number of levels= " << level << std::endl; // unsigned int intIndex = 0; if (level > 0) { int* copyno = new int[level]; G4String* name = new G4String[level]; detectorLevel(aStep, level, copyno, name); // int det = static_cast<int>(FP420);; int det = 1; int stationgen = 0; int zside = 0; int station = 0; int plane = 0; for (int ich=0; ich < level; ich++) { /* // old set up configuration with equidistant stations if(name[ich] == "FP420Ex") { stationgen = copyno[ich]; } else if(name[ich] == "SISTATION") { station = stationgen; } else if(name[ich] == "SIPLANE") { plane = copyno[ich]; } else if(name[ich] == "SIDETL") { zside = 1; } else if(name[ich] == "SIDETR") { zside = 2; } */ // new and old set up configurations are possible: if(name[ich] == "FP420E") { det = copyno[ich]; } else if(name[ich] == "FP420Ex1") { stationgen = 1; // } else if(name[ich] == "FP420Ex2") { // stationgen = 2; } else if(name[ich] == "FP420Ex3") { stationgen = 2;// was =3 } else if(name[ich] == "SISTATION") { station = stationgen; } else if(name[ich] == "SIPLANE") { plane = copyno[ich]; // SIDETL (or R) can be ether X or Y type in next schemes of readout // !!! (=...) zside // // 1 2 <---copyno // Front(=2) Empty(=4) Back(=6) <--SIDETR OR SENSOR2 // 1 2 <---copyno // Front(=1) Back(=3) Empty(=5) <--SIDETL OR SENSOR1 // } else if(name[ich] == "SENSOR2") { // } else if(name[ich] == "SIDETR") { // zside = 4 * copyno[ich] - 2 ;//= 2 6 (copyno=1,2) zside = 3 * copyno[ich];//= 3 6 (copyno=1,2) } else if(name[ich] == "SENSOR1") { // } else if(name[ich] == "SIDETL") { // zside = 2 * copyno[ich] - 1 ;//= 1 3 (copyno=1,2) zside = copyno[ich];//= 1 2 (copyno=1,2) } // // std::cout << "FP420NumberingScheme " << "ich=" << ich << "copyno" << copyno[ich] << "name=" << name[ich] << std::endl; // } // det = 1 for +FP420 , = 2 for -FP420 / (det-1) = 0,1 // 0 is as default for every below: // Z index // station number 1 - 5 (in reality just 2 ones) // superplane(superlayer) number 1 - 10 (in reality just 5 ones) // intindex = myPacker.packEcalIndex (det, zside, station, plane); // intindex = myPacker.packCastorIndex (det, zside, station, plane); intindex = packFP420Index (det, zside, station, plane); /* // std::cout << "FP420NumberingScheme det=" << det << " zside=" << zside << " station=" <<station << " plane=" << plane << std::endl; for (int ich = 0; ich < level; ich++) { std::cout <<" name = " << name[ich] <<" copy = " << copyno[ich] << std::endl; std::cout << " packed index = intindex" << intindex << std::endl; } // */ delete[] copyno; delete[] name; } return intindex; }
unsigned FP420NumberingScheme::packFP420Index | ( | int | det, |
int | zside, | ||
int | station, | ||
int | superplane | ||
) | [static] |
Definition at line 148 of file FP420NumberingScheme.cc.
Referenced by getUnitID(), and FP420Test::update().
{ unsigned int idx = ((det-1)&1)<<20; //bit 20 (det-1): 0 ,1= 2-->2**1=2 -> 2-1 -> ((det-1)&1) 1 bit: 0 idx += (zside&7)<<7; //bits 7-9 zside: 0- 7= 8-->2**3 =8 -> 8-1 -> (zside&7) 3 bits:0-2 // idx += (zside&3)<<7; //bits 7-8 zside: 0- 2= 3-->2**2 =4 -> 4-1 -> (zside&3) 2 bits:0-1 idx += (station&7)<<4; //bits 4-6 station:0- 7= 8-->2**3 =8 -> 8-1 ->(station&7) 3 bits:0-2 idx += (plane&15); //bits 0-3 plane: 0-15=16-->2**4 =16 -> 16-1 ->(plane&15) 4 bits:0-3 // // std::cout << "FP420 packing: det " << det << " zside " << zside << " station " << station << " plane " << plane << " idx " << idx << std::endl; // int newdet, newzside, newstation,newplane; // unpackFP420Index(idx, newdet, newzside, newstation,newplane); // return idx; }
unsigned FP420NumberingScheme::packMYIndex | ( | int | rn0, |
int | pn0, | ||
int | sn0, | ||
int | det, | ||
int | zside, | ||
int | sector, | ||
int | zmodule | ||
) | [inline] |
Definition at line 42 of file FP420NumberingScheme.h.
{ int zScale=(rn0-1); // rn0=3 - current --> for update rn0=7 int sScale = zScale*(pn0-1);//pn0=6 int dScale = sScale*(sn0-1);//sn0=3 unsigned int intindex = dScale*(det - 1)+sScale*(sector - 1)+zScale*(zmodule - 1)+zside; // return intindex; }
int FP420NumberingScheme::realzside | ( | int | rn0, |
int | zsideinorder | ||
) | [inline] |
Definition at line 101 of file FP420NumberingScheme.h.
{ // zsideinorder:1 2 3 4 5 6 //sensorsold 1 0 0 2 0 0 //sensorsnew 1 0 5 2 4 0 ??? //sensorsnew 1 3 0 2 0 6 //zside 1 3 5 2 4 6 over layers 1 and 2 int zside,zsidereal; if(zsideinorder<0) {zside = 0;} else if(zsideinorder<4) {zside = 2*zsideinorder-1;} else if(zsideinorder<7) {zside = 2*zsideinorder-6;} else{zside = 0;} zsidereal=zside; // //old: if(rn0==3){ if(zside>2) zsidereal=0; } //new: if(rn0==7){ // if(zside==3 || zside==6) zsidereal=0; // ???? if(zside==4 || zside==5) zsidereal=0; } // return zsidereal; }
int FP420NumberingScheme::unpackCopyIndex | ( | int | rn0, |
int | zside | ||
) | [inline] |
Definition at line 75 of file FP420NumberingScheme.h.
void FP420NumberingScheme::unpackFP420Index | ( | const unsigned int & | idx, |
int & | det, | ||
int & | zside, | ||
int & | station, | ||
int & | superplane | ||
) | [static] |
Definition at line 168 of file FP420NumberingScheme.cc.
Referenced by ChargeDividerFP420::DeconvolutionShape(), ChargeDividerFP420::PeakShape(), cms::DigitizerFP420::produce(), and FP420Test::update().
{ det = (idx>>20)&1; det += 1; zside = (idx>>7)&7; // zside = (idx>>7)&3; station = (idx>>4)&7; plane = idx&15; // // std::cout << " FP420unpacking: idx=" << idx << " zside " << zside << " station " << station << " plane " << plane << std::endl; // }
int FP420NumberingScheme::unpackLayerIndex | ( | int | rn0, |
int | zside | ||
) | [inline] |
void FP420NumberingScheme::unpackMYIndex | ( | const int & | idx, |
int | rn0, | ||
int | pn0, | ||
int | sn0, | ||
int & | det, | ||
int & | zside, | ||
int & | sector, | ||
int & | zmodule | ||
) | [inline] |
Definition at line 53 of file FP420NumberingScheme.h.
{
int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
det = (idx-1)/dScale + 1;
sector = (idx-1- dScale*(det - 1))/sScale + 1;
zmodule = (idx-1- dScale*(det - 1)- sScale*(sector - 1) )/ zScale + 1;
zside = idx - dScale*(det - 1) - sScale*(sector - 1) - zScale*(zmodule - 1);
}
int FP420NumberingScheme::unpackOrientation | ( | int | rn0, |
int | zside | ||
) | [inline] |
Definition at line 92 of file FP420NumberingScheme.h.
{ // Front: Orientation= 1; Back: Orientation= 2 int Orientation = 2; if(zside>(rn0-1) || zside<1) Orientation = 0; if(zside==1 || zside==2) Orientation = 1; // return Orientation; }