/// @file AllPixGeoDsc.cc /// @brief Implementation of the Allpix geometry description class. #include "AllPixGeoDsc.hh" // // AllPixGeoDsc constructor. // AllPixGeoDsc::AllPixGeoDsc() { // Initialise the vectors of DAC settings. for (Int_t i=0;i<14;i++) m_dacs.push_back(0); }//end of the AllPixGeoDsc constructor. // // AllPixGeoDsc destructor. // AllPixGeoDsc::~AllPixGeoDsc() { }//end of the AllPixGeoDsc destructor. /* temporary ... this has to be changed by a db com or something like that */ void AllPixGeoDsc::Dump() { G4cout << "* GEOM:" << G4endl << "* GEOM: Dumping the geometry description for ID: " << m_ID << endl << "* GEOM: * digitizer : " << m_digitizer << G4endl << "* GEOM: * npix_x = " << m_npix_x << G4endl << "* GEOM: * npix_y = " << m_npix_y << G4endl << "* GEOM: * npix_z = " << m_npix_z << G4endl << "* GEOM: * pixsize_x = " << m_pixsize_x/mm << " [mm]" << G4endl << "* GEOM: * pixsize_y = " << m_pixsize_y/mm << G4endl << "* GEOM: * pixsize_z = " << m_pixsize_z/mm << G4endl << "* GEOM: * sensor_hx = " << m_sensor_hx/mm << ", posx "<< m_sensor_posx/mm << G4endl << "* GEOM: * sensor_hy = " << m_sensor_hy/mm << ", posy "<< m_sensor_posy/mm << G4endl << "* GEOM: * sensor_hz = " << m_sensor_hz/mm << ", posz "<< m_sensor_posz/mm << G4endl << "* GEOM: * chip_hx = " << m_chip_hx/mm << ", posx "<< m_chip_posx/mm << G4endl << "* GEOM: * chip_hy = " << m_chip_hy/mm << ", posy "<< m_chip_posy/mm << G4endl << "* GEOM: * chip_hz = " << m_chip_hz/mm << ", posz "<< m_chip_posz/mm << G4endl << "* GEOM: * pcb_hx = " << m_pcb_hx/mm << G4endl << "* GEOM: * pcb_hy = " << m_pcb_hy/mm << G4endl << "* GEOM: * pcb_hz = " << m_pcb_hz/mm << G4endl << "* GEOM:" << G4endl; } // // // G4double AllPixGeoDsc::GetHalfWrapperDZ() { return GetHalfPCBZ() + GetCuBaseDZ() + GetChipDZ() + GetSensorZ() + GetAlFoilThickness(); // + GetHalfSensorZ(); } G4ThreeVector AllPixGeoDsc::GetSensorPosFromPcbCentre() { return G4ThreeVector( GetSensorPosX(), GetSensorPosY(), GetHalfPCBZ() + GetCuBaseDZ() + GetChipDZ() + GetHalfSensorZ() ); } // // // G4ThreeVector AllPixGeoDsc::GetReadoutChipPosFromPCBCentre() { return G4ThreeVector( GetSensorXOffset(), GetSensorYOffset() - (0.5*(GetChipDY() - GetSensorY()) - 0.5*(GetChipDX() - GetSensorX())), GetCuBaseDZ() + GetHalfPCBZ() + GetHalfChipDZ() ); // GetSensorOffsetFromPCBCentre() // + G4ThreeVector( // 0.0*mm, // -(0.5*(GetChipDY() - GetSensorY()) - 0.5*(GetChipDX() - GetSensorX())), // -(GetHalfSensorZ() + GetHalfChipDZ()) // ); }//end of AllPixGeoDsc::GetReadoutChipPosFromPCBCentre method. // // // G4ThreeVector AllPixGeoDsc::GetCuBasePosFromPCBCentre() { return // GetSensorOffsetFromPCBCentre() // + G4ThreeVector( // GetCuBaseOffsetX(), // GetCuBaseOffsetY(), // -(GetHalfSensorZ() + GetChipDZ() + GetHalfCuBaseDZ()) // ); G4ThreeVector( GetCuBaseOffsetX() + GetSensorXOffset(), GetCuBaseOffsetY() + GetSensorYOffset(), GetHalfCuBaseDZ() + GetHalfPCBZ() ); } /* void AllPixGeoDsc::operator=(AllPixGeoDsc & cp){ cout << cp.GetSensorDigitizer() << " , " << m_digitizer << endl; m_digitizer = cp.GetSensorDigitizer(); } */ /* void AllPixGeoDsc::ReadGeoBits(){ ifstream ifs( "DetDscrDb/detgeom.txt" , ifstream::in ); #define NCHARS 128 char temp[NCHARS]; string tempS; double value = 0.; while (ifs.good()){ ifs.getline(temp, NCHARS); tempS = temp; if(temp[0] == '#' || tempS.empty() ){ // comment or empty string continue; } for(int colItr = 0 ; colItr < 5 ; colItr++){ value = GetColFromLine(tempS, colItr); switch (colItr) { case 0: m_pcb_hx= value*um; break; case 1: m_pcb_hy= value*um; break; case 2: m_pcb_hz = value*um; break; case 3: m_sensor_posx = value*um; break; case 4: m_sensor_posy = value*um; break; } } } ifs.close(); } double AllPixGeoDsc::GetColFromLine(string tempS, int col){ size_t pos; string cutS; int localcol = 0; double value = 0.; //pos = tempS.find(" "); while((pos=tempS.find(" ")) != string::npos) { cutS = tempS.substr(0, pos); value = atof(cutS.c_str()); // in the desired col if(localcol == col){ return value; } // shrink string tempS = tempS.substr(pos+1); localcol++; } // last entry has no extra space, checking last one value = atof(tempS.c_str()); if(localcol == col) return value; // if reaching this point, the col couldn't be found G4cout << "[ERROR] ouch !, couldn't find that colum (AllPixGeoDsc::GetColFromLine)" << endl; G4cout << " giving up, geometry depends on this." << endl; exit(1); return -1; } */