]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Run analyzer: push for Dennis, small changes
authorBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Mon, 7 Dec 2015 12:34:52 +0000 (13:34 +0100)
committerBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Mon, 7 Dec 2015 12:34:52 +0000 (13:34 +0100)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/Run.c
MABS_run_analyzer/Run.h
MABS_run_analyzer/help.h

index a52a2ae2d3d39665c2ee6c9aeeb33821a4f0501f..5b470d0dca78c28fe9f10621a6b7df8617a3a013 100644 (file)
@@ -155,11 +155,11 @@ void ChargeSpektrum(TString runnumber = "")
 //                     runs[runi]->compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold);
 //                     runs[runi]->plotCompareHistograms();
                        runs[runi]->plotAllHistograms(runs[runi]->histogramthreshold);
-                       compareHistogramClassVector.push_back(runs[runi]->histogramthreshold->calibrated);
-//                     compareHistogramClassVector2.push_back(runs[runi]->histogram->calibrated);
+                       compareHistogramClassVector.push_back(runs[runi]->histogramthreshold);
+                       //compareHistogramClassVector.push_back(runs[runi]->histogram);
                     //                      runs[runi]->plot1DHistogram(runs[runi]->histogramthreshold, runs[runi]->histogramthreshold->Veto, "gaus"); 
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogramthreshold, runs[runi]->histogramthreshold->SeedPerc, "landau", 0); 
-                       compareHistogramVector.push_back(runs[runi]->histogramthreshold->calibrated->Seed);
+                       compareHistogramVector.push_back(runs[runi]->histogramthreshold->Seed);
                     runs[runi]->writeAllHistogramsToFile(); 
                 }
                 //cout << runs[runi]->histogram
index e2872f62f85ef60908af8095dabdb2277957a611..5fbbc2bc6aebbb8d688806a0805f2b1d837a2c7a 100644 (file)
@@ -215,8 +215,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
 //             Tl.SetNDC();
 //             Tl.DrawText(0.3, 0.2, "Titel titel");
             //TPaveText *t = new TPaveText(0.0, 0.9, 0.3, 1.0, "brNDC"); // left-up
-//             curhistogramclone->SetLineColor(rootcolors[histogrami]);
-            
+            curhistogramclone->SetLineColor(rootcolors[histogrami%13]);           
             curhistogramclone->Draw("SAME");
             legendEntry = Form("%d %s", curhistogramclassp->labbook->runnumber, curhistogramclone->GetTitle());
             leg1->AddEntry(curhistogramclone, legendEntry, "l");
@@ -230,7 +229,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
             
             canvas->cd(2);
             curhistogramclone = (TH1F*) curhistogramclassp->Sum->Clone();
-//             curhistogramclone->SetLineColor(rootcolors[histogrami]);
+            curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
             curhistogramclone->Draw("SAME");
             leg1->Draw("SAME");
             lastbin2 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin2)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin2;
@@ -242,7 +241,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
             
             canvas->cd(3);
             curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
-//             curhistogramclone->SetLineColor(rootcolors[histogrami]);
+            curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
             curhistogramclone->Draw("SAME");
             leg1->Draw("SAME");
             lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin3;
@@ -253,7 +252,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
             
             canvas->cd(4);
             curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
-//             curhistogramclone->SetLineColor(rootcolors[histogrami]);
+            curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
             curhistogramclone->Draw("SAME");
             legendEntry = Form("%d Noise: %.2f + %.2f - %.2f",curhistogramclassp->labbook->runnumber, curhistogramclassp->avgNoise, curhistogramclassp->avgNoisePlus, curhistogramclassp->avgNoiseMinus);
             leg2->AddEntry(curhistogramclone, legendEntry, "l");
@@ -276,6 +275,8 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
         f->Append(img);
         f->Write();
         
+        MSaveBigPNG(savepathresults + "/" + canvastitle + ".png");
+        
         return 0;
     }
     return 1;
