QPainterPath KisGridPaintOpSettings::brushOutline(const KisPaintInformation &info, OutlineMode mode) const { QPainterPath path; if (mode == CursorIsOutline || mode == CursorIsCircleOutline || mode == CursorTiltOutline) { qreal sizex = getInt(GRID_WIDTH) * getDouble(GRID_SCALE); qreal sizey = getInt(GRID_HEIGHT) * getDouble(GRID_SCALE); QRectF rc(0, 0, sizex, sizey); rc.translate(-rc.center()); path.addRect(rc); QPainterPath tiltLine; QLineF tiltAngle(QPointF(0.0,0.0), QPointF(0.0,sizex)); tiltAngle.setLength(qMax(sizex*0.5, 50.0) * (1 - info.tiltElevation(info, 60.0, 60.0, true))); tiltAngle.setAngle((360.0 - fmod(KisPaintInformation::tiltDirection(info, true) * 360.0 + 270.0, 360.0))-3.0); tiltLine.moveTo(tiltAngle.p1()); tiltLine.lineTo(tiltAngle.p2()); tiltAngle.setAngle((360.0 - fmod(KisPaintInformation::tiltDirection(info, true) * 360.0 + 270.0, 360.0))+3.0); tiltLine.lineTo(tiltAngle.p2()); tiltLine.lineTo(tiltAngle.p1()); path = outlineFetcher()->fetchOutline(info, this, path); if (mode == CursorTiltOutline) { path.addPath(outlineFetcher()->fetchOutline(info, this, tiltLine, 1.0, 0.0, true, 0, 0)); } } return path; }
double DetectorModule::effectiveDsDistance() const { if (fabs(tiltAngle()) < 1e-3) return dsDistance(); else return dsDistance()*sin(center().Theta())/sin(center().Theta()+tiltAngle()); }
double DetectorModule::geometricEfficiency() const { double inefficiency = fabs(dsDistance() / (zCorrelation()==SAMESEGMENT ? outerSensor().stripLength() : length()) / tan(center().Theta()+tiltAngle())); // fabs prevents the inefficiency from becoming negative when theta+tilt > 90 deg (meaning the geometrically inefficient area is on the other end of the module) return 1-inefficiency; }
double DetectorModule::stripOccupancyPerEvent() const { if (fabs(tiltAngle()) < 1e-3) return stripOccupancyPerEventBarrel(); else if (fabs(tiltAngle()) - M_PI/2. < 1e-3) return stripOccupancyPerEventEndcap(); else return stripOccupancyPerEventBarrel()*pow(cos(tiltAngle()),2) + stripOccupancyPerEventEndcap()*pow(sin(tiltAngle()),2); };
double DetectorModule::resolutionEquivalentZ(double hitRho, double trackR, double trackCotgTheta, double resolutionLocalX, double resolutionLocalY) const { double A = hitRho/(2*trackR); double D = trackCotgTheta/sqrt(1-A*A); return sqrt(pow(((D*cos(tiltAngle()) + sin(tiltAngle()))*sin(skewAngle())) * resolutionLocalX,2) + pow((D*sin(tiltAngle()) + cos(tiltAngle())) * resolutionLocalY,2)); }
double DetectorModule::resolutionEquivalentRPhi(double hitRho, double trackR, double resolutionLocalX, double resolutionLocalY) const { double A = hitRho/(2*trackR); double B = A/sqrt(1-A*A); return sqrt(pow((B*sin(skewAngle())*cos(tiltAngle()) + cos(skewAngle())) * resolutionLocalX,2) + pow(B*sin(tiltAngle()) * resolutionLocalY,2)); }