void S60VideoPlayerSession::MvpuoPrepareComplete(TInt aError)
{
    setError(aError); // if we have some playback errors, handle them

    if (m_displayWindow) {
        m_player->RemoveDisplayWindow(*m_displayWindow);
        m_displayWindow = NULL;
    }

    RWindow *window = static_cast<RWindow *>(m_window);
    if (window) {
        /* Get the window size */
        TRect rect;
        if (m_videoOutput && m_videoOutput->inherits("S60VideoWidgetControl")) {
            S60VideoWidgetControl* widgetControl = qobject_cast<S60VideoWidgetControl *>(m_videoOutput);
            const QSize size = widgetControl->videoWidgetSize();
            rect.SetSize(TSize(size.width(), size.height()));
        }
        else if (m_videoOutput && m_videoOutput->inherits("S60VideoOverlay")) {
            S60VideoOverlay* videoOverlay = qobject_cast<S60VideoOverlay *>(m_videoOutput);
            const QSize size = videoOverlay->displayRect().size();
            rect.SetSize(TSize(size.width(), size.height()));
        }
        m_rect = rect;

        window->SetBackgroundColor(TRgb(0, 0, 0, 255));
        TRAPD(error,
            m_player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, m_rect, m_rect);)
        setError(error); // if we can't add window it an error at this point
        TSize originalSize;
        TRAP_IGNORE(
            m_player->VideoFrameSizeL(originalSize);
            m_originalSize = QSize(originalSize.iWidth, originalSize.iHeight);
            m_player->SetScaleFactorL(*window, scaleFactor().first, scaleFactor().second);)
예제 #2
0
void PropGeom::scale()
{
	double current_factor = scaleFactor()*(1.0/lastScaleFactor);

	diameter.set( diameter()*current_factor );

	lastScaleFactor = scaleFactor();

}
예제 #3
0
void PageViewportControllerClientEfl::setViewportPosition(const WebCore::FloatPoint& contentsPoint)
{
    m_contentPosition = contentsPoint;

    FloatPoint pos(contentsPoint);
    pos.scale(scaleFactor(), scaleFactor());
    m_viewImpl->setPagePosition(pos);

    m_controller->didChangeContentsVisibility(m_contentPosition, scaleFactor());
}
예제 #4
0
QPoint ImageWidget::imagePosFromWidgetPos(QPoint widgetPos)
{
    QPoint pos(floor(widgetPos.x() / scaleFactor()),
               floor(widgetPos.y() / scaleFactor()));
    QSize size = imageSize();

    if (pos.x() >= size.width() || pos.y() >= size.height() || pos.x() < 0 || pos.y() < 0) {
        return QPoint(-1,-1);
    } else {
        return pos;
    }
}
예제 #5
0
파일: tool.cpp 프로젝트: 999999333/mapper
void MapEditorTool::drawSelectionBox(QPainter* painter, MapWidget* widget, const MapCoordF& corner1, const MapCoordF& corner2) const
{
	painter->setBrush(Qt::NoBrush);
	
	QPoint point1 = widget->mapToViewport(corner1).toPoint();
	QPoint point2 = widget->mapToViewport(corner2).toPoint();
	QPoint top_left = QPoint(qMin(point1.x(), point2.x()), qMin(point1.y(), point2.y()));
	QPoint bottom_right = QPoint(qMax(point1.x(), point2.x()), qMax(point1.y(), point2.y()));
	
	painter->setPen(QPen(QBrush(active_color), scaleFactor()));
	painter->drawRect(QRect(top_left, bottom_right - QPoint(1, 1)));
	painter->setPen(QPen(QBrush(qRgb(255, 255, 255)), scaleFactor()));
	painter->drawRect(QRect(top_left + QPoint(1, 1), bottom_right - QPoint(2, 2)));
}
예제 #6
0
void PictureShape::saveOdf(KoShapeSavingContext &context) const
{
    // make sure we have a valid image data pointer before saving
    KoImageData *imageData = qobject_cast<KoImageData*>(userData());
    if (imageData == 0) {
        return;
    }

    KoXmlWriter &writer = context.xmlWriter();

    writer.startElement("draw:frame");
    saveOdfAttributes(context, OdfAllAttributes);
    writer.startElement("draw:image");
    // In the spec, only the xlink:href attribute is marked as mandatory, cool :)
    QString name = context.imageHref(imageData);
    writer.addAttribute("xlink:type", "simple");
    writer.addAttribute("xlink:show", "embed");
    writer.addAttribute("xlink:actuate", "onLoad");
    writer.addAttribute("xlink:href", name);
    saveText(context);
    writer.endElement(); // draw:image
    QSizeF scaleFactor(imageData->imageSize().width() / size().width(),
                  imageData->imageSize().height() / size().height());
    saveOdfClipContour(context, scaleFactor);
    writer.endElement(); // draw:frame

    context.addDataCenter(m_imageCollection);
}
예제 #7
0
osg::AnimationPathCallback* createAnimationPathCallback( osg::Vec3Array* vertices, float scale, float time )
{
    osg::ref_ptr<osg::AnimationPath> path = new osg::AnimationPath;
    path->setLoopMode( osg::AnimationPath::LOOP );
    
    osg::Vec3 scaleFactor(scale, scale, scale);
    float delta_time = time / (float)vertices->size();
    for ( unsigned int i=0; i<vertices->size(); ++i )
    {
        osg::Quat rot; osg::Vec3 dir;
        if ( i<vertices->size()-1 )
        {
            dir = (*vertices)[i+1] - (*vertices)[i]; dir.normalize();
            rot.makeRotate( osg::X_AXIS, dir );
        }
        else
        {
            dir = (*vertices)[i] - (*vertices)[i-1]; dir.normalize();
            rot.makeRotate( osg::X_AXIS, dir );
        }
        path->insert( delta_time * (float)i, osg::AnimationPath::ControlPoint((*vertices)[i], rot, scaleFactor) );
    }
    
    osg::ref_ptr<osg::AnimationPathCallback> apcb = new osg::AnimationPathCallback;
    apcb->setAnimationPath( path.get() );
    return apcb.release();    
}
예제 #8
0
void QQuickContext2DTexture::paintWithoutTiles(QQuickContext2DCommandBuffer *ccb)
{
    if (!ccb || ccb->isEmpty())
        return;

    QPaintDevice* device = beginPainting();
    if (!device) {
        endPainting();
        return;
    }

    QPainter p;
    p.begin(device);
    if (m_antialiasing)
        p.setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing, true);
    else
        p.setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing, false);

    if (m_smooth)
        p.setRenderHint(QPainter::SmoothPixmapTransform, true);
    else
        p.setRenderHint(QPainter::SmoothPixmapTransform, false);

    p.setCompositionMode(QPainter::CompositionMode_SourceOver);

    ccb->replay(&p, m_state, scaleFactor());
    endPainting();
    markDirtyTexture();
}
예제 #9
0
int EditPointTool::updateDirtyRectImpl(QRectF& rect)
{
	bool show_object_points = map()->selectedObjects().size() <= max_objects_for_handle_display;
	
	selection_extent = QRectF();
	map()->includeSelectionRect(selection_extent);
	
	rectInclude(rect, selection_extent);
	int pixel_border = show_object_points ? (scaleFactor() * 6) : 1;
	
	// Control points
	if (show_object_points)
	{
		for (Map::ObjectSelection::const_iterator it = map()->selectedObjectsBegin(), end = map()->selectedObjectsEnd(); it != end; ++it)
			(*it)->includeControlPointsRect(rect);
	}
	
	// Text selection
	if (text_editor)
		text_editor->includeDirtyRect(rect);
	
	// Box selection
	if (isDragging() && box_selection)
	{
		rectIncludeSafe(rect, click_pos_map);
		rectIncludeSafe(rect, cur_pos_map);
	}
	
	return pixel_border;
}
예제 #10
0
void GameCore::createDecal(Ogre::Vector3 position,Ogre::Vector3 normal)
{/*
    static int decalID=0;
    btCollisionObject object;
    Ogre::Vector3 hitPos;
    CollisionObjectInfo* info;
  */
    Ogre::Vector3 scaleFactor(8,8,8);
    Entity* ent=sceneManager->createEntity("Decal.mesh");
    /*
    float x=ent->getBoundingBox().getSize().x/2.*scaleFactor.x;
    float y=ent->getBoundingBox().getSize().y/2.*scaleFactor.y;
    Ogre::Vector3 pointArr[]={Ogre::Vector3(-x,-y,0),Ogre::Vector3(-x,y,0),Ogre::Vector3(x,-y,0),Ogre::Vector3(x,y,0)
            ,Ogre::Vector3(-x/2.,-y/2.,0),Ogre::Vector3(-x/2.,y/2.,0),Ogre::Vector3(x/2.,-y/2.,0),Ogre::Vector3(x/2.,y/2.,0)};
    SceneNode* temp=sceneManager->getRootSceneNode()->createChildSceneNode();
    temp->setDirection(normal);
    for(int i=0;i<8;i++)
    {
        pointArr[i]=temp->getOrientation()*pointArr[i];
        if(PhysicsHandler::performRaycastTest(position+(normal*2)+pointArr[i],position-(normal*2)+pointArr[i],&object,dynamics,&hitPos))
        {
            info=(CollisionObjectInfo*)object.getUserPointer();
            if(info->getObjectType()==CollisionObjectTypes::HIT_DECAL)
            {
                temp->setPosition(position);
                temp->translate(0,0,.1,Ogre::Node::TS_LOCAL);
                decalRigidMap[info->getSceneNode()]->setPosition(temp->getPosition());
                return;
            }
        }
    }
  */

    SceneNode* decalNode=sceneManager->getRootSceneNode()->createChildSceneNode();
    ent->setMaterialName("BulletDamageDecal");
    ent->setCastShadows(false);
    decalNode->attachObject(ent);
    decalNode->scale(scaleFactor);
    decalNode->setPosition(position);
    decalNode->setDirection(normal);
    decalNode->translate(0,0,.1,Ogre::Node::TS_LOCAL);
    Ogre::Vector3 newPosition=decalNode->getPosition();
    decalNode->rotate(Ogre::Vector3::UNIT_X,Degree(90));
    hitDecalQueue.push(decalNode);
    if(hitDecalQueue.size()>maxDecals)
    {
        SceneNode* _decalNode=hitDecalQueue.front();
        hitDecalQueue.pop();
        sceneManager->destroySceneNode(_decalNode);
    }
/*
    OgreBulletCollisions::BoxCollisionShape* boxShape=PhysicsHandler::createBoxShape(ent,decalNode->getScale());
    OgreBulletDynamics::RigidBody* decalRigid=PhysicsHandler::addRigidBody("decal_"+Converter::intToString(decalID),decalNode,boxShape,dynamics,newPosition,0,decalNode->getOrientation());
    decalRigid->setKinematicObject(true);
    decalRigid->getBulletObject()->setUserPointer(new CollisionObjectInfo(decalNode, decalRigid, CollisionObjectTypes::HIT_DECAL, NULL));
    decalRigidMap[decalNode]=decalRigid;
    decalID++;
 * */
}
예제 #11
0
파일: image.cpp 프로젝트: Jon0/MuseScore
QSizeF Image::sizeForScale(const QSizeF& scale) const
      {
      QSizeF s = scale / 100.0;
//      qreal sz = _sizeIsSpatium ? spatium() : MScore::DPMM;
//      QSizeF oSize = imageSize() / sz;
      QSizeF oSize = imageSize() / scaleFactor();
      return QSizeF(s.width() * oSize.width(), s.height() * oSize.height());
      }
