]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Analyzer: added TNtuple for online data analysis
authorBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Mon, 11 Sep 2017 12:12:05 +0000 (14:12 +0200)
committerBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Mon, 11 Sep 2017 12:12:05 +0000 (14:12 +0200)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/HistogramType.c
MABS_run_analyzer/Run.c

index 77b121c77c8318bc0803997e17f2df427dc1c98d..b3c77ec916534ebbbf412c2cbb1cc7c1a87af4a8 100644 (file)
@@ -39,8 +39,6 @@ void ChargeSpektrum(TString runnumber = "")
     
     // set file path and other variables to be set
     Init();
-    
-
     cout << "Found " << numberRuns << " run(s) in 'runlist.txt' or given as parameters." << endl;
     for(Int_t runi=0; runi<numberRuns; runi++) // loop over runs read from file or given as aparameters
     {
@@ -104,13 +102,19 @@ void ChargeSpektrum(TString runnumber = "")
                         gROOT->SetBatch(kFALSE);
                     
                     // Uncomment below to do classical analysis withour RTS
-                    compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS);
-                    compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold);
+                    compareHistogramClassVector.push_back(runs[runi]->histogram->normalized);
+                    compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold->normalized);
+                    
+                    
+                    compareHistogramClassVector2.push_back(runs[runi]->histogram->normalized);
+                    
+                    compareHistogramVector.push_back(runs[runi]->histogram->normalized->Seed);
+                    compareHistogramVector.push_back(runs[runi]->histogram->normalized->Sum);
                     
 //                     compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS);
-                     compareHistogramClassVector2.push_back(runs[runi]->histogram->normalized);
-                    compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized);
-                    compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSAggresive->normalized);
+//                      compareHistogramClassVector2.push_back(runs[runi]->histogram->normalized);
+//                  compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized);
+//                  compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSAggresive->normalized);
 //                    compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized);
 //                     compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized);
 //                     compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold->normalized);
@@ -118,6 +122,15 @@ void ChargeSpektrum(TString runnumber = "")
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogram->Seed);
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->Seed);
                     
+                    
+                    ntuple->Fill(runs[runi]->labbook.depletionV,runs[runi]->histogramfixedthreshold->posSeed,0,0);
+//                     ntuple->Fill(2,2,1,1);
+//                     ntuple->Fill(3,3,1,1);
+//                     ntuple->Fill(4,4,1,1);
+//                     ntuple->Fill(5,5,1,1);
+//                     
+//                     
+                    
 //                     compareHistogramVector.push_back(runs[runi]->histogram->Seed);
 //                     compareHistogramVector.push_back(runs[runi]->histogramwoRTS->Seed);
 //                     compareHistogramVector.push_back(runs[runi]->histogramwoRTSAggresive->Seed);
@@ -126,22 +139,32 @@ void ChargeSpektrum(TString runnumber = "")
 //                     runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Seed, "gaus", true, false, false, 500);
                     //runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->normalized->Seed, "GaussTail");
                    //runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->a_Sum[0]);
-                    compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[0]); // Seed
-                   compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[1]); // Seed + next bigger charge pixel
-                   compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[2]); // Seed + 2
-                   compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[8]); // Sum over 9 pixel in cluster
-                   compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[24]); // Sum over 25 pixel in cluster
+//                     compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[0]); // Seed
+//                 compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[1]); // Seed + next bigger charge pixel
+//                 compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[2]); // Seed + 2
+//                 compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[8]); // Sum over 9 pixel in cluster
+//                 compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[24]); // Sum over 25 pixel in cluster
                    
                    
-//                     runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Seed, "gaus", true, false, false, runs[runi]->histogramfixedthreshold->normalized->fixedThresholdValue);
-//                     runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Sum, "gaus", true, false, false, 500);
+//                     runs[runi]->plot1DHistogram( runs[runi]->histogram->normalized->Seed, "gaus", true, false, false, runs[runi]->histogramfixedthreshold->normalized->fixedThresholdValue);
+//                     runs[runi]->plot1DHistogram( runs[runi]->histogram->normalized->Sum, "gaus", true, false, false, runs[runi]->histogramfixedthreshold->normalized->fixedThresholdValue);
+                     
+                     
+//                      runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Seed, "GaussTail", true, false, false, runs[runi]->histogramfixedthreshold->normalized->fixedThresholdValue);
+//                      runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Sum, "GaussTail", true, false, false, runs[runi]->histogramfixedthreshold->normalized->fixedThresholdValue);
                     
                     // plot RTS pixel histogram