index ad45663742e95ac40e03a9be94d46f99477a3628..f1d67cb07eefa912583f7ce831022ccacd8784bb 100644 (file)
@@ -408,6 +408,7 @@ Bool_t Run::analyzeRun(Bool_t force)
         }
         cout << "---------------------------------" << endl;
         cout << colorwhite << "integrateSr90Spectra():" << endlr;
+//         histogramthreshold->noisethresholdborder = 35.0; // TODO remove the overwriting of automatic noise threshold setting
         histogramthreshold->integrateSr90Spectra(histogramthreshold->Seed, frames_found, -1, true);
         histogramfixedthreshold->integrateSr90Spectra(histogramfixedthreshold->Seed, frames_found, 0);
         rescaleHistogramClasses();
@@ -1677,7 +1678,6 @@ void Run::initClusters(Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t
 
 void Run::initRootParameters()
 {
-    rootcolors = new Int_t[13]{1, 2, 4, 6, 8, 13, 46, 28, 32, 33, 12, 20, 40};
     rootlinestyle = new Int_t[13]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
 }
 
index c0dd6242e2ed5c31ec12eb8290b0508e03492d73..cba89f500cdf4f4423068dc87aef2bc1106e16e1 100644 (file)
@@ -182,7 +182,6 @@ private:
     };
     pixelinfo curpixelinfo;
     
-    Int_t* rootcolors;
     Int_t* rootlinestyle;
             
     /** @brief calls #initCluster for each structure of type @c Run::histogram
index 851462d7156fbfcb1ea59f735c038f49f3380e9d..ba5a2fa42fa01b8372c05f488019b4ebdcfa6164 100644 (file)
@@ -11,6 +11,7 @@
 #include "TStopwatch.h"
 
 #include <TCanvas.h>
+#include <Rtypes.h>
 
 #define MAXHITS                        1000000
 //####################################################################
@@ -160,6 +161,7 @@ const TString colorgreen = "\033[1;32m";
 const TString colorcyan = "\033[1;36m";
 const TString colorreset = "\033[0m";  
 const TString endlr = "\033[0m\n";  
+Int_t* rootcolors = new Int_t[13]{1, 2, 4, 6, 8, 13, 46, 28, 32, 33, 12, 20, 40};
 
 /**
  * @brief stores information from the SQL database
@@ -249,5 +251,51 @@ void preparecanvas() {
 //     return 0;
 }
 
+void MSaveBigPNG(TString filename="", double scale=2) {
+    TCanvas* old_canv = gPad->GetCanvas();
+    
+    gROOT->SetBatch(kTRUE);
+    gROOT->ForceStyle(kTRUE);
+    
+    Int_t orig_msz = gStyle->GetMarkerSize();
+    Int_t orig_mst = gStyle->GetMarkerStyle();
+    Int_t orig_lt  = gStyle->GetLineWidth();
+    
+    gStyle->SetMarkerSize(1.0+scale/5);
+    gStyle->SetMarkerStyle(20);
+    gStyle->SetLineWidth(orig_lt*scale);
+    gStyle->SetHistLineWidth(orig_lt*scale);
+    gStyle->SetFuncWidth(orig_lt*scale);
+    
+    if(filename == "") {
+        filename = old_canv->GetName();
+        filename += ".png";
+    }
+    
+    Int_t old_width  = old_canv->GetWindowWidth();
+    Int_t old_height = old_canv->GetWindowHeight();
+    
+    Int_t new_width = old_width * scale;
+    Int_t new_height= old_height* scale;
+    
+    TCanvas* temp_canvas = new TCanvas("temp", "", new_width, new_height);
+    old_canv->DrawClonePad();
+    
+    temp_canvas->Draw();
+    temp_canvas->SaveAs(filename);
+    temp_canvas->Close();
+    
+    gStyle->SetMarkerSize(orig_msz);
+    gStyle->SetMarkerStyle(orig_mst);
+    gStyle->SetLineWidth(orig_lt);
+    gStyle->SetHistLineWidth(orig_lt);
+    gStyle->SetFuncWidth(orig_lt);
+    
+    gROOT->ForceStyle(kFALSE);
+    gROOT->SetBatch(kFALSE);
+    
+    return;
+}
+
 //####################################################################
 #endif
\ No newline at end of file