diff --git a/Headers/MainWindow.h b/Headers/MainWindow.h
index 842e9dfa00caabb82b065d848dd96ea6f3fa71d7..7dc1f617c476a1e06d266d536c1f51b55491d196 100644
--- a/Headers/MainWindow.h
+++ b/Headers/MainWindow.h
@@ -44,6 +44,8 @@ private:
 
     bool doubleEqual(const double& a, const double & b, const double epsilon=0.0001);
     void setupMapping();
+
+    bool imageSpacechaged=false;
 protected:
 
 private slots:
@@ -88,6 +90,13 @@ private slots:
     void onErgCutLowInput();
     void onErgCutHighInput();
 
+    void onPairErgBinsInput();
+    void onPairErgMinInput();
+    void onPairErgMaxInput();
+
+    void onLGHGBinBox(const QString text);
+
+    void onCoinOnStatChanged();
     void onTimeWindowInput();
 
     void onStatChanged(int id);
diff --git a/Headers/plotdata.h b/Headers/plotdata.h
index 30af76ad8c67cf8d2e880306250d389ebab68d31..126614b1b7675d4437d10572804a8a7eed6b1655 100644
--- a/Headers/plotdata.h
+++ b/Headers/plotdata.h
@@ -27,6 +27,12 @@ public:
     bool saveImage2txt(const std::string& fileName);
     bool saveSpectrum2txt(const std::string& fileName);
 
+    void drawPairSpectrum(const int& pair);
+    void clearPairSpectra();
+    void unZoomPairSpectrum(const int& pair);
+    bool savePairSpectrum2txt(const std::string&fileName, const int& pair);
+    void rebinPairSpectra();
+    void updatePairSpectra(const std::vector<MyPulse>& pulses);
 
     void clearLGSpectrum(const int& asic, const int& channel);
     void clearHGSpectrum(const int& asic, const int& channel);
@@ -36,11 +42,12 @@ public:
     void drawHGspectrum(const int& asic, const int& channel);
     void unZoomLG(const int& asic, const int& channel);
     void unZoomHG(const int& asic, const int& channel);
+    void clearLGHG();
     void rebinLGSpectra();
     void rebinHGSpectra();
 
