From c193b43efdeec90dacce2b22f390e5507c5a8598 Mon Sep 17 00:00:00 2001 From: Dennis Doering Date: Wed, 13 May 2015 13:18:42 +0200 Subject: [PATCH] writeObservableToFile added --- MABS_run_analyzer/ChargeSpektrum.c | 59 +++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index ab1eb68..f7aafd8 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -30,7 +30,7 @@ Int_t* ReadRunList(); void plotAllRuns(); void plotAllRuns(TString); - +void writeObservableToFile(TString); Run** runs; Int_t numberRuns; Bool_t isBatch = kFALSE; @@ -85,8 +85,8 @@ void ChargeSpektrum(Int_t runnumber = -1) } runs[runi]->setResultsPath("./results/"); runs[runi]->useDynamicalNoise(true); - // runs[runi]->analyzeRun(true); // creates or opens .root file, can analyze the RAW data - runs[runi]->analyzeFrame(353); + runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data + // runs[runi]->analyzeFrame(353); // gROOT->SetBatch(kTRUE); // runs[runi]->plotSeed(); // runs[runi]->plotSeedThreshold(); @@ -102,6 +102,7 @@ void ChargeSpektrum(Int_t runnumber = -1) } plotAllRuns(""); plotAllRuns("threshold"); + writeObservableToFile("Seed"); } Int_t* ReadRunList() @@ -132,13 +133,61 @@ Int_t* ReadRunList() // { // // } - +void writeObservableToFile(TString observable) +{ + TString runnumberListe="Seed_"; + for(Int_t runi=0;runilabbook.runnumber); + + runnumberListe+=runnumber+"_"; + } + system("mkdir "+ runs[0]->savepathresults + " -p"); + TString filename= runs[0]->savepathresults + "/" + runnumberListe + "_histograms.dat"; + fstream* fout = new fstream(filename,ios::out); + TString header; + for(Int_t runi=0;runilabbook.runnumber); + header+="Bins\t"+runnumber+"\t"; + } + + *fout << header << endl; + TString headerInfo; + for(Int_t runi=0;runiruncode+"\t"; + } + + *fout << headerInfo << endl; + + runs[0]->histogrampointer = &runs[0]->histogramthreshold; + + for(Int_t bin=0;binhistogrampointer->Seed->GetNbinsX();bin++)//Achtung möglicher Bug, da hier nur die Bins vom ersten Run genommen werden, haben die anderen runs mehr/weniger Bins, kann es crashen, sollte aber normalerweise kein Problem sein, da alle Histogramme mit der gleichen Binzahl erstellt werden + { + for(Int_t runi=0;runihistogrampointer = &runs[runi]->histogramthreshold; + TString outline; + outline=Form("%.1f\t%.1f",runs[runi]->histogrampointer->Seed->GetBinCenter(bin),runs[runi]->histogrampointer->Seed->GetBinContent(bin)); + *fout<close(); + + return; + + + +} void plotAllRuns(TString histogramtype) { if (histogramtype.Contains("threshold")) for(Int_t runi=0;runihistogrampointer = &runs[runi]->histogramthreshold; } + runs[runi]->histogrampointer = &runs[runi]->histogramthreshold; + } else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) for(Int_t runi=0;runihistogrampointer = &runs[runi]->histogramCalibrated; } -- 2.43.0