Пример #1
0
void histos_phys_noCher(){
    TFile *fIn1 = new TFile("/home/jmbenlloch/next/petalo/work/histo/LXe_VUV3mm_xy2.4cm_z5cm_PHYS_noCher_QE_1_SPTR_0_ASIC_0_DT300_histos.root", "read");
    TFile *fIn2 = new TFile("/home/jmbenlloch/next/petalo/work/histo/LXe_TPB3mm_xy2.4cm_z5cm_PHYS_noCher_QE_1_SPTR_0_ASIC_0_DT300_histos.root", "read");
    TFile *fIn3 = new TFile("/home/jmbenlloch/next/petalo/work/histo/LYSO_VUV3mm_xy2.4cm_z5cm_PHYS_noCher_QE_1_SPTR_0_ASIC_0_DT300_histos.root", "read");

    TH1F *h1 = (TH1F*) fIn1->Get("DTOF.DTOF3");
    TH1F *h2 = (TH1F*) fIn2->Get("DTOF.DTOF2");
    TH1F *h3 = (TH1F*) fIn3->Get("DTOF.DTOF3");

	TF1* gauF1 = new TF1("gauF1","gaus",-100,100);
	TF1* gauF2 = new TF1("gauF2","gaus",-100,100);
	TF1* gauF3 = new TF1("gauF3","gaus",-100,100);

	h1->Scale(1/h1->Integral(), "width");
	h2->Scale(1/h2->Integral(), "width");
	h3->Scale(1/h3->Integral(), "width");

	h1->Fit("gauF1","","e",-100,100);
	h2->Fit("gauF2","","e",-100,100);
	h3->Fit("gauF3","","e",-100,100);

	plot(h1,h2,h3);
	plot_combined(h1,h2,h3);
}
Пример #2
0
US_RunDetails2::US_RunDetails2( const QVector< US_DataIO::RawData >& data, 
                                const QString&                       runID, 
                                const QString&                       dataDir, 
                                const QStringList&                   cell_ch_wl )
   : US_WidgetsDialog( 0, 0 ), dataList( data ), triples( cell_ch_wl )
{
   setWindowTitle( tr( "Details for Raw Data" ) );
   setPalette( US_GuiSettings::frameColor() );

   QGridLayout* main = new QGridLayout( this );
   main->setSpacing        ( 2 );
   main->setContentsMargins( 2, 2, 2, 2 );

   plotType  = TEMPERATURE;
   temp_warn = true;
   int row  = 0;

   // Plot Rows
   QBoxLayout* plot = new US_Plot( data_plot,
        tr( "Parameter Variation Throughout Run" ),
        tr( "Scan Number" ), 
        tr( "RPM * 1000 / Temperature " ) + DEGC );

   data_plot->setMinimumSize( 400, 200 );
   data_plot->enableAxis( QwtPlot::yRight );

   // Copy font for right axis from left axis
   QwtText axisTitle = data_plot->axisTitle( QwtPlot::yLeft );
   axisTitle.setText( tr( "Time between Scans (min)" ) );
   data_plot->setAxisTitle( QwtPlot::yRight, axisTitle );

   QwtPlotGrid* grid = us_grid( data_plot );
   grid->enableXMin( false );

   main->addLayout( plot, row, 0, 5, 6 );
   row += 6;

   // Row
   QLabel* lb_dir = us_label( tr( "Data Directory:" ) );
   main->addWidget( lb_dir, row, 0 );

   QLineEdit* le_dir = us_lineedit();
   le_dir->setReadOnly( true );
   le_dir->setText( dataDir );
   main->addWidget( le_dir, row++, 1, 1, 5 );

   // Row
   QLabel* lb_desc = us_label( tr( "Description:" ) );
   main->addWidget( lb_desc, row, 0 );

   le_desc = us_lineedit();
   le_desc->setReadOnly( true );
   le_desc->setText( dataDir );
   main->addWidget( le_desc, row++, 1, 1, 5 );

   // Row
   QLabel* lb_runID = us_label( tr( "Run Identification:" ) );
   main->addWidget( lb_runID, row, 0 );

   lw_rpm = us_listwidget();
   lw_rpm->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
   lw_rpm->setMinimumSize( 100, 50 );
   main->addWidget( lw_rpm, row, 2, 5, 2 );

   lw_triples = us_listwidget();
   lw_triples->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
   lw_triples->setMinimumSize( 100, 50 );
   main->addWidget( lw_triples, row, 4, 5, 2 );

   le_runID = us_lineedit();
   le_runID->setReadOnly( true );
   le_runID->setText( runID );
   main->addWidget( le_runID, row++, 1 );

   // Row
   QLabel* lb_runLen = us_label( tr( "Length of Run:" ) );
   main->addWidget( lb_runLen, row, 0 );

   le_runLen = us_lineedit();
   le_runLen->setReadOnly( true );
   main->addWidget( le_runLen, row++, 1 );

   // Row
   QLabel* lb_timeCorr = us_label( tr( "Time Correction:" ) );
   main->addWidget( lb_timeCorr, row, 0 );

   le_timeCorr = us_lineedit();
   le_timeCorr->setReadOnly( true );
   main->addWidget( le_timeCorr, row++, 1 );

   // Row
   QLabel* lb_rotorSpeed = us_label( tr( "Avg. Rotor Speed:" ) );
   main->addWidget( lb_rotorSpeed, row, 0 );

   le_rotorSpeed = us_lineedit();
   le_rotorSpeed->setReadOnly( true );
   main->addWidget( le_rotorSpeed, row++, 1 );

   // Row
   QLabel* lb_avgTemp = us_label( tr( "Avg. Temperature:" ) );
   main->addWidget( lb_avgTemp, row, 0 );

   le_avgTemp = us_lineedit();
   le_avgTemp->setReadOnly( true );
   main->addWidget( le_avgTemp, row++, 1 );

   // Row
   QLabel* lb_tempCheck = us_label( tr( "Temperature Check:" ) );
   main->addWidget( lb_tempCheck, row, 0 );

   QHBoxLayout* box1 = new QHBoxLayout;
   box1->setAlignment( Qt::AlignCenter );

   QHBoxLayout* box2 = new QHBoxLayout;
   box2->setAlignment( Qt::AlignCenter );
   box2->setSpacing( 10 );

   lb_green = new QLabel();
   lb_green->setFixedSize(20, 16);
   lb_green->setPalette( QPalette( QColor( 0, 0x44, 0 ) ) ); // Dark Green
   lb_green->setAutoFillBackground( true );
   lb_green->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

   lb_red   = new QLabel();
   lb_red->setFixedSize(20, 16);
   lb_red->setPalette( QPalette( QColor( 0x55, 0, 0 ) ) ); // Dark Red
   lb_red->setAutoFillBackground( true );
   lb_red->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

   box2->addWidget( lb_green );
   box2->addWidget( lb_red );
   box1->addLayout( box2 );

   main->addLayout( box1, row, 1 );

   QHBoxLayout* buttons = new QHBoxLayout();

   QPushButton* pb_temp = us_pushbutton( tr( "Temperature" ) );
   connect( pb_temp, SIGNAL( clicked() ), SLOT( plot_temp() ) );
   buttons->addWidget( pb_temp );

   QPushButton* pb_rpm = us_pushbutton( tr( "RPM" ) );
   connect( pb_rpm, SIGNAL( clicked() ), SLOT( plot_rpm() ) );
   buttons->addWidget( pb_rpm );

   QPushButton* pb_interval = us_pushbutton( tr( "Interval" ) );
   connect( pb_interval, SIGNAL( clicked() ), SLOT( plot_interval() ) );
   buttons->addWidget( pb_interval );

   QPushButton* pb_all = us_pushbutton( tr( "Combined" ) );
   connect( pb_all, SIGNAL( clicked() ), SLOT( plot_combined() ) );
   buttons->addWidget( pb_all );

   QPushButton* pb_close = us_pushbutton( tr( "Close" ) );
   connect( pb_close, SIGNAL( clicked() ), SLOT( close() ) );
   buttons->addWidget( pb_close );

   main->addLayout( buttons, row++, 2, 1, 4 );

   timer = new QTimer();
   connect( timer, SIGNAL( timeout() ), SLOT( update_timer() ) );

   setup();
   connect( lw_triples, SIGNAL( currentRowChanged( int ) ),
                        SLOT  ( update           ( int ) ) );

   connect( lw_rpm,     SIGNAL( itemClicked     ( QListWidgetItem* ) ),
            this,       SLOT  ( show_rpm_details( QListWidgetItem* ) ) );
}