-    void updateLGSpectra(const int asic, const u_short* chargeLG);
-    void updateHGSpectra(const int asic, const u_short* chargeHG);
+    void updateLGSpectra(const int asic, const u_short (&chargeLG)[32]);
+    void updateHGSpectra(const int asic, const u_short (&chargeHG)[32]);
 
     /**
      * @brief add cones to current image and update.
@@ -81,7 +88,9 @@ private:
     bool spectrum2txt(const TH1D* spectrum, const std::string& fileName);
     std::vector<std::vector<double>> probDist;
 
-    // LG
+    // Pair spectra
+    std::vector<TH1D*> pairSpectra;
+    // LG/HG
     std::vector<TH1D*> LGSpectra;
     std::vector<TH1D*> HGSpectra;
     /**
diff --git a/Headers/plotwindow.h b/Headers/plotwindow.h
index dbe26993b833e07e23e5c50c69d9b9044fcc7668..258a5b58299b3e90f39be96d98c157bf024cd4c9 100644
--- a/Headers/plotwindow.h
+++ b/Headers/plotwindow.h
@@ -24,8 +24,11 @@ private:
     int LGChannelID = 0;
     int HGAsicID = 0;
     int HGChannelID = 0;
+    int pairID = 0;
+    QString source="LG";
 
     void switchLGHG(int id);
+    void switchPair(int id);
 public:
      QPlotWindow(QWidget *parent, const Setup* config_, PlotData* plotdata_);
     ~QPlotWindow();
@@ -51,6 +54,9 @@ public slots:
 
     void handleAsicChanged(int id);
     void handleChannelChanged(int id);
+
+    void handleSourceChanged(int id);
+    void handlePairChanged(int id);
 };
 
 #endif // PLOTWINDOW_H
diff --git a/Headers/qcustomcanvas.h b/Headers/qcustomcanvas.h
index 7cdc8d445ba4315422abb57bc4da34504d13cb59..bf092d0ba971307c4f902b39fac135a56d11394a 100644
--- a/Headers/qcustomcanvas.h
+++ b/Headers/qcustomcanvas.h
@@ -25,7 +25,11 @@ public:
     int getID();
     int getAsicID();
     int getChannelID();
+    int getPairID();
+    QString getSource();
 
+    void hidePairBox();
+    void hideLGHGBoxes();
     void hideBoxes();
 signals:
     void canvasCleared(int id_);
@@ -35,6 +39,8 @@ signals:
 
     void asicChanged(int id_);
     void channelChanged(int id_);
+    void pairChanged(int id_);
+    void sourceChanged(int id_);
 //    void canvasFree
 public slots:
     void handleSave2Txt();
@@ -44,6 +50,8 @@ public slots:
     void handleScreenshot();
     void handleAsicBox();
     void handleChannelBox();
+    void handlePairBox();
+    void handleSourceBox();
 };
 
 #endif // QCUSTOMCANVAS_H
diff --git a/Headers/setup.h b/Headers/setup.h
index f657dffc1369590e8e4f127971ac90b6e2ba77f6..abc1f535012f2322e8167ba8620ff7402a85f6bc 100644
--- a/Headers/setup.h
+++ b/Headers/setup.h
@@ -145,22 +145,21 @@ public:
     int phiBins;
     double phiMin;
     double phiMax;
-    bool imageSpacechaged=false;
 
     // energy spectrum
     int ergBins;
     double ergMin;
     double ergMax;
 
-    // LG spectrum
-    int LGErgBins=2048;
-    double LGErgMin=0;
-    double LGErgMax = 2048;
+    // LG/HG spectrum
+    int LGHGErgBins=2048;
+//    double LGHGErgMin=0;
+//    double LGHGErgMax = 2048;
 
-    // HG Spectrum
-    int HGErgBins=2048;
-    double HGErgMin=0;
-    double HGErgMax = 2048;
+    // pair spectrum
+    int pairErgBins=100;
+    double pairErgMin=0;
+    double pairErgMax=1000;
 
     // Rejections
     bool energyCut;
@@ -168,6 +167,7 @@ public:
     double energyUp;
 
     // coincidence
+    bool coincidenceEnabled;
     double timeWindow; // ns
 
     // data saving options
@@ -231,4 +231,33 @@ public:
     }
 };
 
+
+class MyPulse
+{
+public:
+    ulong histNo=0; // history number
+    double timeStamp=0; // time stamp, ns
+    double height=0; // pulse amplitude, MeV
+    int cellNo=0; // cell number
+    Vector3D pos; // position, cm
+    MyPulse() {}
+    MyPulse(std::string record) {
+        timeStamp = std::stod(record.substr(0, 24));
+        height = std::stod(record.substr(27, 10));
+        pos = Vector3D(std::stod(record.substr(39, 6)),
+                       std::stod(record.substr(47, 6)),
+                       std::stod(record.substr(55, 6)));
+        cellNo = std::stoi(record.substr(68, 6));
+        histNo = std::stoi(record.substr(77, 10));
+    }
+    MyPulse(const QString record) {
+        timeStamp = record.mid(0, 24).toDouble();
+        height = record.mid(27, 10).toDouble();
+        pos = Vector3D(record.mid(39, 6).toDouble(),
+                       record.mid(47, 6).toDouble(),
+                       record.mid(55, 6).toDouble());
+        cellNo = record.mid(68, 6).toInt();
+        histNo = record.mid(77, 10).toULong();
+    }
+};
 #endif // SETUP_H
diff --git a/Headers/worker.h b/Headers/worker.h
index da839e0b8132369d5e25435bbeac18b17664ec29..5e6c43abe94d2f74e8843b9efb445dd1d2c53438 100644
--- a/Headers/worker.h
+++ b/Headers/worker.h
@@ -8,35 +8,6 @@
 #include <QTextStream>
 #include "plotdata.h"
 
-class MyPulse
-{
-public:
-    ulong histNo=0; // history number
-    double timeStamp=0; // time stamp, ns
-    double height=0; // pulse amplitude, MeV
-    int cellNo=0; // cell number
-    Vector3D pos; // position, cm
-    MyPulse() {}
-    MyPulse(std::string record) {
-        timeStamp = std::stod(record.substr(0, 24));
-        height = std::stod(record.substr(27, 10));
-        pos = Vector3D(std::stod(record.substr(39, 6)),
-                       std::stod(record.substr(47, 6)),
-                       std::stod(record.substr(55, 6)));
-        cellNo = std::stoi(record.substr(68, 6));
-        histNo = std::stoi(record.substr(77, 10));
-    }
-    MyPulse(const QString record) {
-        timeStamp = record.mid(0, 24).toDouble();
-        height = record.mid(27, 10).toDouble();
-        pos = Vector3D(record.mid(39, 6).toDouble(),
-                       record.mid(47, 6).toDouble(),
-                       record.mid(55, 6).toDouble());
-        cellNo = record.mid(68, 6).toInt();
-        histNo = record.mid(77, 10).toULong();
-    }
-};
-
 class Event
 {
 public:
diff --git a/MainWindow.ui b/MainWindow.ui
index 1a038edda18b79e9fbf9c3625b26860cf25f2fbe..f3890be8a8e55f2b0340bbbff72f3aa0320d9a97 100644
--- a/MainWindow.ui
+++ b/MainWindow.ui
@@ -18,7 +18,7 @@
     <item row="0" column="0">
      <widget class="QTabWidget" name="tabWidget">
       <property name="currentIndex">
-       <number>0</number>
+       <number>1</number>
       </property>
       <widget class="QWidget" name="General">
        <attribute name="title">
@@ -189,34 +189,58 @@
        </attribute>
        <layout class="QGridLayout" name="gridLayout_3">
         <item row="1" column="0">
-         <layout class="QHBoxLayout" name="horizontalLayout">
-          <item>
-           <widget class="QLabel" name="label">
-            <property name="text">
-             <string>Radius (cm)</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QLineEdit" name="radiusInput"/>
-          </item>
-         </layout>
+         <widget class="QGroupBox" name="groupBox_7">
+          <property name="title">
+           <string>Coincidence</string>
+          </property>
+          <layout class="QGridLayout" name="gridLayout_10">
+           <item row="3" column="0">
+            <widget class="QLabel" name="label">
+             <property name="text">
+              <string>Radius (cm)</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <widget class="QLineEdit" name="timeWindowInput">
+             <property name="text">
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="3" column="1">
+            <widget class="QLineEdit" name="radiusInput"/>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_51">
+             <property name="text">
+              <string>Time window (ns)</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_31">
+             <property name="text">
+              <string>Enable</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QCheckBox" name="enableCoincidencebox">
+             <property name="text">
+              <string/>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
         </item>
-        <item row="2" column="0">
+        <item row="1" column="1">
          <widget class="QGroupBox" name="groupBox">
           <property name="title">
            <string>Azimuthal angle (degree)</string>
           </property>
           <layout class="QGridLayout" name="gridLayout_4">
-           <item row="0" column="1">
-            <widget class="QLineEdit" name="phiBinsInput"/>
-           </item>
-           <item row="1" column="1">
-            <widget class="QLineEdit" name="phiMinInput"/>
-           </item>
-           <item row="2" column="1">
-            <widget class="QLineEdit" name="phiMaxInput"/>
-           </item>
            <item row="0" column="0">
             <widget class="QLabel" name="label_2">
              <property name="text">
@@ -224,6 +248,15 @@
              </property>
             </widget>
            </item>
+           <item row="2" column="1">
+            <widget class="QLineEdit" name="phiMaxInput"/>
+           </item>
+           <item row="1" column="1">
+            <widget class="QLineEdit" name="phiMinInput"/>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="phiBinsInput"/>
+           </item>
            <item row="1" column="0">
             <widget class="QLabel" name="label_3">
              <property name="text">
@@ -241,50 +274,46 @@
           </layout>
          </widget>
         </item>
-        <item row="2" column="1">
-         <widget class="QGroupBox" name="groupBox_4">
+        <item row="2" column="0">
+         <widget class="QGroupBox" name="groupBox_3">
           <property name="title">
-           <string>Energy Cut</string>
+           <string>Coincidence Energy Spectrum</string>
           </property>
-          <layout class="QGridLayout" name="gridLayout_9">
-           <item row="0" column="1">
-            <widget class="QCheckBox" name="enableErgCutBox">
+          <layout class="QGridLayout" name="gridLayout_6">
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_15">
              <property name="text">
-              <string/>
+              <string>Min</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="label_16">
-             <property name="text">
-              <string>Low</string>
-             </property>
-            </widget>
+           <item row="2" column="1">
+            <widget class="QLineEdit" name="ergMinInput"/>
            </item>
-           <item row="1" column="1">
-            <widget class="QLineEdit" name="ergCutLowInput"/>
+           <item row="3" column="1">
+            <widget class="QLineEdit" name="ergMaxInput"/>
            </item>
-           <item row="2" column="0">
-            <widget class="QLabel" name="label_17">
+           <item row="3" column="0">
+            <widget class="QLabel" name="label_14">
              <property name="text">
-              <string>High</string>
+              <string>Max</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="1">
-            <widget class="QLineEdit" name="ergCutHighInput"/>
-           </item>
            <item row="0" column="0">
-            <widget class="QLabel" name="label_18">
+            <widget class="QLabel" name="label_9">
              <property name="text">
-              <string>Enable</string>
+              <string>Bins</string>
              </property>
             </widget>
            </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="ergBinsInput"/>
+           </item>
           </layout>
          </widget>
         </item>
-        <item row="3" column="0">
+        <item row="1" column="2">
          <widget class="QGroupBox" name="groupBox_2">
           <property name="title">
            <string>Elevation angle (degree)</string>
@@ -323,65 +352,135 @@
           </layout>
          </widget>
         </item>
-        <item row="1" column="1">
-         <widget class="QGroupBox" name="groupBox_3">
+        <item row="3" column="0">
+         <widget class="QGroupBox" name="groupBox_8">
           <property name="title">
-           <string>Energy Spectrum</string>
+           <string>Pair Energy Spectrum</string>
           </property>
-          <layout class="QGridLayout" name="gridLayout_6">
+          <layout class="QGridLayout" name="gridLayout_8">
            <item row="0" column="0">
-            <widget class="QLabel" name="label_9">
+            <widget class="QLabel" name="label_25">
              <property name="text">
               <string>Bins</string>
              </property>
             </widget>
            </item>
            <item row="0" column="1">
-            <widget class="QLineEdit" name="ergBinsInput"/>
+            <widget class="QLineEdit" name="pairErgBinInput"/>
            </item>
            <item row="1" column="0">
-            <widget class="QLabel" name="label_15">
+            <widget class="QLabel" name="label_26">
              <property name="text">
               <string>Min</string>
              </property>
             </widget>
            </item>
            <item row="1" column="1">
-            <widget class="QLineEdit" name="ergMinInput"/>
+            <widget class="QLineEdit" name="pairErgMinInput"/>
            </item>
            <item row="2" column="0">
-            <widget class="QLabel" name="label_14">
+            <widget class="QLabel" name="label_27">
              <property name="text">
               <string>Max</string>
              </property>
             </widget>
            </item>
            <item row="2" column="1">
-            <widget class="QLineEdit" name="ergMaxInput"/>
+            <widget class="QLineEdit" name="pairErgMaxInput"/>
            </item>
           </layout>
          </widget>
         </item>
-        <item row="3" column="1">
-         <widget class="QGroupBox" name="groupBox_7">
+        <item row="2" column="1">
+         <widget class="QGroupBox" name="groupBox_4">
           <property name="title">
-           <string>Coincidence</string>
+           <string>Energy Cut</string>
           </property>
-          <layout class="QGridLayout" name="gridLayout_10">
+          <layout class="QGridLayout" name="gridLayout_9">
+           <item row="0" column="1">
+            <widget class="QCheckBox" name="enableErgCutBox">
+             <property name="text">
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_16">
+             <property name="text">
+              <string>Low</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="QLineEdit" name="ergCutLowInput"/>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_17">
+             <property name="text">
+              <string>High</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <widget class="QLineEdit" name="ergCutHighInput"/>
+           </item>
            <item row="0" column="0">
-            <widget class="QLabel" name="label_51">
+            <widget class="QLabel" name="label_18">
              <property name="text">
-              <string>Time window (ns)</string>
+              <string>Enable</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="1">
-            <widget class="QLineEdit" name="timeWindowInput">
+          </layout>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QGroupBox" name="groupBox_9">
+          <property name="title">
+           <string>LG/HG Charge Spectrum</string>
+          </property>
+          <layout class="QGridLayout" name="gridLayout_13">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_28">
              <property name="text">
-              <string/>
+              <string>Bins</string>
              </property>
             </widget>
            </item>
+           <item row="0" column="1">
+            <widget class="QComboBox" name="LGHGBinBox">
+             <item>
+              <property name="text">
+               <string>256</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>512</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>1024</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>2048</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>4096</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>8192</string>
+              </property>
+             </item>
+            </widget>
+           </item>
           </layout>
          </widget>
         </item>
@@ -403,14 +502,14 @@
              <x>0</x>
              <y>0</y>
              <width>642</width>
-             <height>424</height>
+             <height>428</height>
             </rect>
            </property>
            <layout class="QGridLayout" name="mapLayout">
             <item row="0" column="8">
              <widget class="QLabel" name="label_21">
               <property name="text">
-               <string>Threshold</string>
+               <string>Threshold (keV)</string>
               </property>
              </widget>
             </item>
@@ -458,7 +557,7 @@
             <item row="0" column="9">
              <widget class="QLabel" name="label_13">
               <property name="text">
-               <string>Calibration Coef.</string>
+               <string>Calibration Coef. (keV)</string>
               </property>
              </widget>
             </item>
@@ -592,7 +691,7 @@
      <x>0</x>
      <y>0</y>
      <width>684</width>
-     <height>22</height>
+     <height>20</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
diff --git a/Sources/MainWindow.cpp b/Sources/MainWindow.cpp
index ce1ca76e145ae95a9f5659d95c87b53fb3e289df..5470cc616d099e0017f1c841a2f77de68bf11ed8 100644
--- a/Sources/MainWindow.cpp
+++ b/Sources/MainWindow.cpp
@@ -100,6 +100,18 @@ MainWindow::MainWindow(QWidget *parent) :
     tmedv->setNotation(QDoubleValidator::StandardNotation);
     ui->timeWindowInput->setValidator(tmedv);
     connect(ui->timeWindowInput, &QLineEdit::editingFinished, this, &MainWindow::onTimeWindowInput);
+    connect(ui->enableCoincidencebox, &QCheckBox::stateChanged, this, &MainWindow::onCoinOnStatChanged);
+
+    ui->pairErgBinInput->setValidator(new QIntValidator(1, 1000000, ui->pairErgBinInput));
+    QDoubleValidator* pairergmindv = new QDoubleValidator(0, 1000000, 6, ui->pairErgMinInput);
+    pairergmindv->setNotation(QDoubleValidator::StandardNotation);
+    ui->pairErgMinInput->setValidator(pairergmindv);
+    ui->pairErgMaxInput->setValidator(pairergmindv);
+    connect(ui->pairErgBinInput, &QLineEdit::editingFinished, this, &MainWindow::onPairErgBinsInput);
+    connect(ui->pairErgMinInput, &QLineEdit::editingFinished, this, &MainWindow::onPairErgMinInput);
+    connect(ui->pairErgMaxInput, &QLineEdit::editingFinished, this, &MainWindow::onPairErgMaxInput);
+
+    connect(ui->LGHGBinBox, &QComboBox::currentTextChanged, this, &MainWindow::onLGHGBinBox);
 
     // Mapping
     setupMapping();
@@ -408,6 +420,13 @@ void MainWindow::showConfig()
     ui->ergCutLowInput->setText(QString::number(config->energyLow, 'f', 4));
     ui->ergCutHighInput->setText(QString::number(config->energyUp, 'f', 4));
 
+    ui->pairErgBinInput->setText(QString::number(config->pairErgBins));
+    ui->pairErgMinInput->setText(QString::number(config->pairErgMin, 'f', 4));
+    ui->pairErgMaxInput->setText(QString::number(config->pairErgMax, 'f', 4));
+
+    ui->LGHGBinBox->setCurrentText(QString::number(config->LGHGErgBins));
+
+    ui->enableCoincidencebox->setChecked(config->coincidenceEnabled);
     ui->timeWindowInput->setText(QString::number(config->timeWindow, 'f', 4));
 
     // mapping
@@ -481,24 +500,30 @@ bool MainWindow::checkConfig()
        }
     }
 
-    if (config->phiMax <= config->phiMin)
+    if (config->coincidenceEnabled && config->phiMax <= config->phiMin)
     {
-        QMessageBox::warning(this, "Warning", QString("Min phi must be smaller max theta."));
+        QMessageBox::warning(this, "Warning", QString("Azimuthal angle: Min phi must be smaller max theta."));
         return false;
     }
-    if (config->thetaMax <= config->thetaMin)
+    if (config->coincidenceEnabled && config->thetaMax <= config->thetaMin)
     {
-        QMessageBox::warning(this, "Warning", QString("Min theta must be smaller than max theta."));
+        QMessageBox::warning(this, "Warning", QString("Elvation angel: Min theta must be smaller than max theta."));
         return false;
     }
-    if (config->ergMax <= config->ergMin)
+    if (config->coincidenceEnabled && config->ergMax <= config->ergMin)
     {
-        QMessageBox::warning(this, "Warning", QString("Min energy must be smaller than max energy."));
+        QMessageBox::warning(this, "Warning", QString("Coincidence Energy Spectrum: Min energy must be smaller than max energy."));
         return false;
     }
     if (config->energyCut && config->energyUp <= config->energyLow)
     {
-        QMessageBox::warning(this, "Warning", QString("Energy low cut must be smaller than energy high cut."));
+        QMessageBox::warning(this, "Warning", QString("Energy Cut: Energy low cut must be smaller than energy high cut."));
+        return false;
+    }
+
+    if (config->pairErgMax <= config->pairErgMin)
+    {
+        QMessageBox::warning(this, "Warning", QString("Pair Energy Spectrum: Min energy must be smaller than max energy."));
         return false;
     }
 
@@ -520,6 +545,9 @@ bool MainWindow::checkConfig()
         }
     }
 
+    if(!config->coincidenceEnabled)
+        config->timeWindow = 100;
+
     return true;
 }
 
@@ -554,12 +582,15 @@ void MainWindow::onConfigApplied()
         plotdata->clearAll();
     }
     // check if image space changed
-    if (config->imageSpacechaged){
+    if (imageSpacechaged){
         if (plotdata){
             plotdata->rebinImage();
             plotdata->rebinSpectrum();
+            plotdata->rebinPairSpectra();
+            plotdata->rebinLGSpectra();
+            plotdata->rebinHGSpectra();
         }
-        config->imageSpacechaged = false;
+        imageSpacechaged = false;
     }
     // pop up plot window
     if (plotwindow.isNull() || !plotwindow->isVisible()){
@@ -635,7 +666,7 @@ void MainWindow::onRadiusInput()
     if (!doubleEqual(newradius, config->R)){
         onConfigChanged();
         config->R = newradius;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 
@@ -645,7 +676,7 @@ void MainWindow::onPhiBinsInput()
     if (phibins != config->phiBins){
         onConfigChanged();
         config->phiBins = phibins;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 void MainWindow::onPhiMinInput()
@@ -655,7 +686,7 @@ void MainWindow::onPhiMinInput()
     if (!doubleEqual(phimin, config->phiMin)){
         onConfigChanged();
         config->phiMin = phimin;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 void MainWindow::onPhiMaxInput()
@@ -665,7 +696,7 @@ void MainWindow::onPhiMaxInput()
     if (!doubleEqual(phimax, config->phiMax)){
         onConfigChanged();
         config->phiMax = phimax;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 void MainWindow::onThetaBinsInput()
@@ -674,7 +705,7 @@ void MainWindow::onThetaBinsInput()
     if (thetabins != config->thetaBins){
         onConfigChanged();
         config->thetaBins = thetabins;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 void MainWindow::onThetaMinInput()
@@ -684,7 +715,7 @@ void MainWindow::onThetaMinInput()
     if (!doubleEqual(thetamin, config->thetaMin)){
         onConfigChanged();
         config->thetaMin = thetamin;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 void MainWindow::onThetaMaxInput()
@@ -694,7 +725,7 @@ void MainWindow::onThetaMaxInput()
     if (!doubleEqual(thetamax, config->thetaMax)){
         onConfigChanged();
         config->thetaMax = thetamax;
-        config->imageSpacechaged = true;
+        imageSpacechaged = true;
     }
 }
 
@@ -796,6 +827,56 @@ void MainWindow::onsaveSpectrumFormatChanged(const QString text)
     }
 }
 
+void MainWindow::onPairErgBinsInput()
+{
+    int pairErgBins = ui->pairErgBinInput->text().toInt();
+    if (pairErgBins != config->pairErgBins){
+        onConfigChanged();
+        config->pairErgBins = pairErgBins;
+        imageSpacechaged = true;
+    }
+}
+void MainWindow::onPairErgMinInput()
+{
+    double pairErgMin = ui->pairErgMinInput->text().toDouble();
+    if (!doubleEqual(pairErgMin, config->pairErgMin))
+    {
+        onConfigChanged();
+        config->pairErgMin = pairErgMin;
+        imageSpacechaged = true;
+    }
+}
+void MainWindow::onPairErgMaxInput()
+{
+    double pairErgMax = ui->pairErgMaxInput->text().toDouble();
+    if (!doubleEqual(pairErgMax, config->pairErgMax))
+    {
+        onConfigChanged();
+        config->pairErgMax = pairErgMax;
+        imageSpacechaged = true;
+    }
+}
+void MainWindow::onLGHGBinBox(const QString text)
+{
+    int bins = text.toInt();
+    if(bins != config->LGHGErgBins)
+    {
+        onConfigChanged();
+        config->LGHGErgBins = bins;
+        imageSpacechaged = true;
+    }
+}
+void MainWindow::onCoinOnStatChanged()
+{
+    bool enabled = ui->enableCoincidencebox->isChecked();
+    if (enabled != config->coincidenceEnabled)
+    {
+        onConfigChanged();
+        config->coincidenceEnabled = enabled;
+    }
+}
+
+
 void MainWindow::onTimeWindowInput()
 {
     double tmewin = ui->timeWindowInput->text().toDouble();
@@ -969,44 +1050,82 @@ void MainWindow::setupMapping()
 
 void MainWindow::onAllStatChanged()
 {
+    QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Change all channels",
+                                                               QString("Are you sure you want to change the on/off state of all channels?\n"),
+                                                               QMessageBox::Yes | QMessageBox::No,
+                                                               QMessageBox::No);
+    if (resBtn != QMessageBox::Yes) {
+        return;
+    }
     bool newstat = ui->AllChannelOnBox->isChecked();
     for (int i=0; i<ChEntries.size() && i < config->channelSettings.size() / 2; i++) {
         if (newstat != ChEntries[i]->getStat())
         {
             ChEntries[i]->setStat(newstat);
+            onStatChanged(i);
         }
     }
 }
 
 void MainWindow::onAllSourceChanged()
 {
+    QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Change all channels",
+                                                               QString("Are you sure you want to change the signal source of all channels?\n"),
+                                                               QMessageBox::Yes | QMessageBox::No,
+                                                               QMessageBox::No);
+    if (resBtn != QMessageBox::Yes) {
+        return;
+    }
     QString newsource = ui->AllSourceBox->currentText();
     for (int i=0; i<ChEntries.size() && i < config->channelSettings.size() / 2; i++) {
         for (int j=0; j<2; j++) {
             if (newsource != ChEntries[i]->getSource(j+1))
+            {
                 ChEntries[i]->setSource(newsource, j+1);
+                onSourceChanged(i, j+1);
+            }
         }
     }
 }
 
 void MainWindow::onAllThreChanged()
 {
+    QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Change all channels",
+                                                               QString("Are you sure you want to change the energy threshold of all channels?\n"),
+                                                               QMessageBox::Yes | QMessageBox::No,
+                                                               QMessageBox::No);
+    if (resBtn != QMessageBox::Yes) {
+        return;
+    }
     double newthre = ui->AllThreInput->text().toDouble();
     for (int i=0; i<ChEntries.size() && i < config->channelSettings.size() / 2; i++) {
         for (int j=0; j<2; j++) {
             if (!doubleEqual(newthre, ChEntries[i]->getThreshold(j+1)))
+            {
                 ChEntries[i]->setThreshold(newthre, j+1);
+                onThreChanged(i, j+1);
+            }
         }
     }
 }
 
 void MainWindow::onAllCaliCoefChanged()
 {
+    QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Change all channels",
+                                                               QString("Are you sure you want to change the calibration coefficient of all channels?\n"),
+                                                               QMessageBox::Yes | QMessageBox::No,
+                                                               QMessageBox::No);
+    if (resBtn != QMessageBox::Yes) {
+        return;
+    }
     double newcali = ui->AllCaliCoefInput->text().toDouble();
     for (int i=0; i<ChEntries.size() && i < config->channelSettings.size() / 2; i++) {
         for (int j=0; j<2; j++) {
             if (!doubleEqual(newcali, ChEntries[i]->getCaliCoef(j+1)))
+            {
                 ChEntries[i]->setCaliCoef(newcali, j+1);
+                onCaliCoefChanged(i, j+1);
+            }
         }
     }
 }
diff --git a/Sources/plotdata.cpp b/Sources/plotdata.cpp
index cc325770b131dca7ba8fb6713314b9d17706dd79..78f52db7da6950720fda81f637fbd77c84563250 100644
--- a/Sources/plotdata.cpp
+++ b/Sources/plotdata.cpp
@@ -24,7 +24,7 @@ PlotData::PlotData(const Setup* config_)
     hist->SetStats(0);
     hist->GetZaxis()->SetLabelSize(0.02);
     
-    spectrum = new TH1D("Spectrum", " ; Total deposited energy; Counts",
+    spectrum = new TH1D("Spectrum", " ; Total deposited energy (keV); Counts",
                         config->ergBins, config->ergMin, config->ergMax);
     spectrum->Reset();
     spectrum->SetFillColor(40);
@@ -32,13 +32,23 @@ PlotData::PlotData(const Setup* config_)
     std::string strtmp = "Total counts: " + std::to_string(counts);
     countsText = new TText(0.7, 0.92, strtmp.c_str());
 
+    // Pair
+    for(int i=0;i<config->channelSettings.size() / 2;i++)
+    {
+        std::string id_str = std::string("Pair-") + std::to_string(i);
+        TH1D* newhist = new TH1D(id_str.c_str(), " ; Deposited energy (keV); Counts", config->pairErgBins, config->pairErgMin, config->pairErgMax);
+        newhist->Reset();
+        newhist->SetFillColor(40);
+        pairSpectra.push_back(newhist);
+    }
+
     // LG
     for (int i=0;i<128;i++)
     {
         int asic = i/32;
         int channel = i % 32;
-        std::string id_str = std::to_string(asic) + "-" + std::to_string(channel) + "-LG";
-        TH1D* newhist = new TH1D(id_str.c_str(), " ; LG energy; Counts", config->LGErgBins, config->LGErgMin, config->LGErgMax);
+        std::string id_str =  std::string("LG-") + std::to_string(asic) + "-" + std::to_string(channel);
+        TH1D* newhist = new TH1D(id_str.c_str(), " ; Charge LG; Counts", config->LGHGErgBins, 0, config->LGHGErgBins);
         newhist->Reset();
         newhist->SetFillColor(40);
         LGSpectra.push_back(newhist);
@@ -49,8 +59,8 @@ PlotData::PlotData(const Setup* config_)
     {
         int asic = i/32;
         int channel = i % 32;
-        std::string id_str = std::to_string(asic) + "-" + std::to_string(channel) + "-HG";
-        TH1D* newhist = new TH1D(id_str.c_str(), " ; HG energy; Counts", config->HGErgBins, config->HGErgMin, config->HGErgMax);
+        std::string id_str = std::string("HG-") + std::to_string(asic) + "-" + std::to_string(channel);
+        TH1D* newhist = new TH1D(id_str.c_str(), " ; Charge HG; Counts", config->LGHGErgBins, 0, config->LGHGErgBins);
         newhist->Reset();
         newhist->SetFillColor(40);
         HGSpectra.push_back(newhist);
@@ -83,6 +93,14 @@ PlotData::~PlotData()
 //           latitudes[i] = nullptr;
 //       }
 //    }
+    for (std::size_t i=0;i<pairSpectra.size();i++)
+    {
+        if (pairSpectra[i])
+        {
+            delete pairSpectra[i];
+            pairSpectra[i] = nullptr;
+        }
+    }
     for (std::size_t i=0;i<LGSpectra.size();i++)
     {
         if(LGSpectra[i])
@@ -120,6 +138,7 @@ void PlotData::rebinImage()
 {
     mMutex.lock();
     counts = 0;
+    hist->Reset();
     hist->SetBins(config->phiBins, config->phiMin * 180 / M_PI, config->phiMax * 180 / M_PI,
                   config->thetaBins, config->thetaMin * 180 / M_PI, config->thetaMax * 180 / M_PI);
     probDist = std::vector<std::vector<double>>(config->thetaBins, std::vector<double>(config->phiBins, 0));
@@ -130,7 +149,8 @@ void PlotData::rebinImage()
 void PlotData::rebinSpectrum()
 {
     mMutex.lock();
-    hist->SetBins(config->ergBins, config->ergMin, config->ergMax);
+    spectrum->Reset();
+    spectrum->SetBins(config->ergBins, config->ergMin, config->ergMax);
     mMutex.unlock();
 //    return;
 }
@@ -140,7 +160,8 @@ void PlotData::rebinLGSpectra()
     mMutex.lock();
     for (std::size_t i=0;i<LGSpectra.size();i++)
     {
-        LGSpectra[i]->SetBins(config->LGErgBins, config->LGErgMin, config->LGErgMax);
+        LGSpectra[i]->Reset();
+        LGSpectra[i]->SetBins(config->LGHGErgBins, 0, config->LGHGErgBins);
     }
     mMutex.unlock();
 //    return;
@@ -151,7 +172,8 @@ void PlotData::rebinHGSpectra()
     mMutex.lock();
     for (std::size_t i=0;i<HGSpectra.size();i++)
     {
-        HGSpectra[i]->SetBins(config->HGErgBins, config->HGErgMin, config->HGErgMax);
+        HGSpectra[i]->Reset();
+        HGSpectra[i]->SetBins(config->LGHGErgBins, 0, config->LGHGErgBins);
     }
     mMutex.unlock();
 //    return;
@@ -194,6 +216,57 @@ void PlotData::drawSpectrum()
     spectrum->Draw();
 }
 
+void PlotData::drawPairSpectrum(const int& pair)
+{
+    if (pair >= 0 && pair < pairSpectra.size())
+        pairSpectra[pair]->Draw();
+}
+void PlotData::clearPairSpectra()
+{
+    mMutex.lock();
+    for (std::size_t i=0;i<pairSpectra.size();i++)
+    {
+        pairSpectra[i]->Reset();
+    }
+    mMutex.unlock();
+}
+
+void PlotData::unZoomPairSpectrum(const int& pair)
+{
+    mMutex.lock();
+    pairSpectra[pair]->GetXaxis()->UnZoom();
+    pairSpectra[pair]->GetYaxis()->UnZoom();
+    mMutex.unlock();
+}
+bool PlotData::savePairSpectrum2txt(const std::string&fileName, const int& pair)
+{
+    if (pair < 0 || pair >= pairSpectra.size())
+        return false;
+    mMutex.lock();
+    bool saved=spectrum2txt(pairSpectra[pair], fileName);
+    mMutex.unlock();
+    return saved;
+}
+void PlotData::rebinPairSpectra()
+{
+    mMutex.lock();
+    for (std::size_t i=0;i<pairSpectra.size();i++)
+    {
+        pairSpectra[i]->Reset();
+        pairSpectra[i]->SetBins(config->pairErgBins, config->pairErgMin, config->pairErgMax);
+    }
+    mMutex.unlock();
+}
+void PlotData::updatePairSpectra(const std::vector<MyPulse>& pulses)
+{
+    mMutex.lock();
+    for (const MyPulse& p : pulses)
+    {
+        pairSpectra[p.cellNo]->Fill(p.height);
+    }
+    mMutex.unlock();
+}
+
 void PlotData::saveOnExit()
 {
     QDateTime dateTime = QDateTime::currentDateTime();
@@ -235,6 +308,8 @@ void PlotData::clearAll()
     counts=0;
     hist->Reset();
     spectrum->Reset();
+    for (std::size_t i=0;i<pairSpectra.size();i++)
+        pairSpectra[i]->Reset();
     for (std::size_t i=0;i<LGSpectra.size();i++)
         LGSpectra[i]->Reset();
     for (std::size_t i=0;i<HGSpectra.size();i++)
@@ -277,6 +352,21 @@ void PlotData::clearHGSpectrum(const int& asic, const int& channel)
     mMutex.unlock();
 }
 
+void PlotData::clearLGHG()
+{
+    mMutex.lock();
+    for (int i=0;i<LGSpectra.size();i++)
+    {
+        LGSpectra[i]->Reset();
+    }
+
+    for (int i=0;i<HGSpectra.size();i++)
+    {
+        HGSpectra[i]->Reset();
+    }
+    mMutex.unlock();
+}
+
 bool PlotData::saveImage2txt(const std::string& fileName)
 {
 //        qDebug() << "Save as text file";
@@ -395,23 +485,25 @@ bool PlotData::spectrum2txt(const TH1D* s, const std::string& fileName)
     return true;
 }
 
-void PlotData::updateLGSpectra(const int asic, const u_short* chargeLG)
+void PlotData::updateLGSpectra(const int asic, const u_short (&chargeLG)[32])
 {
     mMutex.lock();
     int id = asic * 32;
     for(int i=0;i<32;i++)
     {
-        LGSpectra[id+i]->Fill(chargeLG[i]);
+        if(chargeLG[i] > 0)
+            LGSpectra[id+i]->Fill(chargeLG[i]);
     }
     mMutex.unlock();
 }
-void PlotData::updateHGSpectra(const int asic, const u_short* chargeHG)
+void PlotData::updateHGSpectra(const int asic, const u_short (&chargeHG)[32])
 {
     mMutex.lock();
     int id = asic * 32;
     for(int i=0;i<32;i++)
     {
-        HGSpectra[id+i]->Fill(chargeHG[i]);
+        if(chargeHG[i] > 0)
+            HGSpectra[id+i]->Fill(chargeHG[i]);
     }
     mMutex.unlock();
 }
@@ -557,7 +649,7 @@ int PlotData::addConesNormalized(std::vector<Cone>::const_iterator first,
         // realistic case: initial energy = E_1 + E_2
         E2 = k->E0 - k->Edpst;
         sgma2 = std::pow(k->Edpst/std::pow(k->E0, 2) , 2) + std::pow(1/E2 - E2/std::pow(k->E0, 2) , 2);
-        sgma2 *= std::pow(config->sgmE * 0.511, 2);
+        sgma2 *= std::pow(config->sgmE * 511, 2);
         A = 0.5 * M_1_PI * M_2_SQRTPI * M_SQRT1_2 / std::sqrt(sgma2) / (std::erf((1-alpha)/ (M_SQRT2 * std::sqrt(sgma2))) - std::erf((-1-alpha)/ (M_SQRT2 * std::sqrt(sgma2))));
 //        #pragma omp parallel for private(ray, beta) shared(probDist)
         for (int i = 0; i < config->thetaBins; i++)
diff --git a/Sources/plotwindow.cpp b/Sources/plotwindow.cpp
index 6e66fb36bc5c1c878b5876ec92d9f53b22e5a2e4..cd737d76e08fc65d2f3c2077839499d30849c4df 100644
--- a/Sources/plotwindow.cpp
+++ b/Sources/plotwindow.cpp
@@ -16,8 +16,10 @@ QPlotWindow::QPlotWindow(QWidget *parent, const Setup* config_, PlotData* plotda
     ui->imageCanvas->hideBoxes();
     ui->spectrumCanvas->hideBoxes();
 
-    ui->LGCanvas->setID(3);
-    ui->HGCanvas->setID(4);
+    ui->pairCanvas->setID(3);
+    ui->pairCanvas->hideLGHGBoxes();
+    ui->LGHGCanvas->setID(4);
+    ui->LGHGCanvas->hidePairBox();
 
     connect(ui->actionStart, &QAction::triggered, this, &QPlotWindow::handleStart);
     connect(ui->actionPause, &QAction::triggered, this, &QPlotWindow::handlePause);
@@ -34,19 +36,20 @@ QPlotWindow::QPlotWindow(QWidget *parent, const Setup* config_, PlotData* plotda
     connect(ui->imageCanvas, &QCustomCanvas::canvasSaved2Txt, this, &QPlotWindow::handleSave2txt);
     connect(ui->spectrumCanvas, &QCustomCanvas::canvasSaved2Txt, this, &QPlotWindow::handleSave2txt);
 
-    connect(ui->LGCanvas, &QCustomCanvas::canvasZoomedout, this, &QPlotWindow::handleUnzoom);
-    connect(ui->HGCanvas, &QCustomCanvas::canvasZoomedout, this, &QPlotWindow::handleUnzoom);
-    connect(ui->LGCanvas, &QCustomCanvas::canvasCleared, this, &QPlotWindow::handleClear);
-    connect(ui->HGCanvas, &QCustomCanvas::canvasCleared, this, &QPlotWindow::handleClear);
-    connect(ui->LGCanvas, &QCustomCanvas::canvasSaved2Image, this, &QPlotWindow::handleScreenshot);
-    connect(ui->HGCanvas, &QCustomCanvas::canvasSaved2Image, this, &QPlotWindow::handleScreenshot);
-    connect(ui->LGCanvas, &QCustomCanvas::canvasSaved2Txt, this, &QPlotWindow::handleSave2txt);
-    connect(ui->HGCanvas, &QCustomCanvas::canvasSaved2Txt, this, &QPlotWindow::handleSave2txt);
+    connect(ui->pairCanvas, &QCustomCanvas::canvasZoomedout, this, &QPlotWindow::handleUnzoom);
+    connect(ui->LGHGCanvas, &QCustomCanvas::canvasZoomedout, this, &QPlotWindow::handleUnzoom);
+    connect(ui->pairCanvas, &QCustomCanvas::canvasCleared, this, &QPlotWindow::handleClear);
+    connect(ui->LGHGCanvas, &QCustomCanvas::canvasCleared, this, &QPlotWindow::handleClear);
+    connect(ui->pairCanvas, &QCustomCanvas::canvasSaved2Image, this, &QPlotWindow::handleScreenshot);
+    connect(ui->LGHGCanvas, &QCustomCanvas::canvasSaved2Image, this, &QPlotWindow::handleScreenshot);
+    connect(ui->pairCanvas, &QCustomCanvas::canvasSaved2Txt, this, &QPlotWindow::handleSave2txt);
+    connect(ui->LGHGCanvas, &QCustomCanvas::canvasSaved2Txt, this, &QPlotWindow::handleSave2txt);
 
-    connect(ui->LGCanvas, &QCustomCanvas::asicChanged, this, &QPlotWindow::handleAsicChanged);
-    connect(ui->LGCanvas, &QCustomCanvas::channelChanged, this, &QPlotWindow::handleChannelChanged);
-    connect(ui->HGCanvas, &QCustomCanvas::asicChanged, this, &QPlotWindow::handleAsicChanged);
-    connect(ui->HGCanvas, &QCustomCanvas::channelChanged, this, &QPlotWindow::handleChannelChanged);
+    connect(ui->LGHGCanvas, &QCustomCanvas::asicChanged, this, &QPlotWindow::handleAsicChanged);
+    connect(ui->LGHGCanvas, &QCustomCanvas::channelChanged, this, &QPlotWindow::handleChannelChanged);
+
+    connect(ui->LGHGCanvas, &QCustomCanvas::sourceChanged, this, &QPlotWindow::handleSourceChanged);
+    connect(ui->pairCanvas, &QCustomCanvas::pairChanged, this, &QPlotWindow::handlePairChanged);
 
 
 
@@ -67,21 +70,22 @@ QPlotWindow::QPlotWindow(QWidget *parent, const Setup* config_, PlotData* plotda
     ui->spectrumCanvas->Canvas()->Modified();
     ui->spectrumCanvas->Canvas()->Update();
 
-    // draw LG spectrum
-    ui->LGCanvas->Canvas()->cd();
+    // draw single pair spectrum
+    ui->pairCanvas->Canvas()->cd();
     plotdata->mMutex.lock();
-    plotdata->drawLGspectrum(LGAsicID, LGChannelID);
+//    plotdata->drawLGspectrum(LGAsicID, LGChannelID);
+    plotdata->drawPairSpectrum(pairID);
     plotdata->mMutex.unlock();
-    ui->LGCanvas->Canvas()->Modified();
-    ui->LGCanvas->Canvas()->Update();
+    ui->pairCanvas->Canvas()->Modified();
+    ui->pairCanvas->Canvas()->Update();
 
-    // draw HG spectrum
-    ui->HGCanvas->Canvas()->cd();
+    // draw LG/HG spectrum
+    ui->LGHGCanvas->Canvas()->cd();
     plotdata->mMutex.lock();
-    plotdata->drawHGspectrum(HGAsicID, HGChannelID);
+    plotdata->drawLGspectrum(LGAsicID, LGChannelID);
     plotdata->mMutex.unlock();
-    ui->HGCanvas->Canvas()->Modified();
-    ui->HGCanvas->Canvas()->Update();
+    ui->LGHGCanvas->Canvas()->Modified();
+    ui->LGHGCanvas->Canvas()->Update();
 }
 
 
@@ -112,8 +116,11 @@ void QPlotWindow::handleUnzoom(int id)
         plotdata->unZoomImage();
         plotdata->unZoomSpectrum();
         // TODO
-        plotdata->unZoomLG(LGAsicID, LGChannelID);
-        plotdata->unZoomHG(HGAsicID, HGChannelID);
+        plotdata->unZoomPairSpectrum(pairID);
+        if (source=="LG")
+            plotdata->unZoomLG(LGAsicID, LGChannelID);
+        else if(source == "HG")
+            plotdata->unZoomHG(HGAsicID, HGChannelID);
     }
     else if (id == ui->imageCanvas->getID())
     {
@@ -123,13 +130,16 @@ void QPlotWindow::handleUnzoom(int id)
     {
         plotdata->unZoomSpectrum();
     }
-    else if (id ==ui->LGCanvas->getID())
+    else if (id ==ui->pairCanvas->getID())
     {
-        plotdata->unZoomLG(LGAsicID, LGChannelID);
+        plotdata->unZoomPairSpectrum(pairID);
     }
-    else if (id ==ui->HGCanvas->getID())
+    else if (id ==ui->LGHGCanvas->getID())
     {
-        plotdata->unZoomHG(HGAsicID, HGChannelID);
+        if (source=="LG")
+            plotdata->unZoomLG(LGAsicID, LGChannelID);
+        else if(source == "HG")
+            plotdata->unZoomHG(HGAsicID, HGChannelID);
     }
 }
 
@@ -143,13 +153,13 @@ void QPlotWindow::reopen()
     ui->spectrumCanvas->Canvas()->Modified();
     ui->spectrumCanvas->Canvas()->Update();
 
-    ui->LGCanvas->Canvas()->cd();
-    ui->LGCanvas->Canvas()->Modified();
-    ui->LGCanvas->Canvas()->Update();
+    ui->pairCanvas->Canvas()->cd();
+    ui->pairCanvas->Canvas()->Modified();
+    ui->pairCanvas->Canvas()->Update();
 
-    ui->HGCanvas->Canvas()->cd();
-    ui->HGCanvas->Canvas()->Modified();
-    ui->HGCanvas->Canvas()->Update();
+    ui->LGHGCanvas->Canvas()->cd();
+    ui->LGHGCanvas->Canvas()->Modified();
+    ui->LGHGCanvas->Canvas()->Update();
 }
 
 void QPlotWindow::changeEvent(QEvent *e)
@@ -185,13 +195,13 @@ void QPlotWindow::redraw()
     ui->spectrumCanvas->Canvas()->Modified();
     ui->spectrumCanvas->Canvas()->Update();
 
-    ui->LGCanvas->Canvas()->cd();
-    ui->LGCanvas->Canvas()->Modified();
-    ui->LGCanvas->Canvas()->Update();
+    ui->pairCanvas->Canvas()->cd();
+    ui->pairCanvas->Canvas()->Modified();
+    ui->pairCanvas->Canvas()->Update();
 
-    ui->HGCanvas->Canvas()->cd();
-    ui->HGCanvas->Canvas()->Modified();
-    ui->HGCanvas->Canvas()->Update();
+    ui->LGHGCanvas->Canvas()->cd();
+    ui->LGHGCanvas->Canvas()->Modified();
+    ui->LGHGCanvas->Canvas()->Update();
 
     plotdata->mMutex.unlock();
 }
@@ -209,15 +219,15 @@ void QPlotWindow::handleClear(int id){
         qDebug() << "Clear spectrum";
         plotdata->clearSpectrum();
     }
-    else if (id == ui->LGCanvas->getID())
+    else if (id == ui->pairCanvas->getID())
     {
-        qDebug() << "Clear LG spectrum";
-//        plotdata->clearLGSpectrum();
+        qDebug() << "Clear single pair spectrum";
+        plotdata->clearPairSpectra();
     }
-    else if (id == ui->HGCanvas->getID())
+    else if (id == ui->LGHGCanvas->getID())
     {
-        qDebug() << "Clear HG spectrum";
-//        plotdata->clearHGSpectrum();
+        qDebug() << "Clear LG/HG spectrum";
+        plotdata->clearLGHG();
     }
 }
 
@@ -231,8 +241,8 @@ void QPlotWindow::handleScreenshot(int id){
         qDebug() << "Save all";
         handleScreenshot(ui->imageCanvas->getID());
         handleScreenshot(ui->spectrumCanvas->getID());
-        handleScreenshot(ui->LGCanvas->getID());
-        handleScreenshot(ui->HGCanvas->getID());
+        handleScreenshot(ui->pairCanvas->getID());
+        handleScreenshot(ui->LGHGCanvas->getID());
     }
     else if (id ==ui->imageCanvas->getID()) {
         key = "Image";
@@ -244,19 +254,24 @@ void QPlotWindow::handleScreenshot(int id){
         canvas = ui->spectrumCanvas;
         fileName = config->outputDir.absolutePath() + QString("/Screenshot-%1-%2.png").arg(key, currentDateTime);
     }
-    else if (id ==ui->LGCanvas->getID()) {
-        key = "LG-Spectrum";
-        canvas = ui->LGCanvas;
+    else if (id ==ui->pairCanvas->getID()) {
+        key = "Pair-Spectrum";
+        canvas = ui->pairCanvas;
         fileName = config->outputDir.absolutePath() +
-                QString("/Screenshot-%1-%2-ASIC-%3-Channel-%4.png").arg(key, currentDateTime,
-                                                                        QString::number(LGAsicID), QString::number(LGChannelID));
+                QString("/Screenshot-%1-%2-Pair-%3.png").arg(key, currentDateTime,
+                                                                        QString::number(pairID));
     }
-    else if (id ==ui->HGCanvas->getID()) {
-        key = "HG-Spectrum";
-        canvas = ui->HGCanvas;
-        fileName = config->outputDir.absolutePath() +
-                QString("/Screenshot-%1-%2-ASIC-%3-Channel-%4.png").arg(key, currentDateTime,
-                                                                        QString::number(HGAsicID), QString::number(HGChannelID));
+    else if (id ==ui->LGHGCanvas->getID()) {
+        key = source + "-Spectrum";
+        canvas = ui->LGHGCanvas;
+        if(source == "LG")
+            fileName = config->outputDir.absolutePath() +
+                    QString("/Screenshot-%1-%2-ASIC-%3-Channel-%4.png").arg(key, currentDateTime,
+                                                                            QString::number(LGAsicID), QString::number(LGChannelID));
+        else if (source == "HG")
+            fileName = config->outputDir.absolutePath() +
+                    QString("/Screenshot-%1-%2-ASIC-%3-Channel-%4.png").arg(key, currentDateTime,
+                                                                            QString::number(HGAsicID), QString::number(HGChannelID));
     }
     else
         return;
@@ -287,68 +302,106 @@ void QPlotWindow::handleSave2txt(int id){
         plotdata->saveSpectrum2txt(fileName.toStdString());
         ui->statusbar->showMessage(QString("Spectrum saved to: %1").arg(fileName));
     }
-    else if (id == ui->LGCanvas->getID()) {
-        qDebug() << "Save LG spectrum to txt";
+    else if (id == ui->pairCanvas->getID()) {
+        qDebug() << "Save pai spectrum to txt";
         QString fileName = config->outputDir.absolutePath() +
-                QString("/LG-Spectrum-%1-ASIC-%2-Channel-%3.txt").arg(currentDateTime,
-                                                                      QString::number(LGAsicID), QString::number(LGChannelID));
-        plotdata->saveLGSpectrum2txt(fileName.toStdString(), LGAsicID, LGChannelID);
+                QString("/Pair-Spectrum-%1-ID-%2.txt").arg(currentDateTime,
+                                                           QString::number(pairID));
+        plotdata->savePairSpectrum2txt(fileName.toStdString(), pairID);
         ui->statusbar->showMessage(QString("LG Spectrum saved to: %1").arg(fileName));
     }
-    else if (id == ui->HGCanvas->getID()) {
-        qDebug() << "Save HG spectrum to txt";
-        QString fileName = config->outputDir.absolutePath() +
-                QString("/HG-Spectrum-%1-ASIC-%2-Channel-%3.txt").arg(currentDateTime,
-                                                                      QString::number(HGAsicID), QString::number(HGChannelID));
-        plotdata->saveHGSpectrum2txt(fileName.toStdString(), HGAsicID, HGChannelID);
-        ui->statusbar->showMessage(QString("LG Spectrum saved to: %1").arg(fileName));
+    else if (id == ui->LGHGCanvas->getID()) {
+        qDebug() << "Save LG/HG spectrum to txt";
+        QString fileName;
+        if (source=="LG")
+        {
+            fileName = config->outputDir.absolutePath() +
+                            QString("/HG-Spectrum-%1-ASIC-%2-Channel-%3.txt").arg(currentDateTime,
+                                                                                  QString::number(LGAsicID), QString::number(LGChannelID));
+            plotdata->saveLGSpectrum2txt(fileName.toStdString(), LGAsicID, LGChannelID);
+        }
+        else if (source == "HG")
+        {
+            fileName = config->outputDir.absolutePath() +
+                            QString("/HG-Spectrum-%1-ASIC-%2-Channel-%3.txt").arg(currentDateTime,
+                                                                                  QString::number(HGAsicID), QString::number(HGChannelID));
+            plotdata->saveHGSpectrum2txt(fileName.toStdString(), HGAsicID, HGChannelID);
+        }
+        else
+            return;
+        ui->statusbar->showMessage(QString("LG/HG Spectrum saved to: %1").arg(fileName));
     }
 }
 
-void QPlotWindow::handleAsicChanged(int id)
+void QPlotWindow::handlePairChanged(int id)
 {
-    if (id == ui->LGCanvas->getID())
-    {
-        if (ui->LGCanvas->getAsicID() == LGAsicID)
-            return;
-
-        LGAsicID = ui->LGCanvas->getAsicID();
-        switchLGHG(id);
-    }
-    else if (id == ui->HGCanvas->getID())
+    if (id == ui->pairCanvas->getID())
     {
-        if (ui->HGCanvas->getAsicID() == HGAsicID)
+        int currentID = ui->pairCanvas->getPairID();
+        if (currentID == pairID)
             return;
-        HGAsicID = ui->HGCanvas->getAsicID();
-        switchLGHG(id);
+        pairID = currentID;
+        switchPair(id);
     }
 }
 
+void QPlotWindow::handleAsicChanged(int id)
+{
+ if (id == ui->LGHGCanvas->getID())
+ {
+     int currentID = (source =="LG") ? LGAsicID : HGAsicID;
+     if (ui->LGHGCanvas->getAsicID() == currentID)
+         return;
+     if (source == "LG")
+         LGAsicID = ui->LGHGCanvas->getAsicID();
+     else
+         HGAsicID = ui->LGHGCanvas->getAsicID();
+     switchLGHG(id);
+ }
+}
+
 void QPlotWindow::handleChannelChanged(int id)
 {
-    if (id == ui->LGCanvas->getID())
+    if (id == ui->LGHGCanvas->getID())
     {
-        if (ui->LGCanvas->getChannelID() == LGChannelID)
+        int currentID = (source == "LG") ? LGChannelID : HGChannelID;
+        if (ui->LGHGCanvas->getChannelID() == currentID)
             return;
-        LGChannelID = ui->LGCanvas->getChannelID();
+        if (source == "LG")
+            LGChannelID = ui->LGHGCanvas->getChannelID();
+        else
+            HGChannelID = ui->LGHGCanvas->getChannelID();
         switchLGHG(id);
     }
-    else if (id == ui->HGCanvas->getID())
+}
+
+void QPlotWindow::handleSourceChanged(int id)
+{
+    if (id == ui->LGHGCanvas->getID())
     {
-        if (ui->HGCanvas->getChannelID() == HGChannelID)
+        if(ui->LGHGCanvas->getSource() == source)
             return;
-        HGChannelID = ui->HGCanvas->getChannelID();
+        source = ui->LGHGCanvas->getSource();
+        if (source == "LG")
+        {
+            LGAsicID = HGAsicID;
+            LGChannelID = HGChannelID;
+        }
+        else
+        {
+            HGAsicID = LGAsicID;
+            HGChannelID = LGChannelID;
+        }
         switchLGHG(id);
+//        ui->LGHGCanvas
     }
 }
 
 void QPlotWindow::switchLGHG(int id)
 {
     QCustomCanvas* canvas;
-    if (id == ui->LGCanvas->getID())
-        canvas = ui->LGCanvas;
-    else if (id == ui->HGCanvas->getID())
-       canvas = ui->HGCanvas;
+    if (id == ui->LGHGCanvas->getID())
+       canvas = ui->LGHGCanvas;
     else
         return;
 
@@ -357,16 +410,15 @@ void QPlotWindow::switchLGHG(int id)
     canvas->Canvas()->cd();
     canvas->Canvas()->Clear(); // clear canvas
     // draw new spectrum
-    // TODO
-    if (id == ui->LGCanvas->getID())
+    if (source == "LG")
     {
-        qDebug() << QString("Draw LG ASIC-%1, Channel-%2").arg(LGAsicID, LGChannelID);
+        qDebug() << QString("Draw LG ASIC-%1, Channel-%2").arg(QString::number(LGAsicID), QString::number(LGChannelID));
         plotdata->drawLGspectrum(LGAsicID, LGChannelID);
     }
-    else if (id == ui->HGCanvas->getID())
+    else if (source == "HG")
     {
 
-        qDebug() << QString("Draw HG ASIC-%1, Channel-%2").arg(HGAsicID, HGChannelID);
+        qDebug() << QString("Draw HG ASIC-%1, Channel-%2").arg(QString::number(HGAsicID), QString::number(HGChannelID));
         plotdata->drawHGspectrum(HGAsicID, HGChannelID);
     }
     canvas->Canvas()->Modified();
@@ -374,3 +426,19 @@ void QPlotWindow::switchLGHG(int id)
     plotdata->mMutex.unlock();
 }
 
+void QPlotWindow::switchPair(int id)
+{
+    if (id != ui->pairCanvas->getID())
+        return;
+    // redraw
+    plotdata->mMutex.lock();
+    ui->pairCanvas->Canvas()->cd();
+    ui->pairCanvas->Canvas()->Clear(); // clear canvas
+    // draw new spectrum
+    qDebug() << QString("Draw Pair %1").arg(QString::number(pairID));
+    plotdata->drawPairSpectrum(pairID);
+    ui->pairCanvas->Canvas()->Modified();
+    ui->pairCanvas->Canvas()->Update();
+    plotdata->mMutex.unlock();
+}
+
diff --git a/Sources/qcustomcanvas.cpp b/Sources/qcustomcanvas.cpp
index eac103229f478dca002b3b8243d98672a0aca654..4f28bcf9b3a30ef301e4ac511d4813e7a0db28fb 100644
--- a/Sources/qcustomcanvas.cpp
+++ b/Sources/qcustomcanvas.cpp
@@ -16,8 +16,10 @@ QCustomCanvas::QCustomCanvas(QWidget *parent) :
     #endif
     connect(ui->SaveButton, &QToolButton::clicked, this, &QCustomCanvas::handleSave2Txt);
 
+    connect(ui->pairBox, &QComboBox::currentTextChanged, this, &QCustomCanvas::handlePairBox);
     connect(ui->asicBox, &QComboBox::currentTextChanged, this, &QCustomCanvas::handleAsicBox);
     connect(ui->channelBox, &QComboBox::currentTextChanged, this, &QCustomCanvas::handleChannelBox);
+    connect(ui->sourceBox, &QComboBox::currentTextChanged, this, &QCustomCanvas::handleSourceBox);
 }
 
 QCustomCanvas::~QCustomCanvas()
@@ -40,6 +42,16 @@ int QCustomCanvas::getChannelID()
     return ui->channelBox->currentText().toInt();
 }
 
+int QCustomCanvas::getPairID()
+{
+    return ui->pairBox->currentText().toInt();
+}
+
+QString QCustomCanvas::getSource()
+{
+    return ui->sourceBox->currentText();
+}
+
 void QCustomCanvas::handleSave2Txt()
 {
     qDebug() << "save canvas to txt";
@@ -72,10 +84,34 @@ void QCustomCanvas::handleChannelBox()
     emit channelChanged(id);
 }
 
-void QCustomCanvas::hideBoxes()
+void QCustomCanvas::handlePairBox()
+{
+    emit pairChanged(id);
+}
+
+void QCustomCanvas::handleSourceBox()
 {
+    emit sourceChanged(id);
+}
+
+void QCustomCanvas::hideLGHGBoxes()
+{
+    ui->sourceLabel->hide();
+    ui->sourceBox->hide();
     ui->asicLabel->hide();
     ui->asicBox->hide();
     ui->channelLabel->hide();
     ui->channelBox->hide();
 }
+
+void QCustomCanvas::hidePairBox()
+{
+    ui->pairLabel->hide();
+    ui->pairBox->hide();
+}
+
+void QCustomCanvas::hideBoxes()
+{
+    hidePairBox();
+    hideLGHGBoxes();
+}
diff --git a/Sources/setup.cpp b/Sources/setup.cpp
index d63eaaa91ac34a1bd8283182ff59550930bb72f0..c668b945e5b5ca55041c0de501ba52564dfbee73 100644
--- a/Sources/setup.cpp
+++ b/Sources/setup.cpp
@@ -41,7 +41,7 @@ void Setup::readSetup(const QString path)
     settings.endGroup();
 
     settings.beginGroup("EnergySpectrum");
-    ergBins = settings.value("NEneregyBins").toInt();
+    ergBins = settings.value("NEnergyBins").toInt();
     ergMin  = settings.value("EnergyMin").toDouble();
     ergMax = settings.value("EnergyMax").toDouble();
     settings.endGroup();
@@ -71,7 +71,18 @@ void Setup::readSetup(const QString path)
     energyUp = settings.value("EnergyUpperThreshold").toDouble();
     settings.endGroup();
 
+    settings.beginGroup("PairSpectrum");
+    pairErgBins = settings.value("NEnergyBins").toInt();
+    pairErgMin = settings.value("EnergyMin").toDouble();
+    pairErgMax = settings.value("EnergyMax").toDouble();
+    settings.endGroup();
+
+    settings.beginGroup("LGHGSpectrum");
+    LGHGErgBins = settings.value("NChargeBins").toInt();
+    settings.endGroup();
+
     settings.beginGroup("Coincidence");
+    coincidenceEnabled = settings.value("Enabled").toBool();
     timeWindow = settings.value("TimeWindow").toDouble();
     settings.endGroup();
 
@@ -95,7 +106,7 @@ void Setup::writeSetup(const QString path) const
     settings.endGroup();
 
     settings.beginGroup("EnergySpectrum");
-    settings.setValue("NEneregyBins", ergBins);
+    settings.setValue("NEnergyBins", ergBins);
     settings.setValue("EnergyMin", ergMin);
     settings.setValue("EnergyMax", ergMax);
     settings.endGroup();
@@ -115,7 +126,18 @@ void Setup::writeSetup(const QString path) const
     settings.setValue("EnergyUpperThreshold", energyUp);
     settings.endGroup();
 
+    settings.beginGroup("PairSpectrum");
+    settings.setValue("NEnergyBins", pairErgBins);
+    settings.setValue("EnergyMin", pairErgMin);
+    settings.setValue("EnergyMax", pairErgMax);
+    settings.endGroup();
+
+    settings.beginGroup("LGHGSpectrum");
+    settings.setValue("NChargeBins", LGHGErgBins);
+    settings.endGroup();
+
     settings.beginGroup("Coincidence");
+    settings.setValue("Enabled", coincidenceEnabled);
     settings.setValue("TimeWindow", timeWindow);
     settings.endGroup();
 
diff --git a/Sources/worker.cpp b/Sources/worker.cpp
index 2d88f6a51bfce6df308345d00a5072445d5e13a4..5cd4b13e25e1772ee0d4819d5d16c140b839dc2a 100644
--- a/Sources/worker.cpp
+++ b/Sources/worker.cpp
@@ -25,7 +25,7 @@ bool Worker::processCoincidence(const std::vector<MyPulse>& pulses, Cone& newCon
     }
 //    if (pulses[0].height < 0.01 || pulses[1].height < 0.01)
 //        return false;
-    double cosHalfangle = 1 - pulses[0].height * 0.511 / (pulses[1].height * Etot);
+    double cosHalfangle = 1 - pulses[0].height * 511 / (pulses[1].height * Etot);
     if (std::abs(cosHalfangle)>=1)
     {
         return false;
@@ -202,9 +202,9 @@ void Worker::readBIN(std::vector<Cone> &cones, QDataStream &in)
             plotdata->updateLGSpectra(newPacket.AsicID, newPacket.chargeLG);
             plotdata->updateHGSpectra(newPacket.AsicID, newPacket.chargeHG);
 
-            if (packets.size()>0 && std::abs(newPacket.RunEventTimecode_ns - prevTT) > config->timeWindow){
-                if(packets.size() > 2)
-                    qDebug() << "Coincidence";
+            if (packets.size()>0 && std::abs(newPacket.RunEventTimecode_ns - prevTT) >= config->timeWindow){
+//                if(packets.size() > 2)
+//                    qDebug() << "Coincidence";
                 // process coincident events
                 std::vector<Event> events;
                 if (extractEvents(packets, events))
@@ -218,10 +218,15 @@ void Worker::readBIN(std::vector<Cone> &cones, QDataStream &in)
                     std::vector<MyPulse> pulses;
                     if(event2Pulses(events, pulses))
                     {
-                        Cone newCone;
-                        if (processCoincidence(pulses, newCone)){
-                            cones.push_back(std::move(newCone));
-                            i++;
+                        // upddate pair spectra
+                        plotdata->updatePairSpectra(pulses);
+                        if(config->coincidenceEnabled)
+                        {
+                            Cone newCone;
+                            if (processCoincidence(pulses, newCone)){
+                                cones.push_back(std::move(newCone));
+                                i++;
+                            }
                         }
                     }
                 }
diff --git a/imagerQt.pro b/imagerQt.pro
index 6ad8bb55ba6e5bf1cb06b110acfdf13ec8deb602..d32fa3746b7b50c711363b40e0b9dac47730669f 100644
--- a/imagerQt.pro
+++ b/imagerQt.pro
@@ -67,10 +67,10 @@ msvc {
 }
 
 #ROOTSYS=/home/nmluser/root
-ROOTSYS=/home/ming/root
+#ROOTSYS=/home/ming/root
 
 INCLUDEPATH += \
-    $$ROOTSYS/include \
+    $$(ROOTSYS)/include \
     $$PWD/Headers
 
 win32:LIBS += -L$(ROOTSYS)/lib -llibCore -llibRIO -llibNet \
@@ -78,7 +78,7 @@ win32:LIBS += -L$(ROOTSYS)/lib -llibCore -llibRIO -llibNet \
             -llibRint -llibPostscript -llibMatrix -llibPhysics \
             -llibGui -llibRGL
 else:LIBS += \
-    -L$$ROOTSYS/lib -lCore -lImt -lRIO -lNet -lHist -lGraf \
+    -L$$(ROOTSYS)/lib -lCore -lImt -lRIO -lNet -lHist -lGraf \
     -lGraf3d -lGpad -lTree -lTreePlayer -lRint -lPostscript -lMatrix \
     -lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic
 
diff --git a/plotcanvas.ui b/plotcanvas.ui
index e4b2c1840ad383a89b74b53e0cd84a64cd67d5f0..10cda486483a475066afe83c267aabae8b962a47 100644
--- a/plotcanvas.ui
+++ b/plotcanvas.ui
@@ -16,69 +16,8 @@
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
     <layout class="QGridLayout" name="gridLayout_2">
-     <item row="1" column="3">
-      <widget class="QToolButton" name="ScreenshotButton">
-       <property name="text">
-        <string>...</string>
-       </property>
-       <property name="icon">
-        <iconset resource="resources.qrc">
-         <normaloff>:/icons/icons/screenshot.svg</normaloff>:/icons/icons/screenshot.svg</iconset>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="2">
-      <widget class="QToolButton" name="SaveButton">
-       <property name="text">
-        <string>...</string>
-       </property>
-       <property name="icon">
-        <iconset resource="resources.qrc">
-         <normaloff>:/icons/icons/savecanvas.svg</normaloff>:/icons/icons/savecanvas.svg</iconset>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1">
-      <widget class="QToolButton" name="UnZoomButton">
-       <property name="text">
-        <string>...</string>
-       </property>
-       <property name="icon">
-        <iconset resource="resources.qrc">
-         <normaloff>:/icons/icons/unzoom.svg</normaloff>:/icons/icons/unzoom.svg</iconset>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="0" colspan="11">
-      <widget class="QRootCanvas" name="canvas" native="true"/>
-     </item>
-     <item row="1" column="7">
-      <widget class="QLabel" name="asicLabel">
-       <property name="text">
-        <string>ASIC</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="9">
-      <widget class="QLabel" name="channelLabel">
-       <property name="text">
-        <string>Channel</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
-      <widget class="QToolButton" name="ClearButton">
-       <property name="text">
-        <string>...</string>
-       </property>
-       <property name="icon">
-        <iconset resource="resources.qrc">
-         <normaloff>:/icons/icons/reload.svg</normaloff>:/icons/icons/reload.svg</iconset>
-       </property>
-      </widget>
-     </item>
      <item row="1" column="8">
-      <widget class="QComboBox" name="asicBox">
+      <widget class="QComboBox" name="pairBox">
        <item>
         <property name="text">
          <string>0</string>
@@ -99,9 +38,129 @@
          <string>3</string>
         </property>
        </item>
+       <item>
+        <property name="text">
+         <string>4</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>5</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>6</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>7</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>8</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>9</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>10</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>11</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>12</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>13</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>14</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>15</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>16</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>17</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>18</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>19</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>20</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>21</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>22</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>23</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>24</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>25</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>26</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>27</string>
+        </property>
+       </item>
       </widget>
      </item>
-     <item row="1" column="10">
+     <item row="1" column="14">
       <widget class="QComboBox" name="channelBox">
        <item>
         <property name="text">
@@ -265,6 +324,101 @@
        </item>
       </widget>
      </item>
+     <item row="1" column="13">
+      <widget class="QLabel" name="channelLabel">
+       <property name="text">
+        <string>Channel</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="2">
+      <widget class="QToolButton" name="SaveButton">
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="icon">
+        <iconset resource="resources.qrc">
+         <normaloff>:/icons/icons/savecanvas.svg</normaloff>:/icons/icons/savecanvas.svg</iconset>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="10">
+      <widget class="QComboBox" name="sourceBox">
+       <item>
+        <property name="text">
+         <string>LG</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>HG</string>
+        </property>
+       </item>
+      </widget>
+     </item>
+     <item row="2" column="0" colspan="15">
+      <widget class="QRootCanvas" name="canvas" native="true"/>
+     </item>
+     <item row="1" column="11">
+      <widget class="QLabel" name="asicLabel">
+       <property name="text">
+        <string>ASIC</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="9">
+      <widget class="QLabel" name="sourceLabel">
+       <property name="text">
+        <string>Source</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="3">
+      <widget class="QToolButton" name="ScreenshotButton">
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="icon">
+        <iconset resource="resources.qrc">
+         <normaloff>:/icons/icons/screenshot.svg</normaloff>:/icons/icons/screenshot.svg</iconset>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QToolButton" name="ClearButton">
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="icon">
+        <iconset resource="resources.qrc">
+         <normaloff>:/icons/icons/reload.svg</normaloff>:/icons/icons/reload.svg</iconset>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="12">
+      <widget class="QComboBox" name="asicBox">
+       <item>
+        <property name="text">
+         <string>0</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>1</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>2</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>3</string>
+        </property>
+       </item>
+      </widget>
+     </item>
      <item row="1" column="6">
       <spacer name="horizontalSpacer">
        <property name="orientation">
@@ -278,6 +432,24 @@
        </property>
       </spacer>
      </item>
+     <item row="1" column="1">
+      <widget class="QToolButton" name="UnZoomButton">
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="icon">
+        <iconset resource="resources.qrc">
+         <normaloff>:/icons/icons/unzoom.svg</normaloff>:/icons/icons/unzoom.svg</iconset>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="7">
+      <widget class="QLabel" name="pairLabel">
+       <property name="text">
+        <string>ID</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
   </layout>
@@ -286,7 +458,7 @@
   <customwidget>
    <class>QRootCanvas</class>
    <extends>QWidget</extends>
-   <header location="global">qrootcanvas.h</header>
+   <header>qrootcanvas.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
diff --git a/plotwindow.ui b/plotwindow.ui
index a06c184b357270e778eacb65f177b5606c6d059e..1383933c2d9de2070b42d452d317cf290e3a35c7 100644
--- a/plotwindow.ui
+++ b/plotwindow.ui
@@ -100,7 +100,7 @@
         <number>0</number>
        </property>
        <item row="0" column="0">
-        <widget class="QCustomCanvas" name="LGCanvas" native="true"/>
+        <widget class="QCustomCanvas" name="pairCanvas" native="true"/>
        </item>
       </layout>
      </widget>
@@ -130,7 +130,7 @@
         <number>0</number>
        </property>
        <item row="0" column="0">
-        <widget class="QCustomCanvas" name="HGCanvas" native="true"/>
+        <widget class="QCustomCanvas" name="LGHGCanvas" native="true"/>
        </item>
       </layout>
      </widget>