]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Merge branch 'master' of jspc29.x-matter.uni-frankfurt.de:radhard
authorDennis Doering <doering@physik.uni-frankfurt.de>
Wed, 17 Jun 2015 12:04:06 +0000 (14:04 +0200)
committerDennis Doering <doering@physik.uni-frankfurt.de>
Wed, 17 Jun 2015 12:04:06 +0000 (14:04 +0200)
Conflicts:
MABS_run_analyzer/ChargeSpektrum.c

1  2 
MABS_run_analyzer/ChargeSpektrum.c

index 90d46b86504d9ea984b46629729269ce7b4e9925,a77c7959993e3fa6d84b7adb261b5cf1d0f8e228..a7c1adbc7604fb61a84d25a93892c8fadda677fb
@@@ -176,9 -150,9 +150,10 @@@ void ChargeSpektrum(TString runnumber 
                  {
              //         gROOT->SetBatch(kTRUE);
                      //           runs[runi]->plotSeed();
-           //          runs[runi]->plotSeedThresholdCalibrated();
++
+ //                     runs[runi]->plotSeedThresholdCalibrated();
  //                     runs[runi]->plotSeedThreshold();
//                     runs[runi]->plotSeed();
+                     runs[runi]->plotSeed();
              //         runs[runi]->plotSum();
              //         runs[runi]->plotVeto();
                      //         runs[runi]->plotNoise();
  //     writeObservableToFile("seed threshold calibrated");
      writeObservableToFile("seed threshold");
        writeObservableToFile("seed threshold calibrated");
-       writeObservableToFile("sum threshold");
- }
- Int_t ReadRunList(std::vector<int>* runlist)
- {
-     std::ifstream file("runlist.txt");
-     Int_t row;    
-     while (file >> row) 
-     {
-         try 
-         {
-             if (row > 0)
-             {
-                 runlist->push_back(row);
-                 numberRuns++;
-             }
-         }
-         catch(...)
-         {
-             cout << "File ended";
-         }
-     }
-     return numberRuns;
- }
- // void plotNoiseComparison()
- // {
- //     
- // }
- Bool_t writeObservableToFile(TString histogramtype)
- {
-     if (histogramtype.Contains("threshold"))
-     {
-         if (histogramtype.Contains("calibrated"))
-         {
-             for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */
-             {
-                 if (runs[runi]->histogramthresholdCalibrated.calibrated)
-                     runs[runi]->plothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated;
-                 else
-                     return 1;
-             }
-         }
-         else
-         {
-             for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */ 
-                 runs[runi]->plothistogramstructpointer = &runs[runi]->histogramthreshold;
-         }
-         
-     }
-     else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) {
-         for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
-             if (runs[runi]->histogramCalibrated.calibrated)
-                 runs[runi]->plothistogramstructpointer = &runs[runi]->histogramCalibrated;
-             else return 1;        } }
-     else {
-         for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
-             runs[runi]->plothistogramstructpointer = &runs[runi]->histogram; } }
-     writeObservableToFileHistSelect(histogramtype);
-     return 0;
--}
- void writeObservableToFileHistSelect(TString histogramtype)
- {
-     if (histogramtype.Contains("Seed") || histogramtype.Contains("seed")) {
-         for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */ {
-             runs[runi]->plothistogrampointer = &runs[runi]->plothistogramstructpointer->Seed; } }
-     else if (histogramtype.Contains("Sum") || histogramtype.Contains("sum")) {
-         for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */ {
-             runs[runi]->plothistogrampointer = &runs[runi]->plothistogramstructpointer->Sum; } }
-     else if (histogramtype.Contains("Veto") || histogramtype.Contains("veto")) {
-         for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
-             runs[runi]->plothistogrampointer = &runs[runi]->plothistogramstructpointer->Veto; } }
-     else {
-         for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
-             runs[runi]->plothistogrampointer = &runs[runi]->plothistogramstructpointer->Seed; } }
-     writeObservableToFile();
 +}
