]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Run analyzer: Small bugfixes, defollowed ChargeSpectrum.c: individual changes should...
authorBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Mon, 31 Aug 2015 14:22:52 +0000 (16:22 +0200)
committerBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Mon, 31 Aug 2015 14:22:52 +0000 (16:22 +0200)
.gitignore
MABS_run_analyzer/ChargeSpektrum.c [deleted file]
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/MAPS.c
MABS_run_analyzer/MAPS.h
MABS_run_analyzer/Run.c

index 2b48b418e597bb9d80fe43bfbe64796003183f02..aa483a782d631d142f4896cf37f776917d14ec87 100644 (file)
@@ -9,4 +9,7 @@
 *.log
 *.MOV
 */results/*
-*runlist.txt
\ No newline at end of file
+*runlist.txt
+ChargeSpektrum.c
+MABS_run_analyzer/html/*
+MABS_run_analyzer/latex/*
\ No newline at end of file
diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c
deleted file mode 100644 (file)
index 38698c7..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * @file ChargeSpektrum.c
- * @brief Use brief, otherwise the index won't have a brief explanation.
- *
- * Detailed explanation.
- * 
- * 
- */
-
-#include "MAPS.c"
-#include "Run.c"
-#include "CSVRow.h"
-#include "CSVRow.C"
-#include <TTimeStamp.h>
-
-Run** runs;
-Int_t numberRuns;
-Bool_t isBatch = kFALSE;
-
-#include "ChargeSpektrumFunctions.c"
-
-void ChargeSpektrum(TString runnumber = "")
-{
-    cout << endl << endl; 
-    if (gROOT->IsBatch())
-        isBatch = kTRUE;
-    
-    numberRuns=0;
-    std::vector<int> runList;
-    if (runnumber.Length() > 0)
-    {
-        if (runnumber.Contains("-"))
-        {
-            TObjArray* runarray = runnumber.Tokenize("-");
-            if (runarray->GetEntries()==2)
-            {
-                TObjString* tempstrobj;
-                tempstrobj=static_cast<TObjString*>(runarray->At(0));
-                if (tempstrobj->GetString().Length()>0)
-                {
-                    Int_t tempintstart = tempstrobj->GetString().Atoi();
-                    tempstrobj=static_cast<TObjString*>(runarray->At(1));
-                    if (tempstrobj->GetString().Length()>0)
-                    {
-                        Int_t tempintend = tempstrobj->GetString().Atoi();
-                        if (tempintend-tempintstart > 0)
-                        {
-                            for (Int_t i=tempintstart; i <= tempintend; i++)
-                            {
-                                runList.push_back(i);
-                                numberRuns++;
-                            }
-                        }
-                        else
-                            cout << coloryellow << "Invalid run number range "<< colorreset << colorwhite << tempintstart << " till " << tempintend << endlr;
-                    }
-                    else
-                        cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr;  
-                    
-                }
-                else
-                    cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr;    
-            }
-            else
-            {
-                cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << " or 2 runnumbers devided by " << colorreset << colorwhite << "-" << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset  << colorred << "'." << endlr;
-                cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl;
-                exit(1);
-            }  
-            
-        }
-        else
-        {
-            TObjArray* runarray = runnumber.Tokenize(",");
-            if (runarray->GetEntries()>0)
-            {
-                TObjString* tempstrobj;
-                for (Int_t i=0; i < runarray->GetEntries(); i++)
-                {
-                    tempstrobj=static_cast<TObjString*>(runarray->At(i));
-                    if (tempstrobj->GetString().Length()>0)
-                    {
-                        Int_t tempint = tempstrobj->GetString().Atoi();
-                        if (tempint > 0)
-                        {
-                            runList.push_back(tempint);
-                            numberRuns++;
-                        }
-                        else
-                            cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempint << endlr;
-                    }
-                    else
-                        cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr;
-                }                
-            }
-            else
-            {
-                cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset  << colorred << "'." << endlr;
-                cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl;
-                exit(1);
-            }         
-        }
-    }
-    else
-    {
-        /// number of runs to be analyzed, number of lines read by @c ReadRunList() 
-        ReadRunList(&runList);
-    }
-    runs = new Run*[numberRuns];
-    
-    cout << "Found " << numberRuns << " run(s) in 'runlist.txt' or given as parameters." << endl;
-    for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
-    {
-        if (runList[runi]>0)
-        {
-            runs[runi] = new Run(runList[runi], runi);
-            if (!runs[runi]->error)
-            {
-                if (runi%2)
-                {
-                    // check if devided matrix is investigated
-                    if (runList[runi-1] == runList[runi])
-                    {
-                        cout << "Using devided matrix upper" << endl;
-                        runs[runi]->dividedmatrix = 1;
-                        runs[runi]->upperpart = 1;
-                    }
-                }
-                if (runi+1 < numberRuns)
-                {
-                    if (runList[runi] == runList[runi+1] )
-                    {
-                        cout << "Using devided matrix lower" << endl;
-                        runs[runi]->dividedmatrix = 1;
-                        runs[runi]->upperpart = 0;
-                    }
-                }
-                runs[runi]->setResultsPath("./results/");
-                runs[runi]->error=runs[runi]->initRun();
-                runs[runi]->setDynamicalNoiseMode("simple");
-                runs[runi]->useDynamicalNoise(true);
-                                
-//                 runs[runi]->analyzeFrame(15684);
-//                 runs[runi]->analyzeFrame(803316);
-             //    runs[runi]->analyzeFrame(734);
-       //           runs[runi]->analyzeFrame(4072);  
-                // creates or opens .root file, can analyze the RAW data
-              runs[runi]->error=runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data
-                if (!runs[runi]->error)
-                {
-            //         gROOT->SetBatch(kTRUE);
-                    //           runs[runi]->plotSeed();
-
-//                     runs[runi]->plotSeedThresholdCalibrated();
-//                     runs[runi]->plotSeedThreshold();
-//                     runs[runi]->plotSeed();
-            //         runs[runi]->plotSum();
-            //         runs[runi]->plotVeto();
-                    //         runs[runi]->plotNoise();
-                    if (!isBatch)
-                        gROOT->SetBatch(kFALSE);
-//                             runs[runi]->plotAllHistograms();
-//                     runs[runi]->plotAllHistogramsThresholdCluster();
-                    runs[runi]->plotClusterDistribution(&runs[runi]->histogramthresholdCalibrated);
-//                     runs[runi]->plotAllHistogramsThresholdClusterCalibrated();
-//                      runs[runi]->plotAllHistogramsCalibrated(); 
-//                     runs[runi]->writeAllHistogramsToFile(); 
-                }
-            }
-        }
-    }
-//     plotAllRuns("");
-    plotAllRuns("seed calibrated");
-       setCustomPath("Excel/");
-//     writeObservableToFile("seed threshold calibrated");
-//    writeObservableToFile("seed threshold");
-       writeObservableToFile("seed threshold");
-       writeObservableToFile("sum threshold");
-}
index ec9ea9b1864784f62043d78920b2916b3aacf3f1..82c404b805a9c80b77532b919a2ef39c2c6589e3 100644 (file)
@@ -141,12 +141,7 @@ Bool_t writeObservableToFile()
             }
         }
     }