-                     runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->pixeltimefiredDistrib, "", 0);
+                     //runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->pixeltimefiredDistrib, "", 0);
                     
-                  
+                     
+//                      runs[runi]->plot1DHistogram( runs[runi]->histogram->normalized->Seed);
+//                      runs[runi]->plot1DHistogram( runs[runi]->histogram->normalized->Sum);
                     
-                    runs[runi]->writeAllHistogramsToFile();
+                     runs[runi]->writeAllHistogramsToFile();
+                     
+                     // plot and clear compareHistogramClassVector vector, delete these two lines if you want to compare among different runs
+                     plotAllRuns(&compareHistogramClassVector);
+                     compareHistogramClassVector.clear();
                 }
                 //cout << runs[runi]->histogram
             }
@@ -176,6 +199,7 @@ plotAllRuns(&compareHistogramClassVector2);
 plotAllRuns(&compareHistogramClassVector3);
 plotAllRuns(&compareHistogramClassVector4);
 plotAllRuns(&compareHistogramClassVector5);
+plot1DData(ntuple);
 CompareLeageCurrent(&compareHistogramClassVector4);
 CompareLeageCurrent(&compareHistogramClassVector5);
 writeObservableToFile();
index 45fc2d60fd9fbdac172456db2e1a64852a024a21..c7ef5e18e541ad9e9701bb04c472e5c04f605c16 100644 (file)
@@ -15,6 +15,7 @@
 #include <TCanvas.h>
 #include <TH2C.h>
 #include <TTimeStamp.h>
+#include <TGraphErrors.h>
 #include "HistogramType.h"
 #include "Run.h"
 