- Bool_t writeObservableToFile()
- {
-     system("mkdir "+ runs[0]->savepathresults + " -p");
-     TString headerInfo = "";
-     for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
-     {
-               TString labbookTempSens=Form("%d",runs[runi]->labbook.tempSens);
-               TString labbookFrames=Form("%d",runs[runi]->labbook.frames_foundDB);
-         headerInfo+=runs[runi]->runcode+"\t"+labbookTempSens+labbookFrames+"\t\t";
-     }
-     TH1F* plothistogrampointer = *runs[0]->plothistogrampointer;
-     TString runnumberListe=Form("%s_",plothistogrampointer->GetName());
-     TString header="";
-       for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
-     {
-         if (runs[runi] != nullptr)
-         {
-             if (!runs[runi]->error)
-             {
-                 plothistogrampointer = *runs[runi]->plothistogrampointer;
-                 runnumberListe+=Form("%d_",runs[runi]->labbook.runnumber);
-                 header+=Form("%d\t%d_%s\t\t", runs[runi]->labbook.runnumber, runs[runi]->labbook.runnumber, plothistogrampointer->GetName());
-             }
-         }
-       }
-     TString filename= runs[0]->savepathresults + "/" + runnumberListe + "histograms.dat";
-     fstream* fout = new fstream(filename,ios::out);
-     *fout << headerInfo << endl;
-     *fout << header << endl;
-       for(Int_t bini=0;bini<plothistogrampointer->GetNbinsX();bini++)
-     {
-               for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
-         {
-               
-             if (runs[runi] != nullptr)
-             {
-                 if (!runs[runi]->error)
-                 {
-                     plothistogrampointer = *runs[runi]->plothistogrampointer;
-                     TString outline;
-                                       Float_t histoNorm=plothistogrampointer->GetBinContent(bini)/runs[runi]->labbook.frames_foundDB*10000000;
-                     outline=Form("%.1f\t%.1f\t%.1f\t",plothistogrampointer->GetBinCenter(bini),plothistogrampointer->GetBinContent(bini),histoNorm);
-                     *fout<<outline;
-                 }
-             }
-               }
-               *fout<<endl;
-       }
-     fout->close();
-       
-     return 0;
- }
- Bool_t plotAllRuns(TString histogramtype)
- {
-     if (histogramtype.Contains("threshold"))
-     {
-         if (histogramtype.Contains("calibrated"))
-         {
-             for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */
-                 if (runs[runi]->histogramthresholdCalibrated.calibrated)
-                     runs[runi]->plothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated;
-                 else
-                     return 1;
-         }
-         else
-         {
-             for(Int_t runi=0;runi<numberRuns;runi++)/* loop over runs read from file */ 
-                 runs[runi]->plothistogramstructpointer = &runs[runi]->histogramthreshold;
-         }
-         
-     }
-     else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) {
-         for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
-             if (runs[runi]->histogramCalibrated.calibrated)
-                 runs[runi]->plothistogramstructpointer = &runs[runi]->histogramCalibrated;
-             else
-                 return 1;  } }
-     else {
-         for(Int_t runi=0;runi<numberRuns;runi++) /* loop over runs read from file */ {
-             runs[runi]->plothistogramstructpointer = &runs[runi]->histogram; } }
-     plotAllRuns();
-     return 0;
- }
- Bool_t plotAllRuns()
- {
-     if (numberRuns > 1)
-     {
-         Float_t lastbin;
-         TTimeStamp* time = new TTimeStamp();
-         
-         TCanvas* canvas = new TCanvas(Form("%d",time->GetNanoSec()), "Summary", 1600, 1000);
-         if (isBatch)
-             canvas->SetCanvasSize(3200,2000);
-         
-         canvas->Divide(2,2);
-         Float_t height = numberRuns * 0.04;
-         TLegend* leg1 = new TLegend(0.3,0.89-height,0.89,0.89);//(0.6,0.7,0.89,0.89);
-         TLegend* leg2 = new TLegend(0.6,0.89-height,0.89,0.89);//(0.6,0.7,0.89,0.89);
-         leg1->SetTextSize(0.02);
-         leg2->SetTextSize(0.02);
-         leg1->SetFillColor(0); leg1->SetBorderSize(0);
-         leg2->SetFillColor(0); leg2->SetBorderSize(0);
-         TString  legendEntry;
-         
-         for(Int_t runi=0;runi<numberRuns;runi++) // loop over runs read from file
-         {
-             if (runs[runi] != nullptr)
-             {
-                 if (!runs[runi]->error)
-                 {
-                     canvas->cd(1);
-                     runs[runi]->plothistogramstructpointer->Seed->Draw("SAME");
-                     lastbin = runs[runi]->plothistogramstructpointer->Seed->GetBinCenter(runs[runi]->plothistogramstructpointer->Seed->FindLastBinAbove(2,1));
-                     runs[runi]->plothistogramstructpointer->Seed->SetAxisRange(0,lastbin*1.1,"X");
-                     gPad->SetLogy(1);
-                     legendEntry = Form("%s", runs[runi]->plothistogramstructpointer->Seed->GetTitle());
-                     leg1->AddEntry(runs[runi]->plothistogramstructpointer->Veto, legendEntry, "l");
-                     leg1->Draw("SAME");
-                     canvas->cd(2);
-                     runs[runi]->plothistogramstructpointer->Sum->Draw("SAME");
-                     lastbin = runs[runi]->plothistogramstructpointer->Sum->GetBinCenter(runs[runi]->plothistogramstructpointer->Sum->FindLastBinAbove(2,1));
-                     runs[runi]->plothistogramstructpointer->Sum->SetAxisRange(0,lastbin*1.1,"X");
-                     canvas->cd(3);
-                     runs[runi]->plothistogramstructpointer->Veto->Draw("SAME");
-                     runs[runi]->plothistogramstructpointer->Veto->SetAxisRange(runs[runi]->plothistogramstructpointer->posVeto*0.7,runs[runi]->plothistogramstructpointer->posVeto*1.4,"X");
-                     canvas->cd(4);
-                     runs[runi]->plothistogramstructpointer->Noise->Draw("SAME");
-                     legendEntry = Form("%s, Noise: %.2f", runs[runi]->labbook.matrix.Data(), runs[runi]->plothistogramstructpointer->avgNoise);
-                     leg2->AddEntry(runs[runi]->plothistogramstructpointer->Veto, legendEntry, "l");
-                     leg2->Draw("SAME");
-                 }
-             }
-         }
-         
-         //         canvas -> Print( runs[0]->savepathresults + "/" + canvastitle + ".eps");
-         TImageDump *img = new TImageDump(runs[0]->savepathresults + "/" + Form("%s - %s",runs[0]->runcode.Data(), runs[numberRuns-1]->runcode.Data()) + ".png");
-         canvas->Paint();
-         img->Close();
-         
-         TFile *f = new TFile(runs[0]->savepathresults + "/" + Form("%s - %s",runs[0]->runcode.Data(),runs[numberRuns-1]->runcode.Data()) + ".root","RECREATE");
-         f->cd();
-         f->Append(canvas);
-         f->Append(img);
-         f->Write();
-     }
-     return 0;
- }