]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Analyzer: adjustments to custom class TH1FO
authorBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Sun, 25 Feb 2018 20:28:27 +0000 (21:28 +0100)
committerBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Sun, 25 Feb 2018 20:28:27 +0000 (21:28 +0100)
MABS_run_analyzer/ChargeSpektrumFunctions.cpp
MABS_run_analyzer/HistogramType.cpp
MABS_run_analyzer/Run.cpp
MABS_run_analyzer/Run.h
MABS_run_analyzer/help.h

index 1261047bf35537a56506c4439610f304585f8298..7ebb63b637c34e5e18ef098b81fd46630bb8a052 100644 (file)
@@ -156,7 +156,8 @@ void InterpreteUserInput(TString runnumber, std::vector<int> *runList, std::vect
                     tempstrobj=static_cast<TObjString*>(runarray->At(1));
                     if (tempstrobj->GetString().Length()>0)
                     {
-                        TString tempstrend = tempstrobj->GetString().ReplaceAll("!","");
+                        TString tempstrend = tempstrobj->GetString();
+                        tempstrend = tempstrend.ReplaceAll("!", "");
                         Int_t tempintend = tempstrend.Atoi();
                         if (tempintend-tempintstart > 0)
                         {
@@ -587,13 +588,13 @@ Bool_t CompareHistograms(vector<TH1FO*>* ptCompareHistogramVector, TString title
         //TString canvasname = Form("%d",time->GetNanoSec());        
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramVector->size(); histogrami++)
         {
-            TH1F* curhistogramclone = (TH1F*) ptCompareHistogramVector->at(histogrami)->Clone();
+            TH1FO* curhistogramclone = (TH1FO*) ptCompareHistogramVector->at(histogrami)->Clone();
             heighestval1 = (curhistogramclone->GetMaximum()>heighestval1?curhistogramclone->GetMaximum():heighestval1); 
             canvastitle+= Form("_%s",getRunnumberAtBegin(curhistogramclone->GetName()).Data());        
         }        
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramVector->size(); histogrami++)
         {
-            TH1F* curhistogramclone = (TH1F*) ptCompareHistogramVector->at(histogrami)->Clone();
+            TH1FO* curhistogramclone = (TH1FO*) ptCompareHistogramVector->at(histogrami)->Clone();
             lastbin1 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1))>lastbin1)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1)):lastbin1;     
         }    
         TCanvas* canvas = new TCanvas(canvasname, canvastitle, 1200, 700);
@@ -605,7 +606,7 @@ Bool_t CompareHistograms(vector<TH1FO*>* ptCompareHistogramVector, TString title
         
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramVector->size(); histogrami++)
         {
-            TH1F* curhistogramclone = (TH1F*) ptCompareHistogramVector->at(histogrami)->Clone();
+            TH1FO* curhistogramclone = (TH1FO*) ptCompareHistogramVector->at(histogrami)->Clone();
             if (titlestr.Length() > 0) curhistogramclone->SetName(titlestr);
             if (YAxisTitle.Length() > 0) curhistogramclone->SetYTitle(YAxisTitle);
             curhistogramclone->SetLineColor(rootcolors[histogrami%13]);   
@@ -643,6 +644,7 @@ Bool_t CompareHistograms(vector<TH1FO*>* ptCompareHistogramVector, TString title
         }
         canvas->Update();
         //         gPad->Modified(); gPad->Update();
+        gStyle->SetPaperSize(29,21);
         MSaveBigPNG(canvas, savepathresults + folderadd + "/" + canvastitle + ".png");
         
         TImageDump *img = new TImageDump(savepathresults + folderadd + "/" + canvastitle + ".png");
@@ -974,7 +976,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector, Bool_t
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
         {
             HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
-            TH1F* curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+            TH1FO* curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
             Float_t posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
             curhistogramclone->GetXaxis()->UnZoom();
             if (!unZoom)
@@ -982,7 +984,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector, Bool_t
             heighestval1 = (curhistogramclone->GetMaximum()>heighestval1?curhistogramclone->GetMaximum():heighestval1);  
             
             
-            curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+            curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
             posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
             curhistogramclone->GetXaxis()->UnZoom();
             if (!unZoom)
@@ -991,36 +993,36 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector, Bool_t
             
             heighestval2 = (curhistogramclone->GetMaximum()>heighestval2?curhistogramclone->GetMaximum():heighestval2);
             
-            curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
             posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
             curhistogramclone->GetXaxis()->UnZoom();
             if (!unZoom)
                 curhistogramclone->GetXaxis()->SetRange(curhistogramclone->GetXaxis()->FindBin(curhistogramclassp->noisethresholdborder),curhistogramclone->GetXaxis()->FindBin(posMaxValHist));   // look only for maxima with x greater than noiseborder, cut away noise        
             heighestval3 = (curhistogramclone->GetMaximum()>heighestval3?curhistogramclone->GetMaximum():heighestval3);
             
-            curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Noise->Clone();
             curhistogramclone->GetXaxis()->UnZoom();
             heighestval4 = (curhistogramclone->GetMaximum()>heighestval4?curhistogramclone->GetMaximum():heighestval4);
         }
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
         {
             HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
-            TH1F* curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();            
+            TH1FO* curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();            
             lastbin1 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1))>lastbin1)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval1/20,1)):lastbin1;       
             
