]> jspc29.x-matter.uni-frankfurt.de Git - mvd_soft.git/commitdiff
add normalmode analysis
authorSamir Amar-Youcef <samir@ikf>
Tue, 31 Mar 2015 12:41:07 +0000 (14:41 +0200)
committerSamir Amar-Youcef <samir@ikf>
Tue, 31 Mar 2015 12:41:07 +0000 (14:41 +0200)
15 files changed:
normalmode/analysis_gui/ANA/Makefile [new file with mode: 0644]
normalmode/analysis_gui/ANA/Mi26Ana [new file with mode: 0755]
normalmode/analysis_gui/ANA/Mi26Ana.cpp [new file with mode: 0644]
normalmode/analysis_gui/ANA/Mi26Ana.h [new file with mode: 0644]
normalmode/analysis_gui/ANA/help.h [new file with mode: 0644]
normalmode/analysis_gui/ANA/main.cpp [new file with mode: 0644]
normalmode/analysis_gui/GUI/Makefile [new file with mode: 0644]
normalmode/analysis_gui/GUI/main.cpp [new file with mode: 0644]
normalmode/analysis_gui/GUI/nmode.cpp [new file with mode: 0644]
normalmode/analysis_gui/GUI/nmode.h [new file with mode: 0644]
normalmode/analysis_gui/GUI/nmode.ui [new file with mode: 0644]
normalmode/analysis_gui/GUI/runana.sh [new file with mode: 0755]
normalmode/analysis_gui/GUI/rununpack.sh [new file with mode: 0755]
normalmode/analysis_gui/readme.txt [new file with mode: 0644]
normalmode/unpacker/unpack.C

