int TrSimSensor::GetImplantAddressFromReadoutAddress(int readoutadd) { if ( (GetSensorType()<0)||(GetSensorType()>2) ) { printf("TrSimSensor::GetImplantAddressFromReadoutAddress-E no sensor type selected\n"); return -1; } if ( (readoutadd<0)||(readoutadd>=GetNReadoutStrips()) ) { if (WARNING) printf("TrSimSensor::GetImplantAddressFromReadoutAddress-W invalid readout address (add=%d) requested\n",readoutadd); return -1; } int impladd = -1; switch (GetSensorType()) { case kS: impladd = 4*readoutadd; if (readoutadd!= 0) impladd += 4; if (readoutadd==639) impladd += 4; break; case kK5: impladd = 2*readoutadd; if (readoutadd==191) impladd = 383; break; case kK7: impladd = int(readoutadd/2)*3 + (readoutadd%2)*2; if ( (readoutadd>=64)&&(readoutadd<=159) ) impladd = 96 + (readoutadd-64)*2; // "regular" regime else if (readoutadd>159) impladd += 48; // offset break; } return impladd; }
void TrSimSensor::SetDefaults() { // Sensor parameters switch (GetSensorType()) { case kS: _Cint = TRMCFFKEY.TrSim2010_Cint[1]; // pF _Cbk = TRMCFFKEY.TrSim2010_Cbk[1]; // pF _Cdec = TRMCFFKEY.TrSim2010_Cdec[1]; // pF _diff_type = TRMCFFKEY.TrSim2010_DiffType[1]; _diff_radius = TRMCFFKEY.TrSim2010_DiffRadius[1]; // um _nimplants = 2568; _nreadout = 640; _implant_pitch = 27.5; break; case kK5: _Cint = TRMCFFKEY.TrSim2010_Cint[0]; // pF _Cbk = TRMCFFKEY.TrSim2010_Cbk[0]; // pF _Cdec = TRMCFFKEY.TrSim2010_Cdec[0]; // pF _diff_type = TRMCFFKEY.TrSim2010_DiffType[0]; _diff_radius = TRMCFFKEY.TrSim2010_DiffRadius[0]; // um _nimplants = 384; _nreadout = 192; _implant_pitch = 104; break; case kK7: _Cint = TRMCFFKEY.TrSim2010_Cint[0]; // pF _Cbk = TRMCFFKEY.TrSim2010_Cbk[0]; // pF _Cdec = TRMCFFKEY.TrSim2010_Cdec[0]; // pF _diff_type = TRMCFFKEY.TrSim2010_DiffType[0]; _diff_radius = TRMCFFKEY.TrSim2010_DiffRadius[0]; // um _nimplants = 384; _nreadout = 224; _implant_pitch = 104; break; } }
double TrSimSensor::GetkeVtoADC(float keV) { double x = keV/81; // energy loss in MIP units double pside_uncorr_pars[6] = { 2.07483, 30.2233, -0.895041, 0.0125374, -5.89888e-05, 70.2948}; // double pside_corr_pars[4] = { 18.4885, 20.2601, 0.00336957, -0.00016007}; // double nside_nosat_pars[2] = {-4.42436, 44.6219}; double mip = 1; // mip in mip units! double value = 0.; switch (GetSensorType()) { case kS: // S if (TRMCFFKEY.TrSim2010_PStripCorr==0) { value = pside_uncorr_charge_dependence_function(&x,pside_uncorr_pars); value /= pside_uncorr_charge_dependence_function(&mip,pside_uncorr_pars); } else { printf("TrSimSensor::GetkeVtoADC-E p-strip non-linearity not yet implemented.\n"); // value = pside_corr_charge_dependence_function(&x,pside_corr_pars); // value /= pside_corr_charge_dependence_function(&mip,pside_corr_pars); } value *= TRMCFFKEY.TrSim2010_ADCMipValue[1]; break; case kK5: // K5 case kK7: // K7 value = TRMCFFKEY.TrSim2010_ADCMipValue[0]* x; break; } return value; }
bool TrSimSensor::IsReadoutStrip(int implantadd) { if ( (GetSensorType()<0)||(GetSensorType()>2) ) { printf("TrSimSensor::IsReadoutStrip-E no sensor type selected\n"); return false; } if ( (implantadd<0)||(implantadd>=GetNImplantStrips()) ) { if (WARNING) printf("TrSimSensor::IsReadoutStrip-W invalid implant position (impl=%d) requested\n",implantadd); return false; } /* Sensor Bonding Scheme S: - 2568 implantation strips - 640 readout strips (642 possible positions) implantation 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 ... 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 readout 000 xxx 001 002 638 xxx 639 K5 (one sensor): - 384 implantation strips - 192 readout strips implantation 000 001 002 003 004 005 006 ... 378 379 380 381 382 383 readout 0 1 2 3 189 190 191 K7 (one sensor): - 384 implantation strips - 224 readout strips implantation 000 001 002 003 004 005 006 ... 092 093 094 095 | 096 097 098 ... 286 | 287 288 289 290 291 ... 380 381 382 383 readout 0 1 2 3 4 61 62 63 | 64 65 159 | 160 161 162 221 222 223 */ switch (GetSensorType()) { case kS: return ((implantadd%4)==0) && (implantadd!=4) && (implantadd!=2560) && (implantadd<=2567); break; case kK5: return ( ((implantadd%2)==0) && (implantadd<382) ) || (implantadd==383); break; case kK7: return ( ((implantadd%3)!=1) && ((implantadd< 96)||(implantadd> 287)) && (implantadd<=383) ) || ( ((implantadd%2)==0) && ((implantadd>=96)&&(implantadd<=287)) ); break; } return false; }
int TrSimSensor::GetNChannels() { switch (GetSensorType()) { case kS: return 640; break; case kK5: return 384; break; case kK7: return 384; break; } return 0; }
int TrSimSensor::GetReadoutAddressFromImplantAddress(int implantadd, int nsens) { if ( (GetSensorType()<0)||(GetSensorType()>2) ) { printf("TrSimSensor::GetReadoutAddressFromImplantAddress-E no sensor type selected\n"); return -1; } if ( (implantadd<0)||(implantadd>=GetNImplantStrips()) ) { if (WARNING) printf("TrSimSensor::GetImplantAddressFromReadoutAddress-W invalid implant address (add=%d) requested\n",implantadd); return -1; } if (!IsReadoutStrip(implantadd)) { if (WARNING) printf("TrSimSensor::GetImplantAddressFromReadoutAddress-W requested implant strip is not a readout strip (add=%d)\n",implantadd); return -1; } int readoutadd = -1; switch (GetSensorType()) { case kS: readoutadd = implantadd/4; if (readoutadd> 0) readoutadd -= 1; if (readoutadd>=640) readoutadd = 639; return readoutadd; break; case kK5: readoutadd = implantadd/2; if (implantadd==383) readoutadd = 191; // even sensors if ((nsens%2)==1) readoutadd += 192; // odd sensors return readoutadd; break; case kK7: readoutadd = 2*(implantadd/3) + ((implantadd%3)==2); // first if (implantadd>286) readoutadd -= 32; // third: gap (192 - 160) if ( (implantadd>=96)&&(implantadd<=287) ) readoutadd = implantadd/2 + 16; // second: gap ( 64 - 48) readoutadd = (readoutadd + nsens*224)%384; // on nth sensor return readoutadd; break; } return readoutadd; }
// --------------------------------------------------------------------------- void __fastcall TfrmAboutSensors::CreateIfExists(TSensorCategory ASensorCategory) { TSensorArray LSensorArray = TSensorManager::Current->GetSensorsByCategory(ASensorCategory); TListBoxGroupHeader * LHeader = new TListBoxGroupHeader(this->Owner); LHeader->Parent = lbMain; LHeader->Text = GetSensorCategoryName(ASensorCategory); LHeader->Height = LHeader->Height * 2; for (int i = 0; i < LSensorArray.Length -1 ; i++) { TListBoxItem * LItem = new TListBoxItem(this->Owner); LItem->Parent = lbMain; LItem->Text = GetSensorType(LSensorArray[i]); LItem->ItemData->Accessory = TListBoxItemData::TAccessory::aDetail; LItem->Data = LSensorArray[i]; LItem->OnClick = ListBoxItemClick; LItem->Height = LItem->Height * 2; LItem->Font->Size = LItem->Font->Size * 2; } }