]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Run analyzer: If a run was analyzed with default config, it will be forced to be...
authorBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Thu, 25 Jun 2015 13:52:33 +0000 (15:52 +0200)
committerBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Thu, 25 Jun 2015 13:52:33 +0000 (15:52 +0200)
MABS_run_analyzer/ChargeSpektrum.c [deleted file]
MABS_run_analyzer/MAPS.c
MABS_run_analyzer/MAPS.h
MABS_run_analyzer/Run.c

diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c
deleted file mode 100644 (file)
index ee658a8..0000000
+++ /dev/null
@@ -1,176 +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(8319);
-                
-                // creates or opens .root file, can analyze the RAW data
-                runs[runi]->error=runs[runi]->analyzeRun(true); // 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]->plotAllHistogramsThresholdClusterCalibrated();
-                     runs[runi]->plotAllHistogramsCalibrated(); 
-                    runs[runi]->writeAllHistogramsToFile(); 
-                }
-            }
-        }
-    }
-//     plotAllRuns("");
-    plotAllRuns("seed calibrated");
-//     writeObservableToFile("seed threshold calibrated");
-//    writeObservableToFile("seed threshold");
-       writeObservableToFile("seed threshold calibrated");
-}
index 427a8171716588f65dac99f0d4a7cda334324f79..fcc3d52bb50b04f6f23f25730fb9d3d255e8c58b 100644 (file)
@@ -386,6 +386,7 @@ bool MAPS::checkConf( Int_t &PixelData ) {
 }
 
 bool MAPS::defaultConf(  ) {
+    used_default_config = true;
     FileEvNbInConfig    = 20000;    ///< Event number per file
     FileTotalEvNbInConfig   = 10000000;
     fPixelsData = run->sensorinfocur.columns*run->sensorinfocur.rows;
index 85b6889769ec321a7983122a3a5835b2c5d27c98..97182ba2f40d10068270ea2c999b90e8693e2880 100644 (file)
@@ -315,6 +315,9 @@ public:
     Bool_t error = false;
     
     
+    /// is set to true if somewhere a critical error occurs
+    Bool_t used_default_config = false;
+    
     /**
      * @brief Checks RAW data files and creates a new ROOT file
      *
index dfc616683465cda26c10099de2eaa2810ab831e7..bd0b17cbff8b5e5ef7d04f26d9965f0bed0d0847 100644 (file)
@@ -259,9 +259,12 @@ Bool_t Run::analyzeRun(Bool_t force)
 //             cout << processed->plus << " vs. " << processed->minus << " : " << (processed->plus*1.0)/processed->minus<< endl;
 
             // print a dummy file to indicate, that a root file was created once
-            fstream* fout = new fstream(storepathRAWLinux + "/rootfilecreated",std::ios::out);
-            *fout << "" << endl;
-            fout->close();
+            if (!processed->used_default_config)
+            {
+                fstream* fout = new fstream(storepathRAWLinux + "/rootfilecreated",std::ios::out);
+                *fout << "" << endl;
+                fout->close();
+            }
             processed->save();
         }
         else