-            curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+            curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
             lastbin2 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval2/20,1))>lastbin2)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval2/20,1)):lastbin2;
             
-            curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
             lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval3/20,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(heighestval3/20,1)):lastbin3;
         }
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
         {
             HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
-            TH1F* curhistogramclone;
+            TH1FO* curhistogramclone;
             
             canvas->cd(1);
-            curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
             //             TLatex Tl;
             //             Tl.SetNDC();
             //             Tl.DrawText(0.3, 0.2, "Titel titel");
@@ -1049,7 +1051,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector, Bool_t
             owntitle->Draw("SAME");
             
             canvas->cd(2);
-            curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+            curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
             curhistogramclone->Draw("SAME");
             hs->Add(curhistogramclone);
@@ -1077,7 +1079,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector, Bool_t
             owntitle2->Draw("SAME");
             
             canvas->cd(3);
-            curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
             curhistogramclone->Draw("SAME");
             legendEntry = Form("%s", curhistogramclone->GetTitle());
@@ -1101,7 +1103,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector, Bool_t
             owntitle3->Draw("SAME");
             
             canvas->cd(4);
-            curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Noise->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami%13]);
             curhistogramclone->Draw("SAME");
             legendEntry = Form("%d Noise: %.2f + %.2f - %.2f",curhistogramclassp->labbook->runnumber, curhistogramclassp->avgNoise, curhistogramclassp->avgNoisePlus, curhistogramclassp->avgNoiseMinus);
index 3b4a04e7959a0efabde49e17bcd9f389ca161c4e..a405afbb9273498d0f716d850a1d2a99ae80b4ce 100644 (file)
@@ -59,7 +59,6 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) {
     initHistogramCustom(LeakageCurrentDistrib, "Average Leakage current per pixel" + histogramdescription, color, style, -100, 400, 1000, "Average CDS [ADU]", "Entries");
     //     initHistogram(LeakageCurrentInPixelSorted, "Leakage current" + histogramdescription, color, style);
     initHistogramCustom(pixelHadGoodVeto, "Number of times pixel had good veto" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counter good veto");
-    
     SeedPerc->GetXaxis()->SetRangeUser(0,50);
     Noise->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise);
     NoiseEnd->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise);
@@ -84,7 +83,7 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) {
 
 void HistogramType::initHistogram(TH1FO* &histogrampointer, TString prefix, Int_t color, Int_t style) {
 //     histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s, %s",prefix.Data(), humanreadablestr.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
-    histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), cursystempar->nbins, 0, cursystempar->maxbin);  
+    histogrampointer=new TH1FO(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), cursystempar->nbins, 0, cursystempar->maxbin);  
     histogrampointer->SetLineStyle(style);
     histogrampointer->SetLineColor(color);
     histogrampointer->SetStats(kTRUE);        