diff --git a/normalmode/analysis_gui/ANA/Makefile b/normalmode/analysis_gui/ANA/Makefile
new file mode 100644 (file)
index 0000000..0b7bb4f
--- /dev/null
@@ -0,0 +1,16 @@
+CC=g++\r
+CFLAGS=-c -g -Wall -std=c++11 `root-config --cflags`\r
+LDFLAGS=`root-config --glibs`\r
+CLDFLAGS = -std=c++11 `root-config --cflags --glibs` -lboost_system -lboost_filesystem \r
+SOURCES= main.cpp Mi26Ana.cpp Mi26Ana.h help.h\r
+OBJECTS=$(subst .cc,.o,$(SOURCES))\r
+EXECUTABLE=Mi26Ana\r
+\r
+all: $(SOURCES) $(EXECUTABLE)\r
+\r
+$(EXECUTABLE): $(OBJECTS)\r
+       $(CC) $(CLDFLAGS) $(OBJECTS) -o $@\r
+\r
+\r
+clean:\r
+       rm -f $(OBJS)\r
diff --git a/normalmode/analysis_gui/ANA/Mi26Ana b/normalmode/analysis_gui/ANA/Mi26Ana
new file mode 100755 (executable)
index 0000000..a2b291c
Binary files /dev/null and b/normalmode/analysis_gui/ANA/Mi26Ana differ
diff --git a/normalmode/analysis_gui/ANA/Mi26Ana.cpp b/normalmode/analysis_gui/ANA/Mi26Ana.cpp
new file mode 100644 (file)
index 0000000..894a06e
--- /dev/null
@@ -0,0 +1,722 @@
+#include "Mi26Ana.h"
+#include "help.h"
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH2.h>
+
+
+//####################################################################
+
+Mi26Ana::Mi26Ana() {                                                                                                                                   // ok
+       
+
+       fInputRootFile  = "";
+       fInputPxFile    = "";
+       fNPx                    = 0;
+       fMap                    = 0;
+}
+
+//####################################################################
+
+Mi26Ana::Mi26Ana( TString inFile, TString pxFile, int NPx, int Map ) {                                 // ok
+       
+       fInputRootFile  = inFile;
+       fInputPxFile    = pxFile;
+       fNPx                    = NPx;
+       fMap                    = Map;
+}
+
+//####################################################################
+
+Mi26Ana::~Mi26Ana() {
+       
+       delete[] fNPxFound_arr;
+}
+
+//####################################################################
+
+void Mi26Ana::Exec(int Mode) {
+// Open Root-File
+       fFile   = new TFile(fInputRootFile);
+       cout<<"--------------------------------"<<endl;
+       cout<<"Link file: "<<fInputRootFile<<endl;
+       cout<<"--------------------------------"<<endl;
+       fSensorspresent = 0;
+       
+       if (fFile==0)   { cout<<"Cannot read file!"<<endl; return; }
+       
+       for(Int_t sensorNr=0; sensorNr<MAXSENSORS; sensorNr++)
+       {
+               fSensor[sensorNr] = (TTree*)fFile->Get(Form("sensor%i",sensorNr));
+               
+               if( !fSensor[0] ) { cout<<"Cannot read file!"<<endl; return; }
+               
+               if( fSensor[sensorNr] )
+               {
+                       fNentries[sensorNr] = (UInt_t)fSensor[sensorNr]->GetEntries();
+                       
+                       fSensor[sensorNr]->SetBranchAddress     ("event"                        , &fEvent                       );
+                       fSensor[sensorNr]->SetBranchAddress     ("framenr"                      , &fFramenr                     );
+                       fSensor[sensorNr]->SetBranchAddress     ("sensorid"                     , &fSensorid            );
+                       fSensor[sensorNr]->SetBranchAddress     ("status"                       , &fStatus                      );
+                       fSensor[sensorNr]->SetBranchAddress     ("datalengthcount"      , &fDatalengthcount     );
+                       fSensor[sensorNr]->SetBranchAddress     ("datalength"           , &fDatalength          );
+                       fSensor[sensorNr]->SetBranchAddress     ("timestamp"            , &fTimestamp           );
+                       fSensor[sensorNr]->SetBranchAddress     ("debug"                        , &fDebug                       );
+                       fSensor[sensorNr]->SetBranchAddress     ("states"                       , &fStates                      );
+                       fSensor[sensorNr]->SetBranchAddress     ("row"                          , fRow                          );
+                       fSensor[sensorNr]->SetBranchAddress     ("column"                       , fColumn                       );
+                       fSensor[sensorNr]->SetBranchAddress     ("nextn"                        , fNextn                        );
+                       fSensor[sensorNr]->SetBranchAddress     ("overflow"                     , fOverflow                     );
+                       fSensor[sensorNr]->SetBranchAddress     ("clusters"                     , &fClusters            );
+                       fSensor[sensorNr]->SetBranchAddress     ("pixelsPerCluster"     , fPixelsPerCluster     );
+                       fSensor[sensorNr]->SetBranchAddress     ("statesPerCluster"     , fStatesPerCluster     );
+                       fSensor[sensorNr]->SetBranchAddress     ("row_cg"                       , fRow_cg                       );
+                       fSensor[sensorNr]->SetBranchAddress     ("column_cg"            , fColumn_cg            );
+                       fSensor[sensorNr]->SetBranchAddress     ("shapecode"            , fShapeCode            );
+                       fSensor[sensorNr]->SetBranchAddress     ("dx"                           , fDx                           );
+                       fSensor[sensorNr]->SetBranchAddress     ("dy"                           , fDy                           );
+                       
+                       printf("Sensor No. %3i  --> %10i Entries\n", sensorNr, fNentries[sensorNr] );
+                       fSensorspresent++;
+               }
+               else
+               {
+                       break;
+               }
+       }
+       fSensorspresent=1;
+       cout<<"--------------------------------"<<endl;
+       cout<<" ==> "<< fSensorspresent <<" sensors found!"<<endl;
+       cout<<"--------------------------------"<<endl;
+       
+// Read Pixel File
+       fNPxFound = readPxFile();
+// // fFilename
+//     char    longFile[256]   = "";
+//     char    shortFile[256]  = "";
+//     
+//     strcpy  (longFile, fInputRootFile);
+//     
+//     uint namelength = strlen(longFile);                     
+//     uint pos = 0;
+//     for(uint i=0;   i<namelength;i++)       { if ( longFile[i]=='/' ) { pos=i+1;} }
+//     for(uint i=pos; i<namelength;i++)       { shortFile[i-pos]=longFile[i];          }
+       
+// Exec
+       if              ( Mode == 0 )   { remove();             }
+       else if ( Mode == 1 )   { pixelocc2();  }
+       else if ( Mode == 2 )   { pixelocc3();  }
+       else if ( Mode == 3 )   { pixeloccHT(); }
+       else if ( Mode == 4 )   { pixeloccH3(); }
+}
+
+//####################################################################
+
+void Mi26Ana::remove() {
+       
+       if( fMap==0 )   { MostNoisy     (); }
+       else                    { Map           (); }
+       
+}
+
+//####################################################################
+
+void Mi26Ana::pixelocc2() {
+       
+       Int_t*  pixmulti = new Int_t[1152*576];
+       UInt_t  pixel;
+       UInt_t  maxel;
+               
+       TH1F* plot[fSensorspresent];
+       TCanvas*        cm1 = new TCanvas("pixmulit2","pixmulit2",50,100,700,400);
+       cm1->Divide(fSensorspresent,1);
+               
+       for(Int_t sensor=0;sensor<fSensorspresent;sensor++)
+       {
+// Find noisy pixels:
+               for(UInt_t i=0;i<1152*576;i++)  { pixmulti[i]=0;        }
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       for(UInt_t j=0; j<fStates; j++)
+                       {
+                               for(UInt_t k=0; k<fNextn[j]+1; k++)
+                               {
+                                       pixel = fRow[j]*1152 + fColumn[j] + k;
+                               
+                                       if( pixel<1152*576 )
+                                       {
+                                               pixmulti[pixel]++;
+                                       }
+                               }
+                       }
+               }
+               
+               maxel = TMath::MaxElement(1152*576,pixmulti);
+               if(maxel==0) {maxel=1;}
+               plot[sensor] = new TH1F(Form("pixmulti sensor%i",sensor) ,"Pixel Multiplicity"  , maxel, 0, maxel);
+               
+               for(int i=0;i<1152*576;i++)
+               {
+                       plot[sensor]->Fill(pixmulti[i]);
+               }
+               
+               cm1->cd(1+sensor);
+               plot[sensor]->Draw();
+               plot[sensor]->SetLineColor(2);
+               plot[sensor]->GetXaxis()->SetTitle("Pixel Multiplicity");
+               plot[sensor]->GetYaxis()->SetTitle("Number of Pixels");
+               plot[sensor]->GetXaxis()->CenterTitle();
+               plot[sensor]->GetYaxis()->CenterTitle();
+               gPad->SetLogy();
+       }
+}
+
+//####################################################################
+
+void Mi26Ana::pixelocc3() {
+               
+       TH2F* plot[fSensorspresent];
+       TCanvas*        cm1 = new TCanvas("pixmulit3","pixmulit3",50,100,700,400);
+       cm1->Divide(fSensorspresent,1);
+               
+       for(Int_t sensor=0;sensor<fSensorspresent;sensor++)
+       {
+               plot[sensor] = new TH2F(Form("pixmulti sensor%i",sensor) ,"Pixel Multiplicity", 1152,0,1152,576,0,576);
+               
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       for(UInt_t j=0; j<fStates; j++)
+                       {
+                               for(UInt_t k=0; k<fNextn[j]+1; k++)
+                               {
+                                       plot[sensor]->Fill(fColumn[j]+k, fRow[j]);
+                               }
+                       }
+               }
+               
+               cm1->cd(1+sensor);
+               plot[sensor]->Draw("colz");
+               plot[sensor]->GetXaxis()->SetTitle("Column#");
+               plot[sensor]->GetYaxis()->SetTitle("Row#");
+               plot[sensor]->GetXaxis()->CenterTitle();
+               plot[sensor]->GetYaxis()->CenterTitle();
+       }
+       
+}
+
+//####################################################################
+
+void Mi26Ana::pixeloccHT() {
+       
+       TH1F* plot[fSensorspresent];
+       TCanvas*        cm1 = new TCanvas("hitmulitTime","hitmulitTime",50,100,700,400);
+       cm1->Divide(fSensorspresent,1);
+       
+       int bins = fNentries[0]/8681;
+       int sum;
+       
+               
+       for(Int_t sensor=0;sensor<fSensorspresent;sensor++)
+       {
+               plot[sensor] = new TH1F(Form("hitmulti sensor%i",sensor) ,"Hit Multiplicity", bins,0,bins);
+               sum=0;
+               
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       sum+=fClusters;
+                       if( i%8681==0 && i!=0 )
+                       {
+                               cout<<setw(10)<<right<<setprecision(3)<< 115.2/1000000*i-1.;
+                               cout<<setw(10)<<right<<setprecision(3)<< sum;
+                               cout<<endl;
+                               
+                               plot[sensor]->Fill(115.2/1000000*i-1., sum );
+                               sum=0;
+                       }
+               }
+               
+               cm1->cd(1+sensor);
+               plot[sensor]->SetStats(false);
+               plot[sensor]->SetLineColor(kRed);
+               plot[sensor]->SetMarkerStyle(20);
+               plot[sensor]->SetMarkerSize     (0.5);
+               plot[sensor]->Draw();
+               plot[sensor]->GetXaxis()->SetTitle("Time [sec.]");
+//             plot[sensor]->GetXaxis()->SetTitleColor(4);
+//             plot[sensor]->GetXaxis()->SetTitleOffset(0.5);
+               plot[sensor]->GetYaxis()->SetTitle("Hits per sec.");
+//             plot[sensor]->GetYaxis()->SetTitleColor(4);
+               plot[sensor]->GetYaxis()->SetTitleOffset(1.5);
+               plot[sensor]->GetXaxis()->CenterTitle();
+               plot[sensor]->GetYaxis()->CenterTitle();
+//             plot[sensor]->SetAxisRange(0., bins,"X");
+       }
+}
+
+//####################################################################
+
+void Mi26Ana::pixeloccH3() {
+       
+       TH2F* plot[fSensorspresent];
+       TCanvas*        cm1 = new TCanvas("hitmulit3","hitmulit3",50,100,700,400);
+       cm1->Divide(fSensorspresent,1);
+               
+       for(Int_t sensor=0;sensor<fSensorspresent;sensor++)
+       {
+               plot[sensor] = new TH2F(Form("hitmulti sensor%i",sensor) ,"Hit Multiplicity", 1152,0,1152,576,0,576);
+               
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       for(UInt_t j=0; j<fClusters; j++)
+                       {
+                                       plot[sensor]->Fill(fColumn_cg[j], fRow_cg[j]);
+                       }
+               }
+               
+               cm1->cd(1+sensor);
+               plot[sensor]->Draw("colz");
+               plot[sensor]->GetXaxis()->SetTitle("Column#");
+               plot[sensor]->GetYaxis()->SetTitle("Row#");
+               plot[sensor]->GetXaxis()->CenterTitle();
+               plot[sensor]->GetYaxis()->CenterTitle();
+       }
+}
+
+//####################################################################
+//####################################################################
+//####################################################################
+
+void Mi26Ana::Map() {
+       
+       cout<<"Note: Only one hard-coded Sensor processed!"<<endl;
+       if( fNPxFound==0 )      { cout<<"No pixels in Map!"<<endl; return; }
+       cout<<"Using noisy pixels from map:"<<endl<<fInputPxFile<<endl;
+       char Filename   [512];
+       cout<<"-------------"<<endl;
+       strcpy  (Filename, fInputRootFile); 
+       strcat  (Filename, "tmp");
+       TFile*  OutputFile = new TFile(Filename,"RECREATE");
+       
+       TTree*  Sensor[MAXSENSORS];
+       
+       UInt_t          event;
+       UInt_t          framenr;
+       UShort_t        sensorid;
+       UInt_t          status;
+       UShort_t        datalengthcount;
+       UShort_t        datalength;
+       ULong64_t       timestamp;
+       ULong64_t       debug;
+       UInt_t          states;
+       UInt_t          row                                     [MAXSTATES];
+       UInt_t          column                          [MAXSTATES];
+       UInt_t          nextn                           [MAXSTATES];
+       UInt_t          overflow                        [MAXSTATES];
+       UInt_t          clusters;
+       UInt_t          pixelsPerCluster        [MAXSTATES];
+       UInt_t          statesPerCluster        [MAXSTATES];
+       Float_t         row_cg                          [MAXSTATES];
+       Float_t         column_cg                       [MAXSTATES];
+       UInt_t          shapecode                       [MAXSTATES];
+       UInt_t          dx                                      [MAXSTATES];
+       UInt_t          dy                                      [MAXSTATES];
+       
+       Int_t   pixel;
+       UInt_t  NoisyPixels = fNPxFound;
+       bool    NOISYPIXEL;
+       Int_t*  hitmulti        = new Int_t[1152*576];
+       UInt_t  ROW, COLUMN;
+       UInt_t  count, countF;
+// Progress bar
+       uint    progress_tmp=-1;
+       uint    progress;
+       
+       for(Int_t i=0; i<MAXSENSORS; i++)
+       {
+               Sensor[i]               = new TTree(Form("sensor%i",i), Form("sensor%i",i));
+               
+               Sensor[i]->Branch("event"                               , &event                        , "event/i"                                                     , BUFSIZE);
+               Sensor[i]->Branch("framenr"                             , &framenr                      , "framenr/i"                                           , BUFSIZE);
+               Sensor[i]->Branch("sensorid"                    , &sensorid                     , "sensorid/s"                                          , BUFSIZE);
+               Sensor[i]->Branch("status"                              , &status                       , "status/i"                                            , BUFSIZE);
+               Sensor[i]->Branch("datalength"                  , &datalength           , "datalength/s"                                        , BUFSIZE);
+               Sensor[i]->Branch("datalengthcount"             , &datalengthcount      , "datalengthcount/s"                           , BUFSIZE);     
+               Sensor[i]->Branch("states"                              , &states                       , "states/i"                                            , BUFSIZE);
+               Sensor[i]->Branch("clusters"                    , &clusters                     , "clusters/i"                                          , BUFSIZE);
+               Sensor[i]->Branch("timestamp"                   , &timestamp            , "timestamp/l"                                         , BUFSIZE);
+               Sensor[i]->Branch("debug"                               , &debug                        , "debug/l"                                                     , BUFSIZE);
+               Sensor[i]->Branch("row"                                 , row                           , "row                          [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("column"                              , column                        , "column                       [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("nextn"                               , nextn                         , "nextn                        [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("overflow"                    , overflow                      , "overflow                     [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("pixelsPerCluster"    , pixelsPerCluster      , "pixelsPerCluster     [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("statesPerCluster"    , statesPerCluster      , "statesPerCluster     [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("row_cg"                              , row_cg                        , "row_cg                       [clusters]/F"   , BUFSIZE);
+               Sensor[i]->Branch("column_cg"                   , column_cg                     , "column_cg            [clusters]/F"   , BUFSIZE);
+               Sensor[i]->Branch("shapecode"                   , shapecode                     , "shapecode            [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("dx"                                  , dx                            , "dx                           [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("dy"                                  , dy                            , "dy                           [clusters]/i"   , BUFSIZE);
+       }
+       
+// Loop
+       for(Int_t sensor=0;sensor<1;sensor++)
+//     for(Int_t sensor=0;sensor<fSensorspresent;sensor++)
+       {
+// Find noisy pixels:
+               for(UInt_t i=0;i<1152*576;i++)  { hitmulti[i]=0;        }
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       for(UInt_t j=0; j<fStates; j++)
+                       {
+                               for(UInt_t k=0; k<fNextn[j]+1; k++)
+                               {
+                                       pixel = fRow[j]*1152 + fColumn[j] + k;
+                               
+                                       if( pixel<1152*576 )
+                                       {
+                                               hitmulti[pixel]++;
+                                       }
+                               }
+                       }
+               }
+               
+// Remove noisy pixels
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       event                   = fEvent;
+                       framenr                 = fFramenr;
+                       sensorid                = fSensorid;
+                       status                  = fStatus;
+                       timestamp               = fTimestamp;
+                       clusters                = 0;
+                       
+                       for(UInt_t j=0; j<fClusters; j++)
+                       {
+                               NOISYPIXEL = false;
+                               
+                               for(UInt_t k=0; k<NoisyPixels;k++)
+                               {
+                                       if(!NOISYPIXEL)
+                                       {
+                                               ROW             = fNPxFound_arr[k]/1152;
+                                               COLUMN  = fNPxFound_arr[k]%1152;
+                                               
+                                               if( fPixelsPerCluster[j] == 1 )
+                                               {
+                                                       if( ROW==(UInt_t)fRow_cg[j] && COLUMN==(UInt_t)fColumn_cg[j] )          { NOISYPIXEL = true; }
+                                                       if( fColumn_cg[j]==0 && fRow_cg[j]==0 )                                                         { NOISYPIXEL = true; }
+                                               }
+                                       }
+                               }
+                               
+                               if(!NOISYPIXEL)
+                               {
+                                       row_cg                          [clusters]      = fRow_cg                       [j];
+                                       column_cg                       [clusters]      = fColumn_cg            [j];
+                                       pixelsPerCluster        [clusters]      = fPixelsPerCluster     [j];
+//                                     statesPerCluster        [clusters]      = fStatesPerCluster     [j];
+                                       shapecode                       [clusters]      = fShapeCode            [j];
+//                                     dx                                      [clusters]      = fDx                           [j];
+//                                     dy                                      [clusters]      = fDy                           [j];
+                                       clusters++;
+                               }
+                       }
+                       
+                       Sensor[sensor]->Fill();
+//-------
+                       progress = (Int_t)((i*100)/(fNentries[sensor]-1)*10);
+                       if(progress!=progress_tmp)      { print_progress( ((i*100.)/(fNentries[sensor]-1)) ); progress_tmp=progress;}
+//-------
+               }
+//----------------------
+               count =0;
+               countF=0;
+               for(UInt_t k=0; k<NoisyPixels;k++)
+               {
+                               count++;
+                               countF+=hitmulti[fNPxFound_arr[k]];
+               }
+               cout<<"Remove "<<count<<" Pixels, together firing "<<countF<<" times!"<<endl;
+//----------------------
+       }
+
+
+//---------------------------------------------
+       cout<<"-------------"<<endl;
+       printf("\r Write data for Sensor:\n");
+       for(Int_t i=0; i<fSensorspresent; i++)
+       {
+               Sensor[i]       ->Write("",TObject::kOverwrite);
+               printf(" ->%3i\n", i);
+       }
+       
+       OutputFile->Save();
+       OutputFile->Close();
+       
+//----------------------------------------
+       char    Commando[512];
+       strcpy  (Commando, "mv "                        ); 
+       strcat  (Commando, Filename                     );
+       strcat  (Commando, " "                          );
+       strcat  (Commando, fInputRootFile       );
+       system  (Commando);
+//----------------------------------------     
+       
+       delete[] hitmulti;
+       
+}
+
+//####################################################################
+
+void Mi26Ana::MostNoisy() {
+       
+       cout<<"Note: Only one hard-coded Sensor processed!"<<endl;
+       cout<<"-------------"<<endl;
+       char Filename   [512];
+       strcpy  (Filename, fInputRootFile); 
+       strcat  (Filename, "tmp");
+       TFile*  OutputFile = new TFile(Filename,"RECREATE");
+       
+       TTree*  Sensor[MAXSENSORS];
+       
+       UInt_t          event;
+       UInt_t          framenr;
+       UShort_t        sensorid;
+       UInt_t          status;
+       UShort_t        datalengthcount;
+       UShort_t        datalength;
+       ULong64_t       timestamp;
+       ULong64_t       debug;
+       UInt_t          states;
+       UInt_t          row                                     [MAXSTATES];
+       UInt_t          column                          [MAXSTATES];
+       UInt_t          nextn                           [MAXSTATES];
+       UInt_t          overflow                        [MAXSTATES];
+       UInt_t          clusters;
+       UInt_t          pixelsPerCluster        [MAXSTATES];
+       UInt_t          statesPerCluster        [MAXSTATES];
+       Float_t         row_cg                          [MAXSTATES];
+       Float_t         column_cg                       [MAXSTATES];
+       UInt_t          shapecode                       [MAXSTATES];
+       UInt_t          dx                                      [MAXSTATES];
+       UInt_t          dy                                      [MAXSTATES];
+       
+       Int_t   pixel;
+       UInt_t  NoisyPixels = fNPx;
+       bool    NOISYPIXEL;
+       Int_t*  hitmulti        = new Int_t[1152*576];
+       Int_t*  noisyPixels     = new Int_t[1152*576];
+       UInt_t  ROW, COLUMN;
+       UInt_t  count, countF;
+// Progress bar
+       uint    progress_tmp=-1;
+       uint    progress;
+       
+       for(Int_t i=0; i<MAXSENSORS; i++)
+       {
+               Sensor[i]               = new TTree(Form("sensor%i",i), Form("sensor%i",i));
+               
+               Sensor[i]->Branch("event"                               , &event                        , "event/i"                                                     , BUFSIZE);
+               Sensor[i]->Branch("framenr"                             , &framenr                      , "framenr/i"                                           , BUFSIZE);
+               Sensor[i]->Branch("sensorid"                    , &sensorid                     , "sensorid/s"                                          , BUFSIZE);
+               Sensor[i]->Branch("status"                              , &status                       , "status/i"                                            , BUFSIZE);
+               Sensor[i]->Branch("datalength"                  , &datalength           , "datalength/s"                                        , BUFSIZE);
+               Sensor[i]->Branch("datalengthcount"             , &datalengthcount      , "datalengthcount/s"                           , BUFSIZE);     
+               Sensor[i]->Branch("states"                              , &states                       , "states/i"                                            , BUFSIZE);
+               Sensor[i]->Branch("clusters"                    , &clusters                     , "clusters/i"                                          , BUFSIZE);
+               Sensor[i]->Branch("timestamp"                   , &timestamp            , "timestamp/l"                                         , BUFSIZE);
+               Sensor[i]->Branch("debug"                               , &debug                        , "debug/l"                                                     , BUFSIZE);
+               Sensor[i]->Branch("row"                                 , row                           , "row                          [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("column"                              , column                        , "column                       [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("nextn"                               , nextn                         , "nextn                        [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("overflow"                    , overflow                      , "overflow                     [states]/i"             , BUFSIZE);
+               Sensor[i]->Branch("pixelsPerCluster"    , pixelsPerCluster      , "pixelsPerCluster     [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("statesPerCluster"    , statesPerCluster      , "statesPerCluster     [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("row_cg"                              , row_cg                        , "row_cg                       [clusters]/F"   , BUFSIZE);
+               Sensor[i]->Branch("column_cg"                   , column_cg                     , "column_cg            [clusters]/F"   , BUFSIZE);
+               Sensor[i]->Branch("shapecode"                   , shapecode                     , "shapecode            [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("dx"                                  , dx                            , "dx                           [clusters]/i"   , BUFSIZE);
+               Sensor[i]->Branch("dy"                                  , dy                            , "dy                           [clusters]/i"   , BUFSIZE);
+       }
+       
+// Loop
+       for(Int_t sensor=0;sensor<1;sensor++)
+//     for(Int_t sensor=0;sensor<fSensorspresent;sensor++)
+       {
+// Find noisy pixels:
+               for(UInt_t i=0;i<1152*576;i++)  { hitmulti[i]=0;        }
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       for(UInt_t j=0; j<fStates; j++)
+                       {
+                               for(UInt_t k=0; k<fNextn[j]+1; k++)
+                               {
+                                       pixel = fRow[j]*1152 + fColumn[j] + k;
+                               
+                                       if( pixel<1152*576 )
+                                       {
+                                               hitmulti[pixel]++;
+                                       }
+                               }
+                       }
+               }
+               
+               TMath::Sort(1152*576, hitmulti, noisyPixels     , kTRUE);
+               
+// Remove noisy pixels
+               for(UInt_t i=0;i<fNentries[sensor];i++)
+               {
+                       fSensor[sensor]->GetEntry(i);
+                       
+                       event                   = fEvent;
+                       framenr                 = fFramenr;
+                       sensorid                = fSensorid;
+                       status                  = fStatus;
+                       timestamp               = fTimestamp;
+                       clusters                = 0;
+                       
+                       for(UInt_t j=0; j<fClusters; j++)
+                       {
+                               NOISYPIXEL = false;
+                               
+                               for(UInt_t k=0; k<NoisyPixels;k++)
+                               {
+                                       if(!NOISYPIXEL)
+                                       {
+                                               ROW             = noisyPixels[k]/1152;
+                                               COLUMN  = noisyPixels[k]%1152;
+                                               
+                                               if( fPixelsPerCluster[j] == 1 )
+                                               {
+                                                       if( ROW==(UInt_t)fRow_cg[j] && COLUMN==(UInt_t)fColumn_cg[j] )          { NOISYPIXEL = true; }
+                                                       if( fColumn_cg[j]==0 && fRow_cg[j]==0 )                                                         { NOISYPIXEL = true; }
+                                               }
+                                       }
+                               }
+                               
+                               if(!NOISYPIXEL)
+                               {
+                                       row_cg                          [clusters]      = fRow_cg                       [j];
+                                       column_cg                       [clusters]      = fColumn_cg            [j];
+                                       pixelsPerCluster        [clusters]      = fPixelsPerCluster     [j];
+//                                     statesPerCluster        [clusters]      = fStatesPerCluster     [j];
+                                       shapecode                       [clusters]      = fShapeCode            [j];
+//                                     dx                                      [clusters]      = fDx                           [j];
+//                                     dy                                      [clusters]      = fDy                           [j];
+                                       clusters++;
+                               }
+                       }
+                       
+                       Sensor[sensor]->Fill();
+//-------
+                       progress = (Int_t)((i*100)/(fNentries[sensor]-1)*10);
+                       if(progress!=progress_tmp)      { print_progress( ((i*100.)/(fNentries[sensor]-1)) ); progress_tmp=progress;}
+//-------
+               }
+//----------------------
+               count =0;
+               countF=0;
+               for(UInt_t k=0; k<NoisyPixels;k++)
+               {
+                       if( hitmulti[noisyPixels[k]]!=0 )
+                       {
+                               count++;
+                               countF+=hitmulti[noisyPixels[k]];
+                       }
+               }
+               cout<<"Remove "<<count<<" Pixels, together firing "<<countF<<" times!"<<endl;
+               
+               if(count!=0)
+               {
+                       fstream myfile;
+                       myfile.open( fInputPxFile , ios::out );
+                       
+                       myfile << count <<" ";
+                       
+                       for(UInt_t k=0; k<NoisyPixels;k++)
+                       {
+                               if( hitmulti[noisyPixels[k]]!=0 )
+                               {
+                                       myfile << noisyPixels[k] <<" ";
+                               }
+                       }
+                       
+                       myfile <<endl;
+                       myfile.close();
+               }
+//----------------------
+       }
+
+
+//---------------------------------------------
+       cout<<"-------------"<<endl;
+       printf("\r Write data for Sensor:\n");
+       for(Int_t i=0; i<fSensorspresent; i++)
+       {
+               Sensor[i]       ->Write("",TObject::kOverwrite);
+               printf(" ->%3i\n", i);
+       }
+       
+       OutputFile->Save();
+       OutputFile->Close();
+       
+//----------------------------------------
+       char    Commando[512];
+       strcpy  (Commando, "mv "                        ); 
+       strcat  (Commando, Filename                     );
+       strcat  (Commando, " "                          );
+       strcat  (Commando, fInputRootFile       );
+       system  (Commando);
+//----------------------------------------     
+       delete[] hitmulti;
+       delete[] noisyPixels;
+       
+}
+
+//####################################################################
+
+int Mi26Ana::readPxFile() {
+       
+       ifstream myfile( fInputPxFile, std::ifstream::in );
+       
+       if(!myfile.good())
+       {
+               fNPxFound_arr = new int[1];
+               return 0;
+       }
+       
+       myfile >> fNPxFound;
+       
+       fNPxFound_arr = new int[fNPxFound];
+       
+       int count=0;
+       int     pix;
+       
+       while( myfile.good() )
+       {
+               myfile >> pix;
+               if( count<fNPxFound )   { fNPxFound_arr[count] = pix; }
+               count++;
+               
+               if(count==fNPxFound) break;
+       }
+       
+       if( count==fNPxFound )  { return fNPxFound;     }
+       else                                    { return 0;                     }
+}
+
+//####################################################################
\ No newline at end of file
diff --git a/normalmode/analysis_gui/ANA/Mi26Ana.h b/normalmode/analysis_gui/ANA/Mi26Ana.h
new file mode 100644 (file)
index 0000000..c54b03b
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef Mi26Ana_H
+#define Mi26Ana_H
+
+#define MAXSENSORS                     64
+#define MAXSTATES                      1140
+#define BUFSIZE                                32000
+
+#include <iostream>
+#include <fstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <iomanip> 
+#include <sstream>
+
+#include "TCanvas.h"
+#include "TRootCanvas.h"
+#include <TFile.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include "TH1.h"
+#include "TF1.h"
+#include "TSystem.h"
+#include <TTree.h>
+#include "TROOT.h"
+#include "TMath.h"
+// #include "TSystem.h"
+
+using namespace std;
+
+class Mi26Ana {
+
+private:
+// TTrees
+       TFile*          fFile;
+       TTree*          fSensor                         [MAXSENSORS];
+       UInt_t          fNentries                       [MAXSENSORS];
+       UInt_t          fSensorspresent;
+       
+       UInt_t          fEvent;
+       UInt_t          fFramenr;
+       UShort_t        fSensorid;
+       UInt_t          fStatus;
+       UShort_t        fDatalengthcount;
+       UShort_t        fDatalength;
+       ULong64_t       fTimestamp;
+       ULong64_t       fDebug;
+       UInt_t          fStates;
+       UInt_t          fRow                            [MAXSTATES];
+       UInt_t          fColumn                         [MAXSTATES];
+       UInt_t          fNextn                          [MAXSTATES];
+       UInt_t          fOverflow                       [MAXSTATES];
+       UInt_t          fClusters;
+       UInt_t          fPixelsPerCluster       [MAXSTATES];
+       UInt_t          fStatesPerCluster       [MAXSTATES];
+       Float_t         fRow_cg                         [MAXSTATES];
+       Float_t         fColumn_cg                      [MAXSTATES];
+       UInt_t          fShapeCode                      [MAXSTATES];
+       UInt_t          fDx                                     [MAXSTATES];
+       UInt_t          fDy                                     [MAXSTATES];
+       
+private:
+       void remove                     ();
+       void pixelocc2          ();
+       void pixelocc3          ();
+       void pixeloccHT         ();
+       void pixeloccH3         ();
+       void empty1                     ();
+       void empty2                     ();
+       
+       void Map                        ();
+       void MostNoisy          ();
+       int     readPxFile              ();
+       
+       TString fInputRootFile;
+       TString fInputPxFile;
+       int             fMap;
+       int             fNPx;
+       int             fNPxFound;
+       int*    fNPxFound_arr;
+       
+public:
+       Mi26Ana();
+       Mi26Ana( TString, TString, int, int ); 
+       ~Mi26Ana();
+       
+       void Exec               (int);
+       
+       void setInFile  (TString name)  { fInputRootFile= name; }
+       void setPxFile  (TString name)  { fInputPxFile  = name; }
+       void setNPx             (int val)               { fNPx                  = val;  }
+       void setMap             (int val)               { fMap                  = val;  }
+};
+
+#endif // Mi26Ana_H
\ No newline at end of file
diff --git a/normalmode/analysis_gui/ANA/help.h b/normalmode/analysis_gui/ANA/help.h
new file mode 100644 (file)
index 0000000..5ee6558
--- /dev/null
@@ -0,0 +1,92 @@
+#ifndef HELP_H
+#define HELP_H
+
+#include <iostream>
+#include <cstdlib>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "TStopwatch.h"
+
+//####################################################################
+
+Int_t print_progress(Float_t ProgressInPercent) {
+       
+       Int_t nCharacter = printf("\r [");
+       Int_t iBlock;
+       
+       for( iBlock=0; iBlock<ProgressInPercent/2; ++iBlock )
+       {
+               putchar( '=' );
+               nCharacter++;
+       }
+       
+       for( ; iBlock<100/2; ++iBlock )
+       {
+               putchar( ' ' );
+               nCharacter++;
+       }
+       
+//     Int_t sec       = TimeInSec%60;
+//     Int_t min       = TimeInSec/60;
+//     Int_t hours     = TimeInSec/3600;
+       
+       nCharacter += printf( "] %4.0f%%", ProgressInPercent);
+       fflush( stdout );
+       
+       if((Int_t)ProgressInPercent==100) 
+       {
+               printf("\r");
+               for(Int_t i=0; i<nCharacter; i++)
+               {
+                       putchar( ' ' );
+               }
+               printf("\r ... done! \n");
+       }
+       
+       return nCharacter;
+}
+
+//####################################################################
+
+Int_t print_progress(Float_t ProgressInPercent, Int_t TimeInSec) {
+       
+       Int_t nCharacter = printf("\r [");
+       Int_t iBlock;
+       
+       for( iBlock=0; iBlock<ProgressInPercent/2; ++iBlock )
+       {
+               putchar( '=' );
+               nCharacter++;
+       }
+       
+       for( ; iBlock<100/2; ++iBlock )
+       {
+               putchar( ' ' );
+               nCharacter++;
+       }
+       
+       Int_t sec       = TimeInSec%60;
+       Int_t min       = TimeInSec/60;
+       Int_t hours     = TimeInSec/3600;
+       
+       nCharacter += printf( "] %6.2f%% \t %3i:%02i:%02i   ", ProgressInPercent, hours, min, sec );
+       fflush( stdout );
+       
+       if(ProgressInPercent==100) 
+       {
+               printf("\r");
+               for(Int_t i=0; i<nCharacter; i++)
+               {
+                       putchar( ' ' );
+               }
+               printf("\r ...done! \t ( %i:%02i:%02i ) \n", hours, min, sec );
+       }
+       
+       return nCharacter;
+}
+
+//####################################################################
+#endif
\ No newline at end of file
diff --git a/normalmode/analysis_gui/ANA/main.cpp b/normalmode/analysis_gui/ANA/main.cpp
new file mode 100644 (file)
index 0000000..e0a4079
--- /dev/null
@@ -0,0 +1,33 @@
+#include "Mi26Ana.h"
+#include "TApplication.h"
+
+
+int main(int argc, char** argv) {
+       
+       gROOT->Reset();
+       
+       const char* InFile;
+       const char* PxFile;
+       int                     Mode;
+       int                     NPx;            // Pixelnummer
+       int                     Map;
+       
+       stringstream strValue;
+       
+       if (argc>1) InFile      = argv[1]; 
+       if (argc>2) PxFile      = argv[2];
+       if (argc>3) strValue<<argv[3]; strValue >> Mode;        strValue.clear();
+       if (argc>4) strValue<<argv[4]; strValue >> NPx;         strValue.clear();
+       if (argc>5) strValue<<argv[5]; strValue >> Map;         strValue.clear();
+               
+       TApplication theApp("Analysis", &argc, argv);
+       
+       Mi26Ana* ana = new Mi26Ana();
+       ana->setInFile  (InFile);
+       ana->setPxFile  (PxFile);
+       ana->setNPx             (NPx);
+       ana->setMap             (Map);
+       ana->Exec               (Mode);
+       delete ana;
+       theApp.Run();
+}
\ No newline at end of file
diff --git a/normalmode/analysis_gui/GUI/Makefile b/normalmode/analysis_gui/GUI/Makefile
new file mode 100644 (file)
index 0000000..ec9a2dd
--- /dev/null
@@ -0,0 +1,240 @@
+#############################################################################
+# Makefile for building: nmode
+# Generated by qmake (2.01a) (Qt 4.8.5) on: Wed Mar 25 16:26:40 2015
+# Project:  nmode.pro
+# Template: app
+# Command: /usr/bin/qmake -o Makefile nmode.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC            = gcc
+CXX           = g++
+DEFINES       = -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH       = -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I$(ROOTSYS)/include -I. -I.
+LINK          = g++
+LFLAGS        = -Wl,-O1
+LIBS          = $(SUBLIBS)  -L/usr/lib64 -L$(ROOTSYS)/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lGui -lRGL -lQtGui -L/usr/lib64 -L/usr/X11R6/lib -lQtCore -lpthread 
+AR            = ar cqs
+RANLIB        = 
+QMAKE         = /usr/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+STRIP         = strip
+INSTALL_FILE  = install -m 644 -p
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR   = ./
+
+####### Files
+
+SOURCES       = main.cpp \
+               nmode.cpp moc_nmode.cpp
+OBJECTS       = main.o \
+               nmode.o \
+               moc_nmode.o
+DIST          = /usr/share/qt4/mkspecs/common/unix.conf \
+               /usr/share/qt4/mkspecs/common/linux.conf \
+               /usr/share/qt4/mkspecs/common/gcc-base.conf \
+               /usr/share/qt4/mkspecs/common/gcc-base-unix.conf \
+               /usr/share/qt4/mkspecs/common/g++-base.conf \
+               /usr/share/qt4/mkspecs/common/g++-unix.conf \
+               /usr/share/qt4/mkspecs/qconfig.pri \
+               /usr/share/qt4/mkspecs/modules/qt_phonon.pri \
+               /usr/share/qt4/mkspecs/modules/qt_webkit.pri \
+               /usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /usr/share/qt4/mkspecs/features/qt_config.prf \
+               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /usr/share/qt4/mkspecs/features/default_pre.prf \
+               /usr/share/qt4/mkspecs/features/release.prf \
+               /usr/share/qt4/mkspecs/features/default_post.prf \
+               /usr/share/qt4/mkspecs/features/shared.prf \
+               /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
+               /usr/share/qt4/mkspecs/features/warn_on.prf \
+               /usr/share/qt4/mkspecs/features/qt.prf \
+               /usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /usr/share/qt4/mkspecs/features/moc.prf \
+               /usr/share/qt4/mkspecs/features/resources.prf \
+               /usr/share/qt4/mkspecs/features/uic.prf \
+               /usr/share/qt4/mkspecs/features/yacc.prf \
+               /usr/share/qt4/mkspecs/features/lex.prf \
+               /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               nmode.pro
+QMAKE_TARGET  = nmode
+DESTDIR       = 
+TARGET        = nmode
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+       $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): ui_nmode.h $(OBJECTS)  
+       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: nmode.pro  /usr/share/qt4/mkspecs/default/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
+               /usr/share/qt4/mkspecs/common/linux.conf \
+               /usr/share/qt4/mkspecs/common/gcc-base.conf \
+               /usr/share/qt4/mkspecs/common/gcc-base-unix.conf \
+               /usr/share/qt4/mkspecs/common/g++-base.conf \
+               /usr/share/qt4/mkspecs/common/g++-unix.conf \
+               /usr/share/qt4/mkspecs/qconfig.pri \
+               /usr/share/qt4/mkspecs/modules/qt_phonon.pri \
+               /usr/share/qt4/mkspecs/modules/qt_webkit.pri \
+               /usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /usr/share/qt4/mkspecs/features/qt_config.prf \
+               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /usr/share/qt4/mkspecs/features/default_pre.prf \
+               /usr/share/qt4/mkspecs/features/release.prf \
+               /usr/share/qt4/mkspecs/features/default_post.prf \
+               /usr/share/qt4/mkspecs/features/shared.prf \
+               /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
+               /usr/share/qt4/mkspecs/features/warn_on.prf \
+               /usr/share/qt4/mkspecs/features/qt.prf \
+               /usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /usr/share/qt4/mkspecs/features/moc.prf \
+               /usr/share/qt4/mkspecs/features/resources.prf \
+               /usr/share/qt4/mkspecs/features/uic.prf \
+               /usr/share/qt4/mkspecs/features/yacc.prf \
+               /usr/share/qt4/mkspecs/features/lex.prf \
+               /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               /usr/lib64/libQtGui.prl \
+               /usr/lib64/libQtCore.prl
+       $(QMAKE) -o Makefile nmode.pro
+/usr/share/qt4/mkspecs/common/unix.conf:
+/usr/share/qt4/mkspecs/common/linux.conf:
+/usr/share/qt4/mkspecs/common/gcc-base.conf:
+/usr/share/qt4/mkspecs/common/gcc-base-unix.conf:
+/usr/share/qt4/mkspecs/common/g++-base.conf:
+/usr/share/qt4/mkspecs/common/g++-unix.conf:
+/usr/share/qt4/mkspecs/qconfig.pri:
+/usr/share/qt4/mkspecs/modules/qt_phonon.pri:
+/usr/share/qt4/mkspecs/modules/qt_webkit.pri:
+/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/usr/share/qt4/mkspecs/features/qt_config.prf:
+/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/share/qt4/mkspecs/features/default_pre.prf:
+/usr/share/qt4/mkspecs/features/release.prf:
+/usr/share/qt4/mkspecs/features/default_post.prf:
+/usr/share/qt4/mkspecs/features/shared.prf:
+/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
+/usr/share/qt4/mkspecs/features/warn_on.prf:
+/usr/share/qt4/mkspecs/features/qt.prf:
+/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/usr/share/qt4/mkspecs/features/moc.prf:
+/usr/share/qt4/mkspecs/features/resources.prf:
+/usr/share/qt4/mkspecs/features/uic.prf:
+/usr/share/qt4/mkspecs/features/yacc.prf:
+/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+/usr/lib64/libQtGui.prl:
+/usr/lib64/libQtCore.prl:
+qmake:  FORCE
+       @$(QMAKE) -o Makefile nmode.pro
+
+dist: 
+       @$(CHK_DIR_EXISTS) .tmp/nmode1.0.0 || $(MKDIR) .tmp/nmode1.0.0 
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/nmode1.0.0/ && $(COPY_FILE) --parents nmode.h .tmp/nmode1.0.0/ && $(COPY_FILE) --parents main.cpp nmode.cpp .tmp/nmode1.0.0/ && $(COPY_FILE) --parents nmode.ui .tmp/nmode1.0.0/ && (cd `dirname .tmp/nmode1.0.0` && $(TAR) nmode1.0.0.tar nmode1.0.0 && $(COMPRESS) nmode1.0.0.tar) && $(MOVE) `dirname .tmp/nmode1.0.0`/nmode1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/nmode1.0.0
+
+
+clean:compiler_clean 
+       -$(DEL_FILE) $(OBJECTS)
+       -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+       -$(DEL_FILE) $(TARGET) 
+       -$(DEL_FILE) Makefile
+
+
+check: first
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_nmode.cpp
+compiler_moc_header_clean:
+       -$(DEL_FILE) moc_nmode.cpp
+moc_nmode.cpp: ui_nmode.h \
+               nmode.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) nmode.h -o moc_nmode.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+       -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all: ui_nmode.h
+compiler_uic_clean:
+       -$(DEL_FILE) ui_nmode.h
+ui_nmode.h: nmode.ui
+       /usr/bin/uic nmode.ui -o ui_nmode.h
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean compiler_uic_clean 
+
+####### Compile
+
+main.o: main.cpp nmode.h \
+               ui_nmode.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+nmode.o: nmode.cpp nmode.h \
+               ui_nmode.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o nmode.o nmode.cpp
+
+moc_nmode.o: moc_nmode.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_nmode.o moc_nmode.cpp
+
+####### Install
+
+install:   FORCE
+
+uninstall:   FORCE
+
+FORCE:
+
diff --git a/normalmode/analysis_gui/GUI/main.cpp b/normalmode/analysis_gui/GUI/main.cpp
new file mode 100644 (file)
index 0000000..98b00f9
--- /dev/null
@@ -0,0 +1,22 @@
+// --- main.cpp - start ---
+
+#include "nmode.h"
+#include <QApplication>
+#include <TApplication.h>
+
+int main( int argc, char* argv[] )
+{
+       TApplication* gMyRootApp = new TApplication("My ROOT Application", &argc, argv);
+       gMyRootApp->SetReturnFromRun(true);
+//     gMyRootApp->Run(kTRUE);
+   
+       QApplication a(argc, argv);
+       nmode w;
+       w.show();
+       
+       w.setWindowTitle(QString::fromUtf8("ANA GUI"));
+//         QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) );
+       return a.exec();
+}
+
+// --- main.cpp - end ---
diff --git a/normalmode/analysis_gui/GUI/nmode.cpp b/normalmode/analysis_gui/GUI/nmode.cpp
new file mode 100644 (file)
index 0000000..2624993
--- /dev/null
@@ -0,0 +1,541 @@
+// --- nmode.cpp - start --- 
+#include "nmode.h"
+#include <QtGui>
+#include <QtCore>
+#include <iostream>
+#include <fstream>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <time.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <iomanip> 
+#include <sstream>
+
+#include "TCanvas.h"
+#include "TRootCanvas.h"
+#include <TFile.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include "TH1.h"
+#include "TF1.h"
+#include "TSystem.h"
+#include <TTree.h>
+#include "TROOT.h"
+// #include "TSystem.h"
+
+
+
+using namespace std;
+
+//####################################################################
+
+nmode::nmode(QMainWindow *parent) : QMainWindow(parent) {
+       
+       setupUi(this);
+// Init inputs
+       initGUI();
+       childcount=0;
+//             TApplication* gMyRootApp = new TApplication("My ROOT Application", &argc, argv);
+//     gMyRootApp->SetReturnFromRun(true);
+       
+       connect(lineDir                         ,SIGNAL( textChanged(QString) ) ,this   ,SLOT(  clickDir() )            );
+       connect(lineFile                        ,SIGNAL( textChanged(QString) ) ,this   ,SLOT(  clickFile() )           );
+       connect(pushSave                        ,SIGNAL( clicked() )                    ,this   ,SLOT(  Save() )                        );
+       connect(pushClose                       ,SIGNAL( clicked() )                    ,this   ,SLOT(  Close() )                       );
+       connect(pushFindNew                     ,SIGNAL( clicked() )                    ,this   ,SLOT(  Newest() )                      );
+       connect(pushUnpack                      ,SIGNAL( clicked() )                    ,this   ,SLOT(  Unpack() )                      );
+       connect(pushOpenBrowser         ,SIGNAL( clicked() )                    ,this   ,SLOT(  OpenBrowser() )         );
+       
+       QSignalMapper *signalMapper             = new QSignalMapper(this);
+       QSignalMapper *signalMapper2    = new QSignalMapper(this);
+       
+       signalMapper    ->setMapping( pushRemove                , 0);
+       signalMapper    ->setMapping( pushOcc2                  , 1);
+       signalMapper    ->setMapping( pushOcc3                  , 2);
+       signalMapper    ->setMapping( pushOccHT                 , 3);
+       signalMapper    ->setMapping( pushOccH3                 , 4);
+       signalMapper    ->setMapping( pushEmpty1                , 5);
+       signalMapper2   ->setMapping( pushFindBack              , -1);
+       signalMapper2   ->setMapping( pushFindForth             , 1);
+       
+       connect(pushRemove                      ,SIGNAL( clicked(bool) )                ,signalMapper,  SLOT( map() )           );
+       connect(pushOcc2                        ,SIGNAL( clicked(bool) )                ,signalMapper,  SLOT( map() )           );
+       connect(pushOcc3                        ,SIGNAL( clicked(bool) )                ,signalMapper,  SLOT( map() )           );
+       connect(pushOccHT                       ,SIGNAL( clicked(bool) )                ,signalMapper,  SLOT( map() )           );
+       connect(pushOccH3                       ,SIGNAL( clicked(bool) )                ,signalMapper,  SLOT( map() )           );
+       connect(pushEmpty1                      ,SIGNAL( clicked(bool) )                ,signalMapper,  SLOT( map() )           );
+       connect(pushFindBack            ,SIGNAL( clicked(bool) )                ,signalMapper2, SLOT( map() )           );
+       connect(pushFindForth           ,SIGNAL( clicked(bool) )                ,signalMapper2, SLOT( map() )           );
+       
+       connect(signalMapper            ,SIGNAL( mapped(int) )                  ,this   ,SLOT( RunAna   (int) )                 );
+       connect(signalMapper2           ,SIGNAL( mapped(int) )                  ,this   ,SLOT( NextFile (int) )                 );
+       
+// checkRandPix
+// checkBank1
+// checkBank2
+// checkBank3
+// checkBank4
+// spinRandPix
+
+}
+
+//####################################################################
+
+nmode::~nmode() {
+       
+       Save();
+       Close();
+}
+
+//####################################################################
+
+void nmode::initGUI() {
+       
+       ifstream myfile ( "nmode.ini");
+       string line;
+       int para;
+       
+       if (myfile.is_open())
+       {
+               getline( myfile, line );
+               lineDir         -> insert( QString::fromStdString(line) );
+               getline( myfile, line );
+               lineFile                -> insert( QString::fromStdString(line) );
+               
+               myfile >> para;
+               radioHld                -> setChecked(true);
+               if( para )      { radioRoot             -> setChecked(true); }
+               myfile >> para;
+               radioMost               -> setChecked(true);
+               if( para )      { radioExist    -> setChecked(true); }
+               myfile >> para;
+               spinPix         -> setValue( para );
+       }
+       
+}
+
+//####################################################################
+
+void nmode::clickDir() {
+        lineDir->setStyleSheet("QLineEdit { color:black; }");
+}
+
+//####################################################################
+
+void nmode::clickFile() {
+        lineFile->setStyleSheet("QLineEdit { color:black; }");
+}
+
+//####################################################################
+
+void nmode::Save() {
+       
+       checkDir();
+//     checkFile();
+       
+       fstream myfile;
+       myfile.open( "nmode.ini" , ios::out );
+       myfile << ( lineDir             -> text()).toStdString()        <<endl;
+       myfile << ( lineFile    -> text()).toStdString()        <<endl;
+       myfile << radioRoot             -> isChecked()  <<" ";
+       myfile << radioExist    -> isChecked()  <<" ";
+       myfile <<  spinPix              -> value()              <<" ";
+       myfile <<endl;
+       
+       myfile.close();
+}
+
+//####################################################################
+
+void nmode::Close() {
+
+       
+       for(int i=0;i<childcount;i++)
+       {
+                       child[i]->close();
+       }
+       
+       childcount=0;
+       
+}
+
+//####################################################################
+
+void nmode::Newest() {
+       
+       if(checkDir())
+       {
+               QString text            = lineDir-> text();
+               QByteArray bytes        = text.toAscii();
+               char *Dir                       = bytes.data();
+               
+               time_t timecurr = 0;
+               time_t timenew  = 0;    
+               char Filecurr           [256];
+               char Filenew            [256]   = "";
+               
+               char Ending [4];
+               if( radioRoot -> isChecked() )  { strcpy        (Ending, "root"); }
+               else                                                    { strcpy        (Ending, "hld"); }
+               
+               uint Endinglength = strlen(Ending);
+
+               DIR* dpdf;
+               struct dirent* epdf;
+               struct stat s;
+               uint namelength;
+               bool Endingcorr;
+       
+               dpdf = opendir(Dir);
+// init File_new
+//             strcpy  (File_new, "");
+       
+               if (dpdf != NULL)
+               {
+                       while ( (epdf = readdir(dpdf)) != NULL )
+                       {
+                               if( (string) epdf->d_name != "."   &&   (string) epdf->d_name != ".." )
+                               {
+                                       strcpy  (Filecurr, Dir); 
+                                       strcat  (Filecurr, epdf->d_name);
+
+                                       stat    (Filecurr, &s);
+                                       timecurr = s.st_mtime;
+                                       namelength = strlen(Filecurr);
+                                       
+                                       Endingcorr = true;
+                                       
+                                       if(namelength>Endinglength)
+                                       {
+                                               for(uint i=0; i<Endinglength;i++)
+                                               {
+                                                       if( Filecurr[namelength-Endinglength+i] != Ending[i] )  { Endingcorr=false; break; }
+                                               }
+                                               
+                                               if(Endingcorr && timenew<timecurr)
+                                               {
+//                                                     cout<<left<<setw(3)<< Endingcorr; 
+//                                                     cout<<left<<setw(50)<< Filecurr;
+//                                                     cout<<left<<setw(10)<< timecurr;
+//                                                     cout<<left<<setw(5)<< namelength;
+//                                                     cout<<left<<setw(15)<< ctime(&s.st_mtime);
+                                               
+                                                       strcpy  (Filenew, epdf->d_name);
+                                                       timenew = timecurr;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               
+               if( strlen(Filenew)!=0 )
+               {
+                       lineFile                -> clear();
+                       lineFile                -> insert( QString(Filenew) );
+               }
+               else
+               {
+                       lineFile->setStyleSheet("QLineEdit { color:red; }"); 
+               }
+               
+       }
+}
+
+//####################################################################
+
+void nmode::Unpack() {
+       
+       checkDir();
+               
+       QString text;
+       QByteArray bytes;
+       char *Dir;
+       char *File;
+       
+       text    = lineDir ->text();
+       bytes   = text.toAscii();
+       Dir             = bytes.data();
+       
+       text    = lineFile ->text();
+       bytes   = text.toAscii();
+       File    = bytes.data();
+       
+       string command = "";
+       command += "xterm -hold -geometry 105x15+10+10 -e ./rununpack.sh ";
+       command += Dir;
+       command += " ";
+       command += File;
+       
+       const char *ptr = command.c_str() ;
+                       
+       child[childcount] = new QProcess();
+//     connect(child[childcount], SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(isFinished( int, QProcess::ExitStatus )));
+       child[childcount]->start(ptr);
+       childcount++;
+       
+}
+
+//####################################################################
+
+void nmode::OpenBrowser() {
+       
+       QString text;
+       QByteArray bytes;
+       char *Dir;
+       char *File;
+       char Filein [256] = "";
+       
+       text    = lineDir ->text();
+       bytes   = text.toAscii();
+       Dir             = bytes.data();
+       
+       text    = lineFile ->text();
+       bytes   = text.toAscii();
+       File    = bytes.data();
+       
+       strcpy  (Filein, Dir); 
+       strcat  (Filein, File);
+
+       string command = "";
+       command += "xterm -geometry 130x10+10+10 -e root -l ";
+       command += Filein;
+       
+       const char *ptr = command.c_str() ;
+                       
+       child[childcount] = new QProcess();
+//     connect(child[childcount], SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(isFinished( int, QProcess::ExitStatus )));
+       child[childcount]->start(ptr);
+       childcount++;
+       
+}
+
+//####################################################################
+
+void nmode::NextFile(int sign) {
+       
+       if(checkDir())
+       {
+               QString text;
+               QByteArray bytes;
+               char *Dir;
+               char *File;
+               
+               text    = lineDir ->text();
+               bytes   = text.toAscii();
+               Dir             = bytes.data();
+               
+               text    = lineFile ->text();
+               bytes   = text.toAscii();
+               File    = bytes.data();
+               
+               time_t timeref  = 0;
+               time_t timecurr = 0;
+               time_t timenew  = 2000000000;
+               if(sign==-1)    {timenew        = -2000000000;}
+               
+               char Fileref            [256];
+               char Filecurr           [256];
+               char Filenew            [256]   = "";
+               
+               strcpy  (Fileref, Dir); 
+               strcat  (Fileref, File);
+               
+               struct stat buff;
+               if( stat (Fileref, &buff) == 0 )        { lineFile->setStyleSheet("QLineEdit { color:black; }");        timeref = buff.st_mtime;                        }
+               else                                                            { lineFile->setStyleSheet("QLineEdit { color:red; }");          timeref = timenew; sign=-1*sign; timenew= -1*timenew;   }
+               
+               text    = lineDir ->text();
+               bytes   = text.toAscii();
+               Dir             = bytes.data();
+               
+               text    = lineFile ->text();
+               bytes   = text.toAscii();
+               File    = bytes.data();
+               
+               char Ending [4];
+               if( radioRoot -> isChecked() )  { strcpy        (Ending, "root"); }
+               else                                                    { strcpy        (Ending, "hld"); }
+               
+               uint Endinglength = strlen(Ending);
+
+               DIR* dpdf;
+               struct dirent* epdf;
+               struct stat s;
+               uint namelength;
+               bool Endingcorr;
+                               
+               dpdf = opendir(Dir);
+// init File_new
+//             strcpy  (File_new, "");
+
+               if (dpdf != NULL)
+               {       
+                       while ( (epdf = readdir(dpdf)) != NULL )
+                       {
+                               if( (string) epdf->d_name != "."   &&   (string) epdf->d_name != ".." )
+                               {
+                                       strcpy  (Filecurr, Dir); 
+                                       strcat  (Filecurr, epdf->d_name);
+                                       
+                                       stat    (Filecurr, &s);
+                                       timecurr        = s.st_mtime;
+                                       namelength      = strlen(Filecurr);
+                                       Endingcorr      = true;
+                                       
+                                       if(namelength>Endinglength)
+                                       {
+                                               for(uint i=0; i<Endinglength;i++)
+                                               {
+                                                       if( Filecurr[namelength-Endinglength+i] != Ending[i] )  { Endingcorr=false; break; }
+                                               }
+                                                       
+                                               if(Endingcorr && sign*timecurr>sign*timeref )
+                                               {
+//                                                     cout<<left<<setw(3)<< Endingcorr; 
+//                                                     cout<<left<<setw(50)<< Filecurr;
+//                                                     cout<<left<<setw(10)<< timecurr;
+//                                                     cout<<left<<setw(5)<< namelength;
+//                                                     cout<<left<<setw(15)<< ctime(&s.st_mtime);
+                                                       
+                                                       if( timenew!=0 && sign*timenew>sign*timecurr)
+                                                       {
+                                                               strcpy  (Filenew, epdf->d_name);
+                                                               timenew = timecurr;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+               
+               if              ( strlen(Filenew)!=0 )
+               {
+                       lineFile                -> clear();
+                       lineFile                -> insert( QString(Filenew) );
+               }
+//             else
+//             {
+//                     pushFindBack    ->setStyleSheet("* { background-color: red }");
+//                     pushFindForth   ->setStyleSheet("* { background-color: red }");
+//                     pushFindBack    ->setStyleSheet("* { background-color: lightGray }");
+//                     pushFindForth   ->setStyleSheet("* { background-color: lightGray }");
+//             }
+       }
+}
+
+//####################################################################
+
+void nmode::RunAna(int method) {
+       
+       checkDir();
+       
+       string dirPath  = ( lineDir     -> text() ).toStdString();
+       string filePath = ( lineFile-> text() ).toStdString();
+       
+//     xterm -geometry 65x10+10+10 -e root -l "runreadgui.C+(\""3"\",\"/local/samir/test.root\","0","what","what","0")"
+       
+       std::stringstream strstr1;
+       strstr1.str("");
+       strstr1 << method;
+       
+       std::stringstream strstr2;
+       strstr2.str("");
+       strstr2 << spinPix->value();
+       
+       std::stringstream strstr3;
+       strstr3.str("");
+       strstr3 << radioExist->isChecked();
+       
+//     string command = "xterm -hold -geometry 75x10+10+10 -e ./runana.sh ";
+       string command = "xterm -geometry 75x10+10+10 -e ./runana.sh ";
+       command += " ";
+       command += dirPath + filePath;
+       command += " ";
+       command += strstr1.str();               // method nr
+       command += " ";
+       command += strstr2.str();               // nr pixels
+       command += " ";
+       command += strstr3.str();               // most noisy or exist. Map
+       
+       const char *ptr = command.c_str() ;
+//     cout<<command<<endl;
+       
+       child[childcount] = new QProcess();
+//     connect(child[childcount], SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(isFinished( int, QProcess::ExitStatus )));
+       child[childcount]->start(ptr);
+       childcount++;
+
+}
+
+//####################################################################
+//####################################################################
+
+bool nmode:: checkDir() {
+       
+       QString text            = lineDir ->text();
+       QByteArray bytes        = text.toAscii();
+       char *Dir                       = bytes.data();
+       
+// Add '/' at the end of Dir
+       if( Dir[strlen(Dir)-1] != '/' )
+       {
+               strcat(Dir, "/" );
+               lineDir -> clear();
+               lineDir -> insert( QString(Dir) );
+       }
+       
+// Check whether Dir exists
+       DIR* dpdf = opendir(Dir);
+       
+       if (dpdf != NULL)       { lineDir->setStyleSheet("QLineEdit { color:black; }");  return true;   }
+       else                            { lineDir->setStyleSheet("QLineEdit { color:red; }");  return false;    }
+}
+       
+//####################################################################
+
+bool nmode:: checkFile() {
+       
+       if(checkDir())
+       {
+               QString text;
+               QByteArray bytes;
+               char *Dir;
+               char *File;
+               
+               text    = lineDir ->text();
+               bytes   = text.toAscii();
+               Dir             = bytes.data();
+               
+               text    = lineFile ->text();
+               bytes   = text.toAscii();
+               File    = bytes.data();
+               
+               char Filecurr           [256];
+               strcpy  (Filecurr, Dir); 
+               strcat  (Filecurr, File);
+               
+               struct stat buffer;
+
+               if( stat (Filecurr, &buffer) == 0)      { lineFile->setStyleSheet("QLineEdit { color:black; }");        return true;    }
+               else                                                            { lineFile->setStyleSheet("QLineEdit { color:red; }");          return false;   }
+       }
+
+       return 0;
+}
+       
+//####################################################################
+
+void nmode::Error() {
+               
+       QMessageBox* box = new QMessageBox();
+       box->setWindowTitle(QString("Error"));
+//     box->setText(QString("Current Text:\""+text+"\""));
+       box->setText(QString("Directory not found!"));
+       box->show();
+}
+
+//####################################################################
+// --- nmode.cpp - end --- 
diff --git a/normalmode/analysis_gui/GUI/nmode.h b/normalmode/analysis_gui/GUI/nmode.h
new file mode 100644 (file)
index 0000000..7aca500
--- /dev/null
@@ -0,0 +1,42 @@
+// --- nmode.h - start --- 
+
+#ifndef NMODE_H
+#define NMODE_H
+
+#include "ui_nmode.h"
+#include "TCanvas.h"
+#include <QProcess>
+
+class nmode : public QMainWindow, public Ui::MainWindow {
+       
+       Q_OBJECT
+       
+public:
+       nmode(QMainWindow *parent=0);
+       ~nmode();
+       
+public slots:
+       void Error              ();
+       void Unpack             ();
+       void OpenBrowser();
+       void Save               ();
+       void Newest             ();
+       void Close              ();
+       void clickDir   ();
+       void clickFile  ();
+       void RunAna             (int);
+       void NextFile   (int);
+       
+private:
+       void initGUI();
+       bool checkDir();
+       bool checkFile();
+       
+       QProcess* child[1000];
+       int childcount;
+};
+
+#endif // NMODE_H
+
+// --- nmode.h - end --- 
diff --git a/normalmode/analysis_gui/GUI/nmode.ui b/normalmode/analysis_gui/GUI/nmode.ui
new file mode 100644 (file)
index 0000000..3c8009f
--- /dev/null
@@ -0,0 +1,389 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>495</width>
+    <height>296</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QLineEdit" name="lineDir">
+    <property name="geometry">
+     <rect>
+      <x>59</x>
+      <y>12</y>
+      <width>391</width>
+      <height>26</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineFile">
+    <property name="geometry">
+     <rect>
+      <x>59</x>
+      <y>42</y>
+      <width>391</width>
+      <height>26</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>19</x>
+      <y>18</y>
+      <width>41</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>DIR</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_2">
+    <property name="geometry">
+     <rect>
+      <x>19</x>
+      <y>48</y>
+      <width>41</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>FILE</string>
+    </property>
+   </widget>
+   <widget class="QFrame" name="frame">
+    <property name="geometry">
+     <rect>
+      <x>97</x>
+      <y>148</y>
+      <width>101</width>
+      <height>131</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::StyledPanel</enum>
+    </property>
+    <property name="frameShadow">
+     <enum>QFrame::Raised</enum>
+    </property>
+    <widget class="QSpinBox" name="spinPix">
+     <property name="geometry">
+      <rect>
+       <x>3</x>
+       <y>54</y>
+       <width>95</width>
+       <height>26</height>
+      </rect>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="maximum">
+      <number>165888</number>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioMost">
+     <property name="geometry">
+      <rect>
+       <x>4</x>
+       <y>82</y>
+       <width>101</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>8</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>Most noisy</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioExist">
+     <property name="geometry">
+      <rect>
+       <x>4</x>
+       <y>102</y>
+       <width>101</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>8</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>Exist. Map</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushRemove">
+     <property name="geometry">
+      <rect>
+       <x>3</x>
+       <y>2</y>
+       <width>95</width>
+       <height>51</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>remove/map 
+ Noisy Pixels</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QPushButton" name="pushOcc2">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>150</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Pixel Occ. 
+ 2D</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushOcc3">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>210</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Pixel Occ. 
+ 3D</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushOccH3">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>210</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Hit Occ. 
+ 3D</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushSave">
+    <property name="geometry">
+     <rect>
+      <x>60</x>
+      <y>84</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Save</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushOpenBrowser">
+    <property name="geometry">
+     <rect>
+      <x>400</x>
+      <y>150</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Open 
+ Browser</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushClose">
+    <property name="geometry">
+     <rect>
+      <x>160</x>
+      <y>84</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Close 
+ windows</string>
+    </property>
+   </widget>
+   <widget class="QFrame" name="frame_4">
+    <property name="geometry">
+     <rect>
+      <x>313</x>
+      <y>74</y>
+      <width>135</width>
+      <height>61</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::StyledPanel</enum>
+    </property>
+    <property name="frameShadow">
+     <enum>QFrame::Raised</enum>
+    </property>
+    <widget class="QRadioButton" name="radioHld">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>6</y>
+       <width>51</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="layoutDirection">
+      <enum>Qt::RightToLeft</enum>
+     </property>
+     <property name="text">
+      <string>hld</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioRoot">
+     <property name="geometry">
+      <rect>
+       <x>62</x>
+       <y>6</y>
+       <width>51</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>root</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushFindNew">
+     <property name="geometry">
+      <rect>
+       <x>27</x>
+       <y>26</y>
+       <width>81</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Find Newest</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushFindBack">
+     <property name="geometry">
+      <rect>
+       <x>3</x>
+       <y>26</y>
+       <width>21</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>&lt;</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushFindForth">
+     <property name="geometry">
+      <rect>
+       <x>111</x>
+       <y>26</y>
+       <width>21</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>&gt;</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QPushButton" name="pushUnpack">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>150</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Unpack</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushEmpty1">
+    <property name="geometry">
+     <rect>
+      <x>400</x>
+      <y>210</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Empty 1</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushOccHT">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>150</y>
+      <width>95</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Hit Occ. 
+ vs. Time</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>495</width>
+     <height>20</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <tabstops>
+  <tabstop>lineDir</tabstop>
+  <tabstop>lineFile</tabstop>
+  <tabstop>pushSave</tabstop>
+  <tabstop>pushClose</tabstop>
+  <tabstop>radioHld</tabstop>
+  <tabstop>radioRoot</tabstop>
+  <tabstop>pushFindBack</tabstop>
+  <tabstop>pushFindNew</tabstop>
+  <tabstop>pushFindForth</tabstop>
+  <tabstop>pushUnpack</tabstop>
+  <tabstop>pushRemove</tabstop>
+  <tabstop>spinPix</tabstop>
+  <tabstop>radioMost</tabstop>
+  <tabstop>radioExist</tabstop>
+  <tabstop>pushOcc2</tabstop>
+  <tabstop>pushOccHT</tabstop>
+  <tabstop>pushOpenBrowser</tabstop>
+  <tabstop>pushOcc3</tabstop>
+  <tabstop>pushOccH3</tabstop>
+  <tabstop>pushEmpty1</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/normalmode/analysis_gui/GUI/runana.sh b/normalmode/analysis_gui/GUI/runana.sh
new file mode 100755 (executable)
index 0000000..a15e415
--- /dev/null
@@ -0,0 +1,10 @@
+pxlmap=`pwd`/map.ini
+
+# echo " $1"
+# echo " $2"
+# echo " $3"
+# echo " $4"
+# echo " $pxlmap"
+
+time ./../ANA/Mi26Ana $1 $pxlmap $2 $3 $4
+echo "Finished!"
\ No newline at end of file
diff --git a/normalmode/analysis_gui/GUI/rununpack.sh b/normalmode/analysis_gui/GUI/rununpack.sh
new file mode 100755 (executable)
index 0000000..7f7ced4
--- /dev/null
@@ -0,0 +1,13 @@
+echo "Input-Dir :  $1"
+echo "Input-File:  $2"
+./../../../normalmode/unpacker/Mi26NM $1 $2
+echo "Finished!"
+
+
+
+# --> Unpacker from folder: cpp_standalone
+
+# echo "Input:  $1"
+# # echo "Output: $4"
+# . ../../cpp_standalone/unpackerB $1
+# echo "Finished!"
diff --git a/normalmode/analysis_gui/readme.txt b/normalmode/analysis_gui/readme.txt
new file mode 100644 (file)
index 0000000..6c005ce
--- /dev/null
@@ -0,0 +1,9 @@
+
+1. Compile the code
+       - ANA
+       - GUI
+       - Unpacker (note: there are 2 different unpacker available)
+
+2. Un-/comment the part in GUI/run.sh according to which unpacker you choose
+
+3. To run the analysis GUI, you have to make ROOT available in the console first
\ No newline at end of file
index 624c1f5adcaae9cea9ca56129c2b3311d31adac1..936c74dcbdfe063d686d46b749f018920e6935ff 100755 (executable)
@@ -34,7 +34,7 @@ unpacker::~unpacker() {
                delete[] fFileLength;
                delete[] fInn;
                delete[] fRawData;
-#if SAVE > 0
+               
                cout<<"-------------"<<endl;
                printf("\r Write data for Sensor:\n");
                for(Int_t i=0; i<MAXSENSORS; i++)
@@ -45,7 +45,7 @@ unpacker::~unpacker() {
                                printf(" ->%3i\n", i);
                        }
                }
-               fOutputFile->Write();
+//             fOutputFile->Write();
                fOutputFile->Save();
                fOutputFile->Close();
   
@@ -56,7 +56,6 @@ unpacker::~unpacker() {
                TFile::Open(fOutFileName);
 //             gROOT->ProcessLine("new TBrowser;");
 //             gSystem->Exec(". ./runread.sh&");
-#endif
        }
 
 //     cout<<"--------------------------------"<<endl;
@@ -139,7 +138,7 @@ void unpacker::scanFrames(UInt_t Start, UInt_t Entries) {
                        nrSensors       = getFrameInfo(eventSize, eventnrcount, FrameInfo);
                        if( nrSensors!=fNrSensors )     
                        {
-                               printf("\r Data inconsistent -> Wrong number of sensors (%3u --> %3u )! Frame number %10u skipped! File Number: %10u\n", fNrSensors, nrSensors, eventnrcount, fCurrFile);
+                               printf("\r Data inconsistent: Wrong number of sensors (%2u-->%2u)! Frame number %8u skipped! File Number: %3u\n", fNrSensors, nrSensors, eventnrcount, fCurrFile);
                        }
                        else
                        {
@@ -185,7 +184,6 @@ bool unpacker::checkFiles(TString Dir, TString File)  {
        fEvents = 0;
        
        ULong_t End;
-       
 // Check naming of 'Dir' and 'File'
        if( dir[strlen(dir)-1] != '/' )
        {
@@ -195,13 +193,20 @@ bool unpacker::checkFiles(TString Dir, TString File)  {
        
        len = strlen(file);
        
-       for(uint i=0;i<4;i++)
+       if(len>4)
        {
-               if( file [len-4+i] != ending[i] )
+               for(uint i=0;i<4;i++)
                {
-                       has_ending = false;
+                       if( file [len-4+i] != ending[i] )
+                       {
+                               has_ending = false;
+                       }
                }
        }
+       else
+       {
+               has_ending = false;
+       }
        
        for(uint i=0;i<len;i++)
        {
@@ -345,14 +350,13 @@ bool unpacker::checkFiles(TString Dir, TString File)  {
        }
 
 // ----------------
-       fOutFileName = Dir + File + Form("_DST.root");
+       fOutFileName = Dir + File + Form(".root");
                
        fCurrFile               = 0;
        fCurrPosInFile  = 0;
 // ----------------
-#if SAVE > 0
        fOutputFile = new TFile  (fOutFileName,"RECREATE");
-#endif
+       
        for(Int_t i=0; i<MAXSENSORS; i++)
        {
                fFrameTree[i]           = new TTree(Form("sensor%i",i), Form("sensor%i",i));