]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Singlerun
authorDennis Doering <dennis@jspc31.x-matter.uni-frankfurt.de>
Wed, 18 Sep 2013 13:47:29 +0000 (15:47 +0200)
committerDennis Doering <dennis@jspc31.x-matter.uni-frankfurt.de>
Wed, 18 Sep 2013 13:47:29 +0000 (15:47 +0200)
newCOMBI/ChargeSpektrum.c

index aafb0a936eea192261a25aa5ebbf3ee7e106cc8e..88c8f52162347753e810c1a7f9845c7bbd767de0 100755 (executable)
 #define DRAW_FITS true
 
 #define DATAPATH "/d/salt/data_recovered/maps/DennisDoering/root/Analysedata/"
-struct histogram
-{
- TH1F* Seed;
- TH1F* Sum;
- TH1F* Veto;
- Int_t inputRun;
- Float_t posSeed;
- Float_t posSum;
- Float_t posVeto;
-};
 struct laborbook
 {
  Int_t inputRun;
@@ -56,11 +46,59 @@ struct laborbook
  TString matrix;
  TString radDose;
 };
+struct histogram
+{
+ TH1F* Seed;
+ TH1F* Sum;
+ TH1F* Veto;
+ Int_t inputRun;
+ Float_t posSeed;
+ Float_t posSum;
+ Float_t posVeto;
+ struct laborbook laborbookdata;
+};
 struct histogram GenerateHisto(Int_t inputRun);
 Float_t FitPerform(TH1F*, Int_t);
 struct laborbook LaborBuch(Int_t inputRun);
+Int_t* ReadRunList(Int_t* numberRuns);
 void ChargeSpektrum()
 {
+         
+        Int_t numberRuns=0;
+               ReadRunList(&numberRuns);
+       Int_t* runList=new Int_t[numberRuns];
+       runList=ReadRunList(&numberRuns);
+
+       struct histogram* arrayHisto = new struct histogram[numberRuns];
+       for(Int_t lauf=0;lauf<numberRuns;lauf++)
+       {
+               arrayHisto[lauf]=GenerateHisto(runList[lauf]);
+       }
+       
+       Double_t w = 600;
+    Double_t h = 600;
+    TCanvas * c1 = new TCanvas("c", "c", w, h);
+    c1->SetWindowSize(w + (w - c1->GetWw()), h + (h - c1->GetWh()));
+
+       arrayHisto[0].Seed->Draw("");
+       for(Int_t lauf=1;lauf<numberRuns;lauf++)
+       {
+               arrayHisto[lauf].Seed->Draw("same");
+       }
+       TString ergebnisfile="ergebnisfile.dat";
+       fstream* fout = new fstream(ergebnisfile,ios::out);
+       for(Int_t lauf=0;lauf<numberRuns;lauf++)
+       {       
+               TString header ="Start\t";
+           TString outline=header+Form("%i", arrayHisto[lauf].inputRun)+"\t"+arrayHisto[lauf].laborbookdata.source+"\t"+arrayHisto[lauf].laborbookdata.matrix+"\t"+Form("%.2f", arrayHisto[lauf].posSeed)+"\t"+Form("%.2f", arrayHisto[lauf].posSum)+"\t"+Form("%.2f", arrayHisto[lauf].posVeto);
+
+               cout<<outline<<endl;
+               *fout<<outline<<endl;
+       }
+       fout->close();
+
+/*
+cout<<runList[0]<<":"<<runList[1]<<endl;
 Int_t inputRun=34009;
  //Int_t inputRun=341270;
  struct histogram arrayHisto;
@@ -88,6 +126,7 @@ arrayHisto2.Seed->GetXaxis()->SetLimits(xmin2*factor2,xmax2*factor2);
  //arrayHisto.Veto->Draw("same");
  cout<<arrayHisto.inputRun<<"\t"<<arrayHisto.posSeed<<"\t"<<arrayHisto.posSum<<"\t"<<arrayHisto.posVeto<<endl;
  cout<<arrayHisto2.inputRun<<"\t"<<arrayHisto2.posSeed<<"\t"<<arrayHisto2.posSum<<"\t"<<arrayHisto2.posVeto<<endl;
+ */
 }
 
 struct histogram GenerateHisto(Int_t inputRun)
@@ -229,6 +268,7 @@ struct histogram GenerateHisto(Int_t inputRun)
          arrayHisto.posSeed=posSeed;
          arrayHisto.posSum=posSum;
          arrayHisto.posVeto=posVeto;
+         arrayHisto.laborbookdata=laborbookdata;
 return arrayHisto;}
 
 Float_t FitPerform(TH1F* histNtuple, Int_t inputRun)
@@ -362,5 +402,32 @@ struct laborbook LaborBuch(Int_t inputRun)
         laborbookdata.source= source;
         laborbookdata.matrix= matrix;
         laborbookdata.radDose= radDose;
-return laborbookdata;
+ return laborbookdata;
+}
+Int_t* ReadRunList(Int_t* numberRuns)
+{
+       Int_t* runList=new Int_t[1000];
+       
+       std::ifstream   file("runlist.txt");
+         CSVRow        row;
+         Int_t runLauf=0;
+         while (file >> row) 
+   {
+    
+    try 
+       {
+       
+       
+       
+       runList[runLauf]=atoi(row[0].c_str());
+       
+       runLauf++;
+       }
+    catch(...)
+       {
+      cout << "File ended";
+    }
+  }
+  *numberRuns=runLauf;
+       return runList;
 }
\ No newline at end of file