#include <SimG4CMS/FP420/interface/FP420NumberingScheme.h>
Public Member Functions | |
virtual void | detectorLevel (const G4Step *, int &, int *, G4String *) const |
virtual int | detectorLevel (const G4Step *) 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 plane) |
static void | unpackFP420Index (const unsigned int &idx, int &det, int &zside, int &station, int &plane) |
Definition at line 18 of file FP420NumberingScheme.h.
FP420NumberingScheme::FP420NumberingScheme | ( | ) |
FP420NumberingScheme::~FP420NumberingScheme | ( | ) | [virtual] |
void FP420NumberingScheme::detectorLevel | ( | const G4Step * | aStep, | |
int & | level, | |||
int * | copyno, | |||
G4String * | name | |||
) | const [virtual] |
Definition at line 35 of file FP420NumberingScheme.cc.
References i.
00036 { 00037 00038 //Get name and copy numbers 00039 if (level > 0) { 00040 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); 00041 for (int ii = 0; ii < level; ii++) { 00042 int i = level - ii - 1; 00043 name[ii] = touch->GetVolume(i)->GetName(); 00044 copyno[ii] = touch->GetReplicaNumber(i); 00045 } 00046 } 00047 }
int FP420NumberingScheme::detectorLevel | ( | const G4Step * | aStep | ) | const [virtual] |
Definition at line 26 of file FP420NumberingScheme.cc.
References level.
Referenced by getUnitID().
00026 { 00027 00028 //Find number of levels 00029 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); 00030 int level = 0; 00031 if (touch) level = ((touch->GetHistoryDepth())+1); 00032 return level; 00033 }
unsigned int FP420NumberingScheme::getUnitID | ( | const G4Step * | aStep | ) | const [virtual] |
Definition at line 52 of file FP420NumberingScheme.cc.
References detectorLevel(), level, name, and packFP420Index().
Referenced by FP420SD::setDetUnitId().
00052 { 00053 00054 unsigned intindex=0; 00055 int level = detectorLevel(aStep); 00056 00057 #ifdef debug 00058 // cout.testOut << "FP420NumberingScheme number of levels= " << level << endl; 00059 #endif 00060 00061 // unsigned int intIndex = 0; 00062 if (level > 0) { 00063 int* copyno = new int[level]; 00064 G4String* name = new G4String[level]; 00065 detectorLevel(aStep, level, copyno, name); 00066 00067 // int det = static_cast<int>(FP420);; 00068 00069 int det = 1; 00070 int stationgen = 0; 00071 int zside = 0; 00072 int station = 0; 00073 int plane = 0; 00074 for (int ich=0; ich < level; ich++) { 00075 /* 00076 // old set up configuration with equidistant stations 00077 if(name[ich] == "FP420Ex") { 00078 stationgen = copyno[ich]; 00079 } else if(name[ich] == "SISTATION") { 00080 station = stationgen; 00081 } else if(name[ich] == "SIPLANE") { 00082 plane = copyno[ich]; 00083 } else if(name[ich] == "SIDETL") { 00084 zside = 1; 00085 } else if(name[ich] == "SIDETR") { 00086 zside = 2; 00087 } 00088 */ 00089 // new and old set up configurations are possible: 00090 if(name[ich] == "FP420E") { 00091 det = copyno[ich]; 00092 } else if(name[ich] == "FP420Ex1") { 00093 stationgen = 1; 00094 // } else if(name[ich] == "FP420Ex2") { 00095 // stationgen = 2; 00096 } else if(name[ich] == "FP420Ex3") { 00097 stationgen = 2;// was =3 00098 } else if(name[ich] == "SISTATION") { 00099 station = stationgen; 00100 } else if(name[ich] == "SIPLANE") { 00101 plane = copyno[ich]; 00102 } else if(name[ich] == "SIDETL") { 00103 zside = 1; 00104 } else if(name[ich] == "SIDETR") { 00105 zside = 2; 00106 } 00107 #ifdef debug 00108 // cout.testOut << "FP420NumberingScheme " << "ich=" << ich << "copyno" 00109 // << copyno[ich] << "name=" << name[ich] << endl; 00110 #endif 00111 } 00112 // use for FP420 number 1 00113 // 0 is as defauld for every below: 00114 // Z index X = 1; Y = 2 00115 // station number 1 - 5 00116 // plane number 1 - 10 00117 00118 // intindex = myPacker.packEcalIndex (det, zside, station, plane); 00119 // intindex = myPacker.packCastorIndex (det, zside, station, plane); 00120 intindex = packFP420Index (det, zside, station, plane); 00121 00122 00123 #ifdef debug 00124 /* 00125 cout.debugOut << "FP420NumberingScheme : det " << det << " zside " 00126 << zside << " station " << station << " plane " << plane 00127 << " UnitID 0x" << hex << intindex << dec << endl; 00128 00129 for (int ich = 0; ich < level; ich++) 00130 cout.debugOut <<" name = " << name[ich] <<" copy = " << copyno[ich] 00131 << endl; 00132 cout.testOut << " packed index = 0x" << hex << intindex << dec << endl; 00133 */ 00134 #endif 00135 00136 delete[] copyno; 00137 delete[] name; 00138 } 00139 00140 return intindex; 00141 00142 }
unsigned FP420NumberingScheme::packFP420Index | ( | int | det, | |
int | zside, | |||
int | station, | |||
int | plane | |||
) | [static] |
Definition at line 144 of file FP420NumberingScheme.cc.
Referenced by getUnitID(), cms::DigitizerFP420::produce(), and FP420Test::update().
00144 { 00145 unsigned int idx = ((det-1)&1)<<20; //bit 20 det:0,1=2-->2**1=2 1 bit: 0 00146 idx += (zside&3)<<7; //bits 7-8 zside:0-2=3-->2**2 =4 2 bits:0-1 00147 idx += (station&7)<<4; //bits 4-6 station:0-7=8-->2**3 =8 3 bits:0-2 00148 idx += (plane&15); //bits 0-3 plane: 0-15=16-->2**4 =16 4 bits:0-3 00149 00150 #ifdef debug 00151 /* 00152 cout.testOut << "FP420 packing: det " << det 00153 << " zside " << zside << " station " << station << " plane " << plane << "-> 0x" << hex << idx << dec << endl; 00154 int newdet, newzside, newstation,newplane; 00155 unpackFP420Index(idx, newdet, newzside, newstation,newplane); 00156 */ 00157 #endif 00158 00159 return idx; 00160 }
void FP420NumberingScheme::unpackFP420Index | ( | const unsigned int & | idx, | |
int & | det, | |||
int & | zside, | |||
int & | station, | |||
int & | plane | |||
) | [static] |
Definition at line 161 of file FP420NumberingScheme.cc.
Referenced by ChargeDividerFP420::DeconvolutionShape(), ChargeDividerFP420::PeakShape(), cms::DigitizerFP420::produce(), and FP420Test::update().
00163 { 00164 det = (idx>>20)&1; 00165 det += 1; 00166 zside = (idx>>7)&3; 00167 station = (idx>>4)&7; 00168 plane = idx&15; 00169 00170 #ifdef debug 00171 /* 00172 cout.testOut << " FP420 unpacking: 0x " << hex << idx << dec << " -> det " << det 00173 << " zside " << zside << " station " << station << " plane " << plane << endl; 00174 */ 00175 #endif 00176 }