Пример #1
0
SBoundaryDialog::SBoundaryDialog(int wall, QString maxA, QString maxB) {
  ui.setupUi(this);

  setLabels(wall);
	ui.maxA->setText("of " + maxA);
	ui.maxB->setText("of " + maxB);
}
Пример #2
0
void PolarChartLogValueAxisRadial::createAxisLabels(const QVector<qreal> &layout)
{
    QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
    setLabels(createLogValueLabels(logValueAxis->min(),
                                   logValueAxis->max(),
                                   logValueAxis->base(),
                                   layout.size(),
                                   logValueAxis->labelFormat()));
}
Пример #3
0
  /**
   * Creates and brings up the dialog box which allows the user to
   * re-label the plot various labes.
   * 
   */
  void ScatterPlotWindow::reLabel() {
    QDialog *dialog = new QDialog(p_scatterPlotWindow);
    dialog->setWindowTitle("Name Plot Labels");

    QWidget *buttons = new QWidget (dialog);
    QWidget *textAreas = new QWidget (dialog);
    QWidget *labels = new QWidget (dialog);
    QWidget *main = new QWidget (dialog);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(main,0);
    layout->addWidget(buttons,0);
    dialog->setLayout(layout);

    QToolButton *okButton = new QToolButton(dialog);
    connect(okButton,SIGNAL(released()),this,SLOT(setLabels()));
    connect(okButton,SIGNAL(released()),dialog,SLOT(hide()));
    okButton->setShortcut(Qt::Key_Enter);
    okButton->setText("Ok");

    QToolButton *cancelButton = new QToolButton(dialog);
    connect(cancelButton,SIGNAL(released()),dialog,SLOT(hide()));
    cancelButton->setText("Cancel");

    QLabel *plotLabel = new QLabel("Plot Title: ");
    QLabel *xAxisLabel = new QLabel("X-Axis Label: ");
    QLabel *yAxisLabel = new QLabel("Y-Axis Label: ");

    QVBoxLayout *vlayout = new QVBoxLayout();
    vlayout->addWidget(plotLabel);
    vlayout->addWidget(xAxisLabel);
    vlayout->addWidget(yAxisLabel);    
    labels->setLayout(vlayout);

    p_plotTitleText = new QLineEdit(p_plot->title().text(),dialog);
    p_xAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::xBottom).text(),dialog);
    p_yAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::yLeft).text(),dialog);

    QVBoxLayout *v2layout = new QVBoxLayout();
    v2layout->addWidget(p_plotTitleText);
    v2layout->addWidget(p_xAxisText);
    v2layout->addWidget(p_yAxisText);
    textAreas->setLayout(v2layout);

    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->addWidget(labels);
    mainLayout->addWidget(textAreas);
    main->setLayout(mainLayout);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->addWidget(okButton);
    hlayout->addWidget(cancelButton);
    buttons->setLayout(hlayout);

    dialog->setFixedSize(400,190);
    dialog->show();
  }