예제 #12
0
QSizeF Image::scaleForSize(const QSizeF& s) const
      {
      QSizeF sz = s * scaleFactor();
      return QSizeF(
         (sz.width()  * 100.0)/ imageSize().width(),
         (sz.height() * 100.0)/ imageSize().height()
         );
      }
예제 #13
0
 FilteredFBCombFilter6::FilteredFBCombFilter6(float initialDelayTime, float maxDelayTime)
 {
   gen()->initialize(initialDelayTime, maxDelayTime);
   delayTime(initialDelayTime);
   scaleFactor(0.5f);
   lowpassCutoff(12000.0f);
   highpassCutoff(20.0f);
 }
예제 #14
0
RS_Vector RS_Ellipse::getNearestMiddle(const RS_Vector& coord,
                                       double* dist,
                                       int middlePoints
                                      ) {
    if ( ! ( std::isnormal(getAngle1()) || std::isnormal(getAngle2()))) {
        //no middle point for whole ellipse, angle1=angle2=0
        if (dist!=NULL) {
            *dist = RS_MAXDOUBLE;
        }
        return RS_Vector(false);
    }
    if ( getMajorRadius() < RS_TOLERANCE || getMinorRadius() < RS_TOLERANCE ) {
        //zero radius, return the center
        RS_Vector vp(getCenter());
        if (dist!=NULL) {
            *dist = vp.distanceTo(coord);
        }
        return vp;
    }
    double angle=getAngle();
    double amin=getCenter().angleTo(getStartpoint());
    double amax=getCenter().angleTo(getEndpoint());
    if(isReversed()) {
        std::swap(amin,amax);
    }
    int i=middlePoints + 1;
    double da=fmod(amax-amin+2.*M_PI, 2.*M_PI);
    if ( da < RS_TOLERANCE ) {
        da = 2.*M_PI; //whole ellipse
    }
    da /= i;
    int j=1;
    double curDist=RS_MAXDOUBLE;
    //double a=RS_Math::correctAngle(amin+da-angle);
    double a=amin-angle+da;
    RS_Vector curPoint;
    RS_Vector scaleFactor(RS_Vector(1./getMajorRadius(),1./getMinorRadius()));
    do {
        RS_Vector vp(a);
        RS_Vector vp2=vp;
        vp2.scale(scaleFactor);
        vp.scale(1./vp2.magnitude());
        vp.rotate(angle);
        vp.move(getCenter());
        double d=coord.distanceTo(vp);
        if(d<curDist) {
            curDist=d;
            curPoint=vp;
        }
        j++;
        a += da;
    } while (j<i);
    if (dist!=NULL) {
        *dist = curDist;
    }
    RS_DEBUG->print("RS_Ellipse::getNearestMiddle: angle1=%g, angle2=%g, middle=%g\n",amin,amax,a);
    return curPoint;
}
void CascadedShadowMappingRenderer::updateLightProjAndViewports()
{
    // Find a bounding box of whole camera frustum in light view space.
    nv::vec4f frustumMin(std::numeric_limits<float>::max());
    nv::vec4f frustumMax(std::numeric_limits<float>::lowest());
    frustumBoundingBoxLightViewSpace(m_nearPlane, m_farPlane, frustumMin, frustumMax);

    // Update light projection matrix to only cover the area viewable by the camera
    nv::ortho3D(m_lightProjMatrix, frustumMin.x, frustumMax.x, frustumMin.y, frustumMax.y, 0.0f, frustumMin.z);

    // Find a bounding box of segment in light view space.
    float nearSegmentPlane = 0.0f;
    for (unsigned int i = 0; i < m_frustumSegmentCount; ++i) {
        nv::vec4f segmentMin(std::numeric_limits<float>::max());
        nv::vec4f segmentMax(std::numeric_limits<float>::lowest());
        frustumBoundingBoxLightViewSpace(nearSegmentPlane, m_farPlanes[i], segmentMin, segmentMax);

        // Update viewports.
        nv::vec2f frustumSize(frustumMax.x - frustumMin.x, frustumMax.y - frustumMin.y);
        const float segmentSizeX = segmentMax.x - segmentMin.x;
        const float segmentSizeY = segmentMax.y - segmentMin.y;
        const float segmentSize = segmentSizeX < segmentSizeY ? segmentSizeY : segmentSizeX;
        const nv::vec2f offsetBottomLeft(segmentMin.x - frustumMin.x, segmentMin.y - frustumMin.y);
        const nv::vec2f offsetSegmentSizeRatio(offsetBottomLeft.x / segmentSize, offsetBottomLeft.y / segmentSize);
        const nv::vec2f frustumSegmentSizeRatio(frustumSize.x / segmentSize, frustumSize.y / segmentSize);

        nv::vec2f pixelOffsetTopLeft(offsetSegmentSizeRatio * LIGHT_TEXTURE_SIZE);
        nv::vec2f pixelFrustumSize(frustumSegmentSizeRatio * LIGHT_TEXTURE_SIZE);

        // Scale factor that helps if frustum size is supposed to be bigger
        // than maximum viewport size.
        nv::vec2f scaleFactor(
            m_viewportDims[0] < pixelFrustumSize.x ? m_viewportDims[0] / pixelFrustumSize.x : 1.0f,
            m_viewportDims[1] < pixelFrustumSize.y ? m_viewportDims[1] / pixelFrustumSize.y : 1.0f);

        pixelOffsetTopLeft *= scaleFactor;
        pixelFrustumSize *= scaleFactor;

        m_lightViewports[i] = nv::vec4f(-pixelOffsetTopLeft.x, -pixelOffsetTopLeft.y, pixelFrustumSize.x, pixelFrustumSize.y);
        glViewportIndexedfv(i, m_lightViewports[i]._array);

        // Update light view-projection matrices per segment.
        nv::matrix4f lightProj;
        nv::ortho3D(lightProj, segmentMin.x, segmentMin.x + segmentSize, segmentMin.y, segmentMin.y + segmentSize, 0.0f, frustumMin.z);
        nv::matrix4f lightScale;
        lightScale.set_scale(nv::vec3f(0.5f * scaleFactor.x, 0.5f * scaleFactor.y, 0.5f));
        nv::matrix4f lightBias;
        lightBias.set_translate(nv::vec3f(0.5f * scaleFactor.x, 0.5f * scaleFactor.y, 0.5f));
        m_lightSegmentVPSBMatrices[i] = lightBias * lightScale * lightProj * m_lightViewMatrix;

        nearSegmentPlane = m_normalizedFarPlanes[i];
    }

    // Set remaining viewports to some kind of standard state.
    for (unsigned int i = m_frustumSegmentCount; i < MAX_CAMERA_FRUSTUM_SPLIT_COUNT; ++i) {
        glViewportIndexedf(i, 0, 0, LIGHT_TEXTURE_SIZE, LIGHT_TEXTURE_SIZE);
    }
}
예제 #16
0
QSizeF Image::scaleForSize(const QSizeF& s) const
{
//      QSizeF sz = s * (_sizeIsSpatium ? spatium() : MScore::DPMM);
    QSizeF sz = s * scaleFactor();
    return QSizeF(
               (sz.width()  * 100.0)/ imageSize().width(),
               (sz.height() * 100.0)/ imageSize().height()
           );
}
예제 #17
0
void WaveformRendererEndOfTrack::setup(const QDomNode& node, const SkinContext& context) {
    m_color = QColor(200, 25, 20);
    const QString endOfTrackColorName = context.selectString(node, "EndOfTrackColor");
    if (!endOfTrackColorName.isNull()) {
        m_color.setNamedColor(endOfTrackColorName);
        m_color = WSkinColor::getCorrectColor(m_color);
    }
    m_pen = QPen(QBrush(m_color), 2.5 * scaleFactor());
    generateBackRects();
}
예제 #18
0
int QPinchGesture::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGesture::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast<int*>(_v) = QFlag(totalChangeFlags()); break;
        case 1: *reinterpret_cast<int*>(_v) = QFlag(changeFlags()); break;
        case 2: *reinterpret_cast< qreal*>(_v) = totalScaleFactor(); break;
        case 3: *reinterpret_cast< qreal*>(_v) = lastScaleFactor(); break;
        case 4: *reinterpret_cast< qreal*>(_v) = scaleFactor(); break;
        case 5: *reinterpret_cast< qreal*>(_v) = totalRotationAngle(); break;
        case 6: *reinterpret_cast< qreal*>(_v) = lastRotationAngle(); break;
        case 7: *reinterpret_cast< qreal*>(_v) = rotationAngle(); break;
        case 8: *reinterpret_cast< QPointF*>(_v) = startCenterPoint(); break;
        case 9: *reinterpret_cast< QPointF*>(_v) = lastCenterPoint(); break;
        case 10: *reinterpret_cast< QPointF*>(_v) = centerPoint(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setTotalChangeFlags(QFlag(*reinterpret_cast<int*>(_v))); break;
        case 1: setChangeFlags(QFlag(*reinterpret_cast<int*>(_v))); break;
        case 2: setTotalScaleFactor(*reinterpret_cast< qreal*>(_v)); break;
        case 3: setLastScaleFactor(*reinterpret_cast< qreal*>(_v)); break;
        case 4: setScaleFactor(*reinterpret_cast< qreal*>(_v)); break;
        case 5: setTotalRotationAngle(*reinterpret_cast< qreal*>(_v)); break;
        case 6: setLastRotationAngle(*reinterpret_cast< qreal*>(_v)); break;
        case 7: setRotationAngle(*reinterpret_cast< qreal*>(_v)); break;
        case 8: setStartCenterPoint(*reinterpret_cast< QPointF*>(_v)); break;
        case 9: setLastCenterPoint(*reinterpret_cast< QPointF*>(_v)); break;
        case 10: setCenterPoint(*reinterpret_cast< QPointF*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
예제 #19
0
void MainView::wheelEvent(QWheelEvent *event)
{
	if ( event->delta() > 0 ) scaleLevel--;
	else scaleLevel++;

	if ( scaleLevel <= 0 ) scaleLevel = 1;
	qreal factor = scaleFactor();
	setTransform(QTransform::fromScale(factor, factor));

	if ( miniMap ) miniMap->visibleRectChanged();
}
예제 #20
0
파일: tbg.cpp 프로젝트: xufango/contrib_bk
TimeBaseGenerator::TimeBaseGenerator()
{
	T_dur = 1.0;
	T_init = 0.003;
	SlopeRamp = 0.001;
	alpha = 1.00001;
	scaleFactor();
	offset = 0.0;

	//printf("--> Tbg object created with default parameters\n");
	//o1.open("Gamma_test.txt");
}
예제 #21
0
bool PictureShape::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context)
{
    loadOdfAttributes(element, context, OdfAllAttributes);

    if (loadOdfFrame(element, context)) {
        // load contour (clip)
        KoImageData *imageData = qobject_cast<KoImageData*>(userData());

        QSizeF scaleFactor(size().width() / imageData->imageSize().width(),
                 size().height() / imageData->imageSize().height());

        loadOdfClipContour(element, context, scaleFactor);
        // this is needed so that the image is already normalized when calling waitUntilReady e.g. by cstester
        m_clippingRect.normalize(imageData->imageSize());

        return true;
    }
    return false;
}
예제 #22
0
    void traverse( osg::NodeVisitor& nv )
    {
        if ( _dragger.valid() )
        {
            if ( _active && nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR )
            {
                osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(&nv);

                float pixelSize = cv->pixelSize(_dragger->getBound().center(), 0.48f);
                if ( pixelSize!=_draggerSize )
                {
                    float pixelScale = pixelSize>0.0f ? _draggerSize/pixelSize : 1.0f;
                    osg::Vec3d scaleFactor(pixelScale, pixelScale, pixelScale);

                    osg::Vec3 trans = _dragger->getMatrix().getTrans();
                    _dragger->setMatrix( osg::Matrix::scale(scaleFactor) * osg::Matrix::translate(trans) );
                }
            }
        }
        osg::Group::traverse(nv);
    }
예제 #23
0
파일: tbg.cpp 프로젝트: xufango/contrib_bk
void TimeBaseGenerator::setAlpha(double _alpha)
{
	alpha = _alpha;
	scaleFactor();
	//printf("--> Alpha value set to %f\n",alpha);
}
/*!
    \internal
*/
void QDeclarativeGeoMapQuickItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
    if (!mapAndSourceItemSet_ || updatingGeometry_ ||
        newGeometry.topLeft() == oldGeometry.topLeft()) {
        QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry);
        return;
    }

    QGeoCoordinate newCoordinate = map()->itemPositionToCoordinate(QDoubleVector2D(x(), y()) + (scaleFactor() * QDoubleVector2D(anchorPoint_)), false);
    if (newCoordinate.isValid())
        setCoordinate(newCoordinate);

    // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested
    // call to this function.
}
예제 #25
0
파일: tbg.cpp 프로젝트: xufango/contrib_bk
void TimeBaseGenerator::setT_dur(double _T_dur)
{
	T_dur = _T_dur;
	scaleFactor();
	//printf("--> T_dur value set to %4.3f\n",T_dur);
};
예제 #26
0
void PageViewportControllerClientEfl::didResumeContent()
{
    ASSERT(m_controller);
    m_controller->didChangeContentsVisibility(m_contentPosition, scaleFactor());
}
void computeSmearingConstants(TString data, TString nonqcd, TString smeared) {

	//define signal and control regions
	vector<scaleFactor> m_regions;
	/*
	m_regions.push_back(scaleFactor("4jet_meff500_2","4jet_meff500noratio_2_qcdcontrol"));
	m_regions.push_back(scaleFactor("4jet_meff500_2_70","4jet_meff500noratio_2_qcdcontrol_70"));
	m_regions.push_back(scaleFactor("6jet_meff500_2_70","6jet_meff500noratio_2_qcdcontrol_70"));
	m_regions.push_back(scaleFactor("6jet_meff500_2_75","6jet_meff500noratio_2_qcdcontrol_75"));
	
	m_regions.push_back(scaleFactor("4jet_meff500_3","4jet_meff500noratio_3_qcdcontrol"));
	m_regions.push_back(scaleFactor("4jet_meff700_3","4jet_meff500noratio_3_qcdcontrol"));
	m_regions.push_back(scaleFactor("4jet_meff900_3_70","4jet_meff500noratio_3_qcdcontrol_70"));
	m_regions.push_back(scaleFactor("6jet_meff700_3_70","6jet_meff500noratio_3_qcdcontrol_70"));
	m_regions.push_back(scaleFactor("6jet_meff900_3_75","6jet_meff500noratio_3_qcdcontrol_75"));
	*/
	m_regions.push_back(scaleFactor("sr1_mct150","sr1_revertdphi"));
	m_regions.push_back(scaleFactor("sr1_mct200","sr1_revertdphi"));
	m_regions.push_back(scaleFactor("sr1_mct250","sr1_revertdphi"));
	m_regions.push_back(scaleFactor("sr2_50ht2","sr2_revertdphi"));
	m_regions.push_back(scaleFactor("sr3_50ht3","sr3_revertdphi"));
	m_regions.push_back(scaleFactor("sr3_met250_j150","sr3_revertdphi"));
	
	TFile dataf(data,"READ");
	TFile nonqcdf(nonqcd,"READ");
	TFile smearedf(smeared,"READ");
	
	TString prefix("nom/");
	TString suffix("_cutflow");
	
    ofstream afh("scaleFactors_smearing.h");
    if (!afh.is_open()) {
      cout << "ERROR opening scaleFactors_smearing.h" << endl;
      return;
    }

    afh << "map<TString,float> getSmearingSFs() {" << endl;    
    afh << "	map<TString,float> scaleFactors;" << endl;
	
	for(unsigned int i = 0; i< m_regions.size(); ++i) {
		TH1D* datacf = (TH1D*)dataf.Get(prefix+m_regions.at(i).CR()+suffix);
		TH1D* nonqcdcf = (TH1D*)nonqcdf.Get(prefix+m_regions.at(i).CR()+suffix);
		TH1D* smearedcf = (TH1D*)smearedf.Get(prefix+m_regions.at(i).CR()+suffix);
		
		if(!datacf) {
			cout << "Missing histograms for region " << m_regions.at(i).CR() << " in data input file." << endl;
			continue;
		}
		else if(!nonqcdcf) {
			cout << "Missing histograms for region " << m_regions.at(i).CR() << " in nonqcd input file." << endl;
			continue;
		}
		else if(!smearedcf) {
			cout << "Missing histograms for region " << m_regions.at(i).CR() << " in smeared input file." << endl;
			continue;
		}
		
		m_regions.at(i).Data(datacf->GetBinContent(1));
		m_regions.at(i).NonQCD(nonqcdcf->GetBinContent(1));
		m_regions.at(i).Smear(smearedcf->GetBinContent(1));
		
		m_regions.at(i).WriteScaleFactor(afh);
		m_regions.at(i).WriteScaleFactor(cout);
	}
	
	afh << "	return scaleFactors;" << endl;
	afh << "};" << endl;
	afh.close();
	
	dataf.Close();
	nonqcdf.Close();
	smearedf.Close();
}
예제 #28
0
파일: tbg.cpp 프로젝트: xufango/contrib_bk
void TimeBaseGenerator::setT_init(double _T_init)
{
	T_init = _T_init;
	scaleFactor();
	//printf("--> T_init value set to %4.3f\n",T_init);
};
예제 #29
0
 FBCombFilter::FBCombFilter(float initialDelayTime, float maxDelayTime)
 {
   gen()->initialize(initialDelayTime, maxDelayTime);
   delayTime(initialDelayTime);
   scaleFactor(0.5f);
 }
예제 #30
0
파일: tbg.cpp 프로젝트: xufango/contrib_bk
void TimeBaseGenerator::setSlopeRamp(double _SlopeRamp)
{
	SlopeRamp = _SlopeRamp;
	scaleFactor();
	//printf("--> SlopeRamp value set to %4.3f\n",SlopeRamp);
};