-<<<<<<< HEAD
     TString filename= runs[0]->savepathresults + "/" + ownpath + runnumberListe + "histograms.dat";
-=======
-    runnumberListe+=Form("%s_",plothistogrampointer->GetName());
-    TString filename= runs[0]->savepathresults + "/" + runnumberListe + "histograms.dat";
->>>>>>> without_FSBB
     fstream* fout = new fstream(filename,ios::out);
     *fout << headerInfo << endl;
     *fout << header << endl;
index a2e2e9987eacb6cb602ae73caa0d9dec980e779a..1f0f2dd608b81bc28d779a1e417be2154cc49546 100644 (file)
@@ -165,10 +165,14 @@ void MAPS::save() {
     if(fSave && fOk)
     {
         cout<< endl << "----------------------------------------------------------------"<<endl;
-        cout << "  Frames with suspicious pedestial value: " << std::cout.width(10)<< std::right << fPedestalhighFrames << " out of " << fEventsSum << " (" << (1.0*fPedestalhighFrames/fEventsSum*100) << " %)" << endl;
-        cout << "  Pixel with suspicious pedestial value: " << std::cout.width(10) << std::right << fPedestalhighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) << " %)" << endl;
-        cout << "  Frames with suspicious noise value: " << std::cout.width(10) << std::right<< fNoiseHighFrames << " out of " << fEventsSum << " (" << (1.0*fNoiseHighFrames/fEventsSum*100) << " %)" << endl;
-        cout << "  Pixel with suspicious pedestial value: " << std::cout.width(10) << std::right << fNoiseHighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) << " %)" << endl;
+        if ((1.0*fPedestalhighFrames/fEventsSum*100) > 1.0) cout << coloryellow; if ((1.0*fPedestalhighFrames/fEventsSum*100) > 10.0) cout << colorred;
+        cout << "  Frames with suspicious pedestial value: " << std::cout.width(10)<< std::right << fPedestalhighFrames << " out of " << fEventsSum << " (" << (1.0*fPedestalhighFrames/fEventsSum*100) << " %)" << endlr;
+        if ((1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) > 1.0) cout << coloryellow; if ((1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) > 10.0) cout << colorred;
+        cout << "  Pixel with suspicious pedestial value: " << std::cout.width(10) << std::right << fPedestalhighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) << " %)" << endlr;
+        if ((1.0*fNoiseHighFrames/fEventsSum*100) > 1.0) cout << coloryellow; if ((1.0*fNoiseHighFrames/fEventsSum*100) > 10.0) cout << colorred;
+        cout << "  Frames with suspicious noise value: " << std::cout.width(10) << std::right<< fNoiseHighFrames << " out of " << fEventsSum << " (" << (1.0*fNoiseHighFrames/fEventsSum*100) << " %)" << endlr;
+        if ((1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) > 1.0) cout << coloryellow; if ((1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) > 10.0) cout << colorred;
+        cout << "  Pixel with suspicious noise value: " << std::cout.width(10) << std::right << fNoiseHighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) << " %)" << endlr;
         cout<<"----------------------------------------------------------------"<<endl;
         
         fOutputFile->cd();