@@ -44,6 +45,10 @@ Bool_t FindGoodTitle(vector<HistogramType*>* ptCompareHistogramClassVector, vect
 Bool_t FindGoodTitle(vector<TH1FO*>* ptCompareHistogramVector);
 Bool_t FindGoodTitle();
 
+/** @brief A function to write data from TNtuple to a file. File is save with the prefix "Oberservable_" in the result folder
+ * */
+Bool_t writeNTupleToFile(TNtuple* ntuplepointer);
+
 
 /** @brief A function to plot TH1F histograms of different runs into one file
  * 
@@ -71,6 +76,12 @@ Bool_t writeOneHistogramTypeToFile(vector<HistogramType*>*);
  */
 void Init();
 
+
+/** @brief A function to plot ntuplöe data into a canvas
+ *     
+ */
+TCanvas* plot1DData(TNtuple* ntuplepointer, Bool_t verbose=0, Bool_t logscale=0, TString titlestr="", TString legendstr="" );
+
 Bool_t writeObservableToFile();
 /** @brief A vector able to hold pointer of type #Run::histogramstruct
  * 
@@ -88,6 +99,7 @@ Bool_t testifMixingCalibration(vector<HistogramType*>*);
 string to_str_w_prec(const Float_t a_value, int precision = 1);
 vector<HistogramType*> compareHistogramClassVector, compareHistogramClassVector2, compareHistogramClassVector3, compareHistogramClassVector4, compareHistogramClassVector5, compareHistogramClassVector6, compareHistogramClassVector7, compareHistogramClassVector8, compareHistogramClassVectorMABSBot;
 vector<TH1FO*> compareHistogramVector, compareHistogramVector2, compareHistogramVector3, compareHistogramVector4, compareHistogramVector5, compareHistogramVector6, compareHistogramVector7, compareHistogramVector8;
+TNtuple *ntuple, *ntuple2, *ntuple3, *ntuple4;
 TString ownpath = "";
 TString savepathresults;
 
@@ -115,6 +127,11 @@ void Init()
     //FindGoodTitle();
     TTimeStamp timestamp = TTimeStamp();
     savepathresults = Form("./results/%d%06d/", (int)timestamp.GetDate(kFALSE), (int)timestamp.GetTime(kFALSE));
+    ntuple  = new TNtuple("ntuple", "data", "x:y:xerr:yerr");
+    ntuple2 = new TNtuple("ntuple2","data2","x:y:xerr:yerr");
+    ntuple3 = new TNtuple("ntuple3","data3","x:y:xerr:yerr");
+    ntuple4 = new TNtuple("ntuple4","data4","x:y:xerr:yerr");
+    
 }
 
 // in the command line one can add labels, by printing a equal sign '=' and a string escaped by the question sign '§', for example:
@@ -248,6 +265,74 @@ Int_t ReadRunList(std::vector<int>* runlist)
     return numberRuns;
 }
 
+
+
+TCanvas* plot1DData(TNtuple* ntuplepointer, Bool_t verbose, Bool_t logscale, TString titlestr, TString legendstr )
+{
+    if (ntuplepointer != nullptr)
+    {
+        if (ntuplepointer->GetEntries() > 0) {
+            TString canvastitle = Form("%s", ntuplepointer->GetName());
+            TString canvasname =  Form("%s", ntuplepointer->GetName());
+            TCanvas* canvas = new TCanvas(canvasname, canvastitle, 900, 700);  
+            canvas->SetGrid();
+            
+            if (titlestr.Length()>0)
+                ntuplepointer->SetTitle(titlestr);
+            if (logscale) {
+                gPad->SetLogy(1);            
+            }
+            
+            ntuplepointer->Draw("x:y:xerr:yerr","","goff");
+            
+            TGraphErrors *gr = new TGraphErrors(ntuplepointer->GetEntries(),ntuplepointer->GetV1(),ntuplepointer->GetV2(),ntuplepointer->GetV3(),ntuplepointer->GetV4());
+            gr->SetTitle("TGraphErrors Example");
+            gr->SetMarkerColor(4);
+            gr->SetMarkerStyle(21);
+            gr->Draw("ALP");
+            
+            canvas->Update();        
+    //         canvas -> SaveAs( savepathresults + "/" + runcode + " " + onehistogram->GetName() + ".eps");
+            
+            TImageDump *img = new TImageDump(savepathresults + ntuplepointer->GetName() + ".png");
+            canvas->Paint();
+            img->Close();
+                            
+            writeNTupleToFile(ntuplepointer);
+            return canvas;
+        }
+    }
+    return nullptr;
+}
+
+
+Bool_t writeNTupleToFile(TNtuple* ntuplepointer)
+{
+    if (ntuplepointer != nullptr)
+    {
+        system("mkdir "+ savepathresults + " -p");
+        
+        TString filename = savepathresults + Form("Observable_%s.dat", ntuplepointer->GetName());
+        
+        TString header = "x\ty\txerr\tyerr";
+        fstream* fout = new fstream(filename,ios::out);
+        
+        *fout << header << endl;
+        TString outline;
+        for(int i=0;i<ntuplepointer->GetEntries();i++) {
+            ntuplepointer->GetEntry(i);
+            Float_t *p = ntuplepointer->GetArgs();
+            outline ="";
+            outline+=Form("%.2f\t%.2f\t%.2f\t%.2f", p[0], p[1], p[2], p[3]);
+            *fout<<outline<<endl;
+        }
+        fout->close();
+        return 0;
+    }    
+    return 1;
+}
+
+
 Bool_t writeOneHistogramTypeToFile(vector<HistogramType*>* ptCompareHistogramClassVector)
 {
     if (ptCompareHistogramClassVector->size() > 0)
@@ -437,6 +522,7 @@ Bool_t CompareHistograms(vector<TH1FO*>* ptCompareHistogramVector, TString title
     return 1;
 }
 
+
 Bool_t CompareLeageCurrent(vector<HistogramType*>* ptCompareHistogramClassVector)
 {
     if (ptCompareHistogramClassVector->size() > 0)
@@ -669,19 +755,27 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
         {
             HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami);
             TH1F* curhistogramclone = (TH1F*) curhistogramclassp->Seed->Clone();
+            Float_t posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
             curhistogramclone->GetXaxis()->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        
             heighestval1 = (curhistogramclone->GetMaximum()>heighestval1?curhistogramclone->GetMaximum():heighestval1);  
             lastbin1 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin1)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin1;       
 //              cout << "Last bin: " << colorcyan << lastbin1 << endlr;
 //                     cout << "curhistogramclone->GetMaximum(): " << colorcyan << curhistogramclone->GetMaximum() << endlr;
             
             curhistogramclone = (TH1F*) curhistogramclassp->Sum->Clone();
+            posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
             curhistogramclone->GetXaxis()->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        
+            
+            
             heighestval2 = (curhistogramclone->GetMaximum()>heighestval2?curhistogramclone->GetMaximum():heighestval2);
             lastbin2 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin2)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin2;
             
             curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone();
+            posMaxValHist = curhistogramclone->GetXaxis()->GetXmax();
             curhistogramclone->GetXaxis()->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);
             lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin3;
             //             cout << "heighestval3: " << colorcyan << heighestval3 << endlr;
@@ -714,7 +808,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
             curhistogramclone->SetAxisRange(0,lastbin1*1.1,"X");
             curhistogramclone->SetAxisRange(0,heighestval1*1.1,"Y");
             curhistogramclone->GetYaxis()->SetRangeUser(1,heighestval1*1.0);
-            gPad->SetLogy(1);
+//             gPad->SetLogy(1);
             gPad->SetGrid(1);
             gPad->SetGridy(1);
             owntitle->Clear();
@@ -740,7 +834,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
             //             heighestval2 = (curhistogramclone->GetMaximum()>heighestval2?curhistogramclone->GetMaximum():heighestval2);
             curhistogramclone->GetYaxis()->SetRangeUser(1,heighestval2*1.2);
             curhistogramclone->Draw("SAME");
-                        gPad->SetLogy(1);
+//                         gPad->SetLogy(1);
             gPad->SetGrid(1);
             gPad->SetGridy(1);
             
index d0f5c2b303fc8ea0b0e6d8b025c8654ae87118ce..24de8dd730f11e4d8997513f507e4e225c12d264 100644 (file)
@@ -259,11 +259,11 @@ Bool_t HistogramType::normalizeHistograms( Int_t got_frames_found ) {
     normalized->posSum = posSum;
     normalized->posVeto = posVeto;
     normalized->integralSeed = integralSeed/frames_found*pow10(6);
-    normalized->integralSeedErr = integralSeedErr/frames_found*pow10(6);
+    normalized->integralSeedErr = integralSeedErr * sqrt(pow10(6)/frames_found);
     normalized->integralVeto= integralVeto/frames_found*pow10(6);
     normalized->integralVeto= integralVeto/frames_found*pow10(6);
     normalized->integralSum = integralSum/frames_found*pow10(6);
-    normalized->integralSumErr = integralSumErr/frames_found*pow10(6);
+    normalized->integralSumErr = integralSumErr * sqrt(pow10(6)/frames_found);
     normalized->posSeedPerc = posSeedPerc;
     normalized->sigmaSeedPerc = sigmaSeedPerc;
     normalized->noisethresholdborder = noisethresholdborder;
@@ -416,7 +416,7 @@ Double_t* HistogramType::FitPerform(TH1FO* histogrampointer, TString fitFuncType
             const Double_t def_peakcenter=histogrampointer->GetBinCenter(histogrampointer->GetMaximumBin());
 //             cout << colorcyan << "def_amplitude: " << def_amplitude << endlr;
 //             cout << colorcyan << "def_peakcenter: " << def_peakcenter  << endlr;
-            const Double_t def_gausssig=12;
+            const Double_t def_gausssig=10;
             // set start values for some parameters
             fitFunc->SetParName(0,"amplitude of peak");
             fitFunc->SetParameter(0,def_amplitude);
@@ -479,8 +479,8 @@ Double_t* HistogramType::FitPerform(TH1FO* histogrampointer, TString fitFuncType
             // make an error estimate, in case of rare events one can use the poisson distribution
             // error bars become +- sqrt(n) for each bin, where n is the bin content.
                        
-            parameters[7] = parameters[1] - 3*parameters[2] ; // starting point of histogram integration
-            parameters[8] = parameters[1] + 3*parameters[2] ; // end point of histogram integration
+            parameters[7] = parameters[1] - 2*parameters[2] ; // starting point of histogram integration
+            parameters[8] = parameters[1] + 2*parameters[2] ; // end point of histogram integration
             integralPeak  = histogrampointer->IntegralAndError(histogrampointer->GetXaxis()->FindBin( parameters[7]  ), histogrampointer->GetXaxis()->FindBin( parameters[8]), integralPeakError, "width"); // integral value of histogram (NOT fit), normaliezed with bin size!
             posMax = fitFunc->GetMaximumX(); // Methode 2
             fitFunc->SetLineStyle(1); // normal for the following fits
@@ -704,7 +704,7 @@ Double_t* HistogramType::FitPerform(TH1FO* histogrampointer, TString fitFuncType
         
         // TODO: This fix disables the background
         fitFunc->FixParameter(4,0);
-       // fitFunc->FixParameter(5,0);
+        fitFunc->FixParameter(5,0);
         
         int fittries = 0;
         Bool_t failed = false;
index 8c840d93df6c8a408a85af3a0f169016f382ddff..98058c1d38dddad67cef66c04febb74c524ba172 100644 (file)
@@ -255,7 +255,8 @@ void Run::setSystemSpecificParameters()
     systemparam systemparamPXI (800*16,800,75,150,150);
     systemparam systemparamFSBB (2800,2800/4,25,10,100);
     systemparam systemparamUSBMi19 (400/*maxbin*/,400/1/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
-    systemparam systemparamPipper2 (1000,200,25,10,100);
+    systemparam systemparamPipper2 (1000,500,25,10,100); // change bin size to 200 if Cd109
+    systemparam systemparamPipper2_Cd (1000,200,25,10,100); // change bin size to 200 if Cd109
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi34") )
         cursystemparam = systemparamUSB;
     else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("FSBB") )