@@ -100,7 +99,7 @@ void HistogramType::initHistogram(TH1FO* &histogrampointer, TString prefix, Int_
 
 void HistogramType::initHistogramCustom(TH1FO* &histogrampointer, TString prefix, Int_t color, Int_t style, Double_t xLow, Double_t xUp, Int_t nBins, TString xaxistitle,  TString yaxistitle) {
 //     histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s, %s",prefix.Data(), humanreadablestr.Data()), nBins, xLow, xUp);
-    histogrampointer=(TH1FO*)new TH1F(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), nBins, xLow, xUp);  
+    histogrampointer=new TH1FO(Form("%d %s",labbook->runnumber, prefix.Data()), Form("%s",prefix.Data()), nBins, xLow, xUp);  
     histogrampointer->SetLineStyle(style);
     histogrampointer->SetLineColor(color);
     histogrampointer->SetStats(kTRUE);        
@@ -117,7 +116,7 @@ void HistogramType::initHistogramCustom(TH1FO* &histogrampointer, TString prefix
 void HistogramType::initHistogramArray(vector<TH1FO*>* histogramarraypointer, int numberofhisto, TString prefix, Int_t color, Int_t style) {
     for (int i=0; i < numberofhisto; ++i) {
 //         TH1FO* histogrampointer = (TH1FO*)new TH1F(Form("%d %s %d",labbook->runnumber, prefix.Data(), i+1), Form("%s %d, %s",prefix.Data(), i+1, humanreadablestr.Data()), cursystempar->nbins, 0, cursystempar->maxbin);
-        TH1FO* histogrampointer = (TH1FO*)new TH1F(Form("%d %s %d",labbook->runnumber, prefix.Data(), i+1), Form("%s %d",prefix.Data(), i+1), cursystempar->nbins, 0, cursystempar->maxbin);  
+        TH1FO* histogrampointer = new TH1FO(Form("%d %s %d",labbook->runnumber, prefix.Data(), i+1), Form("%s %d",prefix.Data(), i+1), cursystempar->nbins, 0, cursystempar->maxbin);  
         histogrampointer->SetLineStyle(style);
         histogrampointer->SetLineColor(color);
         histogrampointer->SetStats(kTRUE);        
@@ -171,7 +170,7 @@ Bool_t HistogramType::calibrateHistograms( Float_t gotgain ) {
     if (Veto != 0) calibrateHistogram(calibrated->Veto, Veto, gain, "Collected charge [e]", Form("Entries [1/%.1f e]",calibrated->Veto->GetBinWidth(1)));
     if (Noise != 0) calibrateHistogram(calibrated->Noise, Noise, gain, "Collected charge [e]", Form("Entries [1/%.1f e]",calibrated->Noise->GetBinWidth(1)));
     if (pixeltimefired != 0) calibrated->pixeltimefired = pixeltimefired;
-    if (pixeltimefiredDistrib != 0) calibrated->pixeltimefiredDistrib = pixeltimefiredDistrib;
+    if (pixeltimefiredDistrib != 0) calibrated->pixeltimefiredDistrib = pixeltimefiredDistrib;    
     if (SeedPerc != 0) calibrated->SeedPerc = SeedPerc;
     if (clustermultiplicity != 0) calibrated->clustermultiplicity = clustermultiplicity;
     if (histAvgCluster != 0) calibrate2DHistogramCounts(calibrated->histAvgCluster, histAvgCluster);
@@ -224,6 +223,7 @@ Bool_t HistogramType::calibrateHistograms( Float_t gotgain ) {
     calibrated->medianLeakageCurrentPlus = medianLeakageCurrentPlus * gain / 3.7 / pow10(-3) * (1.6*pow10(-19)) * pow10(15);
     
     calibrated->iscalibrated = true;
+    cout << "Before =" << endlr;
     
     return 1;    
 }
@@ -252,6 +252,7 @@ void HistogramType::calibrateHistogram(TH1FO* &histogrampointernew, TH1FO* &hist
 
 
 void HistogramType::calibrateHistogramYAxis(TH1FO* &histogrampointernew, TH1FO* &histogrampointerold, Double_t scalefactor) {
+    cout << "calibrateHistogramYAxis start " << endl;
     histogrampointernew = (TH1FO*)histogrampointerold->Clone();
     histogrampointernew->SetName(Form("%s Calibr.", histogrampointerold->GetName()));
     histogrampointernew->SetTitle(Form("%s Calibr.", histogrampointerold->GetTitle()));
@@ -264,6 +265,7 @@ void HistogramType::calibrateHistogramYAxis(TH1FO* &histogrampointernew, TH1FO*
     }    
     histogrampointernew->GetYaxis()->SetTitle(Form("Entries [1/%.1f e]",histogrampointernew->GetBinWidth(1)));
     histogrampointernew->itsHistogramType = histogrampointerold->itsHistogramType;
+    cout << "calibrateHistogramYAxis end " << endl;
 }
 
 void HistogramType::calibrate2DHistogramCounts(TH2F* &histogrampointernew, TH2F* &histogrampointerold ) {
index 3a4e25091a3fccf44dcaa8f5c8f42a6c475cccfb..bb36e8493c1b0ee286f72ae57573d189343a6dd7 100644 (file)
@@ -465,7 +465,7 @@ Bool_t Run::analyzeRun(Bool_t force)
         cout << "---------- 1. loop over all classes --------" << endl;
         for (vector<HistogramType*>::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++)  {
             cout << "Processing histograms in class: <" << colorwhite << (*curHistogramClass)->histogramdescription << colorreset << " >" << endlr;
-            cout << colorwhite << " BinFiringRates():" << endlr;
+//             cout << colorwhite << " BinFiringRates():" << endlr;
             BinFiringRates(*curHistogramClass);
             if ((*curHistogramClass)->maskRTSpixel) {
                 //                 if (labbook.chipGen=="Mi19") {
@@ -499,7 +499,7 @@ Bool_t Run::analyzeRun(Bool_t force)
                 }
             }
             if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) {
-                //                 cout << colorwhite << " calculateCCE():" << endlr;
+//                                 cout << colorwhite << " calculateCCE():" << endlr;
                 curHistogramClassPt->calculteCCE(false);
             }
             if (labbook.source.Contains("Sr90")) {
@@ -509,10 +509,11 @@ Bool_t Run::analyzeRun(Bool_t force)
                 //                 cout << colorwhite << " calculteStoN():" << endlr;
                 curHistogramClassPt->calculteStoN(true);
             }            
-            //             cout << colorwhite << "normalizeHistogramClasses():" << endlr;
+//                         cout << colorwhite << "normalizeHistogramClasses():" << endlr;
             normalizeHistogramClasses(curHistogramClassPt);
-            //             cout << colorwhite << "rescaleHistogramClasses():" << endlr;
+//                         cout << colorwhite << "rescaleHistogramClasses():" << endlr;
             rescaleHistogramClasses(curHistogramClassPt);
+             cout << colorcyan << "after rescaleHistogramClasses():" << endlr;
         }
         cout << "--------------------------------------------" << endl;
         if (labbook.source.Contains("Sr90")) {
@@ -736,6 +737,7 @@ Bool_t Run::setNoisethresholdborderE(Float_t noisethresholdborder)
 
 Bool_t Run::rescaleHistogramClasses(HistogramType* curHistogramClassPt)
 {
+    
     float_t vetopeakposition = -1;
     Float_t gain;
           
@@ -769,7 +771,9 @@ Bool_t Run::rescaleHistogramClasses(HistogramType* curHistogramClassPt)
     if (gain > 0) {
         cout << "    Gain for the calibrated class: " << gain << endlr;
     }
+    cout << colorcyan << "calibrateHistograms():" << endlr;
     curHistogramClassPt->calibrateHistograms(gain);
+    cout << colorcyan << "normalized->calibrateHistograms():" << endlr;
     curHistogramClassPt->normalized->calibrateHistograms(gain);
     
     return 1;
@@ -1268,7 +1272,7 @@ Bool_t Run::binF0()
     // afterwards sum them up for an 'average' F0 distribution over the run
     
     
-    averageF0Hist = (TH1FO*) new TH1F(Form("%d AvgF0 for whole chip",labbook.runnumber), Form("%d AvgF0 for whole chip",labbook.runnumber), processed->fHitTree->GetEntries(), 0, processed->fHitTree->GetEntries());  
+    averageF0Hist = new TH1FO(Form("%d AvgF0 for whole chip",labbook.runnumber), Form("%d AvgF0 for whole chip",labbook.runnumber), processed->fHitTree->GetEntries(), 0, processed->fHitTree->GetEntries());  
     averageF0Hist->SetLineStyle(rootlinestyle[plotStyle]); 
     averageF0Hist->SetLineColor(rootcolors[plotStyle]);
     averageF0Hist->SetStats(kTRUE);        
@@ -1299,7 +1303,7 @@ Bool_t Run::binF0()
     labbook.sigmaF0 /= processed->fHitTree->GetEntries();
     labbook.sigmaF0 = sqrt(labbook.sigmaF0);
     
-    averageF0PixelwiseStart = (TH1FO*) new TH1F(Form("%d AvgF0 per Pixel, first 1000 frames",labbook.runnumber), Form("%d Average F0 per Pixel, first 1000 frames",labbook.runnumber), cursensorinfo.columns * cursensorinfo.rows, 0, cursensorinfo.columns * cursensorinfo.rows);  
+    averageF0PixelwiseStart = new TH1FO(Form("%d AvgF0 per Pixel, first 1000 frames",labbook.runnumber), Form("%d Average F0 per Pixel, first 1000 frames",labbook.runnumber), cursensorinfo.columns * cursensorinfo.rows, 0, cursensorinfo.columns * cursensorinfo.rows);  
     averageF0PixelwiseStart->SetLineStyle(1); 
     averageF0PixelwiseStart->SetLineColor(1);
     averageF0PixelwiseStart->SetStats(kTRUE);        
@@ -1310,7 +1314,7 @@ Bool_t Run::binF0()
     averageF0PixelwiseStart->GetXaxis()->CenterTitle();
     averageF0PixelwiseStart->GetYaxis()->CenterTitle();  
     averageF0PixelwiseStart->itsHistogramType = histogram;  
-    averageF0DistrStart = (TH1FO*) new TH1F(Form("%d AvgF0, first 1000 frames",labbook.runnumber), Form("%d Average F0, first 1000 frames",labbook.runnumber), 10000, 0, 10000);  
+    averageF0DistrStart = new TH1FO(Form("%d AvgF0, first 1000 frames",labbook.runnumber), Form("%d Average F0, first 1000 frames",labbook.runnumber), 10000, 0, 10000);  
     averageF0DistrStart->SetLineStyle(1); 
     averageF0DistrStart->SetLineColor(1);
     averageF0DistrStart->SetStats(kTRUE);        
@@ -1321,27 +1325,32 @@ Bool_t Run::binF0()
     averageF0DistrStart->GetXaxis()->CenterTitle();
     averageF0DistrStart->GetYaxis()->CenterTitle();  
     averageF0DistrStart->itsHistogramType = histogram;  
-    averageF0PixelwiseEnd = (TH1FO*) averageF0PixelwiseStart->Clone();
+    cout << colorcyan << averageF0DistrStart->itsHistogramType << endlr;
+//     cout << colorcyan << "Before clone" << endlr;
+    averageF0PixelwiseEnd = (TH1FO*)averageF0PixelwiseStart->Clone();
+//     cout << colorcyan << "After clone" << endlr;
     averageF0PixelwiseEnd->SetNameTitle(Form("%d AvgF0 per Pixel, last 1000 frames",labbook.runnumber),Form("%d AvgF0 per Pixel, last 1000 frames",labbook.runnumber));
     averageF0PixelwiseEnd->SetLineColor(1+100);
+    cout << colorcyan << averageF0PixelwiseEnd->itsHistogramType << endlr;
     averageF0PixelwiseEnd->itsHistogramType = histogram;  
-    averageF0DistrEnd = (TH1FO*) averageF0DistrStart->Clone();
+    cout << colorcyan << averageF0PixelwiseEnd->itsHistogramType << endlr;
+    averageF0DistrEnd = (TH1FO*)averageF0DistrStart->Clone();
     averageF0DistrEnd->SetNameTitle(Form("%d AvgF0, last 1000 frames",labbook.runnumber),Form("%d Average F0, last 1000 frames",labbook.runnumber));
     averageF0DistrEnd->SetLineColor(1+100);
     averageF0DistrEnd->itsHistogramType = histogram;
-    averageF0Distr = (TH1FO*) averageF0DistrStart->Clone();
+    averageF0Distr = (TH1FO*)averageF0DistrStart->Clone();
     averageF0Distr->SetNameTitle(Form("%d AvgF0",labbook.runnumber),Form("%d Average F0",labbook.runnumber));
     averageF0Distr->SetLineColor(2);
     averageF0Distr->itsHistogramType = histogram;  
-    averageF1DistrStart = (TH1FO*) averageF0DistrStart->Clone();
+    averageF1DistrStart = (TH1FO*)averageF0DistrStart->Clone();
     averageF1DistrStart->SetNameTitle(Form("%d AvgF1, first 1000 frames",labbook.runnumber),Form("%d Average F1, first 1000 frames",labbook.runnumber));
     averageF1DistrStart->SetLineColor(3);
     averageF1DistrStart->itsHistogramType = histogram;
-    averageF1DistrEnd = (TH1FO*) averageF0DistrStart->Clone();
+    averageF1DistrEnd =(TH1FO*) averageF0DistrStart->Clone();
     averageF1DistrEnd->SetNameTitle(Form("%d AvgF1, last 1000 frames",labbook.runnumber),Form("%d Average F1, last 1000 frames",labbook.runnumber));
     averageF1DistrEnd->SetLineColor(3+100);
     averageF1DistrEnd->itsHistogramType = histogram;
-    averageF1Distr = (TH1FO*) averageF0DistrStart->Clone();
+    averageF1Distr = (TH1FO*)averageF0DistrStart->Clone();
     averageF1Distr->SetNameTitle(Form("%d AvgF1",labbook.runnumber),Form("%d Average F1",labbook.runnumber));
     averageF1Distr->SetLineColor(4);
     averageF1Distr->itsHistogramType = histogram;  
@@ -1459,6 +1468,7 @@ Bool_t Run::binSeedSumVeto()
     
     
     
+    
     for (Int_t filli=0; filli<3; filli++) { // first and second fill loop   
         for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
         {
@@ -2118,9 +2128,9 @@ Bool_t Run::plotCompareHistograms()
         for (UInt_t histogrami=0; histogrami < compareHistogramClassVector.size(); histogrami++)
         {
             HistogramType* curhistogramclassp = compareHistogramClassVector.at(histogrami);
-            TH1F* curhistogramclone;
+            TH1FO* curhistogramclone;
             canvas->cd(1);
-            curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Seed->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami]);
             curhistogramclone->Draw("SAME");
             legendEntry = Form("%s", curhistogramclone->GetTitle());
@@ -2130,7 +2140,7 @@ Bool_t Run::plotCompareHistograms()
             curhistogramclone->SetAxisRange(0,lastbin1*1.1,"X");
             gPad->SetLogy(1);
             canvas->cd(2);
-            curhistogramclone = (TH1F*) (*curhistogramclassp->Sum)->Clone();
+            curhistogramclone = (TH1FO*) (*curhistogramclassp->Sum)->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami]);
             curhistogramclone->Draw("SAME");
             leg1->Draw("SAME");
@@ -2138,14 +2148,14 @@ Bool_t Run::plotCompareHistograms()
             curhistogramclone->SetAxisRange(0,lastbin2*1.1,"X");
             gPad->SetLogy(1);
             canvas->cd(3);
-            curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Veto->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami]);
             curhistogramclone->Draw("SAME");
             leg1->Draw("SAME");
             lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin3;
             curhistogramclone->SetAxisRange(0,lastbin3*1.1,"X");
             canvas->cd(4);
-            curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone();
+            curhistogramclone = (TH1FO*) curhistogramclassp->Noise->Clone();
             curhistogramclone->SetLineColor(rootcolors[histogrami]);
             curhistogramclone->Draw();
             legendEntry = Form("Noise: %.2f + %.2f - %.2f",curhistogramclassp->avgNoise, curhistogramclassp->avgNoisePlus, curhistogramclassp->avgNoiseMinus);
@@ -2336,13 +2346,13 @@ Bool_t Run::plotClusterDistribution(HistogramType* HistogramTypepointer)
     //         canvas->Print(savepathresults + "/" + canvastitle + ".tex");
     
     // create lorentz fit of a slice
-    TH1FO* xslicetroughcluster = (TH1FO*) new TH1F(Form("%s_xslice", HistogramTypepointer->histAvgCluster->GetTitle()),"X slice",HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins()));
+    TH1FO* xslicetroughcluster = new TH1FO(Form("%s_xslice", HistogramTypepointer->histAvgCluster->GetTitle()),"X slice",HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetXaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins()));
     Double_t* xslicetroughclusterpar = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment 
     Int_t middlebin = (int)(HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins()/2.0 + 0.5);
     for (Int_t bini=1; bini <= HistogramTypepointer->histAvgCluster->GetXaxis()->GetNbins(); bini++)
         xslicetroughcluster->SetBinContent(bini,HistogramTypepointer->histAvgCluster->GetBinContent(bini,middlebin));
     
-    TH1FO* yslicetroughcluster = (TH1FO*) new TH1F(Form("%s_yslice", HistogramTypepointer->histAvgCluster->GetTitle()),"Y slice",HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins()));
+    TH1FO* yslicetroughcluster = new TH1FO(Form("%s_yslice", HistogramTypepointer->histAvgCluster->GetTitle()),"Y slice",HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins(),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinLowEdge(1),HistogramTypepointer->histAvgCluster->GetYaxis()->GetBinUpEdge(HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins()));
     Double_t* yslicetroughclusterpar = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment 
     middlebin = (int)(HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins()/2.0 + 0.5);
     for (Int_t bini=1; bini <= HistogramTypepointer->histAvgCluster->GetYaxis()->GetNbins(); bini++)
@@ -2418,7 +2428,7 @@ TCanvas* Run::plot1DHistogram(HistogramType* HistogramTypepointer, TH1FO* onehis
             gPad->SetLogy(1);            
         }
         if (withOverflow)
-            onehistogram=(TH1FO*)ShowOverflow((TH1F*)onehistogram);
+            onehistogram=ShowOverflow(onehistogram);
         onehistogram->Draw();
         
         Double_t* parameters = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 10 parameters for safety, maximum 9 used at the moment     
@@ -2534,7 +2544,7 @@ TCanvas* Run::plot1DHistogram(HistogramType* HistogramTypepointer, TH1FO* onehis
     return nullptr;
 }
 
-Bool_t Run::writeHistogramToFile(TH1F* onehistogram)
+Bool_t Run::writeHistogramToFile(TH1FO* onehistogram)
 {
     system("mkdir \""+ savepathresults + "\" -p");
     TString filename= savepathresults + "/" + runcode + " " + onehistogram->GetName() + " hist.dat";
index 61cb3c6a4ad2fd4a95e9a3e9188030f7c7f4dee8..11689c655123f0aa915ec8a2500838501e039c93 100644 (file)
@@ -248,7 +248,7 @@ public:
     Bool_t plotCompareHistograms( );
     
     /** @brief Writes a given 2D-histogram into a file */
-    Bool_t writeHistogramToFile(TH1F* onehistogram);
+    Bool_t writeHistogramToFile(TH1FO* onehistogram);
     
     /** @brief Writes a given histogram into a file */
     Bool_t write2DHistogramToFile(TH2F* onehistogram);
index 5608f7b6d821a3a832f9d135bc41dfcd4baf96fa..d0b851075ac831e173b984d832f6160ad29c2fde 100644 (file)
@@ -192,27 +192,68 @@ struct systemparam  {
  * 
  */
 class TH1FO: public TH1F {
+    
+// protected:
+//     HistogramType* itsHistogramType2 = 0;
+    
 public:
     HistogramType* itsHistogramType = 0;
+    //______________________________________________________________________________
+    //                     TH1FO methods
+    // TH1FO : histograms with one float per channel.  Maximum precision 7 digits
+    //______________________________________________________________________________
+        
+    
+    ////////////////////////////////////////////////////////////////////////////////
+    /// Constructor.
+    
+    TH1FO(): TH1F() {};
+    
+    TH1FO(const char *name,const char *title,Int_t nbins,Double_t xlow,Double_t xup):
+    TH1F(name,title,nbins,xlow,xup), itsHistogramType(0){};
+    
+    TH1FO(const char *name,const char *title,Int_t nbins,const Float_t *xbins):
+    TH1F(name,title,nbins,xbins), itsHistogramType(0){ };
+    
+    TH1FO(const char *name,const char *title,Int_t nbins,const Double_t *xbins):
+    TH1F(name,title,nbins,xbins), itsHistogramType(0) { };
+    
+    ////////////////////////////////////////////////////////////////////////////////
+    /// Destructor.    
+    virtual ~TH1FO()
+    {
+        itsHistogramType = 0;
+    }
+    
+    ////////////////////////////////////////////////////////////////////////////////
+    /// Copy constructor.    
+    TH1FO(const TH1FO &th1fo) : TH1F()
+    {
+        ((TH1FO&)th1fo).Copy(*this);
+    }
+    
+    ////////////////////////////////////////////////////////////////////////////////
+    /// Copy a TH1FO histogram to a new profile histogram.    
+    void Copy(TObject &obj) const
+    {
+        try {            
+            TH1F & pobj = static_cast<TH1F&>(obj);
+            TH1F::Copy(pobj);   
+        } catch(...) {
+            Fatal("Copy","Cannot copy a TH1F0 in a %s",obj.IsA()->GetName());
+        }
+        
+    }    
     
-    //     TH1FO* Clone(const char *newname="") {
-    //         TObject *newTObject = this->Clone(newname);
-    //         TH1FO *newTH1FO = (TH1FO *)newTObject;
-    //         newTH1FO->itsHistogramType = this->itsHistogramType;
-    //         return newTH1FO;
-    //     }
-    //     
-    // Overload = operator
-    TH1FO  operator=(const TH1FO &h1) {
-        TH1FO h2;
-        h2 = h1;
-        h2.itsHistogramType = h1.itsHistogramType;
-        return h2;
-    };
-    TH1FO&  operator=(const TH1F &h1);
+    TH1FO& operator=(const TH1FO &cT){
+        if (this != &cT)  ((TH1FO&)cT).Copy(*this);
+        return *this;
+    }
 };
 
 
+
+
 /**
  * @brief A structure to hold information about a given sensor, like number of #columns and #rows
  */
@@ -398,7 +439,7 @@ TString getRunnumberAtBegin(TString str) {
  * @param xVal position of the vertical line at x-axis
  * 
  */
-void plotVerticalLine(TH1F* histogrampointer, Float_t xVal) {
+void plotVerticalLine(TH1FO* histogrampointer, Float_t xVal) {
     if (xVal > 0)
     {
         Float_t posMaxValue = 0;
@@ -431,7 +472,7 @@ void plotVerticalLine(TH1F* histogrampointer, Float_t xVal) {
  * @param histogrampointer histogram pointer to calculate vertical line end
  * @param xVal position of the vertical line at x-axis
  */
-void plotVerticalLineHeigher(TH1F* histogrampointer, Float_t xVal, TString texttoprint = "") {
+void plotVerticalLineHeigher(TH1FO* histogrampointer, Float_t xVal, TString texttoprint = "") {
     if (xVal > 0)
     {   
         if (texttoprint.Length() < 1)
@@ -475,7 +516,7 @@ void plotVerticalLineHeigher(TH1F* histogrampointer, Float_t xVal, TString textt
  * @param xVal position of the vertical line at x-axis
  * 
  */
-void plotTextAtVal(TH1F* histogrampointer, Float_t xVal, TString legendEntry) {
+void plotTextAtVal(TH1FO* histogrampointer, Float_t xVal, TString legendEntry) {
     if (xVal > 0)
     {
         Double_t gPadX2 = histogrampointer->GetBinCenter(histogrampointer->GetXaxis()->GetLast());
@@ -533,7 +574,7 @@ public:
  * @return pointer to the new histogram 
  * 
  */
-TH1F * ShowOverflow(TH1F *h)
+TH1FO * ShowOverflow(TH1FO *h)
 {
     // This function paint the histogram h with an extra bin for overflows
     UInt_t nx    = h->GetNbinsX()+1;
@@ -544,7 +585,7 @@ TH1F * ShowOverflow(TH1F *h)
     char *tempName= new char[strlen(h->GetName())+10];
     sprintf(tempName,"%swtOverFlow",h->GetName());
     // Book a temporary histogram having an extra bin for overflows
-    TH1F *htmp = (TH1F*)h->Clone(tempName);
+    TH1FO *htmp = (TH1FO*)h->Clone(tempName);
     htmp->SetBins (nx, xbins);
     // Fill the new hitogram including the extra bin for overflows
     for (UInt_t i=1; i<=nx; i++)