@@ -992,7 +996,9 @@ void MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t preci
     cout << colorwhite << "----------------------------------" << colorreset << endl;
     for (int i=0; i<n;i++)
     {
-        if (abs(a[i]) > highlightabove)
+        if (a[i] > highlightabove)
+            std::cout << colorgreen;
+        else if ((-1)*a[i] > highlightabove)
             std::cout << colorred;
         std::cout.width(precision+5);
         std::cout << std::fixed;
@@ -1345,7 +1351,7 @@ void MAPS::hitana() {
                 }
                 // maybe this is unnecessary, if upper if clause is a >= comparison
                 else if     ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 )      {
-                    cout << "WARNING: next pixel value identical to precessor" << endl;
+                    cout << "WARNING: next pixel value identical to precessor, frame : " << fFrameInfo.frame << ", values: " << pixelchargeincluster[i] << " == " << pixelchargeincluster[12] << endl;
                     CHANCE=0;    //NOTE: potential error source
                     break;
                 }
@@ -1544,7 +1550,7 @@ void MAPS::hitana() {
                 }
                 // maybe this is unnecessary, if upper if clause is a >= comparison
                 else if     ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 )      {
-                    cout << "WARNING: next pixel value identical to precessor" << endl;
+                    cout << "WARNING: next pixel value identical to precessor, frame : " << fFrameInfo.frame << ", values: " << pixelchargeincluster[i] << " == " << pixelchargeincluster[12] << endl;
                     CHANCE=0;    //NOTE: potential error source
                     break;
                 }