@@ -266,8 +267,12 @@ void Run::setSystemSpecificParameters()
         cursystemparam = systemparamPegasus;
     else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi19") )
         cursystemparam = systemparamUSBMi19;
-    else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Pipper2") )
-        cursystemparam = systemparamPipper2;
+    else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Pipper2") ) {
+        if (labbook.source.Contains("Cd"))
+            cursystemparam = systemparamPipper2_Cd;
+        else
+            cursystemparam = systemparamPipper2;
+    }
     else if (labbook.system.EqualTo("USB")) // && labbook.chipGen.EqualTo("34") )
         cursystemparam = systemparamUSB;
     
@@ -727,7 +732,11 @@ Bool_t Run::rescaleHistogramClasses()
         cout << coloryellow << "Cannot rescale run from [ADU] to [e] units, no calibration peak found." << endlr;
         return 0;
     }
-    Float_t gain = 1640.0/vetopeakposition;
+    Float_t gain = 1;
+    if (labbook.source.Contains("Fe"))
+        gain = 1640.0/vetopeakposition;
+    else if (labbook.source.Contains("Cd"))
+        gain = 6140.0/vetopeakposition;
     for (vector<HistogramType*>::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++)  {
         (*curHistogramClass)->calibrateHistograms(gain);
         (*curHistogramClass)->normalized->calibrateHistograms(gain);
@@ -1004,7 +1013,7 @@ void Run::updateDatabase() {
        // Add code to set the pointer histogramclassToUseForDB to class to use for database values
        // histogramclassToUseForDB = histogramthreshold;
        if (labbook.chipGen.EqualTo("Pipper2")) {
-               histogramclassToUseForDB = histogramwoRTS;
+        histogramclassToUseForDB = histogramfixedthreshold;
        } else {
                histogramclassToUseForDB = histogramwoRTSthreshold;
        }
@@ -1428,7 +1437,7 @@ Bool_t Run::binSeedSumVeto()
                             if (histogramfixedthreshold != 0 && histogram != 0) {
                                 if (histogramfixedthreshold->fixedThresholdValue <= 0) {
                                     float_t cutval = histogram->Sum->GetBinCenter(histogram->Sum->FindLastBinAbove(3,1));
-                                    setFixedThresholdValueADU(cutval*0.8);
+                                    setFixedThresholdValueADU(cutval*0.5); // change back to *0.8
                                 }
                                 if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster
                                 {
@@ -1470,7 +1479,7 @@ Bool_t Run::binSeedSumVeto()
                                     cout << colorcyan << "numberofgoodvetopixels: " << numberofgoodvetopixels << endlr;
                                     cout << colorcyan << "numberofactivepixel: " << numberofactivepixel << endlr;
                                     percentageofGoodVetoPixel = (numberofgoodvetopixels*100.0)/numberofactivepixel;
-                                    cout << colorcyan << "percentageodGoodVetoPixel: " << percentageofGoodVetoPixel << endlr;
+                                    cout << colorcyan << "percentageofGoodVetoPixel: " << percentageofGoodVetoPixel << endlr;
                                 }
                                 
                                 if (histogramGoodVeto->pixelHadGoodVeto->GetBinContent(pixelno+1) > 1) {
@@ -1510,13 +1519,13 @@ Bool_t Run::binSeedSumVeto()
             (*curHistogramClass)->integralVeto = parameters[6];
         }
         if (labbook.chipGen.EqualTo("Pipper2")) 
-            parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "GaussTail", 0, false, (*curHistogramClass)->fixedThresholdValue);
+            parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "gaus", 0, false, (*curHistogramClass)->fixedThresholdValue);
         else
             parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "landau");
         (*curHistogramClass)->integralSeed = parameters[6];
         (*curHistogramClass)->posSeed = parameters[1];
         (*curHistogramClass)->integralSeedErr = parameters[9];
-        parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Sum, "GaussTail", 0, false, (*curHistogramClass)->fixedThresholdValue); //TODO change back to gauss
+        parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Sum, "gaus", 0, false, (*curHistogramClass)->fixedThresholdValue); //TODO change back to gauss
         (*curHistogramClass)->posSum = parameters[1];
         (*curHistogramClass)->integralSum = parameters[6];
         (*curHistogramClass)->integralSumErr = parameters[9];