Пример #4
0
void LabelingModel::setLabels(const cv::Mat1s &labeling)
{
	assert(labeling.size == labels.size);
	// create vole labeling object (build colors) and
	// note: this iterates over the whole label matrix without concurrency.
	// OPTIMIZE
	Labeling vl(labeling, false);
	setLabels(vl, false);
}
Пример #5
0
void CommandPanel::setCommandOptions(const CommandOptions& options)
{
   options_ = options;
   //
   pressedIndex_ = -1;
   highlightedIndex_ = -1;
   //
   setLabels();
}
Пример #6
0
void Graph::init() {
    cleardevice();
    setcolor(CYAN);
    setlinestyle(0, 0, 2);
    drawline(0, 0, 500, 0);
    drawline(0, 0, 0, 400);
    setcolor(WHITE);
    setLabels(x_label, y_label);
}
Пример #7
0
BaffleDialog::BaffleDialog(int wall,
				QString maxA, QString maxB, QString maxPos) {
  ui.setupUi(this);

  setLabels(wall);
  
	ui.maxA->setText("of " + maxA);
	ui.maxB->setText("of " + maxB);
	ui.maxPos->setText("of " + maxPos);
}
Пример #8
0
void LabelingModel::consolidate()
{
	/* create new labeling that will search for all set labels
	 * it only does this if it gets rgb input
	 * TODO: write a real consolidate function in core/labeling class!
	 */
	Labeling newfull(full_labels);
	newfull.consolidate();
	// get rid of old colors
	//newfull.setColors(Labeling::colors(newfull.colors().size(), true));
	// set it
	setLabels(newfull, true);
}
TouchScreenForm::TouchScreenForm(char *title){
    _controller = &TSC;
    setTitleSpacing(2);
    setTitlePadding(5);
    setTitleFontSize(2);
    setTitle(title);
    setTitleColors(0xffff, 0x001f);
    setClearScreenOnDraw(false);
    setLabels(NULL);
    setButtons(NULL);
    setCircleButtons(NULL);
    setArrowButtons(NULL);
    setSliders(NULL);
}
TouchScreenForm::TouchScreenForm(char *title, unsigned int titleForeColor, unsigned int titleBackColor, unsigned int titleFontSize){
    _controller = &TSC;
    setTitleSpacing(2);
    setTitlePadding(5);
    setTitleFontSize(titleFontSize);
    setTitle(title);
    setTitleColors(titleForeColor, titleBackColor);
    setClearScreenOnDraw(false);
    setLabels(NULL);
    setButtons(NULL);
    setCircleButtons(NULL);
    setArrowButtons(NULL);
    setSliders(NULL);
}
Пример #11
0
void ScoreWindow::waitForEvent()
{
  exitPressed = false;
  XFlush(dpy);
  setLabels();

  map();
  XRaiseWindow(dpy, window());

  XEvent ev;
  while (mapped() && !exitPressed) {
    NSNextEvent(&ev);
    NSDispatchEvent(ev);
  }
  this->hide();
}
Пример #12
0
SBoundaryDialog::SBoundaryDialog(QString type, int wall, long int extentA1, long int extentA2, long int extentB1, long int extentB2, double value, double turbulence, QString maxA, QString maxB) {
  ui.setupUi(this);

  ui.extentA1->setPlainText(QString::number(extentA1));
  ui.extentA2->setPlainText(QString::number(extentA2));
  ui.extentB1->setPlainText(QString::number(extentB1));
  ui.extentB2->setPlainText(QString::number(extentB2));
 
  ui.value->setPlainText(QString::number(value));
  ui.turbulence->setPlainText(QString::number(turbulence));

	ui.select->setCurrentIndex(ui.select->findText(type));

  setLabels(wall);
	ui.maxA->setText("of " + maxA);
	ui.maxB->setText("of " + maxB);
}
Пример #13
0
void LabelingModel::loadLabeling(const QString &filename)
{
	GerbilIO io(nullptr, "Labeling From Image File", "labeling image");
	io.setFileCategory("LabelFile");
	io.setFileSuffix(".png");
	/* we are properly initialized with the image dimensions
	 * so we take these frome our initialization */
	io.setWidth(full_labels.cols);
	io.setHeight(full_labels.rows);
	io.setFileName(filename);
	cv::Mat input = io.readImage();
	if (input.empty())
		return;

	Labeling labeling(input, false);
	setLabels(labeling, true);
}
Пример #14
0
BaffleDialog::BaffleDialog(QString type, int wall, long int extentA1, long int extentA2, 
				long int extentB1, long int extentB2, double value, long int pos,
				QString maxA, QString maxB, QString maxPos) {
  ui.setupUi(this);

  ui.extentA1->setPlainText(QString::number(extentA1));
  ui.extentA2->setPlainText(QString::number(extentA2));
  ui.extentB1->setPlainText(QString::number(extentB1));
  ui.extentB2->setPlainText(QString::number(extentB2));
 
  ui.value->setPlainText(QString::number(value));
  ui.pos->setPlainText(QString::number(pos));

	ui.select->setCurrentIndex(ui.select->findText(type));
	
	ui.maxA->setText("of " + maxA);
	ui.maxB->setText("of " + maxB);
	ui.maxPos->setText("of " + maxPos);

  setLabels(wall);
}
Пример #15
0
Файл: main.c Проект: bigzed/uGFX
int main(void) {
	GEvent *			pe;

	// Initialize the display
	gfxInit();

	// Set the widget defaults
	font = gdispOpenFont("*");			// Get the first defined font.
	gwinSetDefaultFont(font);
	gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
	gdispClear(White);

	// Create the gwin windows/widgets
	createWidgets();

    // Assign toggles and dials to specific buttons & sliders etc.
	#if GINPUT_NEED_TOGGLE
		gwinAttachToggle(ghButton1, 0, 0);
		gwinAttachToggle(ghButton2, 0, 1);
	#endif
	#if GINPUT_NEED_DIAL
		gwinAttachDial(ghSlider1, 0, 0);
		gwinAttachDial(ghSlider3, 0, 1);
	#endif

	// Make the console visible
	gwinShow(ghConsole);
	gwinClear(ghConsole);

    // We want to listen for widget events
	geventListenerInit(&gl);
	gwinAttachListener(&gl);
	gtimerInit(&FlashTimer);

	#if !GWIN_NEED_TABSET
		// Press the Tab we want visible
		gwinRadioPress(ghTabButtons);
	#endif

	while(1) {
		// Get an Event
		pe = geventEventWait(&gl, TIME_INFINITE);

		switch(pe->type) {
		case GEVENT_GWIN_BUTTON:
			gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->gwin));
			break;

		case GEVENT_GWIN_SLIDER:
			gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->gwin), ((GEventGWinSlider *)pe)->position);
			break;

		case GEVENT_GWIN_CHECKBOX:
			gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->gwin), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked");

			// If it is the Disable All checkbox then do that.
			if (((GEventGWinCheckbox *)pe)->gwin == ghCheckDisableAll) {
				gwinPrintf(ghConsole, "%s All\n", ((GEventGWinCheckbox *)pe)->isChecked ? "Disable" : "Enable");
				setEnabled(!((GEventGWinCheckbox *)pe)->isChecked);

			// If it is the toggle button checkbox start the flash.
			} else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) {
				gwinFlash(ghCheckbox3);
				gtimerStart(&FlashTimer, FlashOffFn, 0, FALSE, 3000);
			}
			break;

		case GEVENT_GWIN_LIST:
			gwinPrintf(ghConsole, "List %s Item %d %s\n", gwinGetText(((GEventGWinList *)pe)->gwin), ((GEventGWinList *)pe)->item,
					gwinListItemIsSelected(((GEventGWinList *)pe)->gwin, ((GEventGWinList *)pe)->item) ? "Selected" : "Unselected");
			break;

		case GEVENT_GWIN_RADIO:
			gwinPrintf(ghConsole, "Radio Group %u=%s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->gwin));

			switch(((GEventGWinRadio *)pe)->group) {
			#if !GWIN_NEED_TABSET
				case GROUP_TABS:

					// Set control visibility depending on the tab selected
					setTab(((GEventGWinRadio *)pe)->gwin);

					// We show the state of some of the GUI elements here
					setProgressbar(((GEventGWinRadio *)pe)->gwin == ghTabProgressbar);
					if (((GEventGWinRadio *)pe)->gwin == ghTabLabels)
						setLabels();
					break;
			#endif

			case GROUP_COLORS:
				{
					const GWidgetStyle	*pstyle;

					gwinPrintf(ghConsole, "Change Color Scheme\n");

					if (((GEventGWinRadio *)pe)->gwin == ghRadioYellow)
						pstyle = &YellowWidgetStyle;
					else if (((GEventGWinRadio *)pe)->gwin == ghRadioBlack)
						pstyle = &BlackWidgetStyle;
					else
						pstyle = &WhiteWidgetStyle;

					// Clear the screen to the new color
					gdispClear(pstyle->background);

					// Update the style on all controls
					gwinSetDefaultStyle(pstyle, TRUE);
				}
				break;
			}
			break;

		#if GWIN_NEED_TABSET
			case GEVENT_GWIN_TABSET:
				gwinPrintf(ghConsole, "TabPage %u (%s)\n", ((GEventGWinTabset *)pe)->nPage, gwinTabsetGetTitle(((GEventGWinTabset *)pe)->ghPage));

				// We show the state of some of the GUI elements here
				setProgressbar(((GEventGWinTabset *)pe)->ghPage == ghPgProgressbars);
				if (((GEventGWinTabset *)pe)->ghPage == ghPgLabels)
					setLabels();
				break;
		#endif

		default:
			gwinPrintf(ghConsole, "Unknown %d\n", pe->type);
			break;
		}
	}
	return 0;
}
Пример #16
0
SwitchButton::SwitchButton(QWidget* parent) : QPushButton(parent) {
    setCheckable(true);
    // Set default colors and labels
    setColors();
    setLabels();
}
Пример #17
0
void ImageClassifier::loadAttributes() {
	NeuralNetwork::loadAttributes();
	setLabels(getStringListAttribute("labels"));
}
Пример #18
0
QString FileLocationInfo::label(FileType fileType) {
    if (labels.isEmpty())
        setLabels();
    return labels[fileType];
}
Пример #19
0
void ChartCategoryAxisX::updateGeometry()
{
    setLabels(m_axis->categoriesLabels() << QString());
    HorizontalAxis::updateGeometry();
}
Пример #20
0
void PanelResourceInfo::update(const GUI::ResourceTreeItem *item) {
	setLabels(item);
	showExportButtons(item);
}
Пример #21
0
MeasuringReceiver::MeasuringReceiver(Device *devicePtr,
                                     double initialCenter,
                                     QWidget *parent) :
    QDialog(parent),
    device(devicePtr),
    running(true),
    reinitialize(true),
    recalibrate(true)
{
    setWindowTitle("Measuring Receiver");
    setObjectName("SH_Page");
    setFixedWidth(400);

    QPoint pos(0, 0); // For positioning widgets

    Label *title = new Label("Synchronous Level Detector", this);
    title->move(QPoint(5, pos.y()));
    title->resize(width(), WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT+5);
    freqEntry = new FrequencyEntry("Center Freq", initialCenter, this);
    freqEntry->move(pos);
    freqEntry->resize(width() * 0.75, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT+5);

    Label *ampRangeLabel = new Label("Amplitude Range", this);
    ampRangeLabel->move(QPoint(5, pos.y()));
    ampRangeLabel->resize(width(), WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    ampGroup = new QButtonGroup(this);
    QRadioButton *highAmp = new QRadioButton("High Power Range", this),
            *midAmp = new QRadioButton("Mid Power Range", this),
            *lowAmp = new QRadioButton("Low Power Range", this);

    highAmp->move(pos);
    highAmp->resize(width()/2, WIDGET_HEIGHT);
    highAmp->setObjectName("SHPrefRadioButton");
    highAmp->setChecked(true);
    ampGroup->addButton(highAmp, MeasRcvrRangeHigh);

    highLabel = new Label("", this);
    highLabel->move(QPoint(width()/2, pos.y()));
    highLabel->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    midAmp->move(pos);
    midAmp->resize(width()/2, WIDGET_HEIGHT);
    midAmp->setObjectName("SHPrefRadioButton");
    ampGroup->addButton(midAmp, MeasRcvrRangeMid);

    midLabel = new Label("", this);
    midLabel->move(QPoint(width()/2, pos.y()));
    midLabel->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    lowAmp->move(pos);
    lowAmp->resize(width()/2, WIDGET_HEIGHT);
    lowAmp->setObjectName("SHPrefRadioButton");
    ampGroup->addButton(lowAmp, MeasRcvrRangeLow);

    lowLabel = new Label("", this);
    lowLabel->move(QPoint(width()/2, pos.y()));
    lowLabel->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT+5);

    Label *centerLabel = new Label("RF Frequency", this);
    centerLabel->move(QPoint(5, pos.y()));
    centerLabel->resize(width()/2, WIDGET_HEIGHT);
    centerReadout = new Label("915.11002 MHz", this);
    centerReadout->move(QPoint(width()/2 + 5, pos.y()));
    centerReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    Label *powerLabel = new Label("RF Power", this);
    powerLabel->move(QPoint(5, pos.y()));
    powerLabel->resize(width()/2, WIDGET_HEIGHT);
    powerReadout = new Label("-32.22 dBm", this);
    powerReadout->move(QPoint(width()/2 + 5, pos.y()));
    powerReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    Label *relativeLabel = new Label("Relative Power", this);
    relativeLabel->move(QPoint(5, pos.y()));
    relativeLabel->resize(width()/2, WIDGET_HEIGHT);
    relativeReadout = new Label("-5.002 dB", this);
    relativeReadout->move(QPoint(width()/2 + 5, pos.y()));
    relativeReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    Label *averageLabel = new Label("Average Relative Power", this);
    averageLabel->move(QPoint(5, pos.y()));
    averageLabel->resize(width()/2, WIDGET_HEIGHT);
    averageReadout = new Label("-4.998 dB", this);
    averageReadout->move(QPoint(width()/2 + 5, pos.y()));
    averageReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT*1.5);

    SHPushButton *sync = new SHPushButton("Sync", this);
    sync->move(QPoint(5, pos.y()));
    sync->resize(width()/2 - 10, WIDGET_HEIGHT);
    //pos += QPoint(0, WIDGET_HEIGHT);

    SHPushButton *done = new SHPushButton("Done", this);
    done->move(QPoint(width()/2 + 5, pos.y()));
    done->resize(width()/2 - 10, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT*2);

    setFixedHeight(pos.y());
    setSizeGripEnabled(false);

    connect(sync, SIGNAL(clicked()), this, SLOT(triggerReinitialize()));
    connect(done, SIGNAL(clicked()), this, SLOT(accept()));

    connect(freqEntry, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(triggerReinitialize()));

    connect(this, SIGNAL(updateLabels(QString,QString,QString,QString)),
            this, SLOT(setLabels(QString,QString,QString,QString)));
    connect(this, SIGNAL(updateRangeLevelText(QString, int)),
            this, SLOT(setRangeLevelText(QString, int)));
    connect(this, SIGNAL(updateRangeLevelText(int,QString,int)),
            this, SLOT(setRangeLevelText(int,QString,int)));
    connect(this, SIGNAL(updateRangeEnabled(int)),
            this, SLOT(setRangeEnabled(int)));
    connect(this, SIGNAL(updateEntryEnabled(bool)),
            this, SLOT(setEntryEnabled(bool)));

    connect(ampGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(triggerRecalibration()));

    threadHandle = std::thread(&MeasuringReceiver::ProcessThread, this);
}
Пример #22
0
void PolarChartValueAxisAngular::createAxisLabels(const QVector<qreal> &layout)
{
    QStringList labelList = createValueLabels(min(), max(), layout.size(), static_cast<QValueAxis *>(axis())->labelFormat());
    setLabels(labelList);
}
Пример #23
0
void toResultLine::poll(void)
{
    try
    {
        toQColumnDescriptionList desc;
        if (!Columns)
        {
            desc = Query->describe();
            Columns = desc.size();
        }

        if (First)
        {
            if (desc.empty())
                desc = Query->describe();
            clear();
            std::list<QString> labels;
            for (toQColumnDescriptionList::iterator i = desc.begin(); i != desc.end(); i++)
                if (i != desc.begin())
                    labels.insert(labels.end(), (*i).Name);
            setLabels(labels);
        }

        while (Query->hasMore())
        {
            unsigned int num = 0;
            QString lab = (QString)Query->readValue();
            num++;
            std::list<double> vals;
            while (!Query->eof() && num < Columns)
            {
                vals.insert(vals.end(), Query->readValue().toDouble());
                num++;
            }

            if (Flow)
            {
                time_t now = time(NULL);
                if (now != LastStamp)
                {
                    if (LastValues.size() > 0)
                    {
                        std::list<double> dispVal;
                        std::list<double>::iterator i = vals.begin();
                        std::list<double>::iterator j = LastValues.begin();
                        while (i != vals.end() && j != LastValues.end())
                        {
                            dispVal.insert(dispVal.end(), (*i - *j) / (now - LastStamp));
                            i++;
                            j++;
                        }
                        std::list<double> tmp = transform(dispVal);
                        addValues(tmp, lab);
                    }
                    LastValues = vals;
                    LastStamp = now;
                }
            }
            else
            {
                std::list<double> tmp = transform(vals);
                addValues(tmp, lab);
            }
        }
    }
    catch (const QString &exc)
    {
        delete Query;
        Query = NULL;
        Utils::toStatusMessage(exc);
    }
}
Пример #24
0
void finalPlotsPt(int type,bool skip3rd=false){
  //-----
  //TString inputFolderName="./setupZ3/";
  //TString outputFolderName="./finalPlotsZ3/";  

  TString xLabel;
  TString yLabel;
  TString yLabelResp;
  TString yLabelErr;
  
  double lRange,hRange;

  TString text1a,text1b,leg1a,leg1b;
  TString text2a,text2b,leg2a,leg2b;

  setLabels(type,
	    xLabel,yLabel,yLabelResp,yLabelErr,
	    text1a,text1b,leg1a,leg1b,
	    text2a,text2b,leg2a,leg2b,
	    lRange,hRange);

  //setStyle();
  //----
  stringstream stream;  stream << type;
  TString counter = stream.str();


  //TString fileName1="./finalPlotsR27th/histos"+counter+".root";
  TString fileName1="./finalPlotsR27thSol6/histos"+counter+".root";
  //TString fileName1="./finalPlotsR27thSol7/histos"+counter+".root";

  TString outputName1="final_type"+counter+".pdf";
  TString outputName2="final_type"+counter+".png";
  TString outputName3="final_type"+counter+".eps";

  TFile* f1 = new TFile(fileName1);
  TH1F* hData1 = (TH1F*) f1->Get("plotDataFit");
  TH1F* hSim1  = (TH1F*) f1->Get("plotSimFit");
  //TH1F* hMC1   = (TH1F*) f1->Get("plotReso");


  //------
  TCanvas* canvas1 = new TCanvas("canvas1","canvas1",0,0,500,500);
  canvas1->cd();
  if(type==5) canvas1->SetLogy(1);

  hData1->SetMaximum(hRange);
  hData1->SetMinimum(lRange);

  hSim1->SetMaximum(hRange);
  hSim1->SetMinimum(lRange);

  //MarkersSyle:
  //20,21,22: bullet,square,triangle
  //24,25,26: as above, but empty symbols
  
  //Colors:
  //1,2: black, red


  hData1->SetMarkerStyle(20); hData1->SetMarkerColor(1); hData1->SetMarkerSize(1.5);
  hSim1->SetMarkerStyle(20);  hSim1->SetMarkerColor(2);  hSim1->SetMarkerSize(1.5);

  //setStyle();
  hSim1->SetYTitle(yLabel);
  hSim1->SetXTitle(xLabel);

  gStyle->SetErrorX(0.5);

  /*
  //TF1* finalFit = new TF1("finalFit","sqrt( ([0]/x)*([0]/x)+[1]*[1])",1.0,10);
  TF1* finalFit = new TF1("finalFit","[0]/x + [1]");
  finalFit->SetParameter(0,6);
  finalFit->SetParameter(1,20);
  finalFit->SetParName(0,"MultipleScattering term");
  finalFit->SetParName(1,"SinglePointResolution term");
  finalFit->SetLineColor(4);
  finalFit->SetLineWidth(2.5);
  finalFit->SetLineStyle(1);


  //hSim1->Fit("finalFit","","",1.0,10);
  //hData1->Fit("finalFit","","",1.0,10);


  double sA,sB,dA,dB;
  double sAErr,sBErr,dAErr,dBErr;

  hSim1->Fit("finalFit","N");
  sA = finalFit->GetParameter(0);
  sB = finalFit->GetParameter(1);

  hData1->Fit("finalFit");
  dA = finalFit->GetParameter(0);
  dB = finalFit->GetParameter(1);
  dAErr = finalFit->GetParError(0);
  dBErr = finalFit->GetParError(1);


  cout << "sA,sB: " << setiosflags(ios::fixed) << setprecision(1) << sA << " , " << sB << endl;
  cout << "dA,dB: " << setiosflags(ios::fixed) << setprecision(1) << dA << " , " << dB << endl;
  cout << "chi2/NDF: " << finalFit->GetChisquare()/finalFit->GetNDF() << endl;

  TString leb,den;
  if(type==1 || type==4) {
    if(type==1)
      leb="d_{0}";
    else
      leb="d_{0}";
    den="p_{T}";
  }
  if(type==7 || type==8) {
    if(type==7)
      leb="d_{0}";
    else
      leb="d_{Z}";
    den="p";  
  }

  stringstream stream2;  
  stream2 << "For Data, #sigma_{" << leb << "} = #left(#frac{" << setiosflags(ios::fixed) << setprecision(1) << dA <<" #pm " 
	  << dAErr << "}{"
	  << den << "}"<< " + (" << dB << " #pm " << dBErr << ") #right) #mum";
  cout << stream2.str() << endl;

  stringstream stream3;  
  stream3 << "Sim., #sigma(" << leb << ") = #frac{(" << setiosflags(ios::fixed) << setprecision(1) << sA << den << sB << ") #mum";
  cout << stream3.str() << endl;
  */

  TLegend* leg   = new TLegend(0.25,0.55,0.85,0.70);
  leg->AddEntry(hData1,"Data         track | #eta | < 0.4","p");
  leg->AddEntry(hSim1, "Simulation   track | #eta | < 0.4","p");

  leg->SetFillColor(0);
  leg->SetLineColor(0);
  leg->SetShadowColor(0);
  leg->SetTextSize(0.04);
  leg->SetTextAlign(32);
  
  hSim1->Draw("E1");
  hData1->Draw("sameE1");
  leg->Draw();

  /*
  TLatex latex;
  latex.SetNDC();
  latex.SetTextSize(0.03);
  latex.DrawLatex(0.35,0.60,stream2.str().c_str());
  */

  cmsPrel(0);

  gPad->Update();
  gPad->Print(outputName1);
  gPad->Print(outputName2);
  gPad->Print(outputName3);
}