@@ -1752,7 +1758,7 @@ void MAPS::plotFrame(Int_t FrameNumber) {
         cout<<"Hitted pixel discriminator matrix:"<<endl;
         debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
         
-        TCanvas* cm1 = new TCanvas(TString(FrameNumber),TString(FrameNumber),50,100,1200,800);
+        TCanvas* cm1 = new TCanvas(Form("Frame %d",FrameNumber),Form("Frame %d",FrameNumber),50,100,1200,800);
         cm1->Divide(2,3);
         gStyle->SetOptFit(1011);
         gStyle->SetPalette(1);
@@ -1820,9 +1826,11 @@ void MAPS::plotFrame(Int_t FrameNumber) {
         h5->Draw();
         h5->GetXaxis()->SetTitle("Signal [ADC]");
         h5->GetYaxis()->SetTitle("Counts");
-
-        cm1->DrawClone();
+        
+        TCanvas* canvasFrame = (TCanvas*) cm1->DrawClone();
         cm1->Close();
+        canvasFrame->SetTitle(cm1->GetTitle());
+        canvasFrame->SetName(cm1->GetName());
         cm1->Update();
         cout<<"\rPIXELMATRIX plotted!                           "<<endl;
         cout<<"-------------------"<<endl;
index f68a0a7c2ace6bc57bb52e97e9fe9e5ef87d3994..8a372def3abdb53f039ef498134a02926295520f 100644 (file)
@@ -298,6 +298,8 @@ private:
     const TString colorwhite = "\033[1;29m";
     const TString colorred = "\033[1;31m";
     const TString coloryellow = "\033[1;33m";
+    const TString colorgreen = "\033[1;32m";
+    const TString colorcyan = "\033[1;36m";
     const TString colorreset = "\033[0m";
     /// resets color and prints a new line
     const TString endlr = "\033[0m\n";     
index 6ad77e9abc84d6aff1d41850567f0de8e877708c..bef05a615e3d28c7076249d81e6f24e2ae4bc8a1 100644 (file)
@@ -63,16 +63,16 @@ Run::Run(Int_t runnumber, Int_t loopi)
 //                 storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/jspc53_H");
                 storepathRAWLinux = storepathRAWLinux.ReplaceAll("H:","/d/garlic");
                 storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/d/garlic");
-                if (TString(hostname).EqualTo("jspc48"))
-                {
-                    storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/d/jspc28/jspc53_U");
-                    storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/d/jspc28/jspc53_U");                    
-                }
-                else
-                {
-                    storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/jspc53_U");
-                    storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/jspc53_U");
-                }
+//                 if (TString(hostname).EqualTo("jspc48"))
+//                 {
+                    storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/d/garlic");
+                    storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/d/garlic");                    
+//                 }
+//                 else
+//                 {
+//                     storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/jspc53_U");
+//                     storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/jspc53_U");
+//                 }
                 storepathRAWLinux = storepathRAWLinux.ReplaceAll("F:","/jspc12_F");
                 storepathRAWLinux = storepathRAWLinux.ReplaceAll("f:","/jspc12_F");
                 storepathRAWLinux = storepathRAWLinux.ReplaceAll("O:","/d/garlic");
@@ -442,10 +442,8 @@ Bool_t Run::analyzeFrame(Int_t frame)
         {
             processed->InitialDynNoise(100);
             processed->getFrame(frame);
-                       
-             processed->filterCommonMode();
+            // processed->filterCommonMode();
             processed->hitana();
-                       exit(1);
             processed->plotFrame(frame);
             delete processed;
             return 0;
@@ -887,7 +885,7 @@ Bool_t Run::binCluster()
                             xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
                             ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
                         }
-//                         cout << colorwhite << "unten: xcoord: " << xcoord << ", ycoord: " << ycoord << endl;
+                        // cout << colorwhite << "unten: xcoord: " << xcoord << ", ycoord: " << ycoord << endl;
                         
                         histogram.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
                         if (processed->fFrameInfo.pixelthreshold[hiti]>0)
@@ -1013,17 +1011,6 @@ Bool_t Run:: findRotatedClusterDimension(Float_t rotateangle)
             ycoord_abs_max=(ycoord>ycoord_abs_max?ycoord:ycoord_abs_max);
         }
     }
-    //     xcoord_min_step=abs(curpixelinfo.pitchX*cos(rotateangle/180*M_PI)-curpixelinfo.pitchY*sin(rotateangle/180*M_PI));
-    //     ycoord_min_step=abs(curpixelinfo.pitchX*sin(rotateangle/180*M_PI)+curpixelinfo.pitchY*cos(rotateangle/180*M_PI));
-//     cout << "xcoord_min: " << xcoord_min << " xcoord_max: " << xcoord_max << endl;
-//     cout << "ycoord_min: " << ycoord_min << " ycoord_max: " << ycoord_max << endl;
-//     cout << "xcoord_min_step: " << xcoord_min_step << " ycoord_min_step: " << ycoord_min_step << endl;
-    //     double deleteme = curpixelinfo.pitchX*processed->clustersize*cos(rotateangle/180*M_PI)-curpixelinfo.pitchY*processed->clustersize*sin(rotateangle/180*M_PI);
-    //     double deleteme2 = curpixelinfo.pitchX*processed->clustersize*sin(rotateangle/180*M_PI)+curpixelinfo.pitchY*processed->clustersize*cos(rotateangle/180*M_PI);
-    //     cout << "xmax2: " << deleteme << " ymax2: " << deleteme2 << endl;
-//     sizearrrotx= (int)((xcoord_max-xcoord_min+1)/xcoord_min_step)+1;
-//     sizearrroty = (int)((ycoord_max-ycoord_min+1)/ycoord_min_step)+1;
-//     cout << "sizearrrotx: " << sizearrrotx << " sizearrroty: " << sizearrroty << endl;    
     
     initClusters(xcoord_min_step, xcoord_abs_min, xcoord_abs_max, ycoord_min_step, ycoord_abs_min, ycoord_abs_max);
     //sizearrrotx*2, xcoord_abs_min,xcoord_abs_max,sizearrroty*2,ycoord_abs_min,ycoord_abs_max); 
@@ -1288,13 +1275,13 @@ Bool_t Run::plotClusterDistribution(histogramstruct* histogramstructpointer)
     
     canvas->Draw();
     
-    TImageDump *img2 = new TImageDump(savepathresults + "/" + canvastitle + ".png");
-    canvas->Paint();
-    img2->Close();
-    
-    f->Append(canvas);
-    f->Append(img2);
-    f->Write();
+//     TImageDump *img2 = new TImageDump(savepathresults + "/" + canvastitle + ".png");
+//     canvas->Paint();
+//     img2->Close();
+//     
+//     f->Append(canvas);
+//     f->Append(img2);
+//     f->Write();
     // .Data(), Form("Avg. cluster distribution; x; y %s", humanreadablestr.Data()),sizearrrotx, xcoord_abs_min,xcoord_abs_max,sizearrroty,ycoord_abs_min,ycoord_abs_max);
     
     return 0;     
@@ -1877,7 +1864,17 @@ void Run::initHistogram(TH1F* &histogrampointer, TString prefix)
 }
 
 void Run::initClusters(Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t xcoord_abs_max, Float_t ycoord_min_step, Float_t ycoord_abs_min, Float_t ycoord_abs_max)
-{    
+{   
+    if (true) // set to true to debug
+    {
+        cout << "xcoord_abs_min: " << xcoord_abs_min << " xcoord_abs_max: " << xcoord_abs_max << endl;
+        cout << "ycoord_abs_min: " << ycoord_abs_min << " ycoord_abs_max: " << ycoord_abs_max << endl;
+        cout << "xcoord_min_step: " << xcoord_min_step << " ycoord_min_step: " << ycoord_min_step << endl;
+        Int_t sizearrrotx= (int)((xcoord_abs_max-xcoord_abs_min)/xcoord_min_step+0.5);
+        Int_t sizearrroty= (int)((ycoord_abs_max-ycoord_abs_min)/ycoord_min_step+0.5);
+        cout << "sizearrrotx: " << sizearrrotx << " sizearrroty: " << sizearrroty << endl;    
+    }
+    
     initCluster(&histogram, "", xcoord_min_step, xcoord_abs_min, xcoord_abs_max, ycoord_min_step, ycoord_abs_min, ycoord_abs_max);
     initCluster(&histogramthreshold, "_threshold", xcoord_min_step, xcoord_abs_min, xcoord_abs_max, ycoord_min_step, ycoord_abs_min, ycoord_abs